Changeset 595 for trunk/Cocoa/Pester/Source/PSVolumeController.m
- Timestamp:
- 12/21/09 22:11:47 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSVolumeController.m
r584 r595 10 10 #import "NJRSoundManager.h" 11 11 #import "NJRNonCenteringWindow.h" 12 #include <Carbon/Carbon.h> 12 13 13 14 @interface NSMenu (SnowLeopardAdditions) … … 56 57 } 57 58 [menu setAllowsContextMenuPlugIns: NO]; 59 // replace with http://waffle.wootest.net/2007/08/07/popping-up-a-menu-in-cocoa/ 58 60 [menu popUpMenuPositioningItem: nil atLocation: point inView: view]; 59 61 [menu release]; … … 100 102 - (IBAction)volumeSet:(NSSlider *)sender; 101 103 { 104 // XXX don't delay preview for keyboard adjustment 102 105 [delegate volumeController: self didSetVolume: [sender floatValue]]; 103 if (NSEventMaskFromType([[NSApp currentEvent] type]) & (NSLeftMouseUpMask | NSRightMouseUpMask | NSOtherMouseUpMask)) 106 NSLog(@"%@", [NSApp currentEvent]); 107 unsigned eventMask = NSEventMaskFromType([[NSApp currentEvent] type]); 108 // The event may simply be a mouse-up: close the menu. 109 if (eventMask & (NSLeftMouseUpMask | NSRightMouseDownMask | NSOtherMouseDownMask)) 110 [menu cancelTracking]; 111 // On a quick click, the event may be a mouse down but the mouse button is no longer down. 112 if (!(eventMask & (NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask))) 113 return; 114 // 10.6+: use [NSEvent pressedMouseButtons] instead 115 if (GetCurrentButtonState() == 0) 104 116 [menu cancelTracking]; 105 117 }
Note:
See TracChangeset
for help on using the changeset viewer.