Jacek Caban : winex11: Directly use NtUserCreateWindowEx.

Alexandre Julliard julliard at winehq.org
Fri May 6 15:38:40 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May  2 16:57:41 2022 +0200

winex11: Directly use NtUserCreateWindowEx.

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

---

 dlls/winex11.drv/mouse.c  |  7 +++++--
 dlls/winex11.drv/window.c | 19 ++++++++++++-------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 02c5bf88f0e..d080ed5458e 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -373,6 +373,7 @@ static BOOL grab_clipping_window( const RECT *clip )
 #if HAVE_X11_EXTENSIONS_XINPUT2_H
     static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
     struct x11drv_thread_data *data = x11drv_thread_data();
+    UNICODE_STRING class_name;
     Window clip_window;
     HWND msg_hwnd = 0;
     POINT pos;
@@ -383,8 +384,10 @@ static BOOL grab_clipping_window( const RECT *clip )
     if (!data) return FALSE;
     if (!(clip_window = init_clip_window())) return TRUE;
 
-    if (!(msg_hwnd = CreateWindowW( messageW, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0,
-                                    GetModuleHandleW(0), NULL )))
+    RtlInitUnicodeString( &class_name, messageW );
+    if (!(msg_hwnd = NtUserCreateWindowEx( 0, &class_name, &class_name, NULL, 0, 0, 0, 0, 0,
+                                           HWND_MESSAGE, 0, NtCurrentTeb()->Peb->ImageBaseAddress,
+                                           NULL, 0, NULL, 0, FALSE )))
         return TRUE;
 
     if (keyboard_grabbed)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index cfb61c3217a..161f749a81d 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2004,10 +2004,11 @@ HWND create_foreign_window( Display *display, Window xwin )
     unsigned int nchildren;
     XWindowAttributes attr;
     DWORD style = WS_CLIPCHILDREN;
+    UNICODE_STRING class_name;
 
     if (!class_registered)
     {
-        UNICODE_STRING class_name, version = { 0 };
+        UNICODE_STRING version = { 0 };
         WNDCLASSEXW class;
 
         memset( &class, 0, sizeof(class) );
@@ -2050,8 +2051,10 @@ HWND create_foreign_window( Display *display, Window xwin )
         pos.y = attr.y;
     }
 
-    hwnd = CreateWindowW( classW, NULL, style, pos.x, pos.y, attr.width, attr.height,
-                          parent, 0, 0, NULL );
+    RtlInitUnicodeString( &class_name, classW );
+    hwnd = NtUserCreateWindowEx( 0, &class_name, &class_name, NULL, style, pos.x, pos.y,
+                                 attr.width, attr.height, parent, 0, NULL, NULL, 0, NULL,
+                                 0, FALSE );
 
     if (!(data = alloc_win_data( display, hwnd )))
     {
@@ -2167,6 +2170,7 @@ NTSTATUS x11drv_systray_dock( void *arg )
     XSetWindowAttributes attr;
     XVisualInfo visual;
     struct x11drv_win_data *data;
+    UNICODE_STRING class_name;
     BOOL layered;
     HWND hwnd;
 
@@ -2189,10 +2193,11 @@ NTSTATUS x11drv_systray_dock( void *arg )
 
     *params->layered = layered = (visual.depth == 32);
 
-    hwnd = CreateWindowExW( layered ? WS_EX_LAYERED : 0,
-                            icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
-                            CW_USEDEFAULT, CW_USEDEFAULT, params->cx, params->cy,
-                            NULL, NULL, NULL, params->icon );
+    RtlInitUnicodeString( &class_name, icon_classname );
+    hwnd = NtUserCreateWindowEx( layered ? WS_EX_LAYERED : 0, &class_name, &class_name, NULL,
+                                 WS_CLIPSIBLINGS | WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
+                                 params->cx, params->cy, NULL, 0, NULL, params->icon, 0,
+                                 NULL, 0, FALSE );
 
     if (!(data = get_win_data( hwnd ))) return STATUS_UNSUCCESSFUL;
     if (layered) set_window_visual( data, &visual, TRUE );




More information about the wine-cvs mailing list