[gtk/gtk-3-24: 1/2] Win32 IME: Use CFS_EXCLUDE to specify cursor position
- From: Luca Bacci <lbacci src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] Win32 IME: Use CFS_EXCLUDE to specify cursor position
- Date: Mon, 21 Feb 2022 13:36:22 +0000 (UTC)
commit ed08a4e929b0bc97d5e39c6870686d6cc561880d
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Feb 19 17:26:09 2022 +0100
Win32 IME: Use CFS_EXCLUDE to specify cursor position
That mode of operation requires an exclude rectangle, which maps
better to the info provided on gtk_im_context_set_cursor_location(),
coincidentally also fixes the offset seen on the IME preedit window.
https://gitlab.gnome.org/GNOME/gtk/-/issues/374
https://bugzilla.gnome.org/show_bug.cgi?id=663096
modules/input/gtkimcontextime.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/modules/input/gtkimcontextime.c b/modules/input/gtkimcontextime.c
index 8973b70113..30c56c59cd 100644
--- a/modules/input/gtkimcontextime.c
+++ b/modules/input/gtkimcontextime.c
@@ -942,25 +942,18 @@ gtk_im_context_ime_message_filter (GdkXEvent *xevent,
{
gint wx = 0, wy = 0;
CANDIDATEFORM cf;
- guint scale = gdk_window_get_scale_factor (context_ime->client_window);
+ gint scale = gdk_window_get_scale_factor (context_ime->client_window);
get_window_position (context_ime->client_window, &wx, &wy);
- /* FIXME! */
- {
- POINT pt;
- RECT rc;
- GetWindowRect (hwnd, &rc);
- pt.x = wx * scale;
- pt.y = wy * scale;
- ClientToScreen (hwnd, &pt);
- wx = (pt.x - rc.left) / scale;
- wy = (pt.y - rc.top) / scale;
- }
+
cf.dwIndex = 0;
- cf.dwStyle = CFS_CANDIDATEPOS;
+ cf.dwStyle = CFS_EXCLUDE;
cf.ptCurrentPos.x = (wx + context_ime->cursor_location.x) * scale;
- cf.ptCurrentPos.y = (wy + context_ime->cursor_location.y
- + context_ime->cursor_location.height) * scale;
+ cf.ptCurrentPos.y = (wy + context_ime->cursor_location.y) * scale;
+ cf.rcArea.left = (wx + context_ime->cursor_location.x) * scale;
+ cf.rcArea.right = (wx + context_ime->cursor_location.x + context_ime->cursor_location.width) * scale;
+ cf.rcArea.top = (wy + context_ime->cursor_location.y) * scale;
+ cf.rcArea.bottom = (wy + context_ime->cursor_location.y + context_ime->cursor_location.height) *
scale;
ImmSetCandidateWindow (himc, &cf);
if ((msg->lParam & GCS_COMPSTR))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]