xwm: use last focused window for guessing transient parent
On X the global absolute coordinates are sent in ConfigureNotify and transient windows are mapped exactly on that position. On Wayland we don't have the concept of global coordinates, and that's a problem for transient surfaces without transient_for set because they rely on such hint for setting their positioning. 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. Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
e66fcee435
commit
ce1baa8097
@@ -511,6 +511,8 @@ weston_wm_window_activate(struct wl_listener *listener, void *data)
|
|||||||
if (wm->focus_window)
|
if (wm->focus_window)
|
||||||
weston_wm_window_schedule_repaint(wm->focus_window);
|
weston_wm_window_schedule_repaint(wm->focus_window);
|
||||||
wm->focus_window = window;
|
wm->focus_window = window;
|
||||||
|
if (window)
|
||||||
|
wm->focus_latest = window;
|
||||||
if (wm->focus_window)
|
if (wm->focus_window)
|
||||||
weston_wm_window_schedule_repaint(wm->focus_window);
|
weston_wm_window_schedule_repaint(wm->focus_window);
|
||||||
}
|
}
|
||||||
@@ -1562,7 +1564,7 @@ xserver_map_shell_surface(struct weston_wm *wm,
|
|||||||
&wm->server->compositor->shell_interface;
|
&wm->server->compositor->shell_interface;
|
||||||
struct weston_wm_window *parent;
|
struct weston_wm_window *parent;
|
||||||
struct theme *t = window->wm->theme;
|
struct theme *t = window->wm->theme;
|
||||||
int x = 0, y = 0;
|
int parent_id, x = 0, y = 0;
|
||||||
|
|
||||||
if (!shell_interface->create_shell_surface)
|
if (!shell_interface->create_shell_surface)
|
||||||
return;
|
return;
|
||||||
@@ -1573,12 +1575,20 @@ xserver_map_shell_surface(struct weston_wm *wm,
|
|||||||
&shell_client);
|
&shell_client);
|
||||||
|
|
||||||
/* ICCCM 4.1.1 */
|
/* ICCCM 4.1.1 */
|
||||||
if (!window->override_redirect || !window->transient_for) {
|
if (!window->override_redirect) {
|
||||||
shell_interface->set_toplevel(window->shsurf);
|
shell_interface->set_toplevel(window->shsurf);
|
||||||
return;
|
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 */
|
/* non-decorated and non-toplevel windows, e.g. sub-menus */
|
||||||
if (!parent->decorate && parent->override_redirect) {
|
if (!parent->decorate && parent->override_redirect) {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ struct weston_wm {
|
|||||||
struct weston_xserver *server;
|
struct weston_xserver *server;
|
||||||
xcb_window_t wm_window;
|
xcb_window_t wm_window;
|
||||||
struct weston_wm_window *focus_window;
|
struct weston_wm_window *focus_window;
|
||||||
|
struct weston_wm_window *focus_latest;
|
||||||
struct theme *theme;
|
struct theme *theme;
|
||||||
xcb_cursor_t *cursors;
|
xcb_cursor_t *cursors;
|
||||||
int last_cursor;
|
int last_cursor;
|
||||||
|
|||||||
Reference in New Issue
Block a user