[PATCH] Direct change of visible style

Gerard Patel gerard.patel at nerim.net
Thu Sep 20 10:06:33 CDT 2001


If a window is shown using direct change of visible style 
(or using WM_SETREDRAW), Wine don't do it because
the window is not mapped at the X level.

(Under Windows this trick is done only for child windows,
of course - the child is shown using WM_SETREDRAW,
then the parent is shown using ShowWindow() or something
like that)

ChangeLog:

	* dlls/user/user_main.c, dlls/x11drv/x11drv.spec, winpos.c,
windows/win.c,defwnd.c
               map a window if it is shown by a direct style change.
-------------- next part --------------
Index: dlls/user/user_main.c
===================================================================
RCS file: /home/wine/wine/dlls/user/user_main.c,v
retrieving revision 1.30
diff -u -r1.30 user_main.c
--- dlls/user/user_main.c	2001/08/09 22:07:22	1.30
+++ dlls/user/user_main.c	2001/09/20 12:47:48
@@ -95,6 +95,7 @@
     GET_USER_FUNC(ScrollWindowEx);
     GET_USER_FUNC(SetFocus);
     GET_USER_FUNC(SetParent);
+    GET_USER_FUNC(StyleChanged);
     GET_USER_FUNC(SetWindowPos);
     GET_USER_FUNC(SetWindowRgn);
     GET_USER_FUNC(SetWindowIcon);
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.24
diff -u -r1.24 winpos.c
--- dlls/x11drv/winpos.c	2001/09/19 20:37:05	1.24
+++ dlls/x11drv/winpos.c	2001/09/20 12:47:50
@@ -685,6 +685,29 @@
 
 
 /***********************************************************************
+ *		ChangeStyle   (X11DRV.@)
+ *
+ * Update the X state of a window to reflect a style change
+ */
+void X11DRV_StyleChanged( HWND hwnd, LONG oldStyle )
+{
+    WND *wndPtr = WIN_FindWndPtr( hwnd );
+    Display *display;
+    if (!wndPtr) return;
+
+    display = thread_display();
+    if ((wndPtr->dwStyle & WS_VISIBLE) && (!(oldStyle & WS_VISIBLE)))
+    {
+        if (!IsRectEmpty( &wndPtr->rectWindow ))
+        {
+            XMapWindow( display, get_whole_window(wndPtr) );
+            TRACE( "mapping win %x\n", hwnd );
+        }
+    }
+    WIN_ReleaseWndPtr(wndPtr);
+}
+
+/***********************************************************************
  *		SetWindowPos   (X11DRV.@)
  */
 BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
Index: dlls/x11drv/x11drv.spec
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv.spec,v
retrieving revision 1.22
diff -u -r1.22 x11drv.spec
--- dlls/x11drv/x11drv.spec	2001/07/29 20:25:15	1.22
+++ dlls/x11drv/x11drv.spec	2001/09/20 12:47:50
@@ -87,6 +87,7 @@
 @ cdecl ScrollWindowEx(long long long ptr ptr long ptr long) X11DRV_ScrollWindowEx
 @ cdecl SetFocus(long) X11DRV_SetFocus
 @ cdecl SetParent(long long) X11DRV_SetParent
+@ cdecl StyleChanged(ptr long) X11DRV_StyleChanged
 @ cdecl SetWindowPos(ptr) X11DRV_SetWindowPos
 @ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn
 @ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon
Index: include/user.h
===================================================================
RCS file: /home/wine/wine/include/user.h,v
retrieving revision 1.28
diff -u -r1.28 user.h
--- include/user.h	2001/08/18 18:08:27	1.28
+++ include/user.h	2001/09/20 12:47:50
@@ -80,6 +80,7 @@
     INT    (*pScrollWindowEx)(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT);
     void   (*pSetFocus)(HWND);
     HWND   (*pSetParent)(HWND,HWND);
+    void   (*pStyleChanged)(HWND, DWORD);
     BOOL   (*pSetWindowPos)(WINDOWPOS *);
     BOOL   (*pSetWindowRgn)(HWND,HRGN,BOOL);
     HICON  (*pSetWindowIcon)(HWND,HICON,BOOL);
Index: windows/defwnd.c
===================================================================
RCS file: /home/wine/wine/windows/defwnd.c,v
retrieving revision 1.64
diff -u -r1.64 defwnd.c
--- windows/defwnd.c	2001/09/19 20:37:05	1.64
+++ windows/defwnd.c	2001/09/20 12:47:51
@@ -169,6 +169,8 @@
 	if( !bVisible )
 	{
 	    wndPtr->dwStyle |= WS_VISIBLE;
+            if (USER_Driver.pStyleChanged)
+                USER_Driver.pStyleChanged( hwnd, wndPtr->dwStyle & (~WS_VISIBLE) );
             DCE_InvalidateDCE( hwnd, &wndPtr->rectWindow );
 	}
     }
@@ -180,6 +182,8 @@
         RedrawWindow( hwnd, NULL, 0, wParam );
         DCE_InvalidateDCE( hwnd, &wndPtr->rectWindow );
 	wndPtr->dwStyle &= ~WS_VISIBLE;
+        if (USER_Driver.pStyleChanged)
+            USER_Driver.pStyleChanged( hwnd, wndPtr->dwStyle | WS_VISIBLE );
     }
     WIN_ReleaseWndPtr( wndPtr );
 }
Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.153
diff -u -r1.153 win.c
--- windows/win.c	2001/09/19 22:31:15	1.153
+++ windows/win.c	2001/09/20 12:47:55
@@ -1676,6 +1676,7 @@
     LONG *ptr, retval;
     WND * wndPtr = WIN_FindWndPtr( hwnd );
     STYLESTRUCT style;
+    DWORD oldStyle;
 
     TRACE("%x=%p %x %lx %x\n",hwnd, wndPtr, offset, newval, type);
 
@@ -1729,9 +1730,13 @@
 		goto end;
 	case GWL_STYLE:
 	       	style.styleOld = wndPtr->dwStyle;
+                oldStyle = wndPtr->dwStyle;
 		style.styleNew = newval;
                 SendMessageA(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style);
 		wndPtr->dwStyle = style.styleNew;
+                if (wndPtr->dwStyle != oldStyle)
+                    if (USER_Driver.pStyleChanged)
+                        USER_Driver.pStyleChanged( hwnd, oldStyle );
                 SendMessageA(hwnd,WM_STYLECHANGED,GWL_STYLE,(LPARAM)&style);
                 retval = style.styleOld;
                 goto end;
-------------- next part --------------



More information about the wine-patches mailing list