added new windows positions
authorRenan Traba <rvt10@inf.ufpr.br>
Mon, 22 Apr 2013 23:28:11 +0000 (22 20:28 -0300)
committerCarlos R. Mafra <crmafra@gmail.com>
Tue, 21 May 2013 10:24:36 +0000 (21 11:24 +0100)
new window positions top left, top right, bottom left and bottom right
these new maximized positions are combinations of left, right, top and
bottom maximized positions

src/actions.c
src/defaults.c
src/event.c
src/keybind.h

index 8a4a0c1..19b4322 100644 (file)
@@ -502,17 +502,29 @@ void handleMaximize(WWindow *wwin, int directions)
                        effective = requested;
                else {
                        if (requested & MAX_LEFTHALF) {
-                               effective |= MAX_VERTICAL;
+                               if (!(requested & (MAX_TOPHALF | MAX_BOTTOMHALF)))
+                                       effective |= MAX_VERTICAL;
+                               else
+                                       effective |= requested & (MAX_TOPHALF | MAX_BOTTOMHALF);
                                effective &= ~(MAX_HORIZONTAL | MAX_RIGHTHALF);
                        } else if (requested & MAX_RIGHTHALF) {
-                               effective |= MAX_VERTICAL;
+                               if (!(requested & (MAX_TOPHALF | MAX_BOTTOMHALF)))
+                                       effective |= MAX_VERTICAL;
+                               else
+                                       effective |= requested & (MAX_TOPHALF | MAX_BOTTOMHALF);
                                effective &= ~(MAX_HORIZONTAL | MAX_LEFTHALF);
                        }
                        if (requested & MAX_TOPHALF) {
-                               effective |= MAX_HORIZONTAL;
+                               if (!(requested & (MAX_LEFTHALF | MAX_RIGHTHALF)))
+                                       effective |= MAX_HORIZONTAL;
+                               else
+                                       effective |= requested & (MAX_LEFTHALF | MAX_RIGHTHALF);
                                effective &= ~(MAX_VERTICAL | MAX_BOTTOMHALF);
                        } else if (requested & MAX_BOTTOMHALF) {
-                               effective |= MAX_HORIZONTAL;
+                               if (!(requested & (MAX_LEFTHALF | MAX_RIGHTHALF)))
+                                       effective |= MAX_HORIZONTAL;
+                               else
+                                       effective |= requested & (MAX_LEFTHALF | MAX_RIGHTHALF);
                                effective &= ~(MAX_VERTICAL | MAX_TOPHALF);
                        }
                        if (requested & MAX_HORIZONTAL)
index 82202df..25d7fee 100644 (file)
@@ -609,8 +609,16 @@ WDefaultEntry optionList[] = {
                NULL, getKeybind, setKeyGrab, NULL, NULL},
        {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE,
                NULL, getKeybind, setKeyGrab, NULL, NULL},
+       {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE,
+               NULL, getKeybind, setKeyGrab, NULL, NULL},
+       {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE,
+               NULL, getKeybind, setKeyGrab, NULL, NULL},
+       {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE,
+               NULL, getKeybind, setKeyGrab, NULL, NULL},
+       {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE,
+               NULL, getKeybind, setKeyGrab, NULL, NULL},
        {"MaximusKey", "None", (void*)WKBD_MAXIMUS,
-           NULL, getKeybind, setKeyGrab, NULL, NULL},
+               NULL, getKeybind, setKeyGrab, NULL, NULL},
        {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE,
            NULL, getKeybind, setKeyGrab, NULL, NULL},
        {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER,
index f169e02..7664926 100644 (file)
@@ -1484,6 +1484,34 @@ static void handleKeyPress(XEvent * event)
                        handleMaximize(wwin, MAX_HORIZONTAL | MAX_BOTTOMHALF | MAX_KEYBOARD);
                }
                break;
+       case WKBD_LTCMAXIMIZE:
+               if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
+                       CloseWindowMenu(scr);
+
+                       handleMaximize(wwin, MAX_LEFTHALF | MAX_TOPHALF | MAX_KEYBOARD);
+               }
+               break;
+       case WKBD_RTCMAXIMIZE:
+               if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
+                       CloseWindowMenu(scr);
+
+                       handleMaximize(wwin, MAX_RIGHTHALF | MAX_TOPHALF | MAX_KEYBOARD);
+               }
+               break;
+       case WKBD_LBCMAXIMIZE:
+               if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
+                       CloseWindowMenu(scr);
+
+                       handleMaximize(wwin, MAX_LEFTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD);
+               }
+                break;
+       case WKBD_RBCMAXIMIZE:
+               if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
+                       CloseWindowMenu(scr);
+
+                       handleMaximize(wwin, MAX_RIGHTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD);
+               }
+               break;
        case WKBD_MAXIMUS:
                if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
                        CloseWindowMenu(scr);
index 0209aed..bf02965 100644 (file)
@@ -39,6 +39,10 @@ enum {
        WKBD_RHMAXIMIZE,
        WKBD_THMAXIMIZE,
        WKBD_BHMAXIMIZE,
+       WKBD_LTCMAXIMIZE,
+       WKBD_RTCMAXIMIZE,
+       WKBD_LBCMAXIMIZE,
+       WKBD_RBCMAXIMIZE,
        WKBD_MAXIMUS,
        WKBD_SELECT,
        WKBD_RAISE,