diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2015-09-11 14:27:40 -0500 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-09-15 06:51:15 -0700 |
commit | 45a7c27f2b69870ad2fe516ab1290a6a14d2d08a (patch) | |
tree | 2eaff85dabc829cb20d4c6a0cb5532860793709b /desktop-shell | |
parent | c0c1497f999cea4d488ed334636b00b227fdca13 (diff) |
clients: If available, prefer top level surfaces for move or rotate
This stops us from rotating or moving pop-up menus by instead rotating
their parents.
This is easiest to see using a multi-seat configuration.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/shell.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ecc42c56..3c6a3da7 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -481,6 +481,25 @@ get_output_work_area(struct desktop_shell *shell, } } +static struct shell_surface * +find_toplevel_surface(struct shell_surface *in_surface) +{ + struct shell_surface *surface = in_surface; + + if (!surface) + return NULL; + + while (surface->parent) + surface = get_shell_surface(surface->parent); + + /* If no top level surface was found, just use whatever surface was + originally provided. */ + if (!surface || surface->type != SHELL_SURFACE_TOPLEVEL) + surface = in_surface; + + return surface; +} + static void send_configure_for_surface(struct shell_surface *shsurf) { @@ -1770,6 +1789,8 @@ surface_move(struct shell_surface *shsurf, struct weston_pointer *pointer, if (!shsurf) return -1; + shsurf = find_toplevel_surface(shsurf); + if (shsurf->grabbed || shsurf->state.fullscreen || shsurf->state.maximized) return 0; @@ -4994,6 +5015,8 @@ surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer) float dx, dy; float r; + surface = find_toplevel_surface(surface); + rotate = malloc(sizeof *rotate); if (!rotate) return; |