Commit 148f428d authored by Hans de Goede's avatar Hans de Goede

xwayland: Fix setting of _XWAYLAND_RANDR_EMU_MONITOR_RECTS prop on new windows

For window-manager managed windows, xwl_realize_window is only called for
the window-manager's decoration window and not for the actual client window
on which we should set the _XWAYLAND_RANDR_EMU_MONITOR_RECTS prop.

Usualy this is not a problem since we walk all client windows to update
the property when the resolution is changed through a randr call.

But for apps which first do the randr change and only then create their
window this does not work, and our xwl_output_set_window_randr_emu_props
call in xwl_realize_window is a no-op as that is only called for the wm
decoration window and not for the actual client's window.

This commit fixes this by making ensure_surface_for_window() call
xwl_output_set_window_randr_emu_props on the first and only child of
window-manager managed windows.

Note this also removes the non-functional xwl_output_set_window_randr_emu_props
call from xwl_realize_window, which was intended to do this, but does not
work.

This fixes apps using the ogre3d library always running at the
monitors native resolution.
Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 4cfc2677
......@@ -432,6 +432,7 @@ ensure_surface_for_window(WindowPtr window)
struct xwl_screen *xwl_screen;
struct xwl_window *xwl_window;
struct wl_region *region;
WindowPtr toplevel;
if (xwl_window_get(window))
return TRUE;
......@@ -504,7 +505,14 @@ ensure_surface_for_window(WindowPtr window)
xwl_window_init_allow_commits(xwl_window);
if (!window_is_wm_window(window)) {
/* When a new window-manager window is realized, then the randr emulation
* props may have not been set on the managed client window yet.
*/
if (window_is_wm_window(window)) {
toplevel = window_get_client_toplevel(window);
if (toplevel)
xwl_output_set_window_randr_emu_props(xwl_screen, toplevel);
} else {
/* CSD or O-R toplevel window, check viewport on creation */
xwl_window_check_resolution_change_emulation(xwl_window);
}
......@@ -553,8 +561,6 @@ xwl_realize_window(WindowPtr window)
return FALSE;
}
xwl_output_set_window_randr_emu_props(xwl_screen, window);
return ensure_surface_for_window(window);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment