From 911fc3cf5b06610167c8729116131d9699fb80d2 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Sat, 14 Aug 2021 10:42:02 +0900 Subject: [PATCH] [IMM32] Delete Wine-specific functions (#3902) We don't need Wine-specific functions for Japanese input. - Delete __wine_get_ui_window, __wine_register_window and __wine_unregister_window functions. - Modify imm32.spec. CORE-11700 --- dll/win32/imm32/imm.c | 130 ------------------------------------- dll/win32/imm32/imm32.spec | 6 -- 2 files changed, 136 deletions(-) diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index c3ea57fb2cd..e65b686a631 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -623,7 +623,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug = 0, 0, { (DWORD_PTR)(__FILE__ ": threaddata_cs") } }; static CRITICAL_SECTION threaddata_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; -static BOOL disable_ime; static inline BOOL is_himc_ime_unicode(const InputContextData *data) { @@ -661,38 +660,6 @@ static inline CHAR *strdupWtoA( const WCHAR *str ) return ret; } -static IMMThreadData *IMM_GetThreadData(HWND hwnd, DWORD thread) -{ - IMMThreadData *data; - DWORD process; - - if (hwnd) - { - if (!(thread = GetWindowThreadProcessId(hwnd, &process))) return NULL; - if (process != GetCurrentProcessId()) return NULL; - } - else if (thread) - { - HANDLE h = OpenThread(THREAD_QUERY_INFORMATION, FALSE, thread); - if (!h) return NULL; - process = GetProcessIdOfThread(h); - CloseHandle(h); - if (process != GetCurrentProcessId()) return NULL; - } - else - thread = GetCurrentThreadId(); - - EnterCriticalSection(&threaddata_cs); - LIST_FOR_EACH_ENTRY(data, &ImmThreadDataList, IMMThreadData, entry) - if (data->threadID == thread) return data; - - data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)); - data->threadID = thread; - list_add_head(&ImmThreadDataList,&data->entry); - TRACE("Thread Data Created (%x)\n",thread); - return data; -} - static HMODULE load_graphics_driver(void) { static const WCHAR display_device_guid_propW[] = { @@ -795,12 +762,6 @@ static ImmHkl *IMM_GetImmHkl(HKL hkl) } #undef LOAD_FUNCPTR -HWND WINAPI __wine_get_ui_window(HKL hkl) -{ - ImmHkl *immHkl = IMM_GetImmHkl(hkl); - return immHkl->UIWnd; -} - /* for posting messages as the IME */ static void ImmInternalPostIMEMessage(InputContextData *data, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -2605,97 +2566,6 @@ BOOL WINAPI ImmGetConversionStatus( return TRUE; } -static BOOL needs_ime_window(HWND hwnd) -{ - WCHAR classW[8]; - - if (GetClassNameW(hwnd, classW, ARRAY_SIZE(classW)) && !lstrcmpW(classW, szwIME)) - return FALSE; - if (GetClassLongPtrW(hwnd, GCL_STYLE) & CS_IME) return FALSE; - - return TRUE; -} - -/*********************************************************************** - * __wine_register_window (IMM32.@) - */ -BOOL WINAPI __wine_register_window(HWND hwnd) -{ - HWND new = NULL; - IMMThreadData *thread_data; - TRACE("(%p)\n", hwnd); - - if (!needs_ime_window(hwnd)) - return FALSE; - - thread_data = IMM_GetThreadData(hwnd, 0); - if (!thread_data) - return FALSE; - - if (thread_data->disableIME || disable_ime) - { - TRACE("IME for this thread is disabled\n"); - LeaveCriticalSection(&threaddata_cs); - return FALSE; - } - thread_data->windowRefs++; - TRACE("windowRefs=%u, hwndDefault=%p\n", - thread_data->windowRefs, thread_data->hwndDefault); - - /* Create default IME window */ - if (thread_data->windowRefs == 1) - { - /* Do not create the window inside of a critical section */ - LeaveCriticalSection(&threaddata_cs); - new = CreateWindowExW( 0, szwIME, szwDefaultIME, - WS_POPUP | WS_DISABLED | WS_CLIPSIBLINGS, - 0, 0, 1, 1, 0, 0, 0, 0); - /* thread_data is in the current thread so we can assume it's still valid */ - EnterCriticalSection(&threaddata_cs); - /* See if anyone beat us */ - if (thread_data->hwndDefault == NULL) - { - thread_data->hwndDefault = new; - new = NULL; - TRACE("Default is %p\n", thread_data->hwndDefault); - } - } - - LeaveCriticalSection(&threaddata_cs); - - /* Clean up an unused new window outside of the critical section */ - if (new != NULL) - DestroyWindow(new); - return TRUE; -} - -/*********************************************************************** - * __wine_unregister_window (IMM32.@) - */ -void WINAPI __wine_unregister_window(HWND hwnd) -{ - HWND to_destroy = 0; - IMMThreadData *thread_data; - TRACE("(%p)\n", hwnd); - - thread_data = IMM_GetThreadData(hwnd, 0); - if (!thread_data) return; - - thread_data->windowRefs--; - TRACE("windowRefs=%u, hwndDefault=%p\n", - thread_data->windowRefs, thread_data->hwndDefault); - - /* Destroy default IME window */ - if (thread_data->windowRefs == 0 && thread_data->hwndDefault) - { - to_destroy = thread_data->hwndDefault; - thread_data->hwndDefault = NULL; - } - LeaveCriticalSection(&threaddata_cs); - - if (to_destroy) DestroyWindow( to_destroy ); -} - /*********************************************************************** * ImmGetDefaultIMEWnd (IMM32.@) */ diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index 104e4242fc0..e196f08627a 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -113,9 +113,3 @@ @ stdcall -stub ImmWINNLSEnableIME(ptr long) @ stdcall -stub ImmWINNLSGetEnableStatus(ptr) @ stub ImmWINNLSGetIMEHotkey - -################################################################ -# Wine internal extensions -@ stdcall __wine_get_ui_window(ptr) -@ stdcall __wine_register_window(long) -@ stdcall __wine_unregister_window(long)