Vincent Povirk : winex11: Set the fullscreen state of virtual desktops based on size.

Alexandre Julliard julliard at winehq.org
Wed May 27 09:26:50 CDT 2009


Module: wine
Branch: master
Commit: 5c41156ab0328fc2fd644cf85b332470e156981d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c41156ab0328fc2fd644cf85b332470e156981d

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue May 26 12:54:54 2009 -0500

winex11: Set the fullscreen state of virtual desktops based on size.

---

 dlls/winex11.drv/desktop.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index d6b2888..5b96e33 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -42,6 +42,9 @@ static const unsigned int widths[]  = {320, 400, 512, 640, 800, 1024, 1152, 1280
 static const unsigned int heights[] = {200, 300, 384, 480, 600,  768,  864, 1024, 1050, 1200};
 #define NUM_DESKTOP_MODES (sizeof(widths) / sizeof(widths[0]))
 
+#define _NET_WM_STATE_REMOVE 0
+#define _NET_WM_STATE_ADD 1
+
 /* create the mode structures */
 static void make_modes(void)
 {
@@ -150,6 +153,13 @@ Window CDECL X11DRV_create_desktop( UINT width, UINT height )
     win = XCreateWindow( display, DefaultRootWindow(display),
                          0, 0, width, height, 0, screen_depth, InputOutput, visual,
                          CWEventMask | CWCursor | CWColormap, &win_attr );
+    if (win != None && width == screen_width && height == screen_height)
+    {
+        TRACE("setting desktop to fullscreen\n");
+        XChangeProperty( display, win, x11drv_atom(_NET_WM_STATE), XA_ATOM, 32,
+            PropModeReplace, (unsigned char*)&x11drv_atom(_NET_WM_STATE_FULLSCREEN),
+            1);
+    }
     XFlush( display );
     wine_tsx11_unlock();
     if (win != None) X11DRV_init_desktop( win, width, height );
@@ -191,6 +201,35 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
     return TRUE;
 }
 
+static void update_desktop_fullscreen( unsigned int width, unsigned int height)
+{
+    Display *display = thread_display();
+    XEvent xev;
+
+    wine_tsx11_lock();
+
+    xev.xclient.type = ClientMessage;
+    xev.xclient.window = root_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;
+    if (width == max_width && height == max_height)
+        xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
+    else
+        xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
+    xev.xclient.data.l[1] = x11drv_atom(_NET_WM_STATE_FULLSCREEN);
+    xev.xclient.data.l[2] = 0;
+    xev.xclient.data.l[3] = 1;
+
+    TRACE("action=%li\n", xev.xclient.data.l[0]);
+
+    XSendEvent( display, DefaultRootWindow(display), False,
+                SubstructureRedirectMask | SubstructureNotifyMask, &xev );
+
+    wine_tsx11_unlock();
+}
 
 /***********************************************************************
  *		X11DRV_resize_desktop
@@ -212,6 +251,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
     else
     {
         TRACE( "desktop %p change to (%dx%d)\n", hwnd, width, height );
+        update_desktop_fullscreen( width, height );
         SetWindowPos( hwnd, 0, virtual_screen_rect.left, virtual_screen_rect.top,
                       virtual_screen_rect.right - virtual_screen_rect.left,
                       virtual_screen_rect.bottom - virtual_screen_rect.top,




More information about the wine-cvs mailing list