summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2014-04-30 16:28:41 -0700
committerKristian Høgsberg <krh@bitplanet.net>2014-04-30 16:28:41 -0700
commite5c1ae9368821379e0028cd8dc0fa7e039f84c21 (patch)
treea0f16d162ee01debbdc4509bdafea46980c3429e
parent052ef4e7bcd8929b5bceafa2beb76be43fc32822 (diff)
xwayland: Set decoration margin for xwayland windows
-rw-r--r--desktop-shell/shell.c16
-rw-r--r--src/compositor.h4
-rw-r--r--xwayland/window-manager.c9
3 files changed, 23 insertions, 6 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a9c67fa6..8b67844e 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2053,6 +2053,16 @@ set_title(struct shell_surface *shsurf, const char *title)
}
static void
+set_margin(struct shell_surface *shsurf,
+ int32_t left, int32_t right, int32_t top, int32_t bottom)
+{
+ shsurf->margin.left = left;
+ shsurf->margin.right = right;
+ shsurf->margin.top = top;
+ shsurf->margin.bottom = bottom;
+}
+
+static void
shell_surface_set_title(struct wl_client *client,
struct wl_resource *resource, const char *title)
{
@@ -3349,10 +3359,7 @@ xdg_surface_set_margin(struct wl_client *client,
{
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
- shsurf->margin.left = left;
- shsurf->margin.right = right;
- shsurf->margin.top = top;
- shsurf->margin.bottom = bottom;
+ set_margin(shsurf, left, right, top, bottom);
}
static void
@@ -6112,6 +6119,7 @@ module_init(struct weston_compositor *ec,
ec->shell_interface.move = shell_interface_move;
ec->shell_interface.resize = surface_resize;
ec->shell_interface.set_title = set_title;
+ ec->shell_interface.set_margin = set_margin;
weston_layer_init(&shell->fullscreen_layer, &ec->cursor_layer.link);
weston_layer_init(&shell->panel_layer, &shell->fullscreen_layer.link);
diff --git a/src/compositor.h b/src/compositor.h
index 03d89922..1fb5ffa5 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -111,7 +111,9 @@ struct weston_shell_interface {
struct weston_seat *ws, uint32_t edges);
void (*set_title)(struct shell_surface *shsurf,
const char *title);
-
+ void (*set_margin)(struct shell_surface *shsurf,
+ int32_t left, int32_t right,
+ int32_t top, int32_t bottom);
};
struct weston_animation {
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 627c45e1..dd0118ef 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -944,7 +944,8 @@ weston_wm_window_draw_decoration(void *data)
cairo_t *cr;
int x, y, width, height;
int32_t input_x, input_y, input_w, input_h;
-
+ struct weston_shell_interface *shell_interface =
+ &wm->server->compositor->shell_interface;
uint32_t flags = 0;
weston_wm_window_read_properties(window);
@@ -1006,6 +1007,12 @@ weston_wm_window_draw_decoration(void *data)
pixman_region32_init_rect(&window->surface->pending.input,
input_x, input_y, input_w, input_h);
+
+ shell_interface->set_margin(window->shsurf,
+ input_x,
+ width - input_w - input_x,
+ input_y,
+ height - input_h - input_y);
}
}