- if (!resized && (force_reply || ((!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 -
- 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;
- event.xconfigure.border_width = 0;
- event.xconfigure.above = self->frame->plate;
- event.xconfigure.override_redirect = FALSE;
- XSendEvent(event.xconfigure.display, event.xconfigure.window,
- FALSE, StructureNotifyMask, &event);
- }
- }
-
- /* if the client is shrinking, then resize the frame before the client */
- if (send_resize_client && (!user || (w <= oldw || h <= oldh)))
- XResizeWindow(ob_display, self->window, w, h);
+ /* adjust the frame */
+ if (fmoved || fresized) {
+ gulong ignore_start;
+ if (!user)
+ ignore_start = event_start_ignore_all_enters();
+
+ frame_adjust_area(self->frame, fmoved, fresized, FALSE);
+
+ if (!user)
+ event_end_ignore_all_enters(ignore_start);
+ }
+
+ if (!user || final) {
+ gint oldrx = self->root_pos.x;
+ gint oldry = self->root_pos.y;
+ /* we have reset the client to 0 border width, so don't include
+ it in these coords */
+ POINT_SET(self->root_pos,
+ self->frame->area.x + self->frame->size.left -
+ self->border_width,
+ self->frame->area.y + self->frame->size.top -
+ self->border_width);
+ if (self->root_pos.x != oldrx || self->root_pos.y != oldry)
+ rootmoved = TRUE;
+ }
+
+ /* This is kinda tricky and should not be changed.. let me explain!
+
+ When user = FALSE, then the request is coming from the application
+ itself, and we are more strict about when to send a synthetic
+ ConfigureNotify. We strictly follow the rules of the ICCCM sec 4.1.5
+ in this case (if force_reply is true)
+
+ When user = TRUE, then the request is coming from "us", like when we
+ maximize a window or something. In this case we are more lenient. We
+ used to follow the same rules as above, but _Java_ Swing can't handle
+ this. So just to appease Swing, when user = TRUE, we always send
+ a synthetic ConfigureNotify to give the window its root coordinates.
+ */
+ if ((!user && !resized && (rootmoved || force_reply)) ||
+ (user && final && rootmoved))
+ {
+ XEvent event;
+
+ event.type = ConfigureNotify;
+ event.xconfigure.display = ob_display;
+ event.xconfigure.event = self->window;
+ event.xconfigure.window = self->window;
+
+ ob_debug("Sending ConfigureNotify to %s for %d,%d %dx%d\n",
+ self->title, self->root_pos.x, self->root_pos.y, w, h);
+
+ /* root window real coords */
+ event.xconfigure.x = self->root_pos.x;
+ event.xconfigure.y = self->root_pos.y;
+ event.xconfigure.width = w;
+ event.xconfigure.height = h;
+ event.xconfigure.border_width = self->border_width;
+ event.xconfigure.above = None;
+ event.xconfigure.override_redirect = FALSE;
+ XSendEvent(event.xconfigure.display, event.xconfigure.window,
+ FALSE, StructureNotifyMask, &event);
+ }
+
+ /* if the client is shrinking, then resize the frame before the client.
+
+ both of these resize sections may run, because the top one only resizes
+ in the direction that is growing
+ */
+ if (send_resize_client && (w <= oldw || h <= oldh)) {
+ frame_adjust_client_area(self->frame);
+ XMoveResizeWindow(ob_display, self->window,
+ self->frame->size.left, self->frame->size.top, w, h);
+ }