mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 0925a730272ed0c97f64c3365ebe542401f60d7c.
This commit is contained in:
parent
688eeca0be
commit
6bc16f96f7
@ -1,4 +1,4 @@
|
||||
From 281b0621aa872330ab61f927750deb0753417ec8 Mon Sep 17 00:00:00 2001
|
||||
From 34109c1adac6293a87db004d60d342faeb33fcfe Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 8 Jun 2021 09:34:28 +1000
|
||||
Subject: [PATCH] d3d10: Avoid implicit cast of interface pointer.
|
||||
@ -8,10 +8,10 @@ Subject: [PATCH] d3d10: Avoid implicit cast of interface pointer.
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
|
||||
index 5a5f9f37e6d..c127cb2bd2d 100644
|
||||
index 3b4050460a0..b03ed2d6c89 100644
|
||||
--- a/dlls/d3d10/effect.c
|
||||
+++ b/dlls/d3d10/effect.c
|
||||
@@ -131,7 +131,7 @@ static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D1
|
||||
@@ -147,7 +147,7 @@ static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVariable(ID3D1
|
||||
|
||||
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectShaderVariable(ID3D10EffectShaderVariable *iface)
|
||||
{
|
||||
@ -19,8 +19,8 @@ index 5a5f9f37e6d..c127cb2bd2d 100644
|
||||
+ return CONTAINING_RECORD((ID3D10EffectVariable*)iface, struct d3d10_effect_variable, ID3D10EffectVariable_iface);
|
||||
}
|
||||
|
||||
enum d3d10_effect_container_type
|
||||
@@ -4969,7 +4969,7 @@ static void read_variable_array_from_buffer(struct d3d10_effect_variable *variab
|
||||
static struct d3d10_effect_variable * d3d10_array_get_element(struct d3d10_effect_variable *v,
|
||||
@@ -4876,7 +4876,7 @@ static void read_variable_array_from_buffer(struct d3d10_effect_variable *variab
|
||||
|
||||
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectScalarVariable(ID3D10EffectScalarVariable *iface)
|
||||
{
|
||||
@ -29,7 +29,7 @@ index 5a5f9f37e6d..c127cb2bd2d 100644
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE d3d10_effect_scalar_variable_IsValid(ID3D10EffectScalarVariable *iface)
|
||||
@@ -5305,7 +5305,7 @@ static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_
|
||||
@@ -5212,7 +5212,7 @@ static const struct ID3D10EffectScalarVariableVtbl d3d10_effect_scalar_variable_
|
||||
|
||||
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectVectorVariable(ID3D10EffectVectorVariable *iface)
|
||||
{
|
||||
@ -38,7 +38,7 @@ index 5a5f9f37e6d..c127cb2bd2d 100644
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE d3d10_effect_vector_variable_IsValid(ID3D10EffectVectorVariable *iface)
|
||||
@@ -5792,7 +5792,7 @@ static void read_matrix_variable_array_from_buffer(struct d3d10_effect_variable
|
||||
@@ -5699,7 +5699,7 @@ static void read_matrix_variable_array_from_buffer(struct d3d10_effect_variable
|
||||
|
||||
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectMatrixVariable(ID3D10EffectMatrixVariable *iface)
|
||||
{
|
||||
@ -47,7 +47,7 @@ index 5a5f9f37e6d..c127cb2bd2d 100644
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE d3d10_effect_matrix_variable_IsValid(ID3D10EffectMatrixVariable *iface)
|
||||
@@ -6315,7 +6315,7 @@ static void set_shader_resource_variable(ID3D10ShaderResourceView **src, ID3D10S
|
||||
@@ -6222,7 +6222,7 @@ static void set_shader_resource_variable(ID3D10ShaderResourceView **src, ID3D10S
|
||||
static inline struct d3d10_effect_variable *impl_from_ID3D10EffectShaderResourceVariable(
|
||||
ID3D10EffectShaderResourceVariable *iface)
|
||||
{
|
||||
|
@ -1,572 +0,0 @@
|
||||
From d8c34665cf3869d553ef19d7556f5ce3ccf5c786 Mon Sep 17 00:00:00 2001
|
||||
From: Nikolay Sivov <nsivov@codeweavers.com>
|
||||
Date: Wed, 30 Jan 2019 12:25:41 +0300
|
||||
Subject: [PATCH] imm32: Automatically initialize COM on window activation.
|
||||
|
||||
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
|
||||
---
|
||||
dlls/imm32/Makefile.in | 2 +-
|
||||
dlls/imm32/imm.c | 129 ++++++++++++++++++-
|
||||
dlls/imm32/imm32.spec | 1 +
|
||||
dlls/imm32/tests/imm32.c | 252 ++++++++++++++++++++++++++++++++++++-
|
||||
dlls/user32/focus.c | 2 +
|
||||
dlls/user32/misc.c | 2 +
|
||||
dlls/user32/user_private.h | 1 +
|
||||
7 files changed, 386 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/imm32/Makefile.in b/dlls/imm32/Makefile.in
|
||||
index b190888659b..ad10fc2fa45 100644
|
||||
--- a/dlls/imm32/Makefile.in
|
||||
+++ b/dlls/imm32/Makefile.in
|
||||
@@ -1,6 +1,6 @@
|
||||
MODULE = imm32.dll
|
||||
IMPORTLIB = imm32
|
||||
-IMPORTS = user32 gdi32 advapi32
|
||||
+IMPORTS = user32 gdi32 advapi32 ole32
|
||||
|
||||
C_SRCS = \
|
||||
imm.c
|
||||
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
|
||||
index 20633041871..432dd224882 100644
|
||||
--- a/dlls/imm32/imm.c
|
||||
+++ b/dlls/imm32/imm.c
|
||||
@@ -19,6 +19,8 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
+#define COBJMACROS
|
||||
+
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -32,6 +34,8 @@
|
||||
#include "ddk/imm.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
+#include "initguid.h"
|
||||
+#include "objbase.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
||||
@@ -94,8 +98,16 @@ typedef struct _tagIMMThreadData {
|
||||
HWND hwndDefault;
|
||||
BOOL disableIME;
|
||||
DWORD windowRefs;
|
||||
+ IInitializeSpy IInitializeSpy_iface;
|
||||
+ ULARGE_INTEGER spy_cookie;
|
||||
+ BOOL apt_initialized;
|
||||
} IMMThreadData;
|
||||
|
||||
+static inline IMMThreadData *impl_from_IInitializeSpy(IInitializeSpy *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, IMMThreadData, IInitializeSpy_iface);
|
||||
+}
|
||||
+
|
||||
static struct list ImmHklList = LIST_INIT(ImmHklList);
|
||||
static struct list ImmThreadDataList = LIST_INIT(ImmThreadDataList);
|
||||
|
||||
@@ -227,6 +239,88 @@ static DWORD convert_candidatelist_AtoW(
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static HRESULT WINAPI initializespy_QueryInterface(IInitializeSpy *iface, REFIID riid, void **obj)
|
||||
+{
|
||||
+ if (IsEqualIID(&IID_IInitializeSpy, riid) ||
|
||||
+ IsEqualIID(&IID_IUnknown, riid))
|
||||
+ {
|
||||
+ *obj = iface;
|
||||
+ IInitializeSpy_AddRef(iface);
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+
|
||||
+ *obj = NULL;
|
||||
+ return E_NOINTERFACE;
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI initializespy_AddRef(IInitializeSpy *iface)
|
||||
+{
|
||||
+ return 2;
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI initializespy_Release(IInitializeSpy *iface)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void imm_couninit_thread(IMMThreadData *thread_data)
|
||||
+{
|
||||
+ if (!thread_data->apt_initialized)
|
||||
+ return;
|
||||
+
|
||||
+ thread_data->apt_initialized = FALSE;
|
||||
+ CoUninitialize();
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI initializespy_PreInitialize(IInitializeSpy *iface, DWORD coinit, DWORD refs)
|
||||
+{
|
||||
+ IMMThreadData *thread_data = impl_from_IInitializeSpy(iface);
|
||||
+
|
||||
+ /* Application requested initialization of different apartment type. */
|
||||
+ if (!(coinit & COINIT_APARTMENTTHREADED))
|
||||
+ imm_couninit_thread(thread_data);
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI initializespy_PostInitialize(IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD refs)
|
||||
+{
|
||||
+ IMMThreadData *thread_data = impl_from_IInitializeSpy(iface);
|
||||
+
|
||||
+ /* Explicit initialization call should return S_OK first time. */
|
||||
+ if (thread_data->apt_initialized && hr == S_FALSE && refs == 2)
|
||||
+ hr = S_OK;
|
||||
+
|
||||
+ return hr;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI initializespy_PreUninitialize(IInitializeSpy *iface, DWORD refs)
|
||||
+{
|
||||
+ IMMThreadData *thread_data = impl_from_IInitializeSpy(iface);
|
||||
+
|
||||
+ /* Account for explicit uninitialization calls. */
|
||||
+ if (thread_data->apt_initialized && refs == 1)
|
||||
+ thread_data->apt_initialized = FALSE;
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI initializespy_PostUninitialize(IInitializeSpy *iface, DWORD refs)
|
||||
+{
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static const IInitializeSpyVtbl initializespyvtbl =
|
||||
+{
|
||||
+ initializespy_QueryInterface,
|
||||
+ initializespy_AddRef,
|
||||
+ initializespy_Release,
|
||||
+ initializespy_PreInitialize,
|
||||
+ initializespy_PostInitialize,
|
||||
+ initializespy_PreUninitialize,
|
||||
+ initializespy_PostUninitialize,
|
||||
+};
|
||||
+
|
||||
static IMMThreadData *IMM_GetThreadData(HWND hwnd, DWORD thread)
|
||||
{
|
||||
IMMThreadData *data;
|
||||
@@ -253,6 +347,7 @@ static IMMThreadData *IMM_GetThreadData(HWND hwnd, DWORD thread)
|
||||
if (data->threadID == thread) return data;
|
||||
|
||||
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data));
|
||||
+ data->IInitializeSpy_iface.lpVtbl = &initializespyvtbl;
|
||||
data->threadID = thread;
|
||||
list_add_head(&ImmThreadDataList,&data->entry);
|
||||
TRACE("Thread Data Created (%x)\n",thread);
|
||||
@@ -281,6 +376,7 @@ static void IMM_FreeThreadData(void)
|
||||
list_remove(&data->entry);
|
||||
LeaveCriticalSection(&threaddata_cs);
|
||||
IMM_DestroyContext(data->defaultContext);
|
||||
+ imm_couninit_thread(data);
|
||||
HeapFree(GetProcessHeap(),0,data);
|
||||
TRACE("Thread Data Destroyed\n");
|
||||
return;
|
||||
@@ -1636,6 +1732,32 @@ static BOOL needs_ime_window(HWND hwnd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+void WINAPI __wine_activate_window(HWND hwnd)
|
||||
+{
|
||||
+ IMMThreadData *thread_data;
|
||||
+
|
||||
+ TRACE("(%p)\n", hwnd);
|
||||
+
|
||||
+ if (!needs_ime_window(hwnd))
|
||||
+ return;
|
||||
+
|
||||
+ thread_data = IMM_GetThreadData(hwnd, 0);
|
||||
+ if (!thread_data)
|
||||
+ return;
|
||||
+
|
||||
+ if (thread_data->disableIME || disable_ime)
|
||||
+ {
|
||||
+ TRACE("IME for this thread is disabled\n");
|
||||
+ LeaveCriticalSection(&threaddata_cs);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!thread_data->apt_initialized)
|
||||
+ thread_data->apt_initialized = SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED));
|
||||
+
|
||||
+ LeaveCriticalSection(&threaddata_cs);
|
||||
+}
|
||||
+
|
||||
/***********************************************************************
|
||||
* __wine_register_window (IMM32.@)
|
||||
*/
|
||||
@@ -1665,6 +1787,8 @@ BOOL WINAPI __wine_register_window(HWND hwnd)
|
||||
/* Create default IME window */
|
||||
if (thread_data->windowRefs == 1)
|
||||
{
|
||||
+ CoRegisterInitializeSpy(&thread_data->IInitializeSpy_iface, &thread_data->spy_cookie);
|
||||
+
|
||||
/* Do not create the window inside of a critical section */
|
||||
LeaveCriticalSection(&threaddata_cs);
|
||||
new = CreateWindowExW( 0, L"IME", L"Default IME",
|
||||
@@ -1706,8 +1830,11 @@ void WINAPI __wine_unregister_window(HWND hwnd)
|
||||
thread_data->windowRefs, thread_data->hwndDefault);
|
||||
|
||||
/* Destroy default IME window */
|
||||
- if (thread_data->windowRefs == 0 && thread_data->hwndDefault)
|
||||
+ if (thread_data->windowRefs == 0)
|
||||
{
|
||||
+ CoRevokeInitializeSpy(thread_data->spy_cookie);
|
||||
+ thread_data->spy_cookie.QuadPart = 0;
|
||||
+ imm_couninit_thread(thread_data);
|
||||
to_destroy = thread_data->hwndDefault;
|
||||
thread_data->hwndDefault = NULL;
|
||||
}
|
||||
diff --git a/dlls/imm32/imm32.spec b/dlls/imm32/imm32.spec
|
||||
index 4197bb81e21..d9cdc794e9e 100644
|
||||
--- a/dlls/imm32/imm32.spec
|
||||
+++ b/dlls/imm32/imm32.spec
|
||||
@@ -117,3 +117,4 @@
|
||||
@ stdcall __wine_get_ui_window(ptr)
|
||||
@ stdcall __wine_register_window(long)
|
||||
@ stdcall __wine_unregister_window(long)
|
||||
+@ stdcall __wine_activate_window(long)
|
||||
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
|
||||
index cc9e0e8c01f..73cbb4fe5ec 100644
|
||||
--- a/dlls/imm32/tests/imm32.c
|
||||
+++ b/dlls/imm32/tests/imm32.c
|
||||
@@ -18,6 +18,8 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
+#define COBJMACROS
|
||||
+
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
@@ -25,10 +27,17 @@
|
||||
#include "wingdi.h"
|
||||
#include "imm.h"
|
||||
#include "ddk/imm.h"
|
||||
+#include "initguid.h"
|
||||
+#include "objbase.h"
|
||||
+#include "urlmon.h"
|
||||
|
||||
static BOOL (WINAPI *pImmAssociateContextEx)(HWND,HIMC,DWORD);
|
||||
static BOOL (WINAPI *pImmIsUIMessageA)(HWND,UINT,WPARAM,LPARAM);
|
||||
static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t);
|
||||
+static HRESULT (WINAPI *pCoGetApartmentType)(APTTYPE *, APTTYPEQUALIFIER *);
|
||||
+static HRESULT (WINAPI *pCoInitializeEx)(void *, DWORD);
|
||||
+static void (WINAPI *pCoUninitialize)(void);
|
||||
+static HRESULT (WINAPI *pCoCreateInstance)(REFCLSID, IUnknown *, DWORD, REFIID, void **);
|
||||
|
||||
/*
|
||||
* msgspy - record and analyse message traces sent to a certain window
|
||||
@@ -2025,7 +2034,247 @@ static void test_InvalidIMC(void)
|
||||
ok(ret == ERROR_INVALID_HANDLE, "wrong last error %08x!\n", ret);
|
||||
}
|
||||
|
||||
-START_TEST(imm32) {
|
||||
+static LRESULT CALLBACK com_init_test_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
+{
|
||||
+ return DefWindowProcA(hwnd, uMsg, wParam, lParam);
|
||||
+}
|
||||
+
|
||||
+#define COM_INIT_TEST_APTTYPE(apttype) com_init_test_apttype(apttype, __LINE__)
|
||||
+static void com_init_test_apttype(APTTYPE expected_type, unsigned int line)
|
||||
+{
|
||||
+ APTTYPEQUALIFIER apttypequal;
|
||||
+ HRESULT hr, hr_expected;
|
||||
+ APTTYPE apttype;
|
||||
+ IUnknown *unk;
|
||||
+
|
||||
+ if (expected_type == -1)
|
||||
+ hr_expected = CO_E_NOTINITIALIZED;
|
||||
+ else
|
||||
+ hr_expected = S_OK;
|
||||
+
|
||||
+ hr = pCoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
|
||||
+ ok_(__FILE__, line)(hr == hr_expected, "Unexpected hr %#x.\n", hr);
|
||||
+ if (SUCCEEDED(hr))
|
||||
+ IUnknown_Release(unk);
|
||||
+
|
||||
+ hr = pCoGetApartmentType(&apttype, &apttypequal);
|
||||
+ ok_(__FILE__, line)(hr == (expected_type == -1 ? CO_E_NOTINITIALIZED : S_OK),
|
||||
+ "Failed to get apartment type, hr %#x.\n", hr);
|
||||
+ if (SUCCEEDED(hr))
|
||||
+ ok_(__FILE__, line)(apttype == expected_type && apttypequal == APTTYPEQUALIFIER_NONE,
|
||||
+ "Unexpected apartment type %u/%u.\n", apttype, apttypequal);
|
||||
+}
|
||||
+
|
||||
+static HWND test_com_create_window(DWORD style)
|
||||
+{
|
||||
+ WNDCLASSA clsA;
|
||||
+ HWND hwnd;
|
||||
+
|
||||
+ clsA.style = 0;
|
||||
+ clsA.lpfnWndProc = com_init_test_wndproc;
|
||||
+ clsA.cbClsExtra = 0;
|
||||
+ clsA.cbWndExtra = 0;
|
||||
+ clsA.hInstance = GetModuleHandleA(NULL);
|
||||
+ clsA.hIcon = 0;
|
||||
+ clsA.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
|
||||
+ clsA.hbrBackground = NULL;
|
||||
+ clsA.lpszMenuName = NULL;
|
||||
+ clsA.lpszClassName = "COMInitTest";
|
||||
+
|
||||
+ RegisterClassA(&clsA);
|
||||
+
|
||||
+ hwnd = CreateWindowExA(0, "COMInitTest", "Test window", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
||||
+ WS_MAXIMIZEBOX | style, 0, 0, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
||||
+ ok(hwnd != NULL, "Failed to create a test window.\n");
|
||||
+
|
||||
+ return hwnd;
|
||||
+}
|
||||
+
|
||||
+static void test_com_init(const char *testname)
|
||||
+{
|
||||
+ WNDCLASSA clsA;
|
||||
+ HMODULE hmod;
|
||||
+ HRESULT hr;
|
||||
+ HWND hwnd;
|
||||
+
|
||||
+ clsA.style = 0;
|
||||
+ clsA.lpfnWndProc = com_init_test_wndproc;
|
||||
+ clsA.cbClsExtra = 0;
|
||||
+ clsA.cbWndExtra = 0;
|
||||
+ clsA.hInstance = GetModuleHandleA(NULL);
|
||||
+ clsA.hIcon = 0;
|
||||
+ clsA.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
|
||||
+ clsA.hbrBackground = NULL;
|
||||
+ clsA.lpszMenuName = NULL;
|
||||
+ clsA.lpszClassName = "COMInitTest";
|
||||
+
|
||||
+ RegisterClassA(&clsA);
|
||||
+
|
||||
+ hmod = LoadLibraryA("ole32.dll");
|
||||
+
|
||||
+ pCoGetApartmentType = (void *)GetProcAddress(hmod, "CoGetApartmentType");
|
||||
+ pCoInitializeEx = (void *)GetProcAddress(hmod, "CoInitializeEx");
|
||||
+ pCoUninitialize = (void *)GetProcAddress(hmod, "CoUninitialize");
|
||||
+ pCoCreateInstance = (void *)GetProcAddress(hmod, "CoCreateInstance");
|
||||
+
|
||||
+ if (!strcmp(testname, "visible"))
|
||||
+ {
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ hwnd = test_com_create_window(WS_VISIBLE);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
+ ok(hr == S_OK, "Failed to re-initialize, hr %#x.\n", hr);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MTA);
|
||||
+
|
||||
+ pCoUninitialize();
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+ }
|
||||
+ else if (!strcmp(testname, "invisible"))
|
||||
+ {
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ hwnd = test_com_create_window(0);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ ShowWindow(hwnd, SW_SHOW);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
+ ok(hr == S_OK, "Failed to re-initialize, hr %#x.\n", hr);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MTA);
|
||||
+
|
||||
+ pCoUninitialize();
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+ }
|
||||
+ else if (!strcmp(testname, "imedisabled"))
|
||||
+ {
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ ImmDisableIME(-1);
|
||||
+
|
||||
+ hwnd = test_com_create_window(WS_VISIBLE);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
+ ok(hr == S_OK, "Failed to re-initialize, hr %#x.\n", hr);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MTA);
|
||||
+
|
||||
+ pCoUninitialize();
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+ }
|
||||
+ else if (!strcmp(testname, "sta"))
|
||||
+ {
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ hwnd = test_com_create_window(WS_VISIBLE);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ /* Initialize for STA explicitly, S_OK is forced, with incremented counter. */
|
||||
+ hr = pCoInitializeEx(0, COINIT_APARTMENTTHREADED);
|
||||
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ pCoUninitialize();
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+ }
|
||||
+ else if (!strcmp(testname, "uninit"))
|
||||
+ {
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ hwnd = test_com_create_window(WS_VISIBLE);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ pCoUninitialize();
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(-1);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+
|
||||
+ hwnd = test_com_create_window(WS_VISIBLE);
|
||||
+
|
||||
+ COM_INIT_TEST_APTTYPE(APTTYPE_MAINSTA);
|
||||
+
|
||||
+ DestroyWindow(hwnd);
|
||||
+ }
|
||||
+ else
|
||||
+ ok(0, "Unknown test name %s.\n", testname);
|
||||
+}
|
||||
+
|
||||
+static void test_com_initialization(void)
|
||||
+{
|
||||
+ char path_name[MAX_PATH];
|
||||
+ PROCESS_INFORMATION info;
|
||||
+ STARTUPINFOA startup;
|
||||
+ HMODULE hmod;
|
||||
+ char **argv;
|
||||
+ int i;
|
||||
+ static const char *test_params[] =
|
||||
+ {
|
||||
+ "imedisabled",
|
||||
+ "visible",
|
||||
+ "invisible",
|
||||
+ "sta",
|
||||
+ "uninit",
|
||||
+ };
|
||||
+
|
||||
+ hmod = LoadLibraryA("ole32.dll");
|
||||
+ pCoGetApartmentType = (void *)GetProcAddress(hmod, "CoGetApartmentType");
|
||||
+ FreeLibrary(hmod);
|
||||
+ if (!pCoGetApartmentType)
|
||||
+ {
|
||||
+ win_skip("Skipping COM initialization tests on older system.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ winetest_get_mainargs( &argv );
|
||||
+ for (i = 0; i < ARRAY_SIZE(test_params); ++i)
|
||||
+ {
|
||||
+ memset( &startup, 0, sizeof(startup) );
|
||||
+ startup.cb = sizeof( startup );
|
||||
+ sprintf( path_name, "%s imm32 %s", argv[0], test_params[i] );
|
||||
+ ok( CreateProcessA( NULL, path_name, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info ),
|
||||
+ "CreateProcess failed.\n" );
|
||||
+ winetest_wait_child_process( info.hProcess );
|
||||
+ CloseHandle( info.hProcess );
|
||||
+ CloseHandle( info.hThread );
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+START_TEST(imm32)
|
||||
+{
|
||||
+ char **argv;
|
||||
+ int argc = winetest_get_mainargs( &argv );
|
||||
+
|
||||
+ if (argc >= 3)
|
||||
+ {
|
||||
+ test_com_init( argv[2] );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (init())
|
||||
{
|
||||
test_ImmNotifyIME();
|
||||
@@ -2052,6 +2301,7 @@ START_TEST(imm32) {
|
||||
if (pSendInput)
|
||||
test_ime_processkey();
|
||||
else win_skip("SendInput is not available\n");
|
||||
+ test_com_initialization();
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c
|
||||
index 460aea4820e..bbe596d5077 100644
|
||||
--- a/dlls/user32/focus.c
|
||||
+++ b/dlls/user32/focus.c
|
||||
@@ -156,6 +156,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
|
||||
|
||||
if (hwnd == GetForegroundWindow() && !IsIconic( hwnd ))
|
||||
USER_Driver->pSetActiveWindow( hwnd );
|
||||
+
|
||||
+ imm_activate_window( hwnd );
|
||||
}
|
||||
|
||||
/* now change focus if necessary */
|
||||
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
|
||||
index e12a1af5571..d37bc819447 100644
|
||||
--- a/dlls/user32/misc.c
|
||||
+++ b/dlls/user32/misc.c
|
||||
@@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
|
||||
static HWND (WINAPI *imm_get_ui_window)(HKL);
|
||||
BOOL (WINAPI *imm_register_window)(HWND) = NULL;
|
||||
void (WINAPI *imm_unregister_window)(HWND) = NULL;
|
||||
+void (WINAPI *imm_activate_window)(HWND) = NULL;
|
||||
|
||||
/* MSIME messages */
|
||||
static UINT WM_MSIME_SERVICE;
|
||||
@@ -344,6 +345,7 @@ BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
|
||||
imm_get_ui_window = (void*)GetProcAddress(imm32, "__wine_get_ui_window");
|
||||
imm_register_window = (void*)GetProcAddress(imm32, "__wine_register_window");
|
||||
imm_unregister_window = (void*)GetProcAddress(imm32, "__wine_unregister_window");
|
||||
+ imm_activate_window = (void*)GetProcAddress(imm32, "__wine_activate_window");
|
||||
if (!imm_get_ui_window)
|
||||
FIXME("native imm32.dll not supported\n");
|
||||
return TRUE;
|
||||
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
|
||||
index beece021a9f..5bc4a429b8d 100644
|
||||
--- a/dlls/user32/user_private.h
|
||||
+++ b/dlls/user32/user_private.h
|
||||
@@ -209,6 +209,7 @@ C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo)
|
||||
extern INT global_key_state_counter DECLSPEC_HIDDEN;
|
||||
extern BOOL (WINAPI *imm_register_window)(HWND) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *imm_unregister_window)(HWND) DECLSPEC_HIDDEN;
|
||||
+extern void (WINAPI *imm_activate_window)(HWND) DECLSPEC_HIDDEN;
|
||||
|
||||
struct user_key_state_info
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Path Of Exile has been patched to correct this issue, the underlying issue still exists in wine.
|
||||
|
||||
# Mailing list patch, and comments about it's issues.
|
||||
# https://www.winehq.org/pipermail/wine-devel/2019-January/138404.html
|
||||
# https://www.winehq.org/pipermail/wine-devel/2019-February/date.html
|
||||
Fixes: [42695] Path of Exile fails - CoCreateInstance() called in uninitialized apartment
|
||||
Fixes: [47387] Victor Vran has no sound
|
||||
|
||||
Depends: winex11-_NET_ACTIVE_WINDOW
|
@ -1,34 +0,0 @@
|
||||
From 117673ffe8bd5a8aae060307bcf6af83b4da011e Mon Sep 17 00:00:00 2001
|
||||
From: Gijs Vermeulen <gijsvrm@gmail.com>
|
||||
Date: Mon, 17 Dec 2018 11:49:26 +1100
|
||||
Subject: [PATCH] imm32: Only generate 'WM_IME_SETCONTEXT' message if window
|
||||
has focus
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31157
|
||||
---
|
||||
dlls/imm32/imm.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
|
||||
index 28eb00f..4255e98 100644
|
||||
--- a/dlls/imm32/imm.c
|
||||
+++ b/dlls/imm32/imm.c
|
||||
@@ -608,9 +608,12 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
|
||||
if (!hIMC)
|
||||
return old;
|
||||
|
||||
- SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, FALSE, ISC_SHOWUIALL);
|
||||
- data->IMC.hWnd = hWnd;
|
||||
- SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, TRUE, ISC_SHOWUIALL);
|
||||
+ if(GetActiveWindow() == data->IMC.hWnd)
|
||||
+ {
|
||||
+ SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, FALSE, ISC_SHOWUIALL);
|
||||
+ data->IMC.hWnd = hWnd;
|
||||
+ SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, TRUE, ISC_SHOWUIALL);
|
||||
+ }
|
||||
|
||||
return old;
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,5 +0,0 @@
|
||||
# I suspect that bug #28861,#46263 are related to this issue as well.
|
||||
# Both of these hint that the szwWineIMCProperty doesn't the correct value
|
||||
# and thus goes down invalid path leading to a crash.
|
||||
#
|
||||
Fixes: [31157] imm32: Only generate 'WM_IME_SETCONTEXT' message if window has focus.
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "6d307e2a647e71c21106feb0d62e371b3e55ab38"
|
||||
echo "0925a730272ed0c97f64c3365ebe542401f60d7c"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -118,8 +118,6 @@ patch_enable_all ()
|
||||
enable_fonts_Missing_Fonts="$1"
|
||||
enable_gdi32_rotation="$1"
|
||||
enable_gdiplus_Performance_Improvements="$1"
|
||||
enable_imm32_com_initialization="$1"
|
||||
enable_imm32_message_on_focus="$1"
|
||||
enable_include_winsock="$1"
|
||||
enable_inseng_Implementation="$1"
|
||||
enable_kernel32_CopyFileEx="$1"
|
||||
@ -386,12 +384,6 @@ patch_enable ()
|
||||
gdiplus-Performance-Improvements)
|
||||
enable_gdiplus_Performance_Improvements="$2"
|
||||
;;
|
||||
imm32-com-initialization)
|
||||
enable_imm32_com_initialization="$2"
|
||||
;;
|
||||
imm32-message_on_focus)
|
||||
enable_imm32_message_on_focus="$2"
|
||||
;;
|
||||
include-winsock)
|
||||
enable_include_winsock="$2"
|
||||
;;
|
||||
@ -1322,13 +1314,6 @@ if test "$enable_mfplat_streaming_support" -eq 1; then
|
||||
enable_mfplat_reverts=1
|
||||
fi
|
||||
|
||||
if test "$enable_imm32_com_initialization" -eq 1; then
|
||||
if test "$enable_winex11__NET_ACTIVE_WINDOW" -gt 1; then
|
||||
abort "Patchset winex11-_NET_ACTIVE_WINDOW disabled, but imm32-com-initialization depends on that."
|
||||
fi
|
||||
enable_winex11__NET_ACTIVE_WINDOW=1
|
||||
fi
|
||||
|
||||
if test "$enable_fltmgr_sys_FltBuildDefaultSecurityDescriptor" -eq 1; then
|
||||
if test "$enable_winedevice_Default_Drivers" -gt 1; then
|
||||
abort "Patchset winedevice-Default_Drivers disabled, but fltmgr.sys-FltBuildDefaultSecurityDescriptor depends on that."
|
||||
@ -2142,49 +2127,6 @@ if test "$enable_gdiplus_Performance_Improvements" -eq 1; then
|
||||
patch_apply gdiplus-Performance-Improvements/0004-gdiplus-Prefer-using-pre-multiplied-ARGB-data-in-the.patch
|
||||
fi
|
||||
|
||||
# Patchset winex11-_NET_ACTIVE_WINDOW
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#2155] Forward activate window requests to WM using _NET_ACTIVE_WINDOW
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/user32/driver.c, dlls/user32/focus.c, dlls/user32/user_private.h, dlls/winex11.drv/event.c,
|
||||
# | dlls/winex11.drv/window.c, dlls/winex11.drv/winex11.drv.spec, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c
|
||||
# |
|
||||
if test "$enable_winex11__NET_ACTIVE_WINDOW" -eq 1; then
|
||||
patch_apply winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch
|
||||
patch_apply winex11-_NET_ACTIVE_WINDOW/0002-user32-Before-asking-a-WM-to-activate-a-window-make-.patch
|
||||
fi
|
||||
|
||||
# Patchset imm32-com-initialization
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * winex11-_NET_ACTIVE_WINDOW
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#42695] Path of Exile fails - CoCreateInstance() called in uninitialized apartment
|
||||
# | * [#47387] Victor Vran has no sound
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/imm32/Makefile.in, dlls/imm32/imm.c, dlls/imm32/imm32.spec, dlls/imm32/tests/imm32.c, dlls/user32/focus.c,
|
||||
# | dlls/user32/misc.c, dlls/user32/user_private.h
|
||||
# |
|
||||
if test "$enable_imm32_com_initialization" -eq 1; then
|
||||
patch_apply imm32-com-initialization/0001-imm32-Automatically-initialize-COM-on-window-activat.patch
|
||||
fi
|
||||
|
||||
# Patchset imm32-message_on_focus
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#31157] imm32: Only generate 'WM_IME_SETCONTEXT' message if window has focus.
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/imm32/imm.c
|
||||
# |
|
||||
if test "$enable_imm32_message_on_focus" -eq 1; then
|
||||
patch_apply imm32-message_on_focus/0001-imm32-Only-generate-WM_IME_SETCONTEXT-message-if-win.patch
|
||||
fi
|
||||
|
||||
# Patchset include-winsock
|
||||
# |
|
||||
# | Modified files:
|
||||
@ -3954,6 +3896,20 @@ if test "$enable_winex11_Vulkan_support" -eq 1; then
|
||||
patch_apply winex11-Vulkan_support/0001-winex11-Specify-a-default-vulkan-driver-if-one-not-f.patch
|
||||
fi
|
||||
|
||||
# Patchset winex11-_NET_ACTIVE_WINDOW
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#2155] Forward activate window requests to WM using _NET_ACTIVE_WINDOW
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/user32/driver.c, dlls/user32/focus.c, dlls/user32/user_private.h, dlls/winex11.drv/event.c,
|
||||
# | dlls/winex11.drv/window.c, dlls/winex11.drv/winex11.drv.spec, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c
|
||||
# |
|
||||
if test "$enable_winex11__NET_ACTIVE_WINDOW" -eq 1; then
|
||||
patch_apply winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch
|
||||
patch_apply winex11-_NET_ACTIVE_WINDOW/0002-user32-Before-asking-a-WM-to-activate-a-window-make-.patch
|
||||
fi
|
||||
|
||||
# Patchset winex11-WM_WINDOWPOSCHANGING
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
|
@ -1 +1 @@
|
||||
6d307e2a647e71c21106feb0d62e371b3e55ab38
|
||||
0925a730272ed0c97f64c3365ebe542401f60d7c
|
||||
|
Loading…
Reference in New Issue
Block a user