GNU bug report logs -
#46180
Patch to fix input method cursor location for the feature/pgtk branch
Previous Next
Reported by: Yichao Yu <yyc1992 <at> gmail.com>
Date: Fri, 29 Jan 2021 19:48:02 UTC
Severity: normal
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46180 in the body.
You can then email your comments to 46180 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46180
; Package
emacs
.
(Fri, 29 Jan 2021 19:48:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yichao Yu <yyc1992 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 29 Jan 2021 19:48:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
See patch attached below. The pgtk branch carried over some old XIM
code that isn't valid in such configuration. This makes sure the gtk
immodule can get the correct cursor location.
I guess this does mean that the patch I submitted a few months ago to
fix/improve XIM usage would not be useful for much longer but
hopefully it's for the better =).
-----------------------------------
From be5764d617b2a5fe3b26ddab1e739dad6d393825 Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992 <at> gmail.com>
Date: Fri, 29 Jan 2021 14:38:53 -0500
Subject: [PATCH] Add support for setting cursor location using Gtk IM Context
The existing XIC implementation doesn't work when using Gtk IM Context.
Instead, `gtk_im_context_set_cursor_location` should be used
to update the cursor information for the input method.
Tested with fcitx5.
---
src/pgtkim.c | 12 ++++++++++++
src/pgtkterm.c | 12 ++++++++----
src/pgtkterm.h | 2 ++
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/pgtkim.c b/src/pgtkim.c
index 68f83d2c6e..ba69a27501 100644
--- a/src/pgtkim.c
+++ b/src/pgtkim.c
@@ -210,6 +210,18 @@ pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev)
return false;
}
+void
+pgtk_im_set_cursor_location (struct frame *f, int x, int y, int width,
+ int height)
+{
+ struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+ if (dpyinfo->im.context != NULL && dpyinfo->im.focused_frame == f)
+ {
+ GdkRectangle area = { x, y, width, height };
+ gtk_im_context_set_cursor_location (dpyinfo->im.context, &area);
+ }
+}
+
static void
pgtk_im_use_context (struct pgtk_display_info *dpyinfo, bool use_p)
{
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 44e1f3e296..7d46053d31 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -2878,6 +2878,7 @@ pgtk_draw_window_cursor (struct window *w,
struct glyph_row *glyph_row,
int x,
int y, enum text_cursor_kinds cursor_type,
int cursor_width, bool on_p, bool active_p)
{
+ struct frame *f = XFRAME (w->frame);
PGTK_TRACE ("draw_window_cursor: %d, %d, %d, %d, %d, %d.",
x, y, cursor_type, cursor_width, on_p, active_p);
if (on_p)
@@ -2922,11 +2923,14 @@ pgtk_draw_window_cursor (struct window *w,
struct glyph_row *glyph_row
, int x,
}
}
-#ifdef HAVE_X_I18N
if (w == XWINDOW (f->selected_window))
- if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
- xic_set_preeditarea (w, x, y);
-#endif
+ {
+ int frame_x =
+ WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w);
+ int frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, y);
+ pgtk_im_set_cursor_location (f, frame_x, frame_y,
w->phys_cursor_width,
+ w->phys_cursor_height);
+ }
}
}
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 5e71f93998..07d7fc10c6 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -653,6 +653,8 @@ #define FIRST_CHAR_POSITION(f)
\
extern void pgtk_im_focus_in (struct frame *f);
extern void pgtk_im_focus_out (struct frame *f);
extern bool pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev);
+extern void pgtk_im_set_cursor_location (struct frame *f, int x, int y,
+ int width, int height);
extern void pgtk_im_init (struct pgtk_display_info *dpyinfo);
extern void pgtk_im_finish (struct pgtk_display_info *dpyinfo);
--
2.30.0
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46180
; Package
emacs
.
(Sat, 30 Jan 2021 16:14:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 46180 <at> debbugs.gnu.org (full text, mbox):
Thank you for the patch.
I tried it. It seems to be good, and I pushed it.
--
Yuuki Harano
Reply sent
to
Stefan Kangas <stefan <at> marxist.se>
:
You have taken responsibility.
(Wed, 21 Apr 2021 03:21:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yichao Yu <yyc1992 <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 21 Apr 2021 03:21:03 GMT)
Full text and
rfc822 format available.
Message #13 received at 46180-done <at> debbugs.gnu.org (full text, mbox):
Yuuki Harano <masm+github <at> masm11.me> writes:
> Thank you for the patch.
>
> I tried it. It seems to be good, and I pushed it.
This seems to have been pushed. I'm therefore closing this bug report.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 19 May 2021 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 334 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.