Zhiyi Zhang : winex11.drv: Support full screen windows on non-primary monitors.

Alexandre Julliard julliard at winehq.org
Wed Aug 26 15:24:44 CDT 2020


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Aug 25 15:20:48 2020 +0800

winex11.drv: Support full screen windows on non-primary monitors.

A window can be maximized or full screen on non-primary monitors. In this
case we need to add _NET_WM_STATE_MAXIMIZED or _NET_WM_STATE_FULLSCREEN
hint to the window so that they can be handled correctly by window managers.
For example, a full screen window on the secondary monitor needs
_NET_WM_STATE_FULLSCREEN so that window managers prevent panels from obscuring it.

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

---

 dlls/winex11.drv/window.c | 31 +++++++++++++++++++++++++++++--
 dlls/winex11.drv/x11drv.h |  1 +
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 09475d1adb..6378c9c765 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -272,9 +272,36 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
 {
     if (style & WS_THICKFRAME) return TRUE;
     /* Metacity needs the window to be resizable to make it fullscreen */
-    return is_window_rect_fullscreen( &data->whole_rect );
+    return is_window_rect_full_screen( &data->whole_rect );
 }
 
+struct monitor_info
+{
+    const RECT *rect;
+    BOOL full_screen;
+};
+
+static BOOL CALLBACK enum_monitor_proc( HMONITOR monitor, HDC hdc, RECT *monitor_rect, LPARAM lparam )
+{
+    struct monitor_info *info = (struct monitor_info *)lparam;
+
+    if (info->rect->left <= monitor_rect->left && info->rect->right >= monitor_rect->right &&
+        info->rect->top <= monitor_rect->top && info->rect->bottom >= monitor_rect->bottom)
+    {
+        info->full_screen = TRUE;
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+BOOL is_window_rect_full_screen( const RECT *rect )
+{
+    struct monitor_info info = {rect, FALSE};
+
+    EnumDisplayMonitors( NULL, NULL, enum_monitor_proc, (LPARAM)&info );
+    return info.full_screen;
+}
 
 /***********************************************************************
  *              get_mwm_decorations
@@ -945,7 +972,7 @@ void update_net_wm_states( struct x11drv_win_data *data )
     style = GetWindowLongW( data->hwnd, GWL_STYLE );
     if (style & WS_MINIMIZE)
         new_state |= data->net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED));
-    if (is_window_rect_fullscreen( &data->whole_rect ))
+    if (is_window_rect_full_screen( &data->whole_rect ))
     {
         if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
             new_state |= (1 << NET_WM_STATE_MAXIMIZED);
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 233891f7b0..ce00e6c54d 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -641,6 +641,7 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
 extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ) DECLSPEC_HIDDEN;
 extern int X11DRV_check_error(void) DECLSPEC_HIDDEN;
 extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, int y, int cx, int cy ) DECLSPEC_HIDDEN;
+extern BOOL is_window_rect_full_screen( const RECT *rect ) DECLSPEC_HIDDEN;
 extern POINT virtual_screen_to_root( INT x, INT y ) DECLSPEC_HIDDEN;
 extern POINT root_to_virtual_screen( INT x, INT y ) DECLSPEC_HIDDEN;
 extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list