Module: wine
Branch: master
Commit: b3fbc16feaf4119be9ce7f20848995fb2388f489
URL: https://gitlab.winehq.org/wine/wine/-/commit/b3fbc16feaf4119be9ce7f20848995…
Author: Rémi Bernon <rbernon(a)codeweavers.com>
Date: Fri May 12 07:45:40 2023 +0200
winemac: Use the default IME implementation for ImeSelect.
---
dlls/imm32/ime.c | 18 ++++++-
dlls/winemac.drv/Makefile.in | 1 -
dlls/winemac.drv/ime.c | 99 ---------------------------------------
dlls/winemac.drv/winemac.drv.spec | 3 --
4 files changed, 17 insertions(+), 104 deletions(-)
diff --git a/dlls/imm32/ime.c b/dlls/imm32/ime.c
index c10db8958f7..f5799440709 100644
--- a/dlls/imm32/ime.c
+++ b/dlls/imm32/ime.c
@@ -433,7 +433,23 @@ BOOL WINAPI ImeDestroy( UINT force )
BOOL WINAPI ImeSelect( HIMC himc, BOOL select )
{
- FIXME( "himc %p, select %d semi-stub!\n", himc, select );
+ struct ime_private *priv;
+ INPUTCONTEXT *ctx;
+
+ TRACE( "himc %p, select %u\n", himc, select );
+
+ if (!himc || !select) return TRUE;
+ if (!(ctx = ImmLockIMC( himc ))) return FALSE;
+
+ ImmSetOpenStatus( himc, FALSE );
+
+ if ((priv = ImmLockIMCC( ctx->hPrivate )))
+ {
+ memset( priv, 0, sizeof(*priv) );
+ ImmUnlockIMCC( ctx->hPrivate );
+ }
+
+ ImmUnlockIMC( himc );
return TRUE;
}
diff --git a/dlls/winemac.drv/Makefile.in b/dlls/winemac.drv/Makefile.in
index 9735890b221..7228dfbac4f 100644
--- a/dlls/winemac.drv/Makefile.in
+++ b/dlls/winemac.drv/Makefile.in
@@ -12,7 +12,6 @@ C_SRCS = \
event.c \
gdi.c \
image.c \
- ime.c \
keyboard.c \
macdrv_main.c \
mouse.c \
diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c
deleted file mode 100644
index fa8b300d371..00000000000
--- a/dlls/winemac.drv/ime.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * The IME for interfacing with Mac input methods
- *
- * Copyright 2008, 2013 CodeWeavers, Aric Stewart
- * Copyright 2013 Ken Thomases for CodeWeavers Inc.
- *
- * 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
- */
-
-/*
- * Notes:
- * The normal flow for IMM/IME Processing is as follows.
- * 1) The Keyboard Driver generates key messages which are first passed to
- * the IMM and then to IME via ImeProcessKey. If the IME returns 0 then
- * it does not want the key and the keyboard driver then generates the
- * WM_KEYUP/WM_KEYDOWN messages. However if the IME is going to process the
- * key it returns non-zero.
- * 2) If the IME is going to process the key then the IMM calls ImeToAsciiEx to
- * process the key. the IME modifies the HIMC structure to reflect the
- * current state and generates any messages it needs the IMM to process.
- * 3) IMM checks the messages and send them to the application in question. From
- * here the IMM level deals with if the application is IME aware or not.
- */
-
-#include "macdrv_dll.h"
-#include "imm.h"
-#include "immdev.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(imm);
-
-static void GenerateIMEMessage(HIMC hIMC, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- LPINPUTCONTEXT lpIMC;
- LPTRANSMSG lpTransMsg;
-
- lpIMC = ImmLockIMC(hIMC);
- if (lpIMC == NULL)
- return;
-
- lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf, (lpIMC->dwNumMsgBuf + 1) * sizeof(TRANSMSG));
- if (!lpIMC->hMsgBuf)
- return;
-
- lpTransMsg = ImmLockIMCC(lpIMC->hMsgBuf);
- if (!lpTransMsg)
- return;
-
- lpTransMsg += lpIMC->dwNumMsgBuf;
- lpTransMsg->message = msg;
- lpTransMsg->wParam = wParam;
- lpTransMsg->lParam = lParam;
-
- ImmUnlockIMCC(lpIMC->hMsgBuf);
- lpIMC->dwNumMsgBuf++;
-
- ImmGenerateMessage(hIMC);
- ImmUnlockIMC(hIMC);
-}
-
-BOOL WINAPI ImeSelect(HIMC hIMC, BOOL fSelect)
-{
- LPINPUTCONTEXT lpIMC;
- TRACE("%p %s\n", hIMC, fSelect ? "TRUE" : "FALSE");
-
- if (!hIMC || !fSelect) return TRUE;
-
- /* Initialize our structures */
- lpIMC = ImmLockIMC(hIMC);
- if (lpIMC != NULL)
- {
- LPIMEPRIVATE myPrivate;
- myPrivate = ImmLockIMCC(lpIMC->hPrivate);
- if (myPrivate->bInComposition)
- GenerateIMEMessage(hIMC, WM_IME_ENDCOMPOSITION, 0, 0);
- if (myPrivate->bInternalState)
- ImmSetOpenStatus( hIMC, FALSE );
- myPrivate->bInComposition = FALSE;
- myPrivate->bInternalState = FALSE;
- myPrivate->textfont = NULL;
- myPrivate->hwndDefault = NULL;
- ImmUnlockIMCC(lpIMC->hPrivate);
- ImmUnlockIMC(hIMC);
- }
-
- return TRUE;
-}
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index 68bebc794aa..5f086f5c4e5 100644
--- a/dlls/winemac.drv/winemac.drv.spec
+++ b/dlls/winemac.drv/winemac.drv.spec
@@ -1,5 +1,2 @@
# System tray
@ cdecl wine_notify_icon(long ptr)
-
-# IME
-@ stdcall ImeSelect(long long)