diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-22 19:10:43 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-12-22 19:10:43 +0200 |
| commit | 90e9ecb509974221c3a7b1b46cd943d537db7b24 (patch) | |
| tree | 8f286c83999dfab1da91a943445b2054ee079c2e | |
| parent | 97ca806286783bebd76d536220b0f37a8a0bf90c (diff) | |
fix misbehaving windows by handling ConfiguRerequest events
| -rw-r--r-- | monsterwm.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/monsterwm.c b/monsterwm.c index 29d1aae..3c8d717 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -73,6 +73,7 @@ static void buttonpressed(XEvent *e); static void change_desktop(const Arg *arg); static void cleanup(void); static void client_to_desktop(const Arg *arg); +static void configurerequest(XEvent *e); static void deletewindow(Window w); static void destroynotify(XEvent *e); static void die(const char* errstr, ...); @@ -134,11 +135,12 @@ static desktop desktops[DESKTOPS]; /* events array */ static void (*events[LASTEvent])(XEvent *e) = { - [KeyPress] = keypress, - [MapRequest] = maprequest, - [EnterNotify] = enternotify, [ButtonPress] = buttonpressed, + [ConfigureRequest] = configurerequest, [DestroyNotify] = destroynotify, + [EnterNotify] = enternotify, + [KeyPress] = keypress, + [MapRequest] = maprequest, }; void add_window(Window w) { @@ -238,6 +240,22 @@ void client_to_desktop(const Arg *arg) { if(FOLLOW_WINDOW) change_desktop(arg); } +void configurerequest(XEvent *e) { + XConfigureRequestEvent *ev = &e->xconfigurerequest; + XWindowChanges wc; + + wc.x = ev->x; + wc.y = ev->y + (showpanel && TOP_PANEL) ? PANEL_HEIGHT : 0; + wc.width = (ev->width < sw - BORDER_WIDTH) ? ev->width : sw + BORDER_WIDTH; + wc.height = (ev->height < sh - BORDER_WIDTH) ? ev->height : sh + BORDER_WIDTH; + wc.border_width = ev->border_width; + wc.sibling = ev->above; + wc.stack_mode = ev->detail; + + XConfigureWindow(dis, ev->window, ev->value_mask, &wc); + XSync(dis, False); +} + void deletewindow(Window w) { XEvent ev; ev.type = ClientMessage; |
