[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pgtk 9704e23 081/100: Enable GtkIMContext by default
From: |
Yuuki Harano |
Subject: |
feature/pgtk 9704e23 081/100: Enable GtkIMContext by default |
Date: |
Tue, 24 Nov 2020 08:02:42 -0500 (EST) |
branch: feature/pgtk
commit 9704e23f4c2cd56bc8091e2024c7b972a3254bb7
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Jeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>
Enable GtkIMContext by default
* lisp/term/pgtk-win.el: Call pgtk-use-im-context after init.
* src/pgtkim.c (pgtk_im_use_context): New function.
(pgtk_im_init): Call pgtk_im_use_context.
(Fpgtk_use_im_context): Call pgtk_im_use_context.
(syms_of_pgtkim): New variable Vpgtk_use_im_context_on_new_connection.
---
lisp/term/pgtk-win.el | 8 ++++++++
src/pgtkim.c | 54 ++++++++++++++++++++++++++++++++-------------------
2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el
index 4598ba0..a41d3a3 100644
--- a/lisp/term/pgtk-win.el
+++ b/lisp/term/pgtk-win.el
@@ -398,6 +398,14 @@ See the documentation of
`create-fontset-from-fontset-spec' for the format.")
(overlay-put ov 'before-string ovstr)
(setq pgtk-preedit-overlay ov)))
+
+(add-hook 'after-init-hook
+ (function
+ (lambda ()
+ (when (eq window-system 'pgtk)
+ (pgtk-use-im-context pgtk-use-im-context-on-new-connection)))))
+
+
(provide 'pgtk-win)
(provide 'term/pgtk-win)
diff --git a/src/pgtkim.c b/src/pgtkim.c
index 15088bc..0ec931c 100644
--- a/src/pgtkim.c
+++ b/src/pgtkim.c
@@ -210,27 +210,10 @@ pgtk_im_filter_keypress (struct frame *f, GdkEventKey *
ev)
return false;
}
-void
-pgtk_im_init (struct pgtk_display_info *dpyinfo)
-{
- dpyinfo->im.context = NULL;
-}
-
-void
-pgtk_im_finish (struct pgtk_display_info *dpyinfo)
-{
- if (dpyinfo->im.context != NULL)
- g_object_unref (dpyinfo->im.context);
- dpyinfo->im.context = NULL;
-}
-
-DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1,
2, 0,
- doc: /* Set whether use Gtk's im context. */)
- (Lisp_Object use_p, Lisp_Object terminal)
+static void
+pgtk_im_use_context (struct pgtk_display_info *dpyinfo, bool use_p)
{
- struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
-
- if (NILP (use_p))
+ if (!use_p)
{
if (dpyinfo->im.context != NULL)
{
@@ -269,6 +252,31 @@ DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context,
Spgtk_use_im_context, 1, 2,
pgtk_im_focus_in (dpyinfo->im.focused_frame);
}
}
+}
+
+void
+pgtk_im_init (struct pgtk_display_info *dpyinfo)
+{
+ dpyinfo->im.context = NULL;
+
+ pgtk_im_use_context (dpyinfo, !NILP
(Vpgtk_use_im_context_on_new_connection));
+}
+
+void
+pgtk_im_finish (struct pgtk_display_info *dpyinfo)
+{
+ if (dpyinfo->im.context != NULL)
+ g_object_unref (dpyinfo->im.context);
+ dpyinfo->im.context = NULL;
+}
+
+DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1,
2, 0,
+ doc: /* Set whether to use GtkIMContext. */)
+ (Lisp_Object use_p, Lisp_Object terminal)
+{
+ struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal);
+
+ pgtk_im_use_context (dpyinfo, !NILP (use_p));
return Qnil;
}
@@ -282,4 +290,10 @@ syms_of_pgtkim (void)
DEFSYM (Qul, "ul");
DEFSYM (Qfg, "fg");
DEFSYM (Qbg, "bg");
+
+ DEFVAR_LISP ("pgtk-use-im-context-on-new-connection",
Vpgtk_use_im_context_on_new_connection,
+ doc: /* Whether to use GtkIMContext on a new connection.
+If you want to change it after connection, use the `pgtk-use-im-context'
+function. */ );
+ Vpgtk_use_im_context_on_new_connection = Qt;
}
- feature/pgtk 9e56fa9 034/100: Support focus on click event, (continued)
- feature/pgtk 9e56fa9 034/100: Support focus on click event, Yuuki Harano, 2020/11/24
- feature/pgtk 385e85c 038/100: End Resize flickering by copying surface rather than just clearing, Yuuki Harano, 2020/11/24
- feature/pgtk cbd28cd 046/100: improve code readability., Yuuki Harano, 2020/11/24
- feature/pgtk ef67659 045/100: Set screen/display dpi res to make broadway work as expected, Yuuki Harano, 2020/11/24
- feature/pgtk d109dab 059/100: * src/pgtkfns.c: change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk 9eb35f9 033/100: experimental support of tab-bar., Yuuki Harano, 2020/11/24
- feature/pgtk 25cf592 067/100: Change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk e7190d8 075/100: Fix non-English layout does not work, Yuuki Harano, 2020/11/24
- feature/pgtk 28073ba 083/100: Re-implement childframe with emacsgtkfixed, Yuuki Harano, 2020/11/24
- feature/pgtk 6c43496 074/100: Fix font lock is not applied on continued lines, Yuuki Harano, 2020/11/24
- feature/pgtk 9704e23 081/100: Enable GtkIMContext by default,
Yuuki Harano <=
- feature/pgtk b60d4c9 086/100: Fix crash on creating child frames., Yuuki Harano, 2020/11/24
- feature/pgtk b1b7440 098/100: Work around gtk_im_context_filter_keypress() issue with super key, Yuuki Harano, 2020/11/24
- feature/pgtk 992ef48 041/100: update redisplay_interface., Yuuki Harano, 2020/11/24
- feature/pgtk 232c129 035/100: implement pre-edit input method, Yuuki Harano, 2020/11/24
- feature/pgtk 984f9cc 050/100: restore frame_rehighlight_hook., Yuuki Harano, 2020/11/24
- feature/pgtk 51462ce 078/100: Add PGTK to system-configuration-features, Yuuki Harano, 2020/11/24
- feature/pgtk 7c8da33 084/100: Exclude Xlib's modifier keys, Yuuki Harano, 2020/11/24
- feature/pgtk 2d5ffa5 076/100: Make pointer visible when motion notify event, Yuuki Harano, 2020/11/24
- feature/pgtk 2dd20b2 079/100: Self-implement tooltip, Yuuki Harano, 2020/11/24
- feature/pgtk e75ce03 082/100: Add support for x-support-frames, Yuuki Harano, 2020/11/24