Alexandre Julliard : x11drv: Reinitialize the display settings when using a desktop window.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 28 12:12:20 CST 2006


Module: wine
Branch: refs/heads/master
Commit: bec4990cab64f9deb72705656d4f83b2a79c41c9
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=bec4990cab64f9deb72705656d4f83b2a79c41c9

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Mar 28 16:55:03 2006 +0200

x11drv: Reinitialize the display settings when using a desktop window.

---

 dlls/x11drv/desktop.c |   42 ++++++++++++++++++++++++++----------------
 dlls/x11drv/window.c  |   13 +++++++------
 dlls/x11drv/x11drv.h  |    1 +
 3 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/dlls/x11drv/desktop.c b/dlls/x11drv/desktop.c
index ee76168..75b2194 100644
--- a/dlls/x11drv/desktop.c
+++ b/dlls/x11drv/desktop.c
@@ -131,6 +131,31 @@ static void X11DRV_desktop_SetCurrentMod
 }
 
 /***********************************************************************
+ *		X11DRV_init_desktop
+ *
+ * Setup the desktop when not using the root window.
+ */
+void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
+{
+    root_window = win;
+    max_width = screen_width;
+    max_height = screen_height;
+    screen_width  = width;
+    screen_height = height;
+
+    /* initialize the available resolutions */
+    dd_modes = X11DRV_Settings_SetHandlers("desktop", 
+                                           X11DRV_desktop_GetCurrentMode, 
+                                           X11DRV_desktop_SetCurrentMode, 
+                                           NUM_DESKTOP_MODES+2, 1);
+    make_modes();
+    X11DRV_Settings_AddDepthModes();
+    dd_mode_count = X11DRV_Settings_GetModeCount();
+    X11DRV_Settings_SetDefaultMode(0);
+}
+
+
+/***********************************************************************
  *		X11DRV_create_desktop
  *
  * Create the X11 desktop window for the desktop mode.
@@ -142,10 +167,6 @@ Window X11DRV_create_desktop( UINT width
     Display *display = thread_display();
 
     wine_tsx11_lock();
-    max_width = screen_width;
-    max_height = screen_height;
-    screen_width  = width;
-    screen_height = height;
 
     /* Create window */
     win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
@@ -163,17 +184,6 @@ Window X11DRV_create_desktop( UINT width
                          CWEventMask | CWCursor | CWColormap, &win_attr );
     XFlush( display );
     wine_tsx11_unlock();
-    if (win == None) return None;
-
-    /* initialize the available resolutions */
-    dd_modes = X11DRV_Settings_SetHandlers("desktop", 
-                                           X11DRV_desktop_GetCurrentMode, 
-                                           X11DRV_desktop_SetCurrentMode, 
-                                           NUM_DESKTOP_MODES+2, 1);
-    make_modes();
-    X11DRV_Settings_AddDepthModes();
-    dd_mode_count = X11DRV_Settings_GetModeCount();
-    X11DRV_Settings_SetDefaultMode(0);
-    root_window = win;
+    if (win != None) X11DRV_init_desktop( win, width, height );
     return win;
 }
diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c
index 67be435..592d874 100644
--- a/dlls/x11drv/window.c
+++ b/dlls/x11drv/window.c
@@ -858,18 +858,19 @@ static void get_desktop_xwin( Display *d
 
     if (win)
     {
+        unsigned int width, height;
+
         /* retrieve the real size of the desktop */
         SERVER_START_REQ( get_window_rectangles )
         {
             req->handle = data->hwnd;
-            if (!wine_server_call( req ))
-            {
-                screen_width  = reply->window.right - reply->window.left;
-                screen_height = reply->window.bottom - reply->window.top;
-            }
+            wine_server_call( req );
+            width  = reply->window.right - reply->window.left;
+            height = reply->window.bottom - reply->window.top;
         }
         SERVER_END_REQ;
-        data->whole_window = root_window = win;
+        data->whole_window = win;
+        if (win != root_window) X11DRV_init_desktop( win, width, height );
     }
     else
     {
diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h
index fea2721..c528c99 100644
--- a/dlls/x11drv/x11drv.h
+++ b/dlls/x11drv/x11drv.h
@@ -684,6 +684,7 @@ extern BOOL X11DRV_set_window_pos( HWND 
                                    const RECT *rectClient, UINT swp_flags, const RECT *validRects );
 extern void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data );
 
+extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height );
 extern void X11DRV_handle_desktop_resize(unsigned int width, unsigned int height);
 extern void X11DRV_Settings_AddDepthModes(void);
 extern void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq);




More information about the wine-cvs mailing list