winex11.drv: Add support for full screen window state using the NETWM protocol. Take 2

Dmitry Timoshkov dmitry at codeweavers.com
Mon Jun 19 09:24:14 CDT 2006


Hello,

this version of the patch uses client rect instead of the whole window rect
and checks whether window size has changed according to Alexandre's suggestion.
It still works with IE and Diablo 2.

Changelog:
    Add support for full screen window state using the NETWM protocol.

diff -up cvs/hq/wine/dlls/winex11.drv/winpos.c wine/dlls/winex11.drv/winpos.c
--- cvs/hq/wine/dlls/winex11.drv/winpos.c	2006-06-16 22:19:17.000000000 +0900
+++ wine/dlls/winex11.drv/winpos.c	2006-06-19 23:14:50.000000000 +0900
@@ -78,6 +78,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
 #define _NET_WM_MOVERESIZE_SIZE_KEYBOARD     9   /* size via keyboard */
 #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD    10   /* move via keyboard */
 
+#define _NET_WM_STATE_REMOVE  0
+#define _NET_WM_STATE_ADD     1
+#define _NET_WM_STATE_TOGGLE  2
 
 /***********************************************************************
  *           X11DRV_Expose
@@ -520,6 +523,42 @@ void X11DRV_SetWindowStyle( HWND hwnd, D
 
 
 /***********************************************************************
+ *     update_fullscreen_state
+ *
+ * Use the NETWM protocol to set the fullscreen state.
+ * This only works for mapped windows.
+ */
+static void update_fullscreen_state( Display *display, struct x11drv_win_data *data )
+{
+    XEvent xev;
+    BOOL on = FALSE;
+
+    if (data->client_rect.left <= 0 && data->client_rect.right >= screen_width &&
+        data->client_rect.top <= 0 && data->client_rect.bottom >= screen_height)
+        on = TRUE;
+
+    TRACE("setting fullscreen state for hwnd %p to %s\n", data->hwnd, on ? "true" : "false");
+
+    if (data->whole_window)
+    {
+        xev.xclient.type = ClientMessage;
+        xev.xclient.window = data->whole_window;
+        xev.xclient.message_type = x11drv_atom(_NET_WM_STATE);
+        xev.xclient.serial = 0;
+        xev.xclient.display = display;
+        xev.xclient.send_event = True;
+        xev.xclient.format = 32;
+        xev.xclient.data.l[0] = on ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
+        xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_FULLSCREEN);
+        xev.xclient.data.l[2] = 0;
+        wine_tsx11_lock();
+        XSendEvent(display, root_window, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+        wine_tsx11_unlock();
+    }
+}
+
+
+/***********************************************************************
  *           X11DRV_set_window_pos
  *
  * Set a window position and Z order.
@@ -670,6 +709,8 @@ BOOL X11DRV_set_window_pos( HWND hwnd, H
                     XMapWindow( display, data->whole_window );
                     wine_tsx11_unlock();
                 }
+                if (!(swp_flags & SWP_NOSIZE))
+                    update_fullscreen_state( display, data );
             }
         }
     }
diff -up cvs/hq/wine/dlls/winex11.drv/x11drv.h wine/dlls/winex11.drv/x11drv.h
--- cvs/hq/wine/dlls/winex11.drv/x11drv.h	2006-06-16 22:19:17.000000000 +0900
+++ wine/dlls/winex11.drv/x11drv.h	2006-06-19 21:43:49.000000000 +0900
@@ -565,6 +565,8 @@ enum x11drv_atoms
     XATOM_DndSelection,
     XATOM__MOTIF_WM_HINTS,
     XATOM__KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR,
+    XATOM__NET_WM_STATE,
+    XATOM__NET_WM_STATE_FULLSCREEN,
     XATOM__NET_WM_MOVERESIZE,
     XATOM__NET_WM_PID,
     XATOM__NET_WM_PING,
diff -up cvs/hq/wine/dlls/winex11.drv/x11drv_main.c wine/dlls/winex11.drv/x11drv_main.c
--- cvs/hq/wine/dlls/winex11.drv/x11drv_main.c	2006-06-16 22:19:17.000000000 +0900
+++ wine/dlls/winex11.drv/x11drv_main.c	2006-06-19 21:43:49.000000000 +0900
@@ -127,6 +127,8 @@ static const char * const atom_names[NB_
     "DndSelection",
     "_MOTIF_WM_HINTS",
     "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
+    "_NET_WM_STATE",
+    "_NET_WM_STATE_FULLSCREEN",
     "_NET_WM_MOVERESIZE",
     "_NET_WM_PID",
     "_NET_WM_PING",





More information about the wine-patches mailing list