[Xfce4-commits] [xfce/xfwm4] 01/08: client: Maximize on expected output

noreply at xfce.org noreply at xfce.org
Fri Jul 27 22:35:06 CEST 2018


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   2   
   in repository xfce/xfwm4.

commit 0c00ec4c86003e053d2e68337929fad8d7bedff1
Author: P. Pronk <xfce at pronk.nl>
Date:   Tue Jan 10 12:45:53 2017 +0100

    client: Maximize on expected output
    
    Bug: 13284
    
    When dragging a window from a large monitor to the top of a smaller monitor to
    maximize the window, it is possible that the window gets maximised on a
    different monitor then the monitor your mouse is.
    
    This happens because clientToggleMaximized uses the center point of the window
    to calculate on which monitor the window should be maximised.
    
    To fix this behaviour this commits adds a clientToggleMaximizedAtPoint method
    so we can tell on which monitor the window should be maximised.
    
    (cherry picked from commit 9c888ac750265b88a865cdbd01edf50395c82c54)
---
 src/client.c     | 26 +++++++++++++++++++++-----
 src/client.h     |  5 +++++
 src/moveresize.c |  2 +-
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/client.c b/src/client.c
index b8301b3..3496d9e 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3342,6 +3342,24 @@ clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositio
 gboolean
 clientToggleMaximized (Client *c, int mode, gboolean restore_position)
 {
+    g_return_val_if_fail (c != NULL, FALSE);
+
+    TRACE ("entering clientToggleMaximized");
+
+    if (!CLIENT_CAN_MAXIMIZE_WINDOW (c))
+    {
+        return FALSE;
+    }
+
+    return clientToggleMaximizedAtPoint(c,
+                                frameX (c) + (frameWidth (c) / 2),
+                                frameY (c) + (frameHeight (c) / 2),
+                                mode, restore_position);
+}
+
+gboolean
+clientToggleMaximizedAtPoint (Client *c, gint cx, gint cy, int mode, gboolean restore_position)
+{
     DisplayInfo *display_info;
     ScreenInfo *screen_info;
     XWindowChanges wc;
@@ -3350,8 +3368,8 @@ clientToggleMaximized (Client *c, int mode, gboolean restore_position)
 
     g_return_val_if_fail (c != NULL, FALSE);
 
-    TRACE ("entering clientToggleMaximized");
-    TRACE ("maximzing/unmaximizing client \"%s\" (0x%lx)", c->name, c->window);
+    TRACE ("entering clientToggleMaximizedAtPoint");
+    TRACE ("maximizing/unmaximizing client \"%s\" (0x%lx)", c->name, c->window);
 
     if (!CLIENT_CAN_MAXIMIZE_WINDOW (c))
     {
@@ -3360,9 +3378,7 @@ clientToggleMaximized (Client *c, int mode, gboolean restore_position)
 
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
-    myScreenFindMonitorAtPoint (screen_info,
-                                frameX (c) + (frameWidth (c) / 2),
-                                frameY (c) + (frameHeight (c) / 2), &rect);
+    myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect);
 
     wc.x = c->x;
     wc.y = c->y;
diff --git a/src/client.h b/src/client.h
index 3b2d6f2..68d7c7b 100644
--- a/src/client.h
+++ b/src/client.h
@@ -465,6 +465,11 @@ void                     clientUpdateMaximizeSize               (Client *);
 gboolean                 clientToggleMaximized                  (Client *,
                                                                  int,
                                                                  gboolean);
+gboolean                 clientToggleMaximizedAtPoint           (Client *,
+                                                                 gint,
+                                                                 gint,
+                                                                 int,
+                                                                 gboolean);
 gboolean                 clientTile                             (Client *,
                                                                  gint,
                                                                  gint,
diff --git a/src/moveresize.c b/src/moveresize.c
index 1c07e8e..b15d8ab 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -832,7 +832,7 @@ clientMoveTile (Client *c, XMotionEvent *xevent)
             /* mouse pointer on top edge excluding corners */
             if (y < disp_y + dist)
             {
-                return clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED, FALSE);
+                return clientToggleMaximizedAtPoint (c, x, y, CLIENT_FLAG_MAXIMIZED, FALSE);
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list