Map a window if it is shown by a direct style change.

diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c
index 7932948..0b7f627 100644
--- a/dlls/user/user_main.c
+++ b/dlls/user/user_main.c
@@ -98,6 +98,7 @@
     GET_USER_FUNC(SetWindowPos);
     GET_USER_FUNC(SetWindowRgn);
     GET_USER_FUNC(SetWindowIcon);
+    GET_USER_FUNC(SetWindowStyle);
     GET_USER_FUNC(SetWindowText);
     GET_USER_FUNC(ShowWindow);
     GET_USER_FUNC(SysCommandSizeMove);
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index 29a6217..0d4c286 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -685,6 +685,29 @@
 
 
 /***********************************************************************
+ *		SetWindowStyle   (X11DRV.@)
+ *
+ * Update the X state of a window to reflect a style change
+ */
+void X11DRV_SetWindowStyle( HWND hwnd, LONG oldStyle )
+{
+    Display *display = thread_display();
+    WND *wndPtr = WIN_FindWndPtr( hwnd );
+    if (!wndPtr) return;
+
+    if ((wndPtr->dwStyle & WS_VISIBLE) && (!(oldStyle & WS_VISIBLE)))
+    {
+        if (!IsRectEmpty( &wndPtr->rectWindow ))
+        {
+            TRACE( "mapping win %x\n", hwnd );
+            TSXMapWindow( display, get_whole_window(wndPtr) );
+        }
+    }
+    WIN_ReleaseWndPtr(wndPtr);
+}
+
+
+/***********************************************************************
  *		SetWindowPos   (X11DRV.@)
  */
 BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec
index 140bac8..ac08c9e 100644
--- a/dlls/x11drv/x11drv.spec
+++ b/dlls/x11drv/x11drv.spec
@@ -90,6 +90,7 @@
 @ cdecl SetWindowPos(ptr) X11DRV_SetWindowPos
 @ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn
 @ cdecl SetWindowIcon(long long long) X11DRV_SetWindowIcon
+@ cdecl SetWindowStyle(ptr long) X11DRV_SetWindowStyle
 @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
 @ cdecl ShowWindow(long long) X11DRV_ShowWindow
 @ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
diff --git a/include/user.h b/include/user.h
index b50fe3e..6b9dd35 100644
--- a/include/user.h
+++ b/include/user.h
@@ -83,6 +83,7 @@
     BOOL   (*pSetWindowPos)(WINDOWPOS *);
     BOOL   (*pSetWindowRgn)(HWND,HRGN,BOOL);
     HICON  (*pSetWindowIcon)(HWND,HICON,BOOL);
+    void   (*pSetWindowStyle)(HWND,DWORD);
     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
     BOOL   (*pShowWindow)(HWND,INT);
     void   (*pSysCommandSizeMove)(HWND,WPARAM);
diff --git a/windows/defwnd.c b/windows/defwnd.c
index a193cab..8567523 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -169,6 +169,8 @@
 	if( !bVisible )
 	{
 	    wndPtr->dwStyle |= WS_VISIBLE;
+            if (USER_Driver.pSetWindowStyle)
+                USER_Driver.pSetWindowStyle( 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.pSetWindowStyle)
+            USER_Driver.pSetWindowStyle( hwnd, wndPtr->dwStyle | WS_VISIBLE );
     }
     WIN_ReleaseWndPtr( wndPtr );
 }
diff --git a/windows/win.c b/windows/win.c
index a080870..e0c5e31 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -1762,10 +1762,12 @@
 						type, WIN_PROC_WINDOW );
 		goto end;
 	case GWL_STYLE:
+                retval = wndPtr->dwStyle;
 	       	style.styleOld = wndPtr->dwStyle;
 		style.styleNew = newval;
                 SendMessageA(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style);
 		wndPtr->dwStyle = style.styleNew;
+                if (USER_Driver.pSetWindowStyle) USER_Driver.pSetWindowStyle( hwnd, retval );
                 SendMessageA(hwnd,WM_STYLECHANGED,GWL_STYLE,(LPARAM)&style);
                 retval = style.styleOld;
                 goto end;