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

noreply at xfce.org noreply at xfce.org
Wed Dec 6 09:55:48 CET 2017


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       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 9c888ac750265b88a865cdbd01edf50395c82c54
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.
---
 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 0fb5627..24285ab 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3360,6 +3360,24 @@ clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect)
 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;
@@ -3368,8 +3386,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))
     {
@@ -3378,9 +3396,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 e8a72d7..19ef69c 100644
--- a/src/client.h
+++ b/src/client.h
@@ -469,6 +469,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 9dbc561..4854671 100644
--- a/src/moveresize.c
+++ b/src/moveresize.c
@@ -833,7 +833,7 @@ clientMoveTile (Client *c, XfwmEventMotion *event)
             /* 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