[PATCH 3/3] xwayland: Fix override redirect window positioning
Scott Moreau
oreaus at gmail.com
Sat Jun 24 07:18:57 UTC 2017
When override redirect windows are created, the x/y offsets
provided at map time may be incorrect. The correct offsets are
sent in a configure event from the xserver some time later.
Here we fix the positions by delaying the call to set_xwayland()
from map time to the needed configure event in the case where x/y
are both 0 for override redirect windows.
---
xwayland/window-manager.c | 23 ++++++++++++++++++++---
xwayland/xwayland.h | 1 +
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 951a7cf..2e61ea4 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -169,6 +169,7 @@ struct weston_wm_window {
int maximized_horz;
struct wm_size_hints size_hints;
struct motif_wm_hints motif_hints;
+ struct wl_list or_link;
struct wl_list link;
};
@@ -737,9 +738,11 @@ our_resource(struct weston_wm *wm, uint32_t id)
static void
weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *event)
{
+ const struct weston_desktop_xwayland_interface *xi =
+ wm->server->compositor->xwayland_interface;
xcb_configure_notify_event_t *configure_notify =
(xcb_configure_notify_event_t *) event;
- struct weston_wm_window *window;
+ struct weston_wm_window *window, *w, *next;
wm_log("XCB_CONFIGURE_NOTIFY (window %d) %d,%d @ %dx%d%s\n",
configure_notify->window,
@@ -760,6 +763,16 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
if (window->frame)
frame_resize_inside(window->frame,
window->width, window->height);
+ if (window->x != 0 || window->y != 0) {
+ wl_list_for_each_safe(w, next, &wm->or_window_list, or_link) {
+ if (w == window) {
+ if (w->shsurf)
+ xi->set_xwayland(w->shsurf, w->x, w->y);
+ wl_list_remove(&w->or_link);
+ break;
+ }
+ }
+ }
}
}
@@ -2478,6 +2491,7 @@ weston_wm_create(struct weston_xserver *wxs, int fd)
wl_signal_add(&wxs->compositor->kill_signal,
&wm->kill_listener);
wl_list_init(&wm->unpaired_window_list);
+ wl_list_init(&wm->or_window_list);
weston_wm_create_cursors(wm);
weston_wm_window_set_cursor(wm, wm->screen->root, XWM_CURSOR_LEFT_PTR);
@@ -2761,8 +2775,11 @@ xserver_map_shell_surface(struct weston_wm_window *window,
window->legacy_fullscreen_output.output);
return;
} else if (window->override_redirect) {
- xwayland_interface->set_xwayland(window->shsurf,
- window->x, window->y);
+ if (window->x == 0 && window->y == 0)
+ wl_list_insert(&wm->or_window_list, &window->or_link);
+ else
+ xwayland_interface->set_xwayland(window->shsurf,
+ window->x, window->y);
} else if (window->transient_for && window->transient_for->surface) {
parent = window->transient_for;
if (weston_wm_window_type_inactive(window)) {
diff --git a/xwayland/xwayland.h b/xwayland/xwayland.h
index ca75f5b..54e8908 100644
--- a/xwayland/xwayland.h
+++ b/xwayland/xwayland.h
@@ -72,6 +72,7 @@ struct weston_wm {
struct wl_listener activate_listener;
struct wl_listener kill_listener;
struct wl_list unpaired_window_list;
+ struct wl_list or_window_list;
xcb_window_t selection_window;
xcb_window_t selection_owner;
--
2.7.4
More information about the wayland-devel
mailing list