Previous bugfix introduced another regression. It fixed the issue with
size of the unmaximized window, but break new functionality. Revert back
code for maximizing using mouse, leaving out head detection for keyboard
actions, since it is already calculated.

Mouse actions for maximize also has to be fixed due to different
behaviour in original implementation - movement of the window which is
called in handleMaximize filter out MAX_KEYBOARD from argument passed to
the wMaximizeWindow, so that it will always assume that all the actions
have to be done on the head where mouse pointer resides. For moving
windows between heads feature, calculated head is always passed and
used, regardless of how maximizing was invoked (keyboard or mouse) and
mouse pointer position.
---
 src/actions.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index a1099a4..119f5ec 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -393,9 +393,14 @@ void wMaximizeWindow(WWindow *wwin, int directions, int 
head)
        totalArea.y2 = scr->scr_height;
        totalArea.x1 = 0;
        totalArea.y1 = 0;
-       /* ignore provided head information for toggling full 
maximize/unmaximize */
-       if (directions & MAX_KEYBOARD)
-               head = wGetHeadForWindow(wwin);
+
+       /* In case of mouse initiated maximize, use the head in which pointer is
+          located, rather than window position, which is passed to the 
function */
+       if (!(directions & MAX_IGNORE_XINERAMA) && !(directions & 
MAX_KEYBOARD)) {
+               WScreen *scr = wwin->screen_ptr;
+               head = wGetHeadForPointerLocation(scr);
+       }
+
        usableArea = wGetUsableAreaForHead(scr, head, &totalArea, True);
 
        /* Only save directions, not kbd or xinerama hints */
@@ -505,7 +510,7 @@ void handleMaximize(WWindow *wwin, int directions)
                        /* Select windows, which are only horizontally or 
vertically
                         * maximized. Quarters cannot be handled here, since 
there is not
                         * clear on which direction user intend to move such 
window. */
-                       if ((current & MAX_VERTICAL) || (current & 
MAX_HORIZONTAL)) {
+                       if (current & (MAX_VERTICAL | MAX_HORIZONTAL)) {
                                if (requested & MAX_LEFTHALF && current & 
MAX_LEFTHALF) {
                                        dest_head = 
wGetHeadRelativeToCurrentHead(wwin->screen_ptr,
                                                        head, DIRECTION_LEFT);
@@ -540,10 +545,15 @@ void handleMaximize(WWindow *wwin, int directions)
                                                effective |= MAX_HORIZONTAL;
                                                effective &= ~(MAX_VERTICAL | 
MAX_BOTTOMHALF);
                                        }
-                               } if (dest_head == -1)
-                                       wUnmaximizeWindow(wwin);
+                               } if (dest_head != -1)
+                                       /* tell wMaximizeWindow that we were 
using keyboard, not
+                                        * mouse, so that it will use 
calculated head as
+                                        * destination for 
move_half_max_between_heads feature,
+                                        * not from mouse pointer */
+                                       wMaximizeWindow(wwin, (effective | 
flags | MAX_KEYBOARD),
+                                                       dest_head);
                                else
-                                       wMaximizeWindow(wwin, effective | 
flags, dest_head);
+                                       wUnmaximizeWindow(wwin);
                        } else
                                wUnmaximizeWindow(wwin);
                } else
-- 
2.10.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to