Ken Thomases : winemac: Allow clicks on owned windows to reorder them relative to other owned windows of the same owner .

Alexandre Julliard julliard at winehq.org
Fri Jun 7 11:45:12 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Jun  7 04:26:33 2013 -0500

winemac: Allow clicks on owned windows to reorder them relative to other owned windows of the same owner.

---

 dlls/winemac.drv/cocoa_app.m |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index fe9648b..fd481e5 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1424,16 +1424,50 @@ int macdrv_err_on;
 
     - (void) handleMouseButton:(NSEvent*)theEvent
     {
-        WineWindow* window;
+        WineWindow* window = (WineWindow*)[theEvent window];
+        NSEventType type = [theEvent type];
+
+        if ([window isKindOfClass:[WineWindow class]] &&
+            type == NSLeftMouseDown &&
+            (([theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask| NSAlternateKeyMask | NSCommandKeyMask)) != NSCommandKeyMask))
+        {
+            NSWindowButton windowButton;
+            BOOL broughtWindowForward = TRUE;
+
+            /* Any left-click on our window anyplace other than the close or
+               minimize buttons will bring it forward. */
+            for (windowButton = NSWindowCloseButton;
+                 windowButton <= NSWindowMiniaturizeButton;
+                 windowButton++)
+            {
+                NSButton* button = [window standardWindowButton:windowButton];
+                if (button)
+                {
+                    NSPoint point = [button convertPoint:[theEvent locationInWindow] fromView:nil];
+                    if ([button mouse:point inRect:[button bounds]])
+                    {
+                        broughtWindowForward = FALSE;
+                        break;
+                    }
+                }
+            }
+
+            if (broughtWindowForward)
+            {
+                // Clicking on a child window does not normally reorder it with
+                // respect to its siblings, but we want it to.  We have to do it
+                // manually.
+                NSWindow* parent = [window parentWindow];
+                [parent removeChildWindow:window];
+                [parent addChildWindow:window ordered:NSWindowAbove];
+            }
+        }
 
         if (mouseCaptureWindow)
             window = mouseCaptureWindow;
-        else
-            window = (WineWindow*)[theEvent window];
 
         if ([window isKindOfClass:[WineWindow class]])
         {
-            NSEventType type = [theEvent type];
             BOOL pressed = (type == NSLeftMouseDown || type == NSRightMouseDown || type == NSOtherMouseDown);
             CGPoint pt = CGEventGetLocation([theEvent CGEvent]);
             BOOL process;




More information about the wine-cvs mailing list