Alexandre Julliard : user32: Create a dummy window surface for windows that shouldn't be painted to.

Alexandre Julliard julliard at winehq.org
Mon Oct 1 13:35:05 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct  1 13:08:51 2012 +0200

user32: Create a dummy window surface for windows that shouldn't be painted to.

---

 dlls/user32/painting.c |    5 +---
 dlls/user32/win.c      |   65 ++++++++++++++++++++++++++++++++++++++++++++++-
 dlls/user32/win.h      |    1 +
 3 files changed, 65 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 1a6de87..2a634fb 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -191,12 +191,9 @@ static void reset_dce_attrs( struct dce *dce )
  */
 static void release_dce( struct dce *dce )
 {
-    RECT vis_rect;
-
     if (!dce->hwnd) return;  /* already released */
 
-    vis_rect = get_virtual_screen_rect();
-    __wine_set_visible_region( dce->hdc, 0, &vis_rect, &vis_rect, NULL );
+    __wine_set_visible_region( dce->hdc, 0, &dummy_surface.rect, &dummy_surface.rect, &dummy_surface );
     USER_Driver->pReleaseDC( dce->hwnd, dce->hdc );
 
     if (dce->clip_rgn) DeleteObject( dce->clip_rgn );
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 8818868..0faf02d 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -487,6 +487,67 @@ BOOL is_desktop_window( HWND hwnd )
 
 
 /*******************************************************************
+ * Dummy window surface for windows that shouldn't get painted.
+ */
+
+static void dummy_surface_lock( struct window_surface *window_surface )
+{
+    /* nothing to do */
+}
+
+static void dummy_surface_unlock( struct window_surface *window_surface )
+{
+    /* nothing to do */
+}
+
+static void *dummy_surface_get_bitmap_info( struct window_surface *window_surface, BITMAPINFO *info )
+{
+    static DWORD dummy_data;
+
+    info->bmiHeader.biSize          = sizeof( info->bmiHeader );
+    info->bmiHeader.biWidth         = dummy_surface.rect.right;
+    info->bmiHeader.biHeight        = dummy_surface.rect.bottom;
+    info->bmiHeader.biPlanes        = 1;
+    info->bmiHeader.biBitCount      = 32;
+    info->bmiHeader.biCompression   = BI_RGB;
+    info->bmiHeader.biSizeImage     = 0;
+    info->bmiHeader.biXPelsPerMeter = 0;
+    info->bmiHeader.biYPelsPerMeter = 0;
+    info->bmiHeader.biClrUsed       = 0;
+    info->bmiHeader.biClrImportant  = 0;
+    return &dummy_data;
+}
+
+static RECT *dummy_surface_get_bounds( struct window_surface *window_surface )
+{
+    static RECT dummy_bounds;
+    return &dummy_bounds;
+}
+
+static void dummy_surface_flush( struct window_surface *window_surface )
+{
+    /* nothing to do */
+}
+
+static void dummy_surface_destroy( struct window_surface *window_surface )
+{
+    /* nothing to do */
+}
+
+static const struct window_surface_funcs dummy_surface_funcs =
+{
+    dummy_surface_lock,
+    dummy_surface_unlock,
+    dummy_surface_get_bitmap_info,
+    dummy_surface_get_bounds,
+    dummy_surface_flush,
+    dummy_surface_destroy
+};
+
+struct window_surface dummy_surface = { &dummy_surface_funcs, { NULL, NULL }, 1, { 0, 0, 1, 1 } };
+
+
+/*******************************************************************
  *           register_window_surface
  *
  * Register a window surface in the global list, possibly replacing another one.
@@ -495,8 +556,8 @@ void register_window_surface( struct window_surface *old, struct window_surface
 {
     if (old == new) return;
     EnterCriticalSection( &surfaces_section );
-    if (old) list_remove( &old->entry );
-    if (new) list_add_tail( &window_surfaces, &new->entry );
+    if (old && old != &dummy_surface) list_remove( &old->entry );
+    if (new && new != &dummy_surface) list_add_tail( &window_surfaces, &new->entry );
     LeaveCriticalSection( &surfaces_section );
 }
 
diff --git a/dlls/user32/win.h b/dlls/user32/win.h
index 4bbe7ae..b35fc00 100644
--- a/dlls/user32/win.h
+++ b/dlls/user32/win.h
@@ -80,6 +80,7 @@ typedef struct tagWND
   /* Window functions */
 extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
 extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
+extern struct window_surface dummy_surface DECLSPEC_HIDDEN;
 extern void register_window_surface( struct window_surface *old, struct window_surface *new ) DECLSPEC_HIDDEN;
 extern void flush_window_surfaces( BOOL idle ) DECLSPEC_HIDDEN;
 extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list