diff --git a/openbox/client.c b/openbox/client.c index d23eaf00..c8d87ab4 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -249,10 +249,6 @@ void client_manage(Window window) grab_server(FALSE); - /* add to client list/map */ - client_list = g_list_append(client_list, self); - g_hash_table_insert(window_map, &self->window, self); - /* update the focus lists */ focus_order_add_new(self); @@ -323,6 +319,10 @@ void client_manage(Window window) dispatch_client(Event_Client_Mapped, self, 0, 0); + /* add to client list/map */ + client_list = g_list_append(client_list, self); + g_hash_table_insert(window_map, &self->window, self); + ob_debug("Managed window 0x%lx (%s)\n", window, self->class); } @@ -427,6 +427,7 @@ void client_unmanage(ObClient *self) unmapping/mapping */ PROP_ERASE(self->window, net_wm_desktop); PROP_ERASE(self->window, net_wm_state); + PROP_ERASE(self->window, wm_state); } else { /* if we're left in an iconic state, the client wont be mapped. this is bad, since we will no longer be managing the window on restart */ @@ -1346,11 +1347,8 @@ void client_update_strut(ObClient *self) if (!PROP_GETA32(self->window, net_wm_strut, cardinal, &data, &num)) { STRUT_SET(self->strut, 0, 0, 0, 0); } else { - if (num == 4) { - g_message("new strut: %d %d %d %d", - data[0], data[2], data[1], data[3]); + if (num == 4) STRUT_SET(self->strut, data[0], data[2], data[1], data[3]); - } else STRUT_SET(self->strut, 0, 0, 0, 0); g_free(data); @@ -1656,9 +1654,10 @@ static void client_apply_startup_state(ObClient *self) */ } -void client_configure(ObClient *self, ObCorner anchor, - int x, int y, int w, int h, - gboolean user, gboolean final) +void client_configure_full(ObClient *self, ObCorner anchor, + int x, int y, int w, int h, + gboolean user, gboolean final, + gboolean force_reply) { gboolean moved = FALSE, resized = FALSE; @@ -1850,20 +1849,19 @@ void client_configure(ObClient *self, ObCorner anchor, if (moved || resized) frame_adjust_area(self->frame, moved, resized); - /* If you send this and the client hasn't changed you end up with buggy - clients (emacs) freaking out, cuz they send back a configure every - time they receive this event, which resends them this event... etc. - */ - if ((!user && moved) || (user && final)) { + if (force_reply || (!resized && ((!user && moved) || (user && final)))) + { XEvent event; event.type = ConfigureNotify; event.xconfigure.display = ob_display; event.xconfigure.event = self->window; event.xconfigure.window = self->window; - + /* root window real coords */ - event.xconfigure.x = self->frame->area.x + self->frame->size.left; - event.xconfigure.y = self->frame->area.y + self->frame->size.top; + event.xconfigure.x = self->frame->area.x + self->frame->size.left - + self->border_width; + event.xconfigure.y = self->frame->area.y + self->frame->size.top - + self->border_width; event.xconfigure.width = w; event.xconfigure.height = h; diff --git a/openbox/client.h b/openbox/client.h index 4421f8fe..fe37a7d7 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -263,6 +263,9 @@ gboolean client_normal(ObClient *self); /* Returns if the window is focused */ gboolean client_focused(ObClient *self); +#define client_configure(self, anchor, x, y, w, h, user, final) \ + client_configure_full(self, anchor, x, y, w, h, user, final, FALSE) + /*! Move and/or resize the window. This also maintains things like the client's minsize, and size increments. @param anchor The corner to keep in the same position when resizing. @@ -277,10 +280,13 @@ gboolean client_focused(ObClient *self); configuration. e.g. Final should be FALSE if doing an interactive move/resize, and then be TRUE for the last call only. + @param force_reply Send a ConfigureNotify to the client regardless of if + the position changed. */ -void client_configure(ObClient *self, ObCorner anchor, - int x, int y, int w, int h, - gboolean user, gboolean final); +void client_configure_full(ObClient *self, ObCorner anchor, + int x, int y, int w, int h, + gboolean user, gboolean final, + gboolean force_reply); void client_reconfigure(ObClient *self); diff --git a/openbox/event.c b/openbox/event.c index 8259f002..a7ed67fd 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -758,15 +758,16 @@ static void event_handle_client(ObClient *client, XEvent *e) /* if we are iconic (or shaded (fvwm does this)) ignore the event */ if (client->iconic || client->shaded) return; - if (e->xconfigurerequest.value_mask & CWBorderWidth) - client->border_width = e->xconfigurerequest.border_width; - /* resize, then move, as specified in the EWMH section 7.7 */ if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight | - CWX | CWY)) { + CWX | CWY | + CWBorderWidth)) { int x, y, w, h; ObCorner corner; + if (e->xconfigurerequest.value_mask & CWBorderWidth) + client->border_width = e->xconfigurerequest.border_width; + x = (e->xconfigurerequest.value_mask & CWX) ? e->xconfigurerequest.x : client->area.x; y = (e->xconfigurerequest.value_mask & CWY) ? @@ -802,7 +803,8 @@ static void event_handle_client(ObClient *client, XEvent *e) corner = OB_CORNER_TOPLEFT; } - client_configure(client, corner, x, y, w, h, FALSE, TRUE); + client_configure_full(client, corner, x, y, w, h, FALSE, TRUE, + TRUE); } if (e->xconfigurerequest.value_mask & CWStackMode) { @@ -1032,7 +1034,6 @@ static void event_handle_client(ObClient *client, XEvent *e) client_setup_decor_and_functions(client); } else if (msgtype == prop_atoms.net_wm_strut) { - g_message("strut change"); client_update_strut(client); } else if (msgtype == prop_atoms.net_wm_icon ||