From: Po Lu Date: Mon, 10 Jan 2022 01:00:48 +0000 (+0800) Subject: Fix build without X11 I18N X-Git-Tag: emacs-29.0.90~3166 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8d0a2e4dce41fd811319e94e5f01e5fcf8b3c62a;p=emacs.git Fix build without X11 I18N * src/xterm.c (event_handler_gdk): (handle_one_xevent): (x_draw_window_cursor): (x_term_init): Fix build without HAVE_X_I18N. --- diff --git a/src/xterm.c b/src/xterm.c index 36b245ddc35..5e4941a4aed 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -194,8 +194,10 @@ static int x_noop_count; static Lisp_Object xg_default_icon_file; #endif +#ifdef HAVE_X_I18N /* Some functions take this as char *, not const char *. */ static char emacs_class[] = EMACS_CLASS; +#endif enum xembed_info { @@ -8333,6 +8335,38 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) unblock_input (); return GDK_FILTER_REMOVE; } +#elif USE_GTK + if (dpyinfo && (dpyinfo->prefer_native_input + || x_gtk_use_native_input) + && (xev->type == KeyPress +#ifdef HAVE_XINPUT2 + /* GTK claims cookies for us, so we don't have to claim + them here. */ + || (dpyinfo->supports_xi2 + && xev->type == GenericEvent + && (xev->xgeneric.extension + == dpyinfo->xi2_opcode) + && (xev->xgeneric.evtype + == XI_KeyPress)) +#endif + )) + { + struct frame *f; + +#ifdef HAVE_XINPUT2 + if (xev->type == GenericEvent) + f = x_any_window_to_frame (dpyinfo, + ((XIDeviceEvent *) xev->xcookie.data)->event); + else +#endif + f = x_any_window_to_frame (dpyinfo, xev->xany.window); + + if (f && xg_filter_key (f, xev)) + { + unblock_input (); + return GDK_FILTER_REMOVE; + } + } #endif if (! dpyinfo) @@ -10727,6 +10761,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto XI_OTHER; #endif + x_display_set_last_user_time (dpyinfo, xev->time); + ignore_next_mouse_click_timeout = 0; + + f = x_any_window_to_frame (dpyinfo, xev->event); + XKeyPressedEvent xkey; memset (&xkey, 0, sizeof xkey); @@ -10761,6 +10800,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto XI_OTHER; } #endif +#elif USE_GTK + if ((x_gtk_use_native_input + || dpyinfo->prefer_native_input) + && xg_filter_key (any, event)) + { + *finish = X_EVENT_DROP; + goto XI_OTHER; + } #endif #ifdef HAVE_XKB @@ -10793,11 +10840,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (keysym == NoSymbol) goto XI_OTHER; - x_display_set_last_user_time (dpyinfo, xev->time); - ignore_next_mouse_click_timeout = 0; - - f = x_any_window_to_frame (dpyinfo, xev->event); - /* If mouse-highlight is an integer, input clears out mouse highlighting. */ if (!hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight) @@ -11754,7 +11796,9 @@ x_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) { +#ifdef HAVE_X_I18N struct frame *f = XFRAME (WINDOW_FRAME (w)); +#endif if (on_p) { @@ -15353,13 +15397,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) #endif } +#ifdef HAVE_X_I18N { AUTO_STRING (inputStyle, "inputStyle"); AUTO_STRING (InputStyle, "InputStyle"); Lisp_Object value = gui_display_get_resource (dpyinfo, inputStyle, InputStyle, Qnil, Qnil); -#ifdef HAVE_X_I18N if (STRINGP (value)) { if (!strcmp (SSDATA (value), "callback")) @@ -15377,8 +15421,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->prefer_native_input = true; #endif } -#endif } +#endif #ifdef HAVE_X_SM /* Only do this for the very first display in the Emacs session.