Jacek Caban : winex11: Directly use win32u in more places.

Alexandre Julliard julliard at winehq.org
Thu May 5 15:56:01 CDT 2022


Module: wine
Branch: master
Commit: 4af9ac6733440aafc220306a3c835ccc96b61936
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4af9ac6733440aafc220306a3c835ccc96b61936

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun May  1 23:49:53 2022 +0200

winex11: Directly use win32u in more places.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/clipboard.c |  4 ++--
 dlls/winex11.drv/desktop.c   |  5 +++--
 dlls/winex11.drv/event.c     |  5 +++--
 dlls/winex11.drv/mouse.c     |  8 ++++----
 dlls/winex11.drv/window.c    | 12 ++++++++----
 dlls/winex11.drv/wintab.c    | 10 +++++-----
 6 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index 9486f37954e..276eee9b4dd 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -2292,8 +2292,8 @@ void X11DRV_UpdateClipboard(void)
     if (GetCurrentThreadId() == clipboard_thread_id) return;
     now = NtGetTickCount();
     if ((int)(now - last_update) <= SELECTION_UPDATE_DELAY) return;
-    if (SendMessageTimeoutW( GetClipboardOwner(), WM_X11DRV_UPDATE_CLIPBOARD, 0, 0,
-                             SMTO_ABORTIFHUNG, 5000, &ret ) && ret)
+    if (send_message_timeout( NtUserGetClipboardOwner(), WM_X11DRV_UPDATE_CLIPBOARD, 0, 0,
+                              SMTO_ABORTIFHUNG, 5000, &ret ) && ret)
         last_update = now;
 }
 
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index 61fe5578e8b..c335bc5ba2b 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -192,9 +192,10 @@ static LONG X11DRV_desktop_set_current_mode( ULONG_PTR id, DEVMODEW *mode )
 
 static void query_desktop_work_area( RECT *rc_work )
 {
-    static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
+    static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d'};
+    UNICODE_STRING str = { sizeof(trayW), sizeof(trayW), (WCHAR *)trayW };
     RECT rect;
-    HWND hwnd = FindWindowW( trayW, NULL );
+    HWND hwnd = NtUserFindWindowEx( 0, 0, &str, NULL, 0 );
 
     if (!hwnd || !NtUserIsWindowVisible( hwnd )) return;
     if (!NtUserGetWindowRect( hwnd, &rect )) return;
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 12b0884a250..d5e7127ceed 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -665,10 +665,11 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
             HMENU hSysMenu;
 
             if (NtUserGetClassLongW( hwnd, GCL_STYLE ) & CS_NOCLOSE) return;
-            hSysMenu = GetSystemMenu(hwnd, FALSE);
+            hSysMenu = NtUserGetSystemMenu( hwnd, FALSE );
             if (hSysMenu)
             {
-                UINT state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
+                UINT state = NtUserThunkedMenuItemInfo( hSysMenu, SC_CLOSE, MF_BYCOMMAND,
+                                                        NtUserGetMenuState, NULL, NULL );
                 if (state == 0xFFFFFFFF || (state & (MF_DISABLED | MF_GRAYED)))
                     return;
             }
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 46951103bc1..02c5bf88f0e 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -406,7 +406,7 @@ static BOOL grab_clipping_window( const RECT *clip )
     if (data->xi2_state != xi_enabled)
     {
         WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) );
-        DestroyWindow( msg_hwnd );
+        NtUserDestroyWindow( msg_hwnd );
         NtUserClipCursor( NULL );
         return TRUE;
     }
@@ -432,7 +432,7 @@ static BOOL grab_clipping_window( const RECT *clip )
     if (!clipping_cursor)
     {
         disable_xinput2();
-        DestroyWindow( msg_hwnd );
+        NtUserDestroyWindow( msg_hwnd );
         return FALSE;
     }
     clip_rect = *clip;
@@ -1697,9 +1697,9 @@ void move_resize_window( HWND hwnd, int dir )
 
         while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
         {
-            if (!CallMsgFilterW( &msg, MSGF_SIZE ))
+            if (!NtUserCallMsgFilter( &msg, MSGF_SIZE ))
             {
-                TranslateMessage( &msg );
+                NtUserTranslateMessage( &msg, 0 );
                 NtUserDispatchMessage( &msg );
             }
         }
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 7726ba78db0..cfb61c3217a 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2007,13 +2007,16 @@ HWND create_foreign_window( Display *display, Window xwin )
 
     if (!class_registered)
     {
+        UNICODE_STRING class_name, version = { 0 };
         WNDCLASSEXW class;
 
         memset( &class, 0, sizeof(class) );
         class.cbSize        = sizeof(class);
         class.lpfnWndProc   = foreign_window_proc;
         class.lpszClassName = classW;
-        if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
+        RtlInitUnicodeString( &class_name, classW );
+        if (!NtUserRegisterClassExWOW( &class, &class_name, &version, NULL, 0, 0, NULL ) &&
+            GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
         {
             ERR( "Could not register foreign window class\n" );
             return FALSE;
@@ -2052,7 +2055,7 @@ HWND create_foreign_window( Display *display, Window xwin )
 
     if (!(data = alloc_win_data( display, hwnd )))
     {
-        DestroyWindow( hwnd );
+        NtUserDestroyWindow( hwnd );
         return 0;
     }
     SetRect( &data->window_rect, pos.x, pos.y, pos.x + attr.width, pos.y + attr.height );
@@ -2681,12 +2684,13 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
 /* check if the window icon should be hidden (i.e. moved off-screen) */
 static BOOL hide_icon( struct x11drv_win_data *data )
 {
-    static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0};
+    static const WCHAR trayW[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d'};
+    UNICODE_STRING str = { sizeof(trayW), sizeof(trayW), (WCHAR *)trayW };
 
     if (data->managed) return TRUE;
     /* hide icons in desktop mode when the taskbar is active */
     if (!is_virtual_desktop()) return FALSE;
-    return NtUserIsWindowVisible( FindWindowW( trayW, NULL ));
+    return NtUserIsWindowVisible( NtUserFindWindowEx( 0, 0, &str, NULL, 0 ));
 }
 
 /***********************************************************************
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index 44d9c7698aa..a6b80daedbe 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -536,8 +536,8 @@ NTSTATUS x11drv_tablet_load_info( void *hwnd )
     gSysContext.lcSensZ = 65536;
     gSysContext.lcSysSensX= 65536;
     gSysContext.lcSysSensY= 65536;
-    gSysContext.lcSysExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN);
-    gSysContext.lcSysExtY = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+    gSysContext.lcSysExtX = NtUserGetSystemMetrics( SM_CXVIRTUALSCREEN );
+    gSysContext.lcSysExtY = NtUserGetSystemMetrics( SM_CYVIRTUALSCREEN );
 
     /* initialize cursors */
     disable_system_cursors();
@@ -905,7 +905,7 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
     gMsgPacket.pkNormalPressure = motion->axis_data[2];
     gMsgPacket.pkButtons = get_button_state(curnum);
     gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
-    SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
+    send_message( hwndTabletDefault, WT_PACKET, gMsgPacket.pkSerialNumber, (LPARAM)hwnd );
     last_packet = gMsgPacket;
     return TRUE;
 }
@@ -944,7 +944,7 @@ static BOOL button_event( HWND hwnd, XEvent *event )
     }
     gMsgPacket.pkButtons = get_button_state(curnum);
     gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
-    SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
+    send_message( hwndTabletDefault, WT_PACKET, gMsgPacket.pkSerialNumber, (LPARAM)hwnd );
     last_packet = gMsgPacket;
     return TRUE;
 }
@@ -996,7 +996,7 @@ static BOOL proximity_event( HWND hwnd, XEvent *event )
      */
     proximity_info = MAKELPARAM((event->type == proximity_in_type),
                      (event->type == proximity_in_type) || (event->type == proximity_out_type));
-    SendMessageW(hwndTabletDefault, WT_PROXIMITY, (WPARAM)hwnd, proximity_info);
+    send_message( hwndTabletDefault, WT_PROXIMITY, (WPARAM)hwnd, proximity_info );
     return TRUE;
 }
 




More information about the wine-cvs mailing list