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

Alexandre Julliard julliard at winehq.org
Tue Jun 18 14:42:10 CDT 2013


Module: wine
Branch: master
Commit: f035cc73d0ae3f192f19109c1ef16cc536fcc5dc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f035cc73d0ae3f192f19109c1ef16cc536fcc5dc

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Jun 17 23:36:01 2013 -0500

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.

---

 dlls/winemac.drv/cocoa_app.m    |    6 +++++-
 dlls/winemac.drv/cocoa_window.m |   16 ----------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 2441b5d..20050bf 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1426,6 +1426,7 @@ int macdrv_err_on;
     {
         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 @@ int macdrv_err_on;
             (([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 @@ int macdrv_err_on;
 
                 macdrv_release_event(event);
             }
+            else if (broughtWindowForward && ![window isKeyWindow])
+                [self windowGotFocus:window];
         }
 
         // Since mouse button events deliver absolute cursor position, the
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index cf63b25..d926635 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -1181,8 +1181,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
 
     - (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 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
         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];
-        }
     }
 
 




More information about the wine-cvs mailing list