diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-04-12 15:10:35 +0300 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-04-20 01:34:26 +0300 |
| commit | 255f3d477745ea26f88af5ce5fb377bcb4b47806 (patch) | |
| tree | f6d7c3caf086d975b62bbfe754f3b7e6ef2b0147 /monsterwm.c | |
| parent | 66cc063df0da61b1933e32c04672a10808d8d38d (diff) | |
move and resize floating windows with the keyboard
Diffstat (limited to 'monsterwm.c')
| -rw-r--r-- | monsterwm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/monsterwm.c b/monsterwm.c index 171bde4..6fbdc80 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -31,6 +31,7 @@ enum { NET_SUPPORTED, NET_FULLSCREEN, NET_WM_STATE, NET_ACTIVE, NET_COUNT }; typedef union { const char** com; const int i; + const void *v; } Arg; /* a key struct represents a combination of @@ -122,6 +123,7 @@ static void maprequest(XEvent *e); static void monocle(int h, int y); static void move_down(); static void move_up(); +static void moveresize(const Arg *arg); static void mousemotion(const Arg *arg); static void next_win(); static client* prev_client(client *c); @@ -583,6 +585,15 @@ void move_up(void) { tile(); } +/* move and resize a window with the keyboard */ +void moveresize(const Arg *arg) { + XWindowAttributes wa; + if (!current || !XGetWindowAttributes(dis, current->win, &wa)) return; + if (!current->isfloating) { current->isfloating = True; tile(); } + XMoveResizeWindow(dis, current->win, wa.x + ((int *)arg->v)[0], wa.y + ((int *)arg->v)[1], + wa.width + ((int *)arg->v)[2], wa.height + ((int *)arg->v)[3]); +} + /* cyclic focus the next window * if the window is the last on stack, focus head */ void next_win(void) { |
