diff options
| author | Yuuki Harano | 2020-08-22 19:17:04 +0900 |
|---|---|---|
| committer | Jeff Walsh | 2020-11-24 12:24:40 +1100 |
| commit | 9704e23f4c2cd56bc8091e2024c7b972a3254bb7 (patch) | |
| tree | d950041d2c5244ba1910b46803fb2cb0e0b89653 /src | |
| parent | 6df8556ab71ef8ae38e52d770d56510da65a614e (diff) | |
| download | emacs-9704e23f4c2cd56bc8091e2024c7b972a3254bb7.tar.gz emacs-9704e23f4c2cd56bc8091e2024c7b972a3254bb7.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pgtkim.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/pgtkim.c b/src/pgtkim.c index 15088bc64d4..0ec931c4b1c 100644 --- a/src/pgtkim.c +++ b/src/pgtkim.c | |||
| @@ -210,27 +210,10 @@ pgtk_im_filter_keypress (struct frame *f, GdkEventKey * ev) | |||
| 210 | return false; | 210 | return false; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | void | 213 | static void |
| 214 | pgtk_im_init (struct pgtk_display_info *dpyinfo) | 214 | pgtk_im_use_context (struct pgtk_display_info *dpyinfo, bool use_p) |
| 215 | { | ||
| 216 | dpyinfo->im.context = NULL; | ||
| 217 | } | ||
| 218 | |||
| 219 | void | ||
| 220 | pgtk_im_finish (struct pgtk_display_info *dpyinfo) | ||
| 221 | { | ||
| 222 | if (dpyinfo->im.context != NULL) | ||
| 223 | g_object_unref (dpyinfo->im.context); | ||
| 224 | dpyinfo->im.context = NULL; | ||
| 225 | } | ||
| 226 | |||
| 227 | DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1, 2, 0, | ||
| 228 | doc: /* Set whether use Gtk's im context. */) | ||
| 229 | (Lisp_Object use_p, Lisp_Object terminal) | ||
| 230 | { | 215 | { |
| 231 | struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal); | 216 | if (!use_p) |
| 232 | |||
| 233 | if (NILP (use_p)) | ||
| 234 | { | 217 | { |
| 235 | if (dpyinfo->im.context != NULL) | 218 | if (dpyinfo->im.context != NULL) |
| 236 | { | 219 | { |
| @@ -269,6 +252,31 @@ DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1, 2, | |||
| 269 | pgtk_im_focus_in (dpyinfo->im.focused_frame); | 252 | pgtk_im_focus_in (dpyinfo->im.focused_frame); |
| 270 | } | 253 | } |
| 271 | } | 254 | } |
| 255 | } | ||
| 256 | |||
| 257 | void | ||
| 258 | pgtk_im_init (struct pgtk_display_info *dpyinfo) | ||
| 259 | { | ||
| 260 | dpyinfo->im.context = NULL; | ||
| 261 | |||
| 262 | pgtk_im_use_context (dpyinfo, !NILP (Vpgtk_use_im_context_on_new_connection)); | ||
| 263 | } | ||
| 264 | |||
| 265 | void | ||
| 266 | pgtk_im_finish (struct pgtk_display_info *dpyinfo) | ||
| 267 | { | ||
| 268 | if (dpyinfo->im.context != NULL) | ||
| 269 | g_object_unref (dpyinfo->im.context); | ||
| 270 | dpyinfo->im.context = NULL; | ||
| 271 | } | ||
| 272 | |||
| 273 | DEFUN ("pgtk-use-im-context", Fpgtk_use_im_context, Spgtk_use_im_context, 1, 2, 0, | ||
| 274 | doc: /* Set whether to use GtkIMContext. */) | ||
| 275 | (Lisp_Object use_p, Lisp_Object terminal) | ||
| 276 | { | ||
| 277 | struct pgtk_display_info *dpyinfo = check_pgtk_display_info (terminal); | ||
| 278 | |||
| 279 | pgtk_im_use_context (dpyinfo, !NILP (use_p)); | ||
| 272 | 280 | ||
| 273 | return Qnil; | 281 | return Qnil; |
| 274 | } | 282 | } |
| @@ -282,4 +290,10 @@ syms_of_pgtkim (void) | |||
| 282 | DEFSYM (Qul, "ul"); | 290 | DEFSYM (Qul, "ul"); |
| 283 | DEFSYM (Qfg, "fg"); | 291 | DEFSYM (Qfg, "fg"); |
| 284 | DEFSYM (Qbg, "bg"); | 292 | DEFSYM (Qbg, "bg"); |
| 293 | |||
| 294 | DEFVAR_LISP ("pgtk-use-im-context-on-new-connection", Vpgtk_use_im_context_on_new_connection, | ||
| 295 | doc: /* Whether to use GtkIMContext on a new connection. | ||
| 296 | If you want to change it after connection, use the `pgtk-use-im-context' | ||
| 297 | function. */ ); | ||
| 298 | Vpgtk_use_im_context_on_new_connection = Qt; | ||
| 285 | } | 299 | } |