diff options
author | okan | 2013-12-16 19:02:17 +0000 |
---|---|---|
committer | okan | 2013-12-16 19:02:17 +0000 |
commit | 9798372dada127b4294dd53e80501c05e544b86c (patch) | |
tree | d953b0b3e96eaa7da4a614d942438fb44ede06bc /client.c | |
parent | 2f199b5ad84adda4a8b7d72b78529d68ec037786 (diff) | |
download | cwm-9798372dada127b4294dd53e80501c05e544b86c.tar.gz |
Implement support for EWMH's _NET_WM_STATE_FULLSCREEN hint.
Since we already have a form of 'maximize', we need to differentiate
between 'maximize' and the new 'fullscreen' mode. The 'maximize' mode
will continue to honor gap but now *retains* the border, matching the
'vert/horz maximize' behaviour. The new 'fullscreen' mode supports and
follows the _NET_WM_STATE_FULLSCREEN hint, allowing the client perform
additional window modifications; in this mode, cwm(1) will *ignore* gap,
remove borders and freeze(move/resize) the client. Additionally,
'fullscreen' mode will remember various combinations of previous states.
* default keybinding changes: CM-f 'fullscreen', CM-m 'maximize' (re-map
as desired).
Positive feedback from a few, testing and ok sthen@
Diffstat (limited to '')
-rw-r--r-- | client.c | 62 |
1 files changed, 38 insertions, 24 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.163 2013/12/13 22:39:13 okan Exp $ + * $OpenBSD: client.c,v 1.164 2013/12/16 19:02:17 okan Exp $ */ #include <sys/param.h> @@ -229,6 +229,38 @@ client_freeze(struct client_ctx *cc) } void +client_fullscreen(struct client_ctx *cc) +{ + struct screen_ctx *sc = cc->sc; + struct geom xine; + + if ((cc->flags & CLIENT_FREEZE) && + !(cc->flags & CLIENT_FULLSCREEN)) + return; + + if ((cc->flags & CLIENT_FULLSCREEN)) { + cc->bwidth = Conf.bwidth; + cc->geom = cc->fullgeom; + cc->flags &= ~(CLIENT_FULLSCREEN | CLIENT_FREEZE); + goto resize; + } + + cc->fullgeom = cc->geom; + + xine = screen_find_xinerama(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_NOGAP); + + cc->bwidth = 0; + cc->geom = xine; + cc->flags |= (CLIENT_FULLSCREEN | CLIENT_FREEZE); + +resize: + client_resize(cc, 0); + xu_ewmh_set_net_wm_state(cc); +} + +void client_maximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; @@ -238,9 +270,8 @@ client_maximize(struct client_ctx *cc) return; if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) { - cc->flags &= ~CLIENT_MAXIMIZED; cc->geom = cc->savegeom; - cc->bwidth = Conf.bwidth; + cc->flags &= ~CLIENT_MAXIMIZED; goto resize; } @@ -263,8 +294,10 @@ client_maximize(struct client_ctx *cc) cc->geom.x + cc->geom.w / 2, cc->geom.y + cc->geom.h / 2, CWM_GAP); - cc->geom = xine; - cc->bwidth = 0; + cc->geom.x = xine.x; + cc->geom.y = xine.y; + cc->geom.w = xine.w - (cc->bwidth * 2); + cc->geom.h = xine.h - (cc->bwidth * 2); cc->flags |= CLIENT_MAXIMIZED; resize: @@ -284,9 +317,6 @@ client_vmaximize(struct client_ctx *cc) if (cc->flags & CLIENT_VMAXIMIZED) { cc->geom.y = cc->savegeom.y; cc->geom.h = cc->savegeom.h; - cc->bwidth = Conf.bwidth; - if (cc->flags & CLIENT_HMAXIMIZED) - cc->geom.w -= cc->bwidth * 2; cc->flags &= ~CLIENT_VMAXIMIZED; goto resize; } @@ -294,12 +324,6 @@ client_vmaximize(struct client_ctx *cc) cc->savegeom.y = cc->geom.y; cc->savegeom.h = cc->geom.h; - /* if this will make us fully maximized then remove boundary */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_HMAXIMIZED) { - cc->geom.w += cc->bwidth * 2; - cc->bwidth = 0; - } - xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, cc->geom.y + cc->geom.h / 2, CWM_GAP); @@ -325,9 +349,6 @@ client_hmaximize(struct client_ctx *cc) if (cc->flags & CLIENT_HMAXIMIZED) { cc->geom.x = cc->savegeom.x; cc->geom.w = cc->savegeom.w; - cc->bwidth = Conf.bwidth; - if (cc->flags & CLIENT_VMAXIMIZED) - cc->geom.h -= cc->bwidth * 2; cc->flags &= ~CLIENT_HMAXIMIZED; goto resize; } @@ -335,12 +356,6 @@ client_hmaximize(struct client_ctx *cc) cc->savegeom.x = cc->geom.x; cc->savegeom.w = cc->geom.w; - /* if this will make us fully maximized then remove boundary */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_VMAXIMIZED) { - cc->geom.h += cc->bwidth * 2; - cc->bwidth = 0; - } - xine = screen_find_xinerama(sc, cc->geom.x + cc->geom.w / 2, cc->geom.y + cc->geom.h / 2, CWM_GAP); @@ -359,7 +374,6 @@ client_resize(struct client_ctx *cc, int reset) { if (reset) { cc->flags &= ~CLIENT_MAXIMIZED; - cc->bwidth = Conf.bwidth; xu_ewmh_set_net_wm_state(cc); } |