From: Zhiyi Zhang zzhang@codeweavers.com
Move the dummy parent window from (-1, -1) to (0, 0) so that the window is considered visible by Wayland. The window background pixel is set to all zero so that the window is still in fact invisible.
This fixes poor performance when running Office 2016 on Xwayland. It's caused by glXWaitForSbcOML() in glxdrv_wglSwapBuffers() taking 1 second every time it gets called. The timeout is from TIMER_LEN_FLIP (1000ms) in xwl_present_reset_timer() in the xserver source code hw/xwayland/xwayland-present.c. Xwayland doesn't actually know when a frame is visible on screen[1][2]. It relies on a timer to simulate the process and when the window is invisible it uses a timer with a 1000ms timeout. This patch makes the dummy parent window visible so that Xwayland will use the timer with a 17ms timeout(~60fps), which also means that there will still be a 60fps limit for some windows when running on Xwayland.
[1]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/971 [2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/973 --- dlls/winex11.drv/window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 974bd376fe6..e170ab26ae5 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1511,10 +1511,12 @@ Window get_dummy_parent(void)
attrib.override_redirect = True; attrib.border_pixel = 0; + attrib.background_pixel = 0; attrib.colormap = default_colormap; - dummy_parent = XCreateWindow( gdi_display, root_window, -1, -1, 1, 1, 0, default_visual.depth, + dummy_parent = XCreateWindow( gdi_display, root_window, 0, 0, 1, 1, 0, default_visual.depth, InputOutput, default_visual.visual, - CWColormap | CWBorderPixel | CWOverrideRedirect, &attrib ); + CWColormap | CWBorderPixel | CWBackPixel | CWOverrideRedirect, + &attrib ); XMapWindow( gdi_display, dummy_parent ); } return dummy_parent;
Note that a 0 background pixel doesn't make the window invisible.
On Wed Jul 19 01:55:55 2023 +0000, Alexandre Julliard wrote:
Note that a 0 background pixel doesn't make the window invisible.
It is indeed invisible because the alpha channel is zero. But it does depend on default_visual.depth being 32 though. So if the screen depth is 24, then the pixel is black. I don't think 24 is common though.
It is indeed invisible because the alpha channel is zero. But it does depend on default_visual.depth being 32 though. So if the screen depth is 24, then the pixel is black. I don't think 24 is common though.
I don't think it's that uncommon. And even if it's transparent it would still intercept the mouse. Most likely you want to use an empty window region instead.