mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 853105 - Allow double-click to minimize on windows with drawInTitlebar enabled. r=mstange, r=smichaud
This commit is contained in:
parent
99e91c8365
commit
489a85aa1e
@ -4091,7 +4091,18 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
}
|
||||
|
||||
// This might destroy our widget (and null out mGeckoChild).
|
||||
mGeckoChild->DispatchWindowEvent(geckoEvent);
|
||||
bool defaultPrevented = mGeckoChild->DispatchWindowEvent(geckoEvent);
|
||||
|
||||
// Check to see if we are double-clicking in the titlebar.
|
||||
CGFloat locationInTitlebar = [[self window] frame].size.height - [theEvent locationInWindow].y;
|
||||
if (!defaultPrevented && [theEvent clickCount] == 2 &&
|
||||
[[self window] isMovableByWindowBackground] &&
|
||||
[self shouldMinimizeOnTitlebarDoubleClick] &&
|
||||
[[self window] isKindOfClass:[ToolbarWindow class]] &&
|
||||
(locationInTitlebar < [(ToolbarWindow*)[self window] titlebarHeight] ||
|
||||
locationInTitlebar < [(ToolbarWindow*)[self window] unifiedToolbarHeight])) {
|
||||
[[self window] miniaturize:self];
|
||||
}
|
||||
|
||||
// If our mouse-up event's location is over some other object (as might
|
||||
// happen if it came at the end of a dragging operation), also send our
|
||||
@ -4681,6 +4692,17 @@ static int32_t RoundUp(double aDouble)
|
||||
return mTextInputHandler->HasMarkedText();
|
||||
}
|
||||
|
||||
- (BOOL)shouldMinimizeOnTitlebarDoubleClick
|
||||
{
|
||||
NSString *MDAppleMiniaturizeOnDoubleClickKey =
|
||||
@"AppleMiniaturizeOnDoubleClick";
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
bool shouldMinimize = [[userDefaults
|
||||
objectForKey:MDAppleMiniaturizeOnDoubleClickKey] boolValue];
|
||||
|
||||
return shouldMinimize;
|
||||
}
|
||||
|
||||
- (NSInteger) conversationIdentifier
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextInputHandler, reinterpret_cast<NSInteger>(self));
|
||||
|
@ -2946,8 +2946,12 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
|
||||
|
||||
- (CGFloat)titlebarHeight
|
||||
{
|
||||
// We use the original content rect here, not what we return from
|
||||
// [self contentRectForFrameRect:], because that would give us a
|
||||
// titlebarHeight of zero in drawsContentsIntoWindowFrame mode.
|
||||
NSRect frameRect = [self frame];
|
||||
return frameRect.size.height - [self contentRectForFrameRect:frameRect].size.height;
|
||||
NSRect originalContentRect = [NSWindow contentRectForFrameRect:frameRect styleMask:[self styleMask]];
|
||||
return NSMaxY(frameRect) - NSMaxY(originalContentRect);
|
||||
}
|
||||
|
||||
// Stores the complete height of titlebar + toolbar.
|
||||
@ -2959,10 +2963,7 @@ static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
|
||||
mUnifiedToolbarHeight = aHeight;
|
||||
|
||||
// Update sheet positioning hint
|
||||
NSRect frameRect = [self frame];
|
||||
NSRect originalContentRect = [NSWindow contentRectForFrameRect:frameRect styleMask:[self styleMask]];
|
||||
CGFloat originalTitlebarHeight = NSMaxY(frameRect) - NSMaxY(originalContentRect);
|
||||
CGFloat topMargin = mUnifiedToolbarHeight - originalTitlebarHeight;
|
||||
CGFloat topMargin = mUnifiedToolbarHeight - [self titlebarHeight];
|
||||
[self setContentBorderThickness:topMargin forEdge:NSMaxYEdge];
|
||||
|
||||
// Redraw the title bar. If we're inside painting, we'll do it right now,
|
||||
|
Loading…
Reference in New Issue
Block a user