From 0ff95d74be4ab7e0323987046eaf11c200241fae Mon Sep 17 00:00:00 2001 From: Sean Pringle Date: Tue, 5 Feb 2013 10:22:19 +1000 Subject: [PATCH] action_maximise --- action.c | 8 ++++++++ atom.c | 1 + client.c | 8 ++++++++ xoat.c | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/action.c b/action.c index 2281629..417166a 100644 --- a/action.c +++ b/action.c @@ -113,6 +113,14 @@ void action_fullscreen(void *data, int num, client *cli) client_raise_family(cli); } +void action_maximize(void *data, int num, client *cli) +{ + if (!cli) return; + cli->max = !cli->max; + SETPROP_LONG(cli->window, atoms[XOAT_MAXIMIZE], &cli->max, 1); + client_place_spot(cli, cli->spot, cli->monitor, 1); +} + void action_maximize_vert(void *data, int num, client *cli) { if (!cli) return; diff --git a/atom.c b/atom.c index 300c1a5..028d266 100644 --- a/atom.c +++ b/atom.c @@ -31,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. X(XOAT_SPOT),\ X(XOAT_EXIT),\ X(XOAT_RESTART),\ + X(XOAT_MAXIMIZE),\ X(_NET_SUPPORTED),\ X(_NET_ACTIVE_WINDOW),\ X(_NET_CLOSE_WINDOW),\ diff --git a/client.c b/client.c index 6d0756b..0e22a0b 100644 --- a/client.c +++ b/client.c @@ -100,6 +100,8 @@ client* window_build_client(Window win) c->maxv = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_VERT]); c->maxh = client_has_state(c, atoms[_NET_WM_STATE_MAXIMIZE_HORZ]); + GETPROP_LONG(win, atoms[XOAT_MAXIMIZE], &c->max, 1); + // _NET_WM_STATE_MAXIMIZE_VERT may apply to spot2 windows. Detect... if (c->maxv && c->type != atoms[_NET_WM_WINDOW_TYPE_DIALOG] && INTERSECT(m->spots[SPOT2].x, m->spots[SPOT2].y, m->spots[SPOT2].w, m->spots[SPOT2].h, @@ -208,6 +210,12 @@ void client_place_spot(client *c, int spot, int mon, int force) { w = m->w; } + else + if (c->max && spot == SPOT1) + { + h = m->h - y; + w = m->w; + } w -= BORDER*2; h -= BORDER*2; int sw = w, sh = h; long sr; XSizeHints size; diff --git a/xoat.c b/xoat.c index 0a0f77f..aa1e4d0 100644 --- a/xoat.c +++ b/xoat.c @@ -76,7 +76,7 @@ typedef struct { Window transient, leader; Atom type, states[ATOMLIST+1]; short monitor, visible, manage, input, urgent, full, ours, maxv, maxh; - unsigned long spot; + unsigned long spot, max; char *class; } client; @@ -110,6 +110,7 @@ void action_focus_monitor(void*, int, client*); void action_fullscreen(void*, int, client*); void action_maximize_vert(void*, int, client*); void action_maximize_horz(void*, int, client*); +void action_maximize(void*, int, client*); #include "config.h"