Zhiyi Zhang : winex11.drv: Introduce is_virtual_desktop().

Alexandre Julliard julliard at winehq.org
Tue Nov 5 16:11:45 CST 2019


Module: wine
Branch: master
Commit: 99d047724e768822d6508573cd82a5c75b30bdcb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=99d047724e768822d6508573cd82a5c75b30bdcb

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Nov  5 21:04:07 2019 +0800

winex11.drv: Introduce is_virtual_desktop().

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/desktop.c  | 8 +++++++-
 dlls/winex11.drv/event.c    | 2 +-
 dlls/winex11.drv/mouse.c    | 2 +-
 dlls/winex11.drv/palette.c  | 2 +-
 dlls/winex11.drv/systray.c  | 2 +-
 dlls/winex11.drv/window.c   | 4 ++--
 dlls/winex11.drv/x11drv.h   | 1 +
 dlls/winex11.drv/xinerama.c | 4 ++--
 dlls/winex11.drv/xrandr.c   | 2 +-
 dlls/winex11.drv/xvidmode.c | 2 +-
 10 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index fed8dd32e9..e4eb61f7bd 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -77,6 +77,12 @@ static struct screen_size {
 #define _NET_WM_STATE_REMOVE 0
 #define _NET_WM_STATE_ADD 1
 
+/* Return TRUE if Wine is currently in virtual desktop mode */
+BOOL is_virtual_desktop(void)
+{
+    return root_window != DefaultRootWindow( gdi_display );
+}
+
 /* create the mode structures */
 static void make_modes(void)
 {
@@ -268,7 +274,7 @@ static void update_desktop_fullscreen( unsigned int width, unsigned int height)
     Display *display = thread_display();
     XEvent xev;
 
-    if (!display || root_window == DefaultRootWindow( display )) return;
+    if (!display || !is_virtual_desktop()) return;
 
     xev.xclient.type = ClientMessage;
     xev.xclient.window = root_window;
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 25730192d3..dd8837c11d 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -827,7 +827,7 @@ static void focus_out( Display *display , HWND hwnd )
     x11drv_thread_data()->last_focus = hwnd;
     if ((xic = X11DRV_get_ic( hwnd ))) XUnsetICFocus( xic );
 
-    if (root_window != DefaultRootWindow(display))
+    if (is_virtual_desktop())
     {
         if (hwnd == GetDesktopWindow()) reset_clipping_window();
         return;
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 15e5c04a41..290732fa93 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -572,7 +572,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
     {
         RECT virtual_rect = get_virtual_screen_rect();
         if (!EqualRect( &rect, &virtual_rect )) return FALSE;
-        if (root_window != DefaultRootWindow( gdi_display )) return FALSE;
+        if (is_virtual_desktop()) return FALSE;
     }
     TRACE( "win %p clipping fullscreen\n", hwnd );
     return grab_clipping_window( &rect );
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
index 073761a5ee..25bdb5f2bf 100644
--- a/dlls/winex11.drv/palette.c
+++ b/dlls/winex11.drv/palette.c
@@ -217,7 +217,7 @@ int X11DRV_PALETTE_Init(void)
 	    {
 	        X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_PRIVATE;
 
-	        if( root_window != DefaultRootWindow(gdi_display) )
+	        if (is_virtual_desktop())
 	        {
 		    win_attr.colormap = default_colormap;
 		    XChangeWindowAttributes( gdi_display, root_window, CWColormap, &win_attr );
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index d4262c43cf..3be4bd6534 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -587,7 +587,7 @@ static BOOL init_systray(void)
     WNDCLASSEXW class;
     Display *display;
 
-    if (root_window != DefaultRootWindow( gdi_display )) return FALSE;
+    if (is_virtual_desktop()) return FALSE;
     if (init_done) return TRUE;
 
     icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2 * ICON_BORDER;
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index f3c6a1b3cb..99e4094ebd 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2474,7 +2474,7 @@ static BOOL hide_icon( struct x11drv_win_data *data )
 
     if (data->managed) return TRUE;
     /* hide icons in desktop mode when the taskbar is active */
-    if (root_window == DefaultRootWindow( gdi_display )) return FALSE;
+    if (!is_virtual_desktop()) return FALSE;
     return IsWindowVisible( FindWindowW( trayW, NULL ));
 }
 
@@ -2781,7 +2781,7 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
  */
 static LRESULT start_screensaver(void)
 {
-    if (root_window == DefaultRootWindow(gdi_display))
+    if (!is_virtual_desktop())
     {
         const char *argv[3] = { "xdg-screensaver", "activate", NULL };
         int pid = _spawnvp( _P_DETACH, argv[0], argv );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 35e27334db..a96f57dc37 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -656,6 +656,7 @@ struct x11drv_mode_info
 
 extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) DECLSPEC_HIDDEN;
 extern void X11DRV_resize_desktop(unsigned int width, unsigned int height) DECLSPEC_HIDDEN;
+extern BOOL is_virtual_desktop(void) DECLSPEC_HIDDEN;
 extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN;
 extern BOOL create_desktop_win_data( Window win ) DECLSPEC_HIDDEN;
 extern void X11DRV_Settings_AddDepthModes(void) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c
index 57c77d6273..bd607f3006 100644
--- a/dlls/winex11.drv/xinerama.c
+++ b/dlls/winex11.drv/xinerama.c
@@ -310,10 +310,10 @@ void xinerama_init( unsigned int width, unsigned int height )
 
     SetRect( &rect, 0, 0, width, height );
 
-    if (root_window != DefaultRootWindow( gdi_display ) || !query_screens())
+    if (is_virtual_desktop() || !query_screens())
     {
         default_monitor.rcWork = default_monitor.rcMonitor = rect;
-        if (root_window == DefaultRootWindow( gdi_display ))
+        if (!is_virtual_desktop())
             query_work_area( &default_monitor.rcWork );
         else
             query_desktop_work_area( &default_monitor.rcWork );
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 0a64613fac..5616857347 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -1099,7 +1099,7 @@ void X11DRV_XRandR_Init(void)
 
     if (major) return; /* already initialized? */
     if (!usexrandr) return; /* disabled in config */
-    if (root_window != DefaultRootWindow( gdi_display )) return;
+    if (is_virtual_desktop()) return;
     if (!(ret = load_xrandr())) return;  /* can't load the Xrandr library */
 
     /* see if Xrandr is available */
diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c
index 975575fe77..5acc95bd2e 100644
--- a/dlls/winex11.drv/xvidmode.c
+++ b/dlls/winex11.drv/xvidmode.c
@@ -210,7 +210,7 @@ void X11DRV_XF86VM_Init(void)
 #endif /* X_XF86VidModeSetGammaRamp */
 
   /* retrieve modes */
-  if (usexvidmode && root_window == DefaultRootWindow( gdi_display ))
+  if (usexvidmode && !is_virtual_desktop())
   {
       X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL);
       ok = pXF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &real_xf86vm_modes);




More information about the wine-cvs mailing list