summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@intel.com>2012-06-04 19:49:32 +0300
committerTiago Vignatti <tiago.vignatti@intel.com>2012-06-11 20:33:36 +0300
commit69435ad21ede8010ef072a9d481730813b891eef (patch)
tree9ac624a9cc8f5c1b346c31d761c5c6c1782f7004
parentfd45b2f4c6d348e616efc07332f8d55138039f76 (diff)
xwm: use last focused valid window for guessing transient parent
On X the global absolute coordinates are sent in ConfigureNotify and the window is mapped exactly on that position. On Wayland we don't have that, and that's a problem for transient windows without transient_for hint set. So this solution is a workaround. It guesses a parent based on the last focused window to determine the relative position of the transient surface. This put transient windows of Chrome browser back to work now. Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
-rw-r--r--src/xwayland/window-manager.c13
-rw-r--r--src/xwayland/xwayland.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 4127957..278081a 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -439,6 +439,8 @@ weston_wm_window_activate(struct wl_listener *listener, void *data)
if (wm->focus_window)
weston_wm_window_schedule_repaint(wm->focus_window);
wm->focus_window = window;
+ if (window)
+ wm->focus_latest = window;
if (wm->focus_window)
weston_wm_window_schedule_repaint(wm->focus_window);
}
@@ -1322,6 +1324,7 @@ xserver_map_shell_surface(struct weston_wm *wm,
&wm->server->compositor->shell_interface;
struct weston_wm_window *parent;
struct theme *t = window->wm->theme;
+ int parent_id;
int x = 0, y = 0;
if (!shell_interface->create_shell_surface)
@@ -1338,7 +1341,15 @@ xserver_map_shell_surface(struct weston_wm *wm,
return;
}
- parent = hash_table_lookup(wm->window_hash, window->transient_for->id);
+ /* not all non-toplevel has transient_for set. So we need this
+ * workaround to guess a parent that will determine the relative
+ * position of the transient surface */
+ if (!window->transient_for)
+ parent_id = wm->focus_latest->id;
+ else
+ parent_id = window->transient_for->id;
+
+ parent = hash_table_lookup(wm->window_hash, parent_id);
/* non-decorated and non-toplevel windows, e.g. sub-menus */
if (!parent->decorate && parent->override_redirect) {
diff --git a/src/xwayland/xwayland.h b/src/xwayland/xwayland.h
index 438b7be..31a96cf 100644
--- a/src/xwayland/xwayland.h
+++ b/src/xwayland/xwayland.h
@@ -57,6 +57,7 @@ struct weston_wm {
struct weston_xserver *server;
xcb_window_t wm_window;
struct weston_wm_window *focus_window;
+ struct weston_wm_window *focus_latest;
struct theme *theme;
xcb_render_pictforminfo_t render_format;
struct wl_listener activate_listener;