Skip to content
Browse files

if you click on the gear icon to bring up the contextual menu, and th…

…en click on the gear icon again, it used to load the Flash view instead of simply closing the contextual menu; now it doesn't. that was an annoying bug

Signed-off-by: Jonathan 'Wolf' Rentzsch <jwr.git@redshed.net>
  • Loading branch information...
1 parent 99ffac0 commit 4f293153f8bd761e71ef145c17cb3a9867f8753f Simone Manganelli committed with Jul 14, 2009
Showing with 15 additions and 4 deletions.
  1. +2 −0 Plugin/Plugin.h
  2. +13 −4 Plugin/Plugin.m
View
2 Plugin/Plugin.h
@@ -51,6 +51,8 @@ THE SOFTWARE.
NSString *_src;
NSString *_videoId;
NSString *_launchedAppBundleIdentifier;
+
+ BOOL _contextMenuIsVisible;
}
+ (NSView *)plugInViewWithArguments:(NSDictionary *)arguments;
View
17 Plugin/Plugin.m
@@ -113,6 +113,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
if (self) {
_hasH264Version = NO;
_hasHDH264Version = NO;
+ _contextMenuIsVisible = NO;
defaultWhitelist = [NSArray arrayWithObjects: @"com.apple.frontrow",
@"com.apple.dashboard.client",
@"com.apple.ScreenSaver.Engine",
@@ -475,7 +476,7 @@ - (BOOL) _gearVisible
return NSWidth( bounds ) > 32 && NSHeight( bounds ) > 32;
}
-- (void) mouseDown:(NSEvent *)event
+- (BOOL) mouseEventIsWithinGearIconBorders:(NSEvent *)event
{
float margin = 5.0;
float gearImageHeight = 16.0;
@@ -499,7 +500,13 @@ - (void) mouseDown:(NSEvent *)event
(localMouseLocation.y <= (viewHeight - margin)) );
}
- if (xCoordWithinGearImage && yCoordWithinGearImage) {
+ return (xCoordWithinGearImage && yCoordWithinGearImage);
+}
+
+- (void) mouseDown:(NSEvent *)event
+{
+ if ([self mouseEventIsWithinGearIconBorders:event]) {
+ _contextMenuIsVisible = YES;
[NSMenu popUpContextMenu:[self menuForEvent:event] withEvent:event forView:self];
} else {
mouseIsDown = YES;
@@ -535,13 +542,15 @@ - (void) mouseUp:(NSEvent *)event
// Now that we track the mouse for mouse-over when the mouse is up
// for drawing the gear only on mouse-over, we don't remove it here.
- if (mouseInside) {
+ if (mouseInside && (! _contextMenuIsVisible) ) {
if ([self _isOptionPressed] && ![self _isHostWhitelisted]) {
[self _askToAddCurrentSiteToWhitelist];
} else {
[self _convertTypesForContainer];
}
- }
+ } else {
+ _contextMenuIsVisible = NO;
+ }
}
- (BOOL) _isOptionPressed

0 comments on commit 4f29315

Please sign in to comment.
Something went wrong with that request. Please try again.