mfwm

A tiling fork of dylanaraps sowm.
git clone git://depsterr.com/git/mfwm
Log | Files | Refs | README | LICENSE

commit f19fd045a85d44a7338928a9eb3f94c00690eb73
parent d271e266e624023f37edb91e805fa3bb36d92884
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Tue, 15 Oct 2019 23:44:04 +0300

sowm: resize optimization

Diffstat:
Msowm.c | 32+++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/sowm.c b/sowm.c @@ -164,26 +164,21 @@ void notify_enter(XEvent *e) { There's no use in computing each and every event as we only really care about the newest one. - The window is then moved or resized and finally its - fullscreen value is reset to '0' (False). + The window is then moved or resized. */ void notify_motion(XEvent *e) { - client *c; - - if (mouse.subwindow != None) { - int xd = e->xbutton.x_root - mouse.x_root; - int yd = e->xbutton.y_root - mouse.y_root; + if (mouse.subwindow == None) return; - while(XCheckTypedEvent(d, MotionNotify, e)); + int xd = e->xbutton.x_root - mouse.x_root; + int yd = e->xbutton.y_root - mouse.y_root; - XMoveResizeWindow(d, mouse.subwindow, - attr.x + (mouse.button==1 ? xd : 0), - attr.y + (mouse.button==1 ? yd : 0), - attr.width + (mouse.button==3 ? xd : 0), - attr.height + (mouse.button==3 ? yd : 0)); + while(XCheckTypedEvent(d, MotionNotify, e)); - for WIN if (c->w == mouse.subwindow) c->f = 0; - } + XMoveResizeWindow(d, mouse.subwindow, + attr.x + (mouse.button == 1 ? xd : 0), + attr.y + (mouse.button == 1 ? yd : 0), + attr.width + (mouse.button == 3 ? xd : 0), + attr.height + (mouse.button == 3 ? yd : 0)); } /* @@ -240,8 +235,15 @@ void button_press(XEvent *e) { /* On a mouse button release we simply unset the 'mouse' global as all of this mouse pointer nonsense is done. + + We also reset the current window's fullscreen state as it is + no longer at 0,0+[screen_width]X[screen_height]. */ void button_release() { + client *c; + + for WIN if (c->w == mouse.subwindow) c->f = 0; + mouse.subwindow = None; }