From: gryf <gry...@gmail.com> Using MoveHalfMaximizedWindowsBetweenScreens option user can enable ability for moving half-maximized windows not only within current screen/head/display, but also to other heads, if they exists. Note, that only vertically or horizontally maximized windows can be transfered to another display. Quarter-maximized windows are not supported, since it is ambiguous to predict in which direction such window should be moved. --- NEWS | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/actions.c | 48 ++++++++++++++++++++++++++++++++- 2 files changed, 133 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS index 4dcacb7..b407b78 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,92 @@ respectively. This setting can also be changed by unchecking or checking "Expert User Preferences" tab in WPrefs.app. +Move half-maximized windows between the screens +----------------------------------------------- + +New option was introduced to allow change of behaviour of half-maximize windows +in multiple displays environment. In such environment it is more natural that +half maximized windows would travel from one screen to another. Now it is +possible to make that happen by setting an option +"MoveHalfMaximizedWindowsBetweenScreens" to "Yes" in +~/GNUstep/Defaults/WindowMaker config file, or by checking "Allow move +half-maximized windows between multiple screens." in 'Expert User Preferences" +tab in WPrefs.app. + +For example, given there are two screens in layout where one display is on the +left and second display is on the right with window on first screen: + + ┌┬────────────────┬─────────────────┬┐ + ├┘ ┌───────┐ │ ├┤ + │ ├───────┤ │ ├┤ + │ │ │ │ ├┤ + │ │ │ │ ├┤ + │ └───────┘ │ └┤ + ├┬┐ ├┬┬┐ │ + └┴┴───────────────┴┴┴┴───────────────┘ + +It can be right-half-maximized (using previously defined key combination), so it +become: + + ┌┬───────┬────────┬─────────────────┬┐ + ├┘ ├────────┤ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ └┤ + ├┬┐ └────────┼┬┬┐ │ + └┴┴───────────────┴┴┴┴───────────────┘ + +In this example there is an assumption that WindowMaker is configured, that +maximized windows wont cover mini icons nor dock. + +Without setting new option to true, issuing another right-half-maximize will +restore window dimensions and position to the original state (like on the first +figure). With new option set to true it will move window to second screen like: + + ┌┬────────────────┬────────┬────────┬┐ + ├┘ ├────────┤ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ └┤ + ├┬┐ ├┬┬┬─────┘ │ + └┴┴───────────────┴┴┴┴───────────────┘ + +Another activation of right-half-maxmimize: + + ┌┬────────────────┬────────┬────────┬┐ + ├┘ │ ├────────┼┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + ├┬┐ ├┬┬┐ └────────┘│ + └┴┴───────────────┴┴┴┴───────────────┘ + +And final activation of right-half-maxmimize: + + ┌┬────────────────┬───────┬─────────┬┐ + ├┘ ├───────┤ ├┤ + │ │ │ ├┤ + │ │ │ ├┤ + │ ├───────┘ ├┤ + │ │ └┤ + ├┬┐ ├┬┬┐ │ + └┴┴───────────────┴┴┴┴───────────────┘ + +Where window is restored its size (but not position, since it it on different +head now). Moving window in directions like left-half-maximize, +top-half-maximize and bottom-half-maximize will behave in similar way depending +on the layout of displays. + +Note, that only windows that are half-maximized vertically or horizontally can +be moved to another screen due to the fact, that direction of movement of +quarter-maximized windows is ambiguous. As for vertical/horizontal-maximize, +since doesn't move the window but only strech it vertically/horizontally this +feature also doesn't apply. + + -- 0.95.7 Window snapping diff --git a/src/actions.c b/src/actions.c index b2a2bbb..4a96ce3 100644 --- a/src/actions.c +++ b/src/actions.c @@ -496,7 +496,53 @@ void handleMaximize(WWindow *wwin, int directions) if ((wwin->flags.old_maximized & MAX_MAXIMUS) && !(requested & MAX_MAXIMUS)) wMaximizeWindow(wwin, MAX_MAXIMUS | flags, head); - else + + else if (wPreferences.move_half_max_between_heads) { + /* 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 (requested & MAX_LEFTHALF && current & MAX_LEFTHALF) { + head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr, + head, DIRECTION_LEFT); + if (head != -1) { + effective |= MAX_RIGHTHALF; + effective |= MAX_VERTICAL; + effective &= ~(MAX_HORIZONTAL | MAX_LEFTHALF); + } + } else if (requested & MAX_RIGHTHALF && + current & MAX_RIGHTHALF) { + head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr, + head, DIRECTION_RIGHT); + if (head != -1) { + effective |= MAX_LEFTHALF; + effective |= MAX_VERTICAL; + effective &= ~(MAX_HORIZONTAL | MAX_RIGHTHALF); + } + } else if (requested & MAX_TOPHALF && current & MAX_TOPHALF) { + head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr, + head, DIRECTION_UP); + if (head != -1) { + effective |= MAX_BOTTOMHALF; + effective |= MAX_HORIZONTAL; + effective &= ~(MAX_VERTICAL | MAX_TOPHALF); + } + } else if (requested & MAX_BOTTOMHALF && + current & MAX_BOTTOMHALF) { + head = wGetHeadRelativeToCurrentHead(wwin->screen_ptr, + head, DIRECTION_DOWN); + if (head != -1) { + effective |= MAX_TOPHALF; + effective |= MAX_HORIZONTAL; + effective &= ~(MAX_VERTICAL | MAX_BOTTOMHALF); + } + } if (head == -1) + wUnmaximizeWindow(wwin); + else + wMaximizeWindow(wwin, effective | flags, head); + } else + wUnmaximizeWindow(wwin); + } else wUnmaximizeWindow(wwin); /* these alone mean vertical|horizontal toggle */ } else if ((effective == MAX_LEFTHALF) || -- 2.10.2 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.