Skip to content
Snippets Groups Projects
Commit f035cc73 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard
Browse files

winemac: Don't give windows focus on click if the click was sent to Wine.

Only clicks on the title bar (outside the close or minimize buttons) or the
grow box give windows focus.
parent 3faf1a92
Branches
Tags
No related merge requests found
......@@ -1426,6 +1426,7 @@ - (void) handleMouseButton:(NSEvent*)theEvent
{
WineWindow* window = (WineWindow*)[theEvent window];
NSEventType type = [theEvent type];
BOOL broughtWindowForward = FALSE;
if ([window isKindOfClass:[WineWindow class]] &&
!window.disabled && !window.noActivate &&
......@@ -1433,7 +1434,8 @@ - (void) handleMouseButton:(NSEvent*)theEvent
(([theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask| NSAlternateKeyMask | NSCommandKeyMask)) != NSCommandKeyMask))
{
NSWindowButton windowButton;
BOOL broughtWindowForward = TRUE;
broughtWindowForward = TRUE;
/* Any left-click on our window anyplace other than the close or
minimize buttons will bring it forward. */
......@@ -1538,6 +1540,8 @@ - (void) handleMouseButton:(NSEvent*)theEvent
macdrv_release_event(event);
}
else if (broughtWindowForward && ![window isKeyWindow])
[self windowGotFocus:window];
}
// Since mouse button events deliver absolute cursor position, the
......
......@@ -1181,8 +1181,6 @@ - (void) makeKeyAndOrderFront:(id)sender
- (void) sendEvent:(NSEvent*)event
{
WineApplicationController* controller = [WineApplicationController sharedController];
/* NSWindow consumes certain key-down events as part of Cocoa's keyboard
interface control. For example, Control-Tab switches focus among
views. We want to bypass that feature, so directly route key-down
......@@ -1190,21 +1188,7 @@ - (void) sendEvent:(NSEvent*)event
if ([event type] == NSKeyDown)
[[self firstResponder] keyDown:event];
else
{
if ([event type] == NSLeftMouseDown &&
(([event modifierFlags] & (NSShiftKeyMask | NSControlKeyMask| NSAlternateKeyMask | NSCommandKeyMask)) != NSCommandKeyMask))
{
/* Since our windows generally claim they can't be made key, clicks
in their title bars are swallowed by the theme frame stuff. So,
we hook directly into the event stream and assume that any click
in the window will activate it, if Wine and the Win32 program
accept. */
if (![self isKeyWindow] && !self.disabled && !self.noActivate)
[controller windowGotFocus:self];
}
[super sendEvent:event];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment