From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/keyboard.c | 80 ++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 94860f2e36c..9574b2797b5 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -441,16 +441,94 @@ static pthread_mutex_t layout_list_mutex = PTHREAD_MUTEX_INITIALIZER;
int macdrv_layout_list_needs_update = TRUE;
+static const NLS_LOCALE_HEADER *locale_table; + +static int compare_locale_names(const WCHAR *n1, const WCHAR *n2) +{ + for (;;) + { + WCHAR ch1 = *n1++; + WCHAR ch2 = *n2++; + if (ch1 >= 'a' && ch1 <= 'z') ch1 -= 'a' - 'A'; + else if (ch1 == '_') ch1 = '-'; + if (ch2 >= 'a' && ch2 <= 'z') ch2 -= 'a' - 'A'; + else if (ch2 == '_') ch2 = '-'; + if (!ch1 || ch1 != ch2) return ch1 - ch2; + } +} + + +static const NLS_LOCALE_LCNAME_INDEX *find_lcname_entry(const WCHAR *name) +{ + const NLS_LOCALE_LCNAME_INDEX *lcnames_index; + const WCHAR *locale_strings; + int min = 0, max = locale_table->nb_lcnames - 1; + + locale_strings = (const WCHAR *)((char *)locale_table + locale_table->strings_offset); + lcnames_index = (const NLS_LOCALE_LCNAME_INDEX *)((char *)locale_table + locale_table->lcnames_offset); + + while (min <= max) + { + int res, pos = (min + max) / 2; + const WCHAR *str = locale_strings + lcnames_index[pos].name; + res = compare_locale_names(name, str + 1); + if (res < 0) max = pos - 1; + else if (res > 0) min = pos + 1; + else return &lcnames_index[pos]; + } + return NULL; +} + + static DWORD get_lcid(CFStringRef lang) { + const NLS_LOCALE_LCNAME_INDEX *entry; + const NLS_LOCALE_DATA *locale; CFRange range; WCHAR str[10]; + ULONG offset; + + if (!locale_table) + { + struct + { + UINT ctypes; + UINT unknown1; + UINT unknown2; + UINT unknown3; + UINT locales; + UINT charmaps; + UINT geoids; + UINT scripts; + } *header; + LCID system_lcid; + LARGE_INTEGER size; + + if (NtInitializeNlsFiles((void **)&header, &system_lcid, &size)) + { + ERR("NtInitializeNlsFiles failed\n"); + return 0; + } + + if (InterlockedCompareExchangePointer((void **)&locale_table, + (char *)header + header->locales, NULL)) + NtUnmapViewOfSection(GetCurrentProcess(), header); + }
range.location = 0; range.length = min(CFStringGetLength(lang), ARRAY_SIZE(str) - 1); CFStringGetCharacters(lang, range, str); str[range.length] = 0; - return LocaleNameToLCID(str, 0); + + if (!(entry = find_lcname_entry(str))) + { + ERR("%s not found\n", debugstr_w(str)); + return 0; + } + + offset = locale_table->locales_offset + entry->idx * locale_table->locale_size; + locale = (const NLS_LOCALE_DATA *)((const char *)locale_table + offset); + return locale->inotneutral ? entry->id : locale->idefaultlanguage; }
static HKL get_hkl(CFStringRef lang, CFStringRef type)
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/vulkan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 8481176fd70..ddef551c3d7 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -558,7 +558,7 @@ static VkResult macdrv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR * static long prev_time, start_time; DWORD time;
- time = GetTickCount(); + time = NtGetTickCount(); frames++; frames_total++; if (time - prev_time > 1500)
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/surface.c | 4 ++-- dlls/winemac.drv/window.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c index 5d51d18422a..e8039b3b3aa 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -86,7 +86,7 @@ static void update_blit_data(struct macdrv_window_surface *surface)
if (NtGdiCombineRgn(blit, surface->drawn, 0, RGN_COPY) > NULLREGION && (!surface->region || NtGdiCombineRgn(blit, blit, surface->region, RGN_AND) > NULLREGION) && - OffsetRgn(blit, surface->header.rect.left, surface->header.rect.top) > NULLREGION) + NtGdiOffsetRgn(blit, surface->header.rect.left, surface->header.rect.top) > NULLREGION) surface->blit_data = get_region_data(blit, 0);
NtGdiDeleteObjectApp(blit); @@ -285,7 +285,7 @@ struct window_surface *create_surface(macdrv_window window, const RECT *rect, if (old_mac_surface && old_mac_surface->drawn) { surface->drawn = NtGdiCreateRectRgn(rect->left, rect->top, rect->right, rect->bottom); - OffsetRgn(surface->drawn, -rect->left, -rect->top); + NtGdiOffsetRgn(surface->drawn, -rect->left, -rect->top); if (NtGdiCombineRgn(surface->drawn, surface->drawn, old_mac_surface->drawn, RGN_AND) <= NULLREGION) { NtGdiDeleteObjectApp(surface->drawn); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 36e34abbd12..59788244c22 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -396,8 +396,8 @@ static void sync_window_region(struct macdrv_win_data *data, HRGN win_region) NtUserMirrorRgn(data->hwnd, hrgn); if (hrgn) { - OffsetRgn(hrgn, data->window_rect.left - data->whole_rect.left, - data->window_rect.top - data->whole_rect.top); + NtGdiOffsetRgn(hrgn, data->window_rect.left - data->whole_rect.left, + data->window_rect.top - data->whole_rect.top); } region_data = get_region_data(hrgn, 0); if (region_data) @@ -540,7 +540,8 @@ static void sync_window_min_max_info(HWND hwnd) primary_monitor_rect.left = primary_monitor_rect.top = 0; primary_monitor_rect.right = NtUserGetSystemMetrics(SM_CXSCREEN); primary_monitor_rect.bottom = NtUserGetSystemMetrics(SM_CYSCREEN); - AdjustWindowRectEx(&primary_monitor_rect, adjustedStyle, ((style & WS_POPUP) && GetMenu(hwnd)), exstyle); + AdjustWindowRectEx(&primary_monitor_rect, adjustedStyle, + ((style & WS_POPUP) && NtUserGetWindowLongPtrW(hwnd, GWLP_ID)), exstyle);
xinc = -primary_monitor_rect.left; yinc = -primary_monitor_rect.top; @@ -1848,7 +1849,8 @@ LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam)
/* prevent a simple ALT press+release from activating the system menu, as that can get confusing */ - if (command == SC_KEYMENU && !(WCHAR)lparam && !GetMenu(hwnd) && + if (command == SC_KEYMENU && !(WCHAR)lparam && + !NtUserGetWindowLongPtrW(hwnd, GWLP_ID) && (NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_SYSMENU)) { TRACE("ignoring SC_KEYMENU wp %lx lp %lx\n", wparam, lparam);
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/dllmain.c | 25 ------------------------- dlls/winex11.drv/mouse.c | 26 +++++++++++++++++--------- dlls/winex11.drv/unixlib.h | 10 ---------- 3 files changed, 17 insertions(+), 44 deletions(-)
diff --git a/dlls/winex11.drv/dllmain.c b/dlls/winex11.drv/dllmain.c index b9bf5efd1e3..b06c955c2a4 100644 --- a/dlls/winex11.drv/dllmain.c +++ b/dlls/winex11.drv/dllmain.c @@ -128,30 +128,6 @@ static NTSTATUS x11drv_clipboard_init( UINT arg ) }
-static NTSTATUS WINAPI x11drv_is_system_module( void *arg, ULONG size ) -{ - HMODULE module; - unsigned int i; - - static const WCHAR cursor_modules[][16] = - { - { 'u','s','e','r','3','2','.','d','l','l',0 }, - { 'c','o','m','c','t','l','3','2','.','d','l','l',0 }, - { 'o','l','e','3','2','.','d','l','l',0 }, - { 'r','i','c','h','e','d','2','0','.','d','l','l',0 } - }; - - if (!(module = GetModuleHandleW( arg ))) return system_module_none; - - for (i = 0; i < ARRAYSIZE(cursor_modules); i++) - { - if (GetModuleHandleW( cursor_modules[i] ) == module) return i; - } - - return system_module_none; -} - - static NTSTATUS x11drv_load_icon( UINT id ) { return HandleToUlong( LoadIconW( NULL, UlongToPtr( id ))); @@ -189,7 +165,6 @@ static const kernel_callback kernel_callbacks[] = x11drv_dnd_post_drop, x11drv_ime_set_composition_string, x11drv_ime_set_result, - x11drv_is_system_module, x11drv_systray_change_owner, };
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 2ce03c3f12f..9e005881170 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -931,12 +931,16 @@ static const struct system_cursors riched20_cursors[] = { 0 } };
-static const struct system_cursors *module_cursors[] = +static const struct { - user32_cursors, - comctl32_cursors, - ole32_cursors, - riched20_cursors, + const struct system_cursors *cursors; + WCHAR name[16]; +} module_cursors[] = +{ + { user32_cursors, {'u','s','e','r','3','2','.','d','l','l',0} }, + { comctl32_cursors, {'c','o','m','c','t','l','3','2','.','d','l','l',0} }, + { ole32_cursors, {'o','l','e','3','2','.','d','l','l',0} }, + { riched20_cursors, {'r','i','c','h','e','d','2','0','.','d','l','l',0} } };
struct cursor_font_fallback @@ -1054,6 +1058,7 @@ static int find_fallback_shape( const char *name ) static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) { const struct system_cursors *cursors; + const WCHAR *module; unsigned int i; Cursor cursor = 0; HKEY key; @@ -1094,11 +1099,14 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) }
if (info->szResName[0]) goto done; /* only integer resources are supported here */ - i = x11drv_client_func( client_func_is_system_module, info->szModName, - (lstrlenW( info->szModName ) + 1) * sizeof(WCHAR) ); - if (i == system_module_none) goto done;
- cursors = module_cursors[i]; + if ((module = wcsrchr( info->szModName, '\' ))) module++; + else module = info->szModName; + for (i = 0; i < ARRAY_SIZE( module_cursors ); i++) + if (!wcsicmp( module, module_cursors[i].name )) break; + if (i == ARRAY_SIZE( module_cursors )) goto done; + + cursors = module_cursors[i].cursors; for (i = 0; cursors[i].id; i++) if (cursors[i].id == info->wResID) { diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index 9be7c18cd12..76cfad88f4d 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -75,15 +75,6 @@ struct systray_dock_params BOOL *layered; };
-enum system_modules -{ - system_module_user32, - system_module_comctl32, - system_module_ole32, - system_module_riched20, - system_module_none = 0xffff, -}; - /* x11drv_tablet_info params */ struct tablet_info_params { @@ -108,7 +99,6 @@ enum x11drv_client_funcs client_func_dnd_post_drop, client_func_ime_set_composition_string, client_func_ime_set_result, - client_func_is_system_module, client_func_systray_change_owner, client_func_last };
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/macdrv.h | 1 + dlls/winemac.drv/mouse.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 04a8af81c53..26028247a96 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -367,6 +367,7 @@ static inline UINT asciiz_to_unicode(WCHAR *dst, const char *src) }
/* FIXME: remove once we use unixlib */ +#define wcsicmp strcmpiW #define wcsnicmp strncmpiW #define wcsrchr strrchrW #define wcstol strtolW diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index d5db014dece..078b674d7c0 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -170,7 +170,7 @@ CFStringRef copy_system_cursor_name(ICONINFOEXW *info) const struct system_cursors *cursors; unsigned int i; CFStringRef cursor_name = NULL; - HMODULE module; + const WCHAR *module; HKEY key; WCHAR *p, name[MAX_PATH * 2];
@@ -223,10 +223,11 @@ CFStringRef copy_system_cursor_name(ICONINFOEXW *info) }
if (info->szResName[0]) goto done; /* only integer resources are supported here */ - if (!(module = GetModuleHandleW(info->szModName))) goto done;
- for (i = 0; i < ARRAY_SIZE(module_cursors); i++) - if (GetModuleHandleW(module_cursors[i].name) == module) break; + if ((module = wcsrchr(info->szModName, '\'))) module++; + else module = info->szModName; + for (i = 0; i < ARRAY_SIZE( module_cursors ); i++) + if (!wcsicmp(module, module_cursors[i].name)) break; if (i == ARRAY_SIZE(module_cursors)) goto done;
cursors = module_cursors[i].cursors;
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/clipboard.c | 261 +++-------------------------------- 1 file changed, 22 insertions(+), 239 deletions(-)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index dca62997028..d431728036e 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -87,6 +87,9 @@ static CFDataRef export_unicodetext_to_utf16(void *data, size_t size); * Static Variables **************************************************************************/
+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}; + /* Clipboard formats */ static struct list format_list = LIST_INIT(format_list);
@@ -194,7 +197,6 @@ static ULONG last_clipboard_update; static DWORD last_get_seqno; static WINE_CLIPFORMAT **current_mac_formats; static unsigned int nb_current_mac_formats; -static WCHAR clipboard_pipe_name[256];
/************************************************************************** @@ -1605,6 +1607,9 @@ static LRESULT CALLBACK clipboard_wndproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM is_clipboard_owner = FALSE; KillTimer(hwnd, 1); break; + case WM_USER: + update_clipboard(); + break; } return DefWindowProcW(hwnd, msg, wp, lp); } @@ -1639,42 +1644,6 @@ static BOOL wait_clipboard_mutex(void) }
-/************************************************************************** - * init_pipe_name - * - * Init-once helper for get_pipe_name. - */ -static BOOL CALLBACK init_pipe_name(INIT_ONCE* once, void* param, void** context) -{ - static const WCHAR prefix[] = {'\','\','.','\','p','i','p','e','\','_','_','w','i','n','e','_','c','l','i','p','b','o','a','r','d','_'}; - - memcpy(clipboard_pipe_name, prefix, sizeof(prefix)); - if (!GetUserObjectInformationW(GetProcessWindowStation(), UOI_NAME, - clipboard_pipe_name + ARRAY_SIZE(prefix), - sizeof(clipboard_pipe_name) - sizeof(prefix), NULL)) - { - ERR("failed to get winstation name\n"); - return FALSE; - } - - return TRUE; -} - - -/************************************************************************** - * get_pipe_name - * - * Get the name of the pipe used to communicate with the per-window-station - * clipboard manager thread. - */ -static const WCHAR* get_pipe_name(void) -{ - static INIT_ONCE once = INIT_ONCE_STATIC_INIT; - InitOnceExecuteOnce(&once, init_pipe_name, NULL, NULL); - return clipboard_pipe_name[0] ? clipboard_pipe_name : NULL; -} - - /************************************************************************** * clipboard_thread * @@ -1682,14 +1651,8 @@ static const WCHAR* get_pipe_name(void) */ 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; struct macdrv_window_features wf; - const WCHAR* pipe_name; - HANDLE pipe = NULL; - HANDLE event = NULL; - OVERLAPPED overlapped; - BOOL need_connect = TRUE, pending = FALSE; MSG msg;
if (!wait_clipboard_mutex()) return 0; @@ -1719,103 +1682,15 @@ static DWORD WINAPI clipboard_thread(void *arg) goto done; }
- pipe_name = get_pipe_name(); - if (!pipe_name) - { - ERR("failed to get pipe name\n"); - goto done; - } - - pipe = CreateNamedPipeW(pipe_name, PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED, - PIPE_TYPE_BYTE, PIPE_UNLIMITED_INSTANCES, 1, 1, 0, NULL); - if (!pipe) - { - ERR("failed to create named pipe: %u\n", GetLastError()); - goto done; - } - - event = CreateEventW(NULL, TRUE, FALSE, NULL); - if (!event) - { - ERR("failed to create event: %d\n", GetLastError()); - goto done; - } - clipboard_thread_id = GetCurrentThreadId(); NtUserAddClipboardFormatListener(clipboard_hwnd); register_builtin_formats(); grab_win32_clipboard();
TRACE("clipboard thread %04x running\n", GetCurrentThreadId()); - while (1) - { - DWORD result; - - if (need_connect) - { - pending = FALSE; - memset(&overlapped, 0, sizeof(overlapped)); - overlapped.hEvent = event; - if (ConnectNamedPipe(pipe, &overlapped)) - { - ERR("asynchronous ConnectNamedPipe unexpectedly returned true: %d\n", GetLastError()); - ResetEvent(event); - } - else - { - result = GetLastError(); - switch (result) - { - case ERROR_PIPE_CONNECTED: - case ERROR_NO_DATA: - SetEvent(event); - need_connect = FALSE; - break; - case ERROR_IO_PENDING: - need_connect = FALSE; - pending = TRUE; - break; - default: - ERR("failed to initiate pipe connection: %d\n", result); - break; - } - } - } - - result = MsgWaitForMultipleObjectsEx(1, &event, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE | MWMO_INPUTAVAILABLE); - switch (result) - { - case WAIT_OBJECT_0: - { - DWORD written; - - if (pending && !GetOverlappedResult(pipe, &overlapped, &written, FALSE)) - ERR("failed to connect pipe: %d\n", GetLastError()); - - update_clipboard(); - DisconnectNamedPipe(pipe); - need_connect = TRUE; - break; - } - case WAIT_OBJECT_0 + 1: - while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) - { - if (msg.message == WM_QUIT) - goto done; - DispatchMessageW(&msg); - } - break; - case WAIT_IO_COMPLETION: - break; - default: - ERR("failed to wait for connection or input: %d\n", GetLastError()); - break; - } - } + while (GetMessageW(&msg, 0, 0, 0)) DispatchMessageW(&msg);
done: - if (event) CloseHandle(event); - if (pipe) CloseHandle(pipe); macdrv_destroy_cocoa_window(clipboard_cocoa_window); DestroyWindow(clipboard_hwnd); return 0; @@ -1833,124 +1708,32 @@ done: void macdrv_UpdateClipboard(void) { static ULONG last_update; - ULONG now, end; - const WCHAR* pipe_name; - HANDLE pipe; - BYTE dummy; - DWORD count; - OVERLAPPED overlapped = { 0 }; - BOOL canceled = FALSE; + static HWND clipboard_manager; + ULONG now; + DWORD_PTR ret;
if (GetCurrentThreadId() == clipboard_thread_id) return;
TRACE("\n");
- now = GetTickCount(); - if ((int)(now - last_update) <= CLIPBOARD_UPDATE_DELAY) return; - last_update = now; - - if (!(pipe_name = get_pipe_name())) return; - pipe = CreateFileW(pipe_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); - if (pipe == INVALID_HANDLE_VALUE) - { - WARN("failed to open pipe to clipboard manager: %d\n", GetLastError()); - return; - } - - overlapped.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - if (!overlapped.hEvent) - { - ERR("failed to create event: %d\n", GetLastError()); - goto done; - } - - /* We expect the read to fail because the server just closes our connection. This - is just waiting for that close to happen. */ - if (ReadFile(pipe, &dummy, sizeof(dummy), NULL, &overlapped)) - { - WARN("asynchronous ReadFile unexpectedly returned true: %d\n", GetLastError()); - goto done; - } - else - { - DWORD error = GetLastError(); - if (error == ERROR_PIPE_NOT_CONNECTED || error == ERROR_BROKEN_PIPE) - { - /* The server accepted, handled, and closed our connection before we - attempted the read, which is fine. */ - goto done; - } - else if (error != ERROR_IO_PENDING) - { - ERR("failed to initiate read from pipe: %d\n", error); - goto done; - } - } + now = NtGetTickCount(); + if (last_update && (int)(now - last_update) <= CLIPBOARD_UPDATE_DELAY) return;
- end = now + 500; - while (1) + if (!NtUserIsWindow(clipboard_manager)) { - DWORD result, timeout; - - if (canceled) - timeout = INFINITE; - else + UNICODE_STRING str; + RtlInitUnicodeString(&str, clipboard_classname); + clipboard_manager = NtUserFindWindowEx(NULL, NULL, &str, NULL, 0); + if (!clipboard_manager) { - now = GetTickCount(); - timeout = end - now; - if ((int)timeout < 0) - timeout = 0; - } - - result = MsgWaitForMultipleObjectsEx(1, &overlapped.hEvent, timeout, QS_SENDMESSAGE, MWMO_ALERTABLE); - switch (result) - { - case WAIT_OBJECT_0: - { - if (GetOverlappedResult(pipe, &overlapped, &count, FALSE)) - WARN("unexpectedly succeeded in reading from pipe\n"); - else - { - result = GetLastError(); - if (result != ERROR_BROKEN_PIPE && result != ERROR_OPERATION_ABORTED && - result != ERROR_HANDLES_CLOSED) - WARN("failed to read from pipe: %d\n", result); - } - - goto done; - } - case WAIT_OBJECT_0 + 1: - { - MSG msg; - while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE)) - DispatchMessageW(&msg); - break; - } - case WAIT_IO_COMPLETION: - break; - case WAIT_TIMEOUT: - WARN("timed out waiting for read\n"); - CancelIoEx(pipe, &overlapped); - canceled = TRUE; - break; - default: - if (canceled) - { - ERR("failed to wait for cancel: %d\n", GetLastError()); - goto done; - } - - ERR("failed to wait for read: %d\n", GetLastError()); - CancelIoEx(pipe, &overlapped); - canceled = TRUE; - break; + ERR("clipboard manager not found\n"); + return; } }
-done: - if (overlapped.hEvent) CloseHandle(overlapped.hEvent); - CloseHandle(pipe); + send_message_timeout(clipboard_manager, WM_USER, 0, 0, + SMTO_ABORTIFHUNG, 5000, &ret); + last_update = now; }
This merge request was approved by Huw Davies.