Interpret the size in the configure event as window geometry
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 14 Jul 2014 20:28:48 +0000 (16:28 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 17 Jul 2014 20:58:45 +0000 (13:58 -0700)
The size of the configure event has always been specified as in window
geometry coordinates, but it was never implemented this way.

clients/window.c
desktop-shell/shell.c

index b82a93e..f44bf64 100644 (file)
@@ -3787,6 +3787,15 @@ widget_schedule_resize(struct widget *widget, int32_t width, int32_t height)
        window_schedule_resize(widget->window, width, height);
 }
 
+static int
+window_get_shadow_margin(struct window *window)
+{
+       if (window->frame)
+               return frame_get_shadow_margin(window->frame->frame);
+       else
+               return 0;
+}
+
 static void
 handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
                         int32_t width, int32_t height,
@@ -3836,7 +3845,14 @@ handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
        }
 
        if (width > 0 && height > 0) {
-               window_schedule_resize(window, width, height);
+               /* The width / height params are for window geometry,
+                * but window_schedule_resize takes allocation. Add
+                * on the shadow margin to get the difference. */
+               int margin = window_get_shadow_margin(window);
+
+               window_schedule_resize(window,
+                                      width + margin * 2,
+                                      height + margin * 2);
        } else {
                window_schedule_resize(window,
                                       window->saved_allocation.width,
index f22cef8..fca1c00 100644 (file)
@@ -1832,6 +1832,11 @@ surface_resize(struct shell_surface *shsurf,
        surface_subsurfaces_boundingbox(shsurf->surface, NULL, NULL,
                                        &resize->width, &resize->height);
 
+       resize->width -= shsurf->margin.left;
+       resize->width -= shsurf->margin.right;
+       resize->height -= shsurf->margin.top;
+       resize->height -= shsurf->margin.bottom;
+
        shsurf->resize_edges = edges;
        shell_surface_state_changed(shsurf);
        shell_grab_start(&resize->base, &resize_grab_interface, shsurf,