<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 24, 2017 at 1:18 AM, Scott Moreau <span dir="ltr"><<a href="mailto:oreaus@gmail.com" target="_blank">oreaus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When override redirect windows are created, the x/y offsets<br>
provided at map time may be incorrect. The correct offsets are<br>
sent in a configure event from the xserver some time later.<br>
Here we fix the positions by delaying the call to set_xwayland()<br>
from map time to the needed configure event in the case where x/y<br>
are both 0 for override redirect windows.<br>
---<br>
xwayland/window-manager.c | 23 ++++++++++++++++++++---<br>
xwayland/xwayland.h | 1 +<br>
2 files changed, 21 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c<br>
index 951a7cf..2e61ea4 100644<br>
--- a/xwayland/window-manager.c<br>
+++ b/xwayland/window-manager.c<br>
@@ -169,6 +169,7 @@ struct weston_wm_window {<br>
int maximized_horz;<br>
struct wm_size_hints size_hints;<br>
struct motif_wm_hints motif_hints;<br>
+ struct wl_list or_link;<br>
struct wl_list link;<br>
};<br>
<br>
@@ -737,9 +738,11 @@ our_resource(struct weston_wm *wm, uint32_t id)<br>
static void<br>
weston_wm_handle_configure_<wbr>notify(struct weston_wm *wm, xcb_generic_event_t *event)<br>
{<br>
+ const struct weston_desktop_xwayland_<wbr>interface *xi =<br>
+ wm->server->compositor-><wbr>xwayland_interface;<br>
xcb_configure_notify_event_t *configure_notify =<br>
(xcb_configure_notify_event_t *) event;<br>
- struct weston_wm_window *window;<br>
+ struct weston_wm_window *window, *w, *next;<br>
<br>
wm_log("XCB_CONFIGURE_NOTIFY (window %d) %d,%d @ %dx%d%s\n",<br>
configure_notify->window,<br>
@@ -760,6 +763,16 @@ weston_wm_handle_configure_<wbr>notify(struct weston_wm *wm, xcb_generic_event_t *eve<br>
if (window->frame)<br>
frame_resize_inside(window-><wbr>frame,<br>
window->width, window->height);<br>
+ if (window->x != 0 || window->y != 0) {<br>
+ wl_list_for_each_safe(w, next, &wm->or_window_list, or_link) {<br>
+ if (w == window) {<br>
+ if (w->shsurf)<br>
+ xi->set_xwayland(w->shsurf, w->x, w->y);<br>
+ wl_list_remove(&w->or_link);<br>
+ break;<br>
+ }<br>
+ }<br>
+ }<br>
}<br>
}<br>
<br>
@@ -2478,6 +2491,7 @@ weston_wm_create(struct weston_xserver *wxs, int fd)<br>
wl_signal_add(&wxs-><wbr>compositor->kill_signal,<br>
&wm->kill_listener);<br>
wl_list_init(&wm->unpaired_<wbr>window_list);<br>
+ wl_list_init(&wm->or_window_<wbr>list);<br>
<br>
weston_wm_create_cursors(wm);<br>
weston_wm_window_set_cursor(<wbr>wm, wm->screen->root, XWM_CURSOR_LEFT_PTR);<br>
@@ -2761,8 +2775,11 @@ xserver_map_shell_surface(<wbr>struct weston_wm_window *window,<br>
window->legacy_fullscreen_<wbr>output.output);<br>
return;<br>
} else if (window->override_redirect) {<br>
- xwayland_interface->set_<wbr>xwayland(window->shsurf,<br>
- window->x, window->y);<br>
+ if (window->x == 0 && window->y == 0)<br>
+ wl_list_insert(&wm->or_window_<wbr>list, &window->or_link);<br>
+ else<br>
+ xwayland_interface->set_<wbr>xwayland(window->shsurf,<br>
+ window->x, window->y);<br>
} else if (window->transient_for && window->transient_for-><wbr>surface) {<br>
parent = window->transient_for;<br>
if (weston_wm_window_type_<wbr>inactive(window)) {<br>
diff --git a/xwayland/xwayland.h b/xwayland/xwayland.h<br>
index ca75f5b..54e8908 100644<br>
--- a/xwayland/xwayland.h<br>
+++ b/xwayland/xwayland.h<br>
@@ -72,6 +72,7 @@ struct weston_wm {<br>
struct wl_listener activate_listener;<br>
struct wl_listener kill_listener;<br>
struct wl_list unpaired_window_list;<br>
+ struct wl_list or_window_list;<br>
<br>
xcb_window_t selection_window;<br>
xcb_window_t selection_owner;<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
</font></span></blockquote></div><br><br></div><div class="gmail_extra">The problem fixed by this patch is also fixed with <a href="https://lists.freedesktop.org/archives/wayland-devel/2017-June/034357.html">https://lists.freedesktop.org/archives/wayland-devel/2017-June/034357.html</a> which is a much cleaner solution.<br></div></div>