summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2015-01-24 17:54:21 +0200
committerBryce Harrington <bryce@osg.samsung.com>2015-01-26 11:25:19 -0800
commit836b9c7177c37852819c5b771008024935080032 (patch)
treede832f42849037f0896fbdc440780587c35e27e4
parent9bb133990a82899f9d8614489b88af51f9161a23 (diff)
downloadweston-836b9c7177c37852819c5b771008024935080032.tar.gz
xwm: don't set inactive surfaces as top level
Some X clients create popup or tooltips windows as top level, without setting them as override redirect or as transient. Since we don't want to take the focus away from a surface when one of its popup is opened, check the _NET_WM_WINDOW_TYPE of the X surfaces being mapped and set them as inactive if it is one of some types. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
-rw-r--r--xwayland/window-manager.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 9284a05c..6f1996f0 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -2273,6 +2273,18 @@ legacy_fullscreen(struct weston_wm *wm,
return 0;
}
+static bool
+weston_wm_window_type_inactive(struct weston_wm_window *window)
+{
+ struct weston_wm *wm = window->wm;
+
+ return window->type == wm->atom.net_wm_window_type_tooltip ||
+ window->type == wm->atom.net_wm_window_type_dropdown ||
+ window->type == wm->atom.net_wm_window_type_dnd ||
+ window->type == wm->atom.net_wm_window_type_combo ||
+ window->type == wm->atom.net_wm_window_type_popup;
+}
+
static void
xserver_map_shell_surface(struct weston_wm_window *window,
struct weston_surface *surface)
@@ -2282,6 +2294,7 @@ xserver_map_shell_surface(struct weston_wm_window *window,
&wm->server->compositor->shell_interface;
struct weston_output *output;
struct weston_wm_window *parent;
+ int flags = 0;
weston_wm_window_read_properties(window);
@@ -2340,11 +2353,20 @@ xserver_map_shell_surface(struct weston_wm_window *window,
WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
} else if (window->transient_for && window->transient_for->surface) {
parent = window->transient_for;
+ if (weston_wm_window_type_inactive(window))
+ flags = WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
shell_interface->set_transient(window->shsurf,
parent->surface,
window->x - parent->x,
- window->y - parent->y, 0);
+ window->y - parent->y, flags);
} else {
- shell_interface->set_toplevel(window->shsurf);
+ if (weston_wm_window_type_inactive(window)) {
+ shell_interface->set_xwayland(window->shsurf,
+ window->x,
+ window->y,
+ WL_SHELL_SURFACE_TRANSIENT_INACTIVE);
+ } else {
+ shell_interface->set_toplevel(window->shsurf);
+ }
}
}