Alexandre Julliard : user32: Forward all WM_SYSCOMMAND messages to the driver, not only moves and resizes.

Alexandre Julliard julliard at winehq.org
Fri Apr 11 06:27:30 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Apr 10 15:43:24 2008 +0200

user32: Forward all WM_SYSCOMMAND messages to the driver, not only moves and resizes.

---

 dlls/user32/driver.c              |   14 ++++++------
 dlls/user32/nonclient.c           |    3 ++
 dlls/user32/user_private.h        |    2 +-
 dlls/user32/winpos.c              |    2 -
 dlls/winex11.drv/winex11.drv.spec |    2 +-
 dlls/winex11.drv/winpos.c         |   41 ++++++++++++++++++++----------------
 6 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 1251ee4..bdca8f9 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -120,7 +120,7 @@ static const USER_DRIVER *load_driver(void)
         GET_USER_FUNC(SetWindowIcon);
         GET_USER_FUNC(SetWindowStyle);
         GET_USER_FUNC(SetWindowText);
-        GET_USER_FUNC(SysCommandSizeMove);
+        GET_USER_FUNC(SysCommand);
         GET_USER_FUNC(WindowMessage);
 #undef GET_USER_FUNC
     }
@@ -400,9 +400,9 @@ static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
 {
 }
 
-static BOOL nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
+static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
 {
-    return FALSE;
+    return -1;
 }
 
 static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
@@ -466,7 +466,7 @@ static const USER_DRIVER null_driver =
     nulldrv_SetWindowIcon,
     nulldrv_SetWindowStyle,
     nulldrv_SetWindowText,
-    nulldrv_SysCommandSizeMove,
+    nulldrv_SysCommand,
     nulldrv_WindowMessage
 };
 
@@ -726,9 +726,9 @@ static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
     load_driver()->pSetWindowText( hwnd, text );
 }
 
-static BOOL loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
+static LRESULT loaderdrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
 {
-    return load_driver()->pSysCommandSizeMove( hwnd, wparam );
+    return load_driver()->pSysCommand( hwnd, wparam, lparam );
 }
 
 static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
@@ -792,6 +792,6 @@ static const USER_DRIVER lazy_load_driver =
     loaderdrv_SetWindowIcon,
     loaderdrv_SetWindowStyle,
     loaderdrv_SetWindowText,
-    loaderdrv_SysCommandSizeMove,
+    loaderdrv_SysCommand,
     loaderdrv_WindowMessage
 };
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index a5f5064..729a901 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -1533,6 +1533,9 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
     if (HOOK_CallHooks( WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, TRUE ))
         return 0;
 
+    if (!USER_Driver->pSysCommand( hwnd, wParam, lParam ))
+        return 0;
+
     switch (wParam & 0xfff0)
     {
     case SC_SIZE:
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index adf4ca4..9ffdb21 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -156,7 +156,7 @@ typedef struct tagUSER_DRIVER {
     void   (*pSetWindowIcon)(HWND,UINT,HICON);
     void   (*pSetWindowStyle)(HWND,DWORD);
     void   (*pSetWindowText)(HWND,LPCWSTR);
-    BOOL   (*pSysCommandSizeMove)(HWND,WPARAM);
+    LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM);
     LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
 } USER_DRIVER;
 
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 5d346ee..6914ec0 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2381,8 +2381,6 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
     TRACE("hwnd %p command %04lx, hittest %d, pos %d,%d\n",
           hwnd, syscommand, hittest, pt.x, pt.y);
 
-    if (USER_Driver->pSysCommandSizeMove( hwnd, wParam )) return;
-
     if (syscommand == SC_MOVE)
     {
         if (!hittest) hittest = start_size_move( hwnd, wParam, &capturePoint, style );
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 4ad3f3d..959721d 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -112,7 +112,7 @@
 @ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn
 @ cdecl SetWindowStyle(ptr long) X11DRV_SetWindowStyle
 @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
-@ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
+@ cdecl SysCommand(long long) X11DRV_SysCommand
 @ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
 
 # WinTab32
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 81fb93d..f5b27f0 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -712,13 +712,12 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
 
 
 /***********************************************************************
- *           SysCommandSizeMove   (X11DRV.@)
+ *           SysCommand   (X11DRV.@)
  *
- * Perform SC_MOVE and SC_SIZE commands.
+ * Perform WM_SYSCOMMAND handling.
  */
-BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
+LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
 {
-    WPARAM syscommand = wparam & 0xfff0;
     WPARAM hittest = wparam & 0x0f;
     DWORD dwPoint;
     int x, y, dir;
@@ -726,24 +725,18 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
     Display *display = thread_display();
     struct x11drv_win_data *data;
 
-    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
-    if (!data->whole_window || !data->managed) return FALSE;
+    if (!(data = X11DRV_get_win_data( hwnd ))) return -1;
+    if (!data->whole_window || !data->managed || !data->mapped) return -1;
 
-    if (!is_netwm_supported( display, x11drv_atom(_NET_WM_MOVERESIZE) ))
-    {
-        TRACE( "_NET_WM_MOVERESIZE not supported\n" );
-        return FALSE;
-    }
-
-    if (syscommand == SC_MOVE)
+    switch (wparam & 0xfff0)
     {
+    case SC_MOVE:
         if (!hittest) dir = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
         else dir = _NET_WM_MOVERESIZE_MOVE;
-    }
-    else
-    {
+        break;
+    case SC_SIZE:
         /* windows without WS_THICKFRAME are not resizable through the window manager */
-        if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_THICKFRAME)) return FALSE;
+        if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_THICKFRAME)) return -1;
 
         switch (hittest)
         {
@@ -757,6 +750,18 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
         case WMSZ_BOTTOMRIGHT: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; break;
         default:               dir = _NET_WM_MOVERESIZE_SIZE_KEYBOARD; break;
         }
+        break;
+
+    default:
+        return -1;
+    }
+
+    if (IsZoomed(hwnd)) return -1;
+
+    if (!is_netwm_supported( display, x11drv_atom(_NET_WM_MOVERESIZE) ))
+    {
+        TRACE( "_NET_WM_MOVERESIZE not supported\n" );
+        return -1;
     }
 
     dwPoint = GetMessagePos();
@@ -784,5 +789,5 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
     XUngrabPointer( display, CurrentTime );
     XSendEvent(display, root_window, False, SubstructureNotifyMask, &xev);
     wine_tsx11_unlock();
-    return TRUE;
+    return 0;
 }




More information about the wine-cvs mailing list