diff options
-rw-r--r-- | src/events.c | 88 | ||||
-rw-r--r-- | src/manage.c | 18 | ||||
-rw-r--r-- | src/manage.h | 2 |
3 files changed, 70 insertions, 38 deletions
diff --git a/src/events.c b/src/events.c index 7127669..1eb9149 100644 --- a/src/events.c +++ b/src/events.c @@ -216,6 +216,40 @@ destroy_window (XDestroyWindowEvent *ev) } static void +configure_notify (XConfigureEvent *e) +{ + rp_window *win; + + win = find_window (e->window); + + if (win && win->state == NormalState) + { + if (win->height != e->height + || win->width != e->width + || win->border != e->border_width + || win->x != e->x + || win->y != e->y) + { + /* The notify event was generated from a granted configure + request which means we must re-maximize the window. + + If the window has resize increments then ratpoison has to + know the real size of the window to increment properly. So, + update the structure before calling maximize. */ + + win->x = e->x; + win->y = e->y; + win->width = e->width; + win->height = e->height; + win->border = e->border_width; + + maximize (win); + } + } +} + + +static void configure_request (XConfigureRequestEvent *e) { int border; @@ -274,55 +308,49 @@ configure_request (XConfigureRequestEvent *e) changes.width = e->width; PRINT_DEBUG("request CWWidth %d\n", e->width); } + else + { + changes.width = win->width; + } if (e->value_mask & CWHeight) { changes.height = e->height; PRINT_DEBUG("request CWHeight %d\n", e->height); } + else + { + changes.height = win->height; + } if (e->value_mask & CWX) { changes.x = e->x + border; PRINT_DEBUG("request CWX %d\n", e->x); } + else + { + changes.x = win->x; + } if (e->value_mask & CWY) { changes.y = e->y + border; PRINT_DEBUG("request CWY %d\n", e->y); } + else + { + changes.y = win->y; + } if (e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight)) { - if (win->state == NormalState) - { - /* Draw the hardline. Visible windows always maximize. */ - maximize (win); - } - else - { - /* The window isn't visible so grant it whatever it - likes. */ - XConfigureWindow (dpy, win->w, - e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight), - &changes); - - /* Update the window's structure. */ - if (e->value_mask & CWX) - win->x = changes.x; - if (e->value_mask & CWY) - win->y = changes.y; - if (e->value_mask & CWBorderWidth) - win->border = border; - if (e->value_mask & CWWidth) - win->width = changes.width; - if (e->value_mask & CWHeight) - win->height = changes.height; - } + XConfigureWindow (dpy, win->w, + e->value_mask & (CWX|CWY|CWBorderWidth|CWWidth|CWHeight), + &changes); - /* This is required to be ICCCM compliant. */ - send_configure (win); + send_configure (win->w, changes.x, changes.y, changes.width, changes.height, + border); } } else @@ -600,7 +628,7 @@ property_notify (XEvent *ev) case XA_WM_TRANSIENT_FOR: PRINT_DEBUG ("Transient for\n"); - win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for); + win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for); break; default: @@ -753,6 +781,10 @@ delegate_event (XEvent *ev) break; case ConfigureNotify: + PRINT_DEBUG ("--- Handling ConfigureNotify ---\n"); + configure_notify (&ev->xconfigure); + break; + case MapNotify: case Expose: case MotionNotify: diff --git a/src/manage.c b/src/manage.c index f1ac058..7c5c148 100644 --- a/src/manage.c +++ b/src/manage.c @@ -230,22 +230,22 @@ update_window_name (rp_window *win) /* Send an artificial configure event to the window. */ void -send_configure (rp_window *win) +send_configure (Window w, int x, int y, int width, int height, int border) { XConfigureEvent ce; ce.type = ConfigureNotify; - ce.event = win->w; - ce.window = win->w; - ce.x = win->x; - ce.y = win->y; - ce.width = win->width; - ce.height = win->height; - ce.border_width = win->border; + ce.event = w; + ce.window = w; + ce.x = x; + ce.y = y; + ce.width = width; + ce.height = height; + ce.border_width = border; ce.above = None; ce.override_redirect = 0; - XSendEvent (dpy, win->w, False, StructureNotifyMask, (XEvent*)&ce); + XSendEvent (dpy, w, False, StructureNotifyMask, (XEvent*)&ce); } void diff --git a/src/manage.h b/src/manage.h index 892751b..02dbbe3 100644 --- a/src/manage.h +++ b/src/manage.h @@ -31,7 +31,7 @@ void unmanage (rp_window *w); int update_window_name (rp_window *win); void update_normal_hints (rp_window *win); void rename_current_window (); -void send_configure (rp_window *win); +void send_configure (Window w, int x, int y, int width, int height, int border); void set_state (rp_window *win, int state); long get_state (rp_window *win); |