From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/Makefile.in | 1 + dlls/winex11.drv/dllmain.c | 34 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 4 ++++ dlls/winex11.drv/x11drv_main.c | 28 ++++------------------------ 4 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 dlls/winex11.drv/dllmain.c
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index ff2e38d64a7..2a0e3467905 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -13,6 +13,7 @@ C_SRCS = \ clipboard.c \ desktop.c \ display.c \ + dllmain.c \ event.c \ graphics.c \ ime.c \ diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c new file mode 100644 index 00000000000..d46cbc6a422 --- /dev/null +++ b/dlls/winex11.drv/dllmain.c @@ -0,0 +1,34 @@ +/* + * winex11.drv entry points + * + * Copyright 2022 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include "x11drv.h" + + +HMODULE x11drv_module = 0; + +BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) +{ + if (reason != DLL_PROCESS_ATTACH) return TRUE; + + DisableThreadLibraryCalls( instance ); + x11drv_module = instance; + return !x11drv_init( NULL ); +} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 957ef6ea667..f00d69a2f6a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -841,6 +841,10 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) max( rect->bottom, rect->top + 1 ) > virtual_rect.top); }
+/* unixlib interface */ + +extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; + /* GDI helpers */
static inline BOOL lp_to_dp( HDC hdc, POINT *points, INT count ) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index aa8ddc49385..eb11b532af7 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -81,7 +81,6 @@ BOOL shape_layered_windows = TRUE; int copy_default_colors = 128; int alloc_system_colors = 256; int xrender_error_base = 0; -HMODULE x11drv_module = 0; char *process_name = NULL;
static x11drv_error_callback err_callback; /* current callback for error */ @@ -630,7 +629,7 @@ static void init_visuals( Display *display, int screen ) /*********************************************************************** * X11DRV process initialisation routine */ -static BOOL process_attach(void) +NTSTATUS x11drv_init( void *arg ) { Display *display; void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL ); @@ -638,7 +637,7 @@ static BOOL process_attach(void) if (!libx11) { ERR( "failed to load %s: %s\n", SONAME_LIBX11, dlerror() ); - return FALSE; + return STATUS_UNSUCCESSFUL; } pXGetEventData = dlsym( libx11, "XGetEventData" ); pXFreeEventData = dlsym( libx11, "XFreeEventData" ); @@ -651,7 +650,7 @@ static BOOL process_attach(void) /* Open display */
if (!XInitThreads()) ERR( "XInitThreads failed, trouble ahead\n" ); - if (!(display = XOpenDisplay( NULL ))) return FALSE; + if (!(display = XOpenDisplay( NULL ))) return STATUS_UNSUCCESSFUL;
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */ root_window = DefaultRootWindow( display ); @@ -689,7 +688,7 @@ static BOOL process_attach(void)
init_user_driver(); X11DRV_DisplayDevices_Init(FALSE); - return TRUE; + return STATUS_SUCCESS; }
@@ -777,25 +776,6 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) }
-/*********************************************************************** - * X11DRV initialisation routine - */ -BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) -{ - BOOL ret = TRUE; - - switch(reason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( hinst ); - x11drv_module = hinst; - ret = process_attach(); - break; - } - return ret; -} - - /*********************************************************************** * SystemParametersInfo (X11DRV.@) */
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/clipboard.c | 141 ++++++++++------------------------- dlls/winex11.drv/dllmain.c | 102 +++++++++++++++++++++++++ dlls/winex11.drv/unixlib.h | 9 +++ dlls/winex11.drv/x11drv.h | 1 + 4 files changed, 153 insertions(+), 100 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 4ba36239595..9486f37954e 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -2143,67 +2143,6 @@ BOOL update_clipboard( HWND hwnd ) }
-/************************************************************************** - * clipboard_wndproc - * - * Window procedure for the clipboard manager. - */ -static LRESULT CALLBACK clipboard_wndproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) -{ - switch (msg) - { - case WM_NCCREATE: - return TRUE; - case WM_CLIPBOARDUPDATE: - if (is_clipboard_owner) break; /* ignore our own changes */ - acquire_selection( thread_init_display() ); - break; - case WM_RENDERFORMAT: - if (render_format( wp )) rendered_formats++; - break; - case WM_TIMER: - if (!is_clipboard_owner) break; - request_selection_contents( thread_display(), FALSE ); - break; - case WM_DESTROYCLIPBOARD: - TRACE( "WM_DESTROYCLIPBOARD: lost ownership\n" ); - is_clipboard_owner = FALSE; - KillTimer( hwnd, 1 ); - break; - } - return DefWindowProcW( hwnd, msg, wp, lp ); -} - - -/************************************************************************** - * wait_clipboard_mutex - * - * Make sure that there's only one clipboard thread per window station. - */ -static BOOL wait_clipboard_mutex(void) -{ - static const WCHAR prefix[] = {'_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_'}; - WCHAR buffer[MAX_PATH + ARRAY_SIZE( prefix )]; - HANDLE mutex; - - memcpy( buffer, prefix, sizeof(prefix) ); - if (!GetUserObjectInformationW( GetProcessWindowStation(), UOI_NAME, - buffer + ARRAY_SIZE( prefix ), - sizeof(buffer) - sizeof(prefix), NULL )) - { - ERR( "failed to get winstation name\n" ); - return FALSE; - } - mutex = CreateMutexW( NULL, TRUE, buffer ); - if (GetLastError() == ERROR_ALREADY_EXISTS) - { - TRACE( "waiting for mutex %s\n", debugstr_w( buffer )); - WaitForSingleObject( mutex, INFINITE ); - } - return TRUE; -} - - /************************************************************************** * selection_notify_event * @@ -2278,15 +2217,11 @@ static void xfixes_init(void) * * Thread running inside the desktop process to manage the clipboard */ -static DWORD WINAPI clipboard_thread( void *arg ) +static BOOL clipboard_init( HWND hwnd ) { - static const WCHAR clipboard_classname[] = {'_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_','m','a','n','a','g','e','r',0}; XSetWindowAttributes attr; - WNDCLASSW class; - MSG msg; - - if (!wait_clipboard_mutex()) return 0;
+ clipboard_hwnd = hwnd; clipboard_display = thread_init_display(); attr.event_mask = PropertyChangeMask; import_window = XCreateWindow( clipboard_display, root_window, 0, 0, 1, 1, 0, CopyFromParent, @@ -2294,34 +2229,53 @@ static DWORD WINAPI clipboard_thread( void *arg ) if (!import_window) { ERR( "failed to create import window\n" ); - return 0; - } - - memset( &class, 0, sizeof(class) ); - class.lpfnWndProc = clipboard_wndproc; - class.lpszClassName = clipboard_classname; - - if (!RegisterClassW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) - { - ERR( "could not register clipboard window class err %u\n", GetLastError() ); - return 0; - } - if (!(clipboard_hwnd = CreateWindowW( clipboard_classname, NULL, 0, 0, 0, 0, 0, - HWND_MESSAGE, 0, 0, NULL ))) - { - ERR( "failed to create clipboard window err %u\n", GetLastError() ); - return 0; + return FALSE; }
clipboard_thread_id = GetCurrentThreadId(); - AddClipboardFormatListener( clipboard_hwnd ); + NtUserAddClipboardFormatListener( hwnd ); register_builtin_formats(); xfixes_init(); request_selection_contents( clipboard_display, TRUE );
TRACE( "clipboard thread %04x running\n", GetCurrentThreadId() ); - while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg ); - return 0; + return TRUE; +} + + + + +/************************************************************************** + * x11drv_clipboard_message + */ +NTSTATUS x11drv_clipboard_message( void *arg ) +{ + struct clipboard_message_params *params = arg; + + switch (params->msg) + { + case WM_NCCREATE: + return clipboard_init( params->hwnd ); + case WM_CLIPBOARDUPDATE: + if (is_clipboard_owner) break; /* ignore our own changes */ + acquire_selection( thread_init_display() ); + break; + case WM_RENDERFORMAT: + if (render_format( params->wparam )) rendered_formats++; + break; + case WM_TIMER: + if (!is_clipboard_owner) break; + request_selection_contents( thread_display(), FALSE ); + break; + case WM_DESTROYCLIPBOARD: + TRACE( "WM_DESTROYCLIPBOARD: lost ownership\n" ); + is_clipboard_owner = FALSE; + NtUserKillTimer( params->hwnd, 1 ); + break; + } + + return NtUserMessageCall( params->hwnd, params->msg, params->wparam, params->lparam, + NULL, NtUserDefWindowProc, FALSE ); }
@@ -2400,16 +2354,3 @@ BOOL X11DRV_SelectionClear( HWND hwnd, XEvent *xev ) request_selection_contents( event->display, TRUE ); return FALSE; } - - -/************************************************************************** - * X11DRV_InitClipboard - */ -void X11DRV_InitClipboard(void) -{ - DWORD id; - HANDLE handle = CreateThread( NULL, 0, clipboard_thread, NULL, 0, &id ); - - if (handle) CloseHandle( handle ); - else ERR( "failed to create clipboard thread\n" ); -} diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index d46cbc6a422..49db5e3d2a5 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -20,10 +20,112 @@
#include "config.h" #include "x11drv.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
HMODULE x11drv_module = 0;
+/************************************************************************** + * wait_clipboard_mutex + * + * Make sure that there's only one clipboard thread per window station. + */ +static BOOL wait_clipboard_mutex(void) +{ + static const WCHAR prefix[] = {'_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_'}; + WCHAR buffer[MAX_PATH + ARRAY_SIZE( prefix )]; + HANDLE mutex; + + memcpy( buffer, prefix, sizeof(prefix) ); + if (!GetUserObjectInformationW( GetProcessWindowStation(), UOI_NAME, + buffer + ARRAY_SIZE( prefix ), + sizeof(buffer) - sizeof(prefix), NULL )) + { + ERR( "failed to get winstation name\n" ); + return FALSE; + } + mutex = CreateMutexW( NULL, TRUE, buffer ); + if (GetLastError() == ERROR_ALREADY_EXISTS) + { + TRACE( "waiting for mutex %s\n", debugstr_w( buffer )); + WaitForSingleObject( mutex, INFINITE ); + } + return TRUE; +} + + +/************************************************************************** + * clipboard_wndproc + * + * Window procedure for the clipboard manager. + */ +static LRESULT CALLBACK clipboard_wndproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) +{ + struct clipboard_message_params params; + + switch (msg) + { + case WM_NCCREATE: + case WM_CLIPBOARDUPDATE: + case WM_RENDERFORMAT: + case WM_TIMER: + case WM_DESTROYCLIPBOARD: + params.hwnd = hwnd; + params.msg = msg; + params.wparam = wp; + params.lparam = lp; + return x11drv_clipboard_message( ¶ms ); + } + + return DefWindowProcW( hwnd, msg, wp, lp ); +} + + +/************************************************************************** + * clipboard_thread + * + * Thread running inside the desktop process to manage the clipboard + */ +static DWORD WINAPI clipboard_thread( void *arg ) +{ + static const WCHAR clipboard_classname[] = {'_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_','m','a','n','a','g','e','r',0}; + WNDCLASSW class; + MSG msg; + + if (!wait_clipboard_mutex()) return 0; + + memset( &class, 0, sizeof(class) ); + class.lpfnWndProc = clipboard_wndproc; + class.lpszClassName = clipboard_classname; + + if (!RegisterClassW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) + { + ERR( "could not register clipboard window class err %u\n", GetLastError() ); + return 0; + } + if (!CreateWindowW( clipboard_classname, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, NULL )) + { + ERR( "failed to create clipboard window err %u\n", GetLastError() ); + return 0; + } + + while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg ); + return 0; +} + + +void X11DRV_InitClipboard(void) +{ + DWORD id; + HANDLE thread = CreateThread( NULL, 0, clipboard_thread, NULL, 0, &id ); + + if (thread) CloseHandle( thread ); + else ERR( "failed to create clipboard thread\n" ); +} + + BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) { if (reason != DLL_PROCESS_ATTACH) return TRUE; diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 537a8e0326a..3865ecab7a0 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -19,6 +19,15 @@ #include "ntuser.h" #include "wine/unixlib.h"
+/* x11drv_clipboard_message params */ +struct clipboard_message_params +{ + HWND hwnd; + UINT msg; + WPARAM wparam; + LPARAM lparam; +}; + /* DnD support */
struct format_entry diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index f00d69a2f6a..b763a7aa345 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -844,6 +844,7 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) /* unixlib interface */
extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN;
/* GDI helpers */
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/event.c | 12 ++---------- dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/xdnd.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index a6499400283..105caab5deb 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1478,16 +1478,8 @@ static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
static void post_drop( HWND hwnd, DROPFILES *drop, ULONG size ) { - HDROP handle; - - if ((handle = GlobalAlloc( GMEM_SHARE, size ))) - { - DROPFILES *ptr = GlobalLock( handle ); - memcpy( ptr, drop, size ); - ptr->fWide = TRUE; - GlobalUnlock( handle ); - PostMessageW( hwnd, WM_DROPFILES, (WPARAM)handle, 0 ); - } + drop->fWide = HandleToUlong( hwnd ); /* abuse fWide to pass window handle */ + x11drv_post_drop( drop, size ); }
/********************************************************************** diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index b763a7aa345..4dc251b9ac2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -846,6 +846,8 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN;
+extern NTSTATUS WINAPI x11drv_post_drop( void *data, ULONG size ) DECLSPEC_HIDDEN; + /* GDI helpers */
static inline BOOL lp_to_dp( HDC hdc, POINT *points, INT count ) diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index d5ae510db49..45205c836be 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -748,3 +748,21 @@ UINT handle_dnd_event( void *params ) return 0; } } + +NTSTATUS WINAPI x11drv_post_drop( void *data, ULONG size ) +{ + HDROP handle; + + if ((handle = GlobalAlloc( GMEM_SHARE, size ))) + { + DROPFILES *ptr = GlobalLock( handle ); + HWND hwnd; + memcpy( ptr, data, size ); + hwnd = UlongToHandle( ptr->fWide ); + ptr->fWide = TRUE; + GlobalUnlock( handle ); + PostMessageW( hwnd, WM_DROPFILES, (WPARAM)handle, 0 ); + } + + return 0; +}
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/desktop.c | 13 +++++++------ dlls/winex11.drv/dllmain.c | 10 ++++++++++ dlls/winex11.drv/unixlib.h | 7 +++++++ dlls/winex11.drv/winex11.drv.spec | 2 +- dlls/winex11.drv/x11drv.h | 1 + 5 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index f8c44549fc1..61fe5578e8b 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -321,13 +321,14 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
/*********************************************************************** - * X11DRV_create_desktop + * x11drv_create_desktop * * Create the X11 desktop window for the desktop mode. */ -BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) +NTSTATUS x11drv_create_desktop( void *arg ) { static const WCHAR rootW[] = {'r','o','o','t',0}; + const struct create_desktop_params *params = arg; XSetWindowAttributes win_attr; Window win; Display *display = thread_init_display(); @@ -337,7 +338,7 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) UOI_NAME, name, sizeof(name), NULL )) name[0] = 0;
- TRACE( "%s %ux%u\n", debugstr_w(name), width, height ); + TRACE( "%s %ux%u\n", debugstr_w(name), params->width, params->height );
/* magic: desktop "root" means use the root window */ if (!lstrcmpiW( name, rootW )) return FALSE; @@ -354,12 +355,12 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) win_attr.colormap = None;
win = XCreateWindow( display, DefaultRootWindow(display), - 0, 0, width, height, 0, default_visual.depth, InputOutput, default_visual.visual, - CWEventMask | CWCursor | CWColormap, &win_attr ); + 0, 0, params->width, params->height, 0, default_visual.depth, InputOutput, + default_visual.visual, CWEventMask | CWCursor | CWColormap, &win_attr ); if (!win) return FALSE; if (!create_desktop_win_data( win )) return FALSE;
- X11DRV_init_desktop( win, width, height ); + X11DRV_init_desktop( win, params->width, params->height ); if (is_desktop_fullscreen()) { TRACE("setting desktop to fullscreen\n"); diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index 49db5e3d2a5..f5e829d73af 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -134,3 +134,13 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) x11drv_module = instance; return !x11drv_init( NULL ); } + + +/*********************************************************************** + * wine_create_desktop (winex11.@) + */ +BOOL CDECL wine_create_desktop( UINT width, UINT height ) +{ + struct create_desktop_params params = { .width = width, .height = height }; + return x11drv_create_desktop( ¶ms ); +} diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 3865ecab7a0..43a00b619c1 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -28,6 +28,13 @@ struct clipboard_message_params LPARAM lparam; };
+/* x11drv_create_desktop params */ +struct create_desktop_params +{ + UINT width; + UINT height; +}; + /* DnD support */
struct format_entry diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 6e0ccfab4b0..77e4a6285de 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -5,7 +5,7 @@ @ cdecl WTInfoW(long long ptr) X11DRV_WTInfoW
# Desktop -@ cdecl wine_create_desktop(long long) X11DRV_create_desktop +@ cdecl wine_create_desktop(long long)
# System tray @ cdecl wine_notify_icon(long ptr) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4dc251b9ac2..bda4322d26b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -845,6 +845,7 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_create_desktop( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI x11drv_post_drop( void *data, ULONG size ) DECLSPEC_HIDDEN;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/dllmain.c | 36 ++++++++++++++++++++++++++++++ dlls/winex11.drv/unixlib.h | 8 +++++++ dlls/winex11.drv/wintab.c | 45 +++++++++++++++++++++----------------- dlls/winex11.drv/x11drv.h | 4 ++++ 4 files changed, 73 insertions(+), 20 deletions(-)
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index f5e829d73af..84c20217c78 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -144,3 +144,39 @@ BOOL CDECL wine_create_desktop( UINT width, UINT height ) struct create_desktop_params params = { .width = width, .height = height }; return x11drv_create_desktop( ¶ms ); } + +/*********************************************************************** + * AttachEventQueueToTablet (winex11.@) + */ +int CDECL X11DRV_AttachEventQueueToTablet( HWND owner ) +{ + return x11drv_tablet_attach_queue( owner ); +} + +/*********************************************************************** + * GetCurrentPacket (winex11.@) + */ +int CDECL X11DRV_GetCurrentPacket( void *packet ) +{ + return x11drv_tablet_get_packet( packet ); +} + +/*********************************************************************** + * LoadTabletInfo (winex11.@) + */ +BOOL CDECL X11DRV_LoadTabletInfo( HWND hwnd ) +{ + return x11drv_tablet_load_info( hwnd ); +} + +/*********************************************************************** + * WTInfoW (winex11.@) + */ +UINT CDECL X11DRV_WTInfoW( UINT category, UINT index, void *output ) +{ + struct tablet_info_params params; + params.category = category; + params.index = index; + params.output = output; + return x11drv_tablet_info( ¶ms ); +} diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 43a00b619c1..231beb055dc 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -35,6 +35,14 @@ struct create_desktop_params UINT height; };
+/* x11drv_tablet_info params */ +struct tablet_info_params +{ + UINT category; + UINT index; + void *output; +}; + /* DnD support */
struct format_entry diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index aa0d7be2fd0..edd6fb8d271 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -481,9 +481,9 @@ static void disable_system_cursors(void)
/*********************************************************************** - * X11DRV_LoadTabletInfo (X11DRV.@) + * x11drv_tablet_load_info */ -BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) +NTSTATUS x11drv_tablet_load_info( void *hwnd ) { static const WCHAR SZ_CONTEXT_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0}; static const WCHAR SZ_DEVICE_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','D','e','v','i','c','e',0}; @@ -509,7 +509,7 @@ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) return FALSE; }
- hwndTabletDefault = hwnddefault; + hwndTabletDefault = hwnd;
/* Do base initialization */ strcpyW(gSysContext.lcName, SZ_CONTEXT_NAME); @@ -1001,9 +1001,9 @@ static BOOL proximity_event( HWND hwnd, XEvent *event ) }
/*********************************************************************** - * X11DRV_AttachEventQueueToTablet (X11DRV.@) + * x11drv_tablet_attach_queue */ -int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) +NTSTATUS x11drv_tablet_attach_queue( void *owner ) { struct x11drv_thread_data *data = x11drv_init_thread_data(); int num_devices; @@ -1013,11 +1013,11 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) XDeviceInfo *target = NULL; XDevice *the_device; XEventClass event_list[7]; - Window win = X11DRV_get_whole_window( hOwner ); + Window win = X11DRV_get_whole_window( owner );
if (!win || !xinput_handle) return 0;
- TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors); + TRACE("Creating context for window %p (%lx) %i cursors\n", owner, win, gNumCursors);
devices = pXListInputDevices(data->display, &num_devices);
@@ -1093,11 +1093,11 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) }
/*********************************************************************** - * X11DRV_GetCurrentPacket (X11DRV.@) + * x11drv_tablet_get_packet */ -int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) +NTSTATUS x11drv_tablet_get_packet( void *packet ) { - *packet = gMsgPacket; + *(WTPACKET *)packet = gMsgPacket; return 1; }
@@ -1114,10 +1114,15 @@ static inline int CopyTabletData(LPVOID target, LPCVOID src, INT size) }
/*********************************************************************** - * X11DRV_WTInfoW (X11DRV.@) + * x11drv_tablet_info */ -UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) +NTSTATUS x11drv_tablet_info( void *arg ) { + struct tablet_info_params *params = arg; + UINT wCategory = params->category; + UINT nIndex = params->index; + void *lpOutput = params->output; + /* * It is valid to call WTInfoA with lpOutput == NULL, as per standard. * lpOutput == NULL signifies the user only wishes @@ -1546,33 +1551,33 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) #else /* SONAME_LIBXI */
/*********************************************************************** - * AttachEventQueueToTablet (X11DRV.@) + * x11drv_tablet_attach_queue */ -int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) +NTSTATUS x11drv_tablet_attach_queue( void *owner ) { return 0; }
/*********************************************************************** - * GetCurrentPacket (X11DRV.@) + * x11drv_tablet_get_packet */ -int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) +NTSTATUS x11drv_tablet_get_packet( void *arg ) { return 0; }
/*********************************************************************** - * LoadTabletInfo (X11DRV.@) + * x11drv_tablet_load_info */ -BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) +NTSTATUS x11drv_tablet_load_info( void *arg ) { return FALSE; }
/*********************************************************************** - * WTInfoW (X11DRV.@) + * x11drv_tablet_info */ -UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) +NTSTATUS x11drv_tablet_info( void *arg ) { return 0; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index bda4322d26b..5f49f609e1e 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -846,6 +846,10 @@ static inline BOOL is_window_rect_mapped( const RECT *rect ) extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_create_desktop( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_tablet_attach_queue( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_tablet_get_packet( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_tablet_load_info( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_tablet_info( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI x11drv_post_drop( void *data, ULONG size ) DECLSPEC_HIDDEN;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/dllmain.c | 14 +++++++------- dlls/winex11.drv/unixlib.h | 16 ++++++++++++++++ dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/x11drv_main.c | 24 +++++++++++++++++++++++- 4 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index 84c20217c78..6a9f4a57273 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -76,7 +76,7 @@ static LRESULT CALLBACK clipboard_wndproc( HWND hwnd, UINT msg, WPARAM wp, LPARA params.msg = msg; params.wparam = wp; params.lparam = lp; - return x11drv_clipboard_message( ¶ms ); + return X11DRV_CALL( clipboard_message, ¶ms ); }
return DefWindowProcW( hwnd, msg, wp, lp ); @@ -132,7 +132,7 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
DisableThreadLibraryCalls( instance ); x11drv_module = instance; - return !x11drv_init( NULL ); + return !X11DRV_CALL( init, NULL ); }
@@ -142,7 +142,7 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved ) BOOL CDECL wine_create_desktop( UINT width, UINT height ) { struct create_desktop_params params = { .width = width, .height = height }; - return x11drv_create_desktop( ¶ms ); + return X11DRV_CALL( create_desktop, ¶ms ); }
/*********************************************************************** @@ -150,7 +150,7 @@ BOOL CDECL wine_create_desktop( UINT width, UINT height ) */ int CDECL X11DRV_AttachEventQueueToTablet( HWND owner ) { - return x11drv_tablet_attach_queue( owner ); + return X11DRV_CALL( tablet_attach_queue, owner ); }
/*********************************************************************** @@ -158,7 +158,7 @@ int CDECL X11DRV_AttachEventQueueToTablet( HWND owner ) */ int CDECL X11DRV_GetCurrentPacket( void *packet ) { - return x11drv_tablet_get_packet( packet ); + return X11DRV_CALL( tablet_get_packet, packet ); }
/*********************************************************************** @@ -166,7 +166,7 @@ int CDECL X11DRV_GetCurrentPacket( void *packet ) */ BOOL CDECL X11DRV_LoadTabletInfo( HWND hwnd ) { - return x11drv_tablet_load_info( hwnd ); + return X11DRV_CALL( tablet_load_info, hwnd ); }
/*********************************************************************** @@ -178,5 +178,5 @@ UINT CDECL X11DRV_WTInfoW( UINT category, UINT index, void *output ) params.category = category; params.index = index; params.output = output; - return x11drv_tablet_info( ¶ms ); + return X11DRV_CALL( tablet_info, ¶ms ); } diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 231beb055dc..062bb59c663 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -19,6 +19,22 @@ #include "ntuser.h" #include "wine/unixlib.h"
+enum x11drv_funcs +{ + unix_clipboard_message, + unix_create_desktop, + unix_init, + unix_tablet_attach_queue, + unix_tablet_get_packet, + unix_tablet_info, + unix_tablet_load_info, + unix_funcs_count, +}; + +/* FIXME: Use __wine_unix_call when the rest of the stack is ready */ +extern NTSTATUS x11drv_unix_call( enum x11drv_funcs code, void *params ) DECLSPEC_HIDDEN; +#define X11DRV_CALL(func, params) x11drv_unix_call( unix_ ## func, params ) + /* x11drv_clipboard_message params */ struct clipboard_message_params { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 5f49f609e1e..08bfa6dd1d5 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -843,7 +843,6 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
/* unixlib interface */
-extern NTSTATUS x11drv_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_create_desktop( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_attach_queue( void *arg ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index eb11b532af7..cc565bd30a7 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -629,7 +629,7 @@ static void init_visuals( Display *display, int screen ) /*********************************************************************** * X11DRV process initialisation routine */ -NTSTATUS x11drv_init( void *arg ) +static NTSTATUS x11drv_init( void *arg ) { Display *display; void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL ); @@ -951,3 +951,25 @@ NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDP pthread_mutex_unlock( &d3dkmt_mutex ); return STATUS_SUCCESS; } + + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + x11drv_clipboard_message, + x11drv_create_desktop, + x11drv_init, + x11drv_tablet_attach_queue, + x11drv_tablet_get_packet, + x11drv_tablet_info, + x11drv_tablet_load_info, +}; + + +C_ASSERT( ARRAYSIZE(__wine_unix_call_funcs) == unix_funcs_count ); + + +/* FIXME: Use __wine_unix_call instead */ +NTSTATUS x11drv_unix_call( enum x11drv_funcs code, void *params ) +{ + return __wine_unix_call_funcs[code]( params ); +}
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/ime.c | 9 ++++++--- dlls/winex11.drv/unixlib.h | 9 +++++++++ dlls/winex11.drv/x11drv.h | 4 ++-- dlls/winex11.drv/x11drv_main.c | 2 ++ dlls/winex11.drv/xim.c | 13 ++++++++----- 5 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/ime.c b/dlls/winex11.drv/ime.c index c1584930861..1656601577d 100644 --- a/dlls/winex11.drv/ime.c +++ b/dlls/winex11.drv/ime.c @@ -637,6 +637,7 @@ UINT WINAPI ImeToAsciiEx (UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState,
BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) { + struct xim_preedit_state_params preedit_params; BOOL bRet = FALSE; LPINPUTCONTEXT lpIMC;
@@ -680,7 +681,9 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) TRACE("IMC_SETOPENSTATUS\n");
bRet = TRUE; - X11DRV_SetPreeditState(lpIMC->hWnd, lpIMC->fOpen); + preedit_params.hwnd = lpIMC->hWnd; + preedit_params.open = lpIMC->fOpen; + X11DRV_CALL( xim_preedit_state, &preedit_params ); if (!lpIMC->fOpen) { LPIMEPRIVATE myPrivate; @@ -688,7 +691,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) myPrivate = ImmLockIMCC(lpIMC->hPrivate); if (myPrivate->bInComposition) { - X11DRV_ForceXIMReset(lpIMC->hWnd); + X11DRV_CALL( xim_reset, lpIMC->hWnd ); GenerateIMEMessage(hIMC, WM_IME_ENDCOMPOSITION, 0, 0); myPrivate->bInComposition = FALSE; } @@ -764,7 +767,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
TRACE("CPS_CANCEL\n");
- X11DRV_ForceXIMReset(lpIMC->hWnd); + X11DRV_CALL( xim_reset, lpIMC->hWnd );
if (lpIMC->hCompStr) ImmDestroyIMCC(lpIMC->hCompStr); diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 062bb59c663..2a957af0f56 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -28,6 +28,8 @@ enum x11drv_funcs unix_tablet_get_packet, unix_tablet_info, unix_tablet_load_info, + unix_xim_preedit_state, + unix_xim_reset, unix_funcs_count, };
@@ -59,6 +61,13 @@ struct tablet_info_params void *output; };
+/* x11drv_xim_preedit_state params */ +struct xim_preedit_state_params +{ + HWND hwnd; + BOOL open; +}; + /* DnD support */
struct format_entry diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 08bfa6dd1d5..c6e5044c110 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -827,8 +827,6 @@ extern BOOL X11DRV_InitXIM( const WCHAR *input_style ) DECLSPEC_HIDDEN; extern XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) DECLSPEC_HIDDEN; extern void X11DRV_SetupXIM(void) DECLSPEC_HIDDEN; extern void X11DRV_XIMLookupChars( const char *str, DWORD count ) DECLSPEC_HIDDEN; -extern void X11DRV_ForceXIMReset(HWND hwnd) DECLSPEC_HIDDEN; -extern void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen) DECLSPEC_HIDDEN;
#define XEMBED_MAPPED (1 << 0)
@@ -849,6 +847,8 @@ extern NTSTATUS x11drv_tablet_attach_queue( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_get_packet( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_load_info( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_info( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_xim_preedit_state( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_xim_reset( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI x11drv_post_drop( void *data, ULONG size ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index cc565bd30a7..22f0f0a729f 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -962,6 +962,8 @@ const unixlib_entry_t __wine_unix_call_funcs[] = x11drv_tablet_get_packet, x11drv_tablet_info, x11drv_tablet_load_info, + x11drv_xim_preedit_state, + x11drv_xim_reset, };
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index ec4be2e0c5d..81f420891ad 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -241,7 +241,7 @@ static void XIMPreEditCaretCallback(XIC ic, XPointer client_data, TRACE("Finished\n"); }
-void X11DRV_ForceXIMReset(HWND hwnd) +NTSTATUS x11drv_xim_reset( void *hwnd ) { XIC ic = X11DRV_get_ic(hwnd); if (ic) @@ -251,19 +251,21 @@ void X11DRV_ForceXIMReset(HWND hwnd) leftover = XmbResetIC(ic); XFree(leftover); } + return 0; }
-void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen) +NTSTATUS x11drv_xim_preedit_state( void *arg ) { + struct xim_preedit_state_params *params = arg; XIC ic; XIMPreeditState state; XVaNestedList attr;
- ic = X11DRV_get_ic(hwnd); + ic = X11DRV_get_ic( params->hwnd ); if (!ic) - return; + return 0;
- if (fOpen) + if (params->open) state = XIMPreeditEnable; else state = XIMPreeditDisable; @@ -274,6 +276,7 @@ void X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen) XSetICValues(ic, XNPreeditAttributes, attr, NULL); XFree(attr); } + return 0; }
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/systray.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index c6d12b21c28..45ad0617246 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -322,14 +322,13 @@ static void add_to_standalone_tray( struct tray_icon *icon )
icon->display = nb_displayed; pos = get_icon_pos( icon ); - icon->window = CreateWindowW( icon_classname, NULL, WS_CHILD | WS_VISIBLE, - pos.x, pos.y, icon_cx, icon_cy, standalone_tray, NULL, NULL, icon ); + CreateWindowW( icon_classname, NULL, WS_CHILD | WS_VISIBLE, + pos.x, pos.y, icon_cx, icon_cy, standalone_tray, NULL, NULL, icon ); if (!icon->window) { icon->display = -1; return; } - create_tooltip( icon );
nb_displayed++; size = get_window_size(); @@ -474,6 +473,11 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
switch (msg) { + case WM_CREATE: + icon->window = hwnd; + create_tooltip( icon ); + break; + case WM_SIZE: if (icon->window && icon->layered) repaint_tray_icon( icon ); break; @@ -643,10 +647,10 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window get_systray_visual_info( display, systray_window, &visual );
icon->layered = (visual.depth == 32); - icon->window = CreateWindowExW( icon->layered ? WS_EX_LAYERED : 0, - icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP, - CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy, - NULL, NULL, NULL, icon ); + CreateWindowExW( icon->layered ? WS_EX_LAYERED : 0, + icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP, + CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy, + NULL, NULL, NULL, icon );
if (!(data = get_win_data( icon->window ))) return; if (icon->layered) set_window_visual( data, &visual, TRUE ); @@ -654,7 +658,6 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window window = data->whole_window; release_win_data( data );
- create_tooltip( icon ); ShowWindow( icon->window, SW_SHOWNA );
TRACE( "icon window %p/%lx\n", icon->window, window );
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/mouse.c | 8 ++++++-- dlls/winex11.drv/settings.c | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 3d68dc80b3e..7133f2e2694 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1053,7 +1053,6 @@ static int find_fallback_shape( const char *name ) */ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) { - static const WCHAR idW[] = {'%','h','u',0}; const struct system_cursors *cursors; unsigned int i; Cursor cursor = 0; @@ -1070,7 +1069,12 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) p = name + strlenW( name ); *p++ = ','; if (info->szResName[0]) strcpyW( p, info->szResName ); - else sprintfW( p, idW, info->wResID ); + else + { + char buf[16]; + sprintf( buf, "%hu", info->wResID ); + asciiz_to_unicode( p, buf ); + } valueA[0] = 0;
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver\Cursors */ diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index 44c61776b4b..1e8868acc6c 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -217,8 +217,6 @@ void init_registry_display_settings(void) static HKEY get_display_device_reg_key( const WCHAR *device_name ) { static const WCHAR display[] = {'\','\','.','\','D','I','S','P','L','A','Y'}; - static const WCHAR video_value_fmt[] = {'\','D','e','v','i','c','e','\', - 'V','i','d','e','o','%','d',0}; static const WCHAR video_key[] = { '\','R','e','g','i','s','t','r','y', '\','M','a','c','h','i','n','e', @@ -235,6 +233,7 @@ static HKEY get_display_device_reg_key( const WCHAR *device_name ) WCHAR value_name[MAX_PATH], buffer[4096], *end_ptr; KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer; DWORD adapter_index, size; + char adapter_name[100]; HKEY hkey;
/* Device name has to be \.\DISPLAY%d */ @@ -248,7 +247,8 @@ static HKEY get_display_device_reg_key( const WCHAR *device_name )
/* Open \Device\Video* in HKLM\HARDWARE\DEVICEMAP\VIDEO\ */ if (!(hkey = reg_open_key( NULL, video_key, sizeof(video_key) ))) return FALSE; - sprintfW(value_name, video_value_fmt, adapter_index); + sprintf( adapter_name, "\Device\Video%d", adapter_index ); + asciiz_to_unicode( value_name, adapter_name ); size = query_reg_value( hkey, value_name, value, sizeof(buffer) ); NtClose( hkey ); if (!size || value->Type != REG_SZ) return FALSE;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/x11drv_main.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 22f0f0a729f..f05885c316a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -422,7 +422,7 @@ static inline DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name, static void setup_options(void) { static const WCHAR x11driverW[] = {'\','X','1','1',' ','D','r','i','v','e','r',0}; - WCHAR buffer[MAX_PATH+16]; + WCHAR buffer[MAX_PATH+16], *p, *appname; HKEY hkey, appkey = 0; DWORD len;
@@ -431,18 +431,21 @@ static void setup_options(void)
/* open the app-specific key */
- len = GetModuleFileNameW( 0, buffer, MAX_PATH ); + appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer; + if ((p = strrchrW( appname, '/' ))) appname = p + 1; + if ((p = strrchrW( appname, '\' ))) appname = p + 1; + len = lstrlenW( appname ); + if (len && len < MAX_PATH) { HKEY tmpkey; - WCHAR *p, *appname = buffer; - if ((p = strrchrW( appname, '/' ))) appname = p + 1; - if ((p = strrchrW( appname, '\' ))) appname = p + 1; - CharLowerW(appname); - len = WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, NULL, 0, NULL, NULL ); - if ((process_name = malloc( len ))) - WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, process_name, len, NULL, NULL ); - strcatW( appname, x11driverW ); + int i; + for (i = 0; appname[i]; i++) buffer[i] = RtlDowncaseUnicodeChar( appname[i] ); + buffer[i] = 0; + appname = buffer; + if ((process_name = malloc( len * 3 + 1 ))) + ntdll_wcstoumbs( appname, len + 1, process_name, len * 3 + 1, FALSE ); + memcpy( appname + i, x11driverW, sizeof(x11driverW) ); /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */ if ((tmpkey = open_hkcu_key( "Software\Wine\AppDefaults" ))) {
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/wintab.c | 6 +++--- dlls/winex11.drv/x11drv_main.c | 3 ++- dlls/winex11.drv/xim.c | 25 +++++++++++++------------ dlls/winex11.drv/xrender.c | 6 +++--- 4 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index edd6fb8d271..44d9c7698aa 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -736,7 +736,7 @@ NTSTATUS x11drv_tablet_load_info( void *hwnd ) Button = (XButtonInfoPtr) any; TRACE(" ButtonInput %d: [class %d|length %d|num_buttons %d]\n", class_loop, (int) Button->class, Button->length, Button->num_buttons); - cursor.BTNNAMES = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*cchBuf); + cursor.BTNNAMES = malloc( sizeof(WCHAR) * cchBuf ); for (i = 0; i < cursor.BUTTONS; i++) { /* FIXME - these names are probably incorrect */ @@ -744,14 +744,14 @@ NTSTATUS x11drv_tablet_load_info( void *hwnd ) while (cch > cchBuf - cchPos - 1) /* we want one extra byte for the last NUL */ { cchBuf *= 2; - cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchBuf); + cursor.BTNNAMES = realloc( cursor.BTNNAMES, sizeof(WCHAR) * cchBuf ); }
strcpyW(cursor.BTNNAMES + cchPos, cursor.NAME); cchPos += cch; } cursor.BTNNAMES[cchPos++] = 0; - cursor.BTNNAMES = HeapReAlloc(GetProcessHeap(), 0, cursor.BTNNAMES, sizeof(WCHAR)*cchPos); + cursor.BTNNAMES = realloc( cursor.BTNNAMES, sizeof(WCHAR)*cchPos ); cursor.cchBTNNAMES = cchPos; } break; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index f05885c316a..5347bc7c1a5 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -28,6 +28,7 @@ #include <string.h> #include <sys/time.h> #include <unistd.h> +#include <assert.h> #include <dlfcn.h> #include <X11/cursorfont.h> #include <X11/Xlib.h> @@ -293,7 +294,7 @@ static int error_handler( Display *display, XErrorEvent *error_evt ) { ERR( "X protocol error: serial=%ld, request_code=%d - breaking into debugger\n", error_evt->serial, error_evt->request_code ); - DebugBreak(); /* force an entry in the debugger */ + assert( 0 ); } old_error_handler( display, error_evt ); return 0; diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 81f420891ad..4b63a24cccf 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -72,13 +72,7 @@ static void X11DRV_ImmSetInternalString(DWORD dwOffset,
if (byte_expansion + dwCompStringLength >= dwCompStringSize) { - if (CompositionString) - ptr_new = HeapReAlloc(GetProcessHeap(), 0, CompositionString, - dwCompStringSize + byte_expansion); - else - ptr_new = HeapAlloc(GetProcessHeap(), 0, - dwCompStringSize + byte_expansion); - + ptr_new = realloc( CompositionString, dwCompStringSize + byte_expansion ); if (ptr_new == NULL) { ERR("Couldn't expand composition string buffer\n"); @@ -150,7 +144,7 @@ static void XIMPreEditDoneCallback(XIC ic, XPointer client_data, XPointer call_d TRACE("PreeditDoneCallback %p\n",ic); ximInComposeMode = FALSE; if (dwCompStringSize) - HeapFree(GetProcessHeap(), 0, CompositionString); + free( CompositionString ); dwCompStringSize = 0; dwCompStringLength = 0; CompositionString = NULL; @@ -464,17 +458,24 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) XIC xic; XICCallback destroy = {(XPointer)data, X11DRV_DestroyIC}; XICCallback P_StateNotifyCB, P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB; - LANGID langid = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())); + LCID lcid; Window win = data->whole_window; XFontSet fontSet = x11drv_thread_data()->font_set;
TRACE("xim = %p\n", xim);
+ lcid = NtCurrentTeb()->CurrentLocale; + if (!lcid) NtQueryDefaultLocale( TRUE, &lcid ); + /* use complex and slow XIC initialization method only for CJK */ - if (langid != LANG_CHINESE && - langid != LANG_JAPANESE && - langid != LANG_KOREAN) + switch (PRIMARYLANGID(LANGIDFROMLCID(lcid))) { + case LANG_CHINESE: + case LANG_JAPANESE: + case LANG_KOREAN: + break; + + default: xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 2a694794397..33725338f60 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -774,7 +774,7 @@ static AA_Type aa_type_from_flags( UINT aa_flags )
static UINT get_xft_aa_flags( const LOGFONTW *lf ) { - char *value; + char *value, *p; UINT ret = 0;
switch (lf->lfQuality) @@ -785,8 +785,8 @@ static UINT get_xft_aa_flags( const LOGFONTW *lf ) default: if (!(value = XGetDefault( gdi_display, "Xft", "antialias" ))) break; TRACE( "got antialias '%s'\n", value ); - if (tolower(value[0]) == 'f' || tolower(value[0]) == 'n' || - value[0] == '0' || !_strnicmp( value, "off", -1 )) + for (p = value; *p; p++) if ('A' <= *p && *p <= 'Z') *p += 'a' - 'A'; /* to lower */ + if (value[0] == 'f' || value[0] == 'n' || value[0] == '0' || !strcmp( value, "off" )) { ret = GGO_BITMAP; break;