Mercurial > dwindows
comparison mac/dw.m @ 2618:156ad91481eb
WARNING: Standardize button press and release button parameter values.
This may break existing code using 3rd mouse button press/release events.
The motion callback and OS/2 had been passing the 3rd mouse button as value 4.
Other platforms were passing it as value 3. Since button/press and release
events only have a single button values 1,2,3 were unique... but OS/2 was
passing the mask value instead, making these not work cross platform.
I decided to make the button press/release and motion events all function the
same. Passing the mask values instead of button numbers. This change will
only affect button 3 on button press or release events on Windows, Mac and GTK.
OS/2 already functioned this way, iOS and Android do not support button 3.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 23 Jul 2021 20:26:56 +0000 |
parents | d17e3fb76bde |
children | e63c1373c010 |
comparison
equal
deleted
inserted
replaced
2617:d17e3fb76bde | 2618:156ad91481eb |
---|---|
621 case 3: | 621 case 3: |
622 case 4: | 622 case 4: |
623 { | 623 { |
624 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; | 624 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
625 NSPoint p = [NSEvent mouseLocation]; | 625 NSPoint p = [NSEvent mouseLocation]; |
626 int button = 1; | 626 int button = DW_BUTTON1_MASK; |
627 | 627 |
628 if([event isMemberOfClass:[NSEvent class]]) | 628 if([event isMemberOfClass:[NSEvent class]]) |
629 { | 629 { |
630 id view = [[[event window] contentView] superview]; | 630 id view = [[[event window] contentView] superview]; |
631 NSEventType type = [event type]; | 631 NSEventType type = [event type]; |
632 | 632 |
633 p = [view convertPoint:[event locationInWindow] toView:object]; | 633 p = [view convertPoint:[event locationInWindow] toView:object]; |
634 | 634 |
635 if(type == DWEventTypeRightMouseDown || type == DWEventTypeRightMouseUp) | 635 if(type == DWEventTypeRightMouseDown || type == DWEventTypeRightMouseUp) |
636 { | 636 { |
637 button = 2; | 637 button = DW_BUTTON2_MASK; |
638 } | 638 } |
639 else if(type == DWEventTypeOtherMouseDown || type == DWEventTypeOtherMouseUp) | 639 else if(type == DWEventTypeOtherMouseDown || type == DWEventTypeOtherMouseUp) |
640 { | 640 { |
641 button = 3; | 641 button = DW_BUTTON3_MASK; |
642 } | 642 } |
643 else if([event modifierFlags] & DWEventModifierFlagControl) | 643 else if([event modifierFlags] & DWEventModifierFlagControl) |
644 { | 644 { |
645 button = 2; | 645 button = DW_BUTTON2_MASK; |
646 } | 646 } |
647 } | 647 } |
648 | 648 |
649 return buttonfunc(object, (int)p.x, (int)p.y, button, handler->data); | 649 return buttonfunc(object, (int)p.x, (int)p.y, button, handler->data); |
650 } | 650 } |