diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c
index 7932948d53269e61c51bfd047b12d378bdc28639..0b7f6271f9d1c6fdd5d67654e76a89713167c140 100644
--- a/dlls/user/user_main.c
+++ b/dlls/user/user_main.c
@@ -98,6 +98,7 @@ static BOOL load_driver(void)
     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 29a62171a80dcfb2897a4c143d2c799e48088563..0d4c286f2652061451660be947e75b0e19ea14a0 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -684,6 +684,29 @@ static BOOL fixup_flags( WINDOWPOS *winpos )
 }
 
 
+/***********************************************************************
+ *		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.@)
  */
diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec
index 140bac8a9a7b2b9185d3bc186766e8e613a80ad6..ac08c9ec3c7c8e7c3f901ae42d344937c6edbce5 100644
--- a/dlls/x11drv/x11drv.spec
+++ b/dlls/x11drv/x11drv.spec
@@ -90,6 +90,7 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
 @ 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 b50fe3ea132052afce86eef99c5091c93656fde6..6b9dd355ed066f08b1d7d5d224d067c2ba87e973 100644
--- a/include/user.h
+++ b/include/user.h
@@ -83,6 +83,7 @@ typedef struct tagUSER_DRIVER {
     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 a193cabcf9d8585b2a38c878b3011cb3c73c2920..8567523cb90afaa7554506f2d6611d685f41a27c 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -169,6 +169,8 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam )
 	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 @@ static void DEFWND_SetRedraw( HWND hwnd, WPARAM wParam )
         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 a080870bb947f8b158a270f7a0b15ef4ad182848..e0c5e31bf766df9a9a1e133322daf91eaabea5c5 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -1762,10 +1762,12 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
 						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;