static void x_scroll_bar_end_update (struct x_display_info *, struct scroll_bar *);
#endif
+#ifdef HAVE_X_I18N
+static int x_filter_event (struct x_display_info *, XEvent *);
+#endif
+
static bool x_dnd_in_progress;
static bool x_dnd_waiting_for_finish;
static Window x_dnd_pending_finish_target;
static int x_dnd_n_targets;
static struct frame *x_dnd_frame;
static XWindowAttributes x_dnd_old_window_attrs;
-static XIC x_dnd_old_ic;
static bool x_dnd_unwind_flag;
#define X_DND_SUPPORTED_VERSION 5
#ifdef USE_GTK
current_hold_quit = NULL;
#endif
-#ifdef HAVE_X_I18N
- FRAME_XIC (f) = x_dnd_old_ic;
-#endif
block_input ();
/* Restore the old event mask. */
#ifndef USE_GTK
XEvent next_event;
int finish;
-#endif
-#ifdef HAVE_X_I18N
- XIC ic = FRAME_XIC (f);
#endif
XWindowAttributes root_window_attrs;
| SubstructureNotifyMask
| PropertyChangeMask);
-#ifdef HAVE_X_I18N
- /* Make sure no events get filtered when XInput 2 is enabled.
- Otherwise, the ibus XIM server gets very confused. */
- FRAME_XIC (f) = NULL;
-#endif
while (x_dnd_in_progress || x_dnd_waiting_for_finish)
{
hold_quit.kind = NO_EVENT;
#ifndef USE_GTK
XNextEvent (FRAME_X_DISPLAY (f), &next_event);
+#ifdef HAVE_X_I18N
+#ifdef HAVE_XINPUT2
+ if (next_event.type != GenericEvent
+ || !FRAME_DISPLAY_INFO (f)->supports_xi2
+ || (next_event.xgeneric.extension
+ != FRAME_DISPLAY_INFO (f)->xi2_opcode))
+ {
+#endif
+ if (!x_filter_event (FRAME_DISPLAY_INFO (f), &next_event))
+ handle_one_xevent (FRAME_DISPLAY_INFO (f),
+ &next_event, &finish, &hold_quit);
+#ifdef HAVE_XINPUT2
+ }
+ else
+ handle_one_xevent (FRAME_DISPLAY_INFO (f),
+ &next_event, &finish, &hold_quit);
+#endif
+#else
handle_one_xevent (FRAME_DISPLAY_INFO (f),
&next_event, &finish, &hold_quit);
+#endif
#else
gtk_main_iteration ();
#endif
{
if (hold_quit.kind == SELECTION_REQUEST_EVENT)
{
- x_dnd_old_ic = ic;
x_dnd_old_window_attrs = root_window_attrs;
x_dnd_unwind_flag = true;
FRAME_DISPLAY_INFO (f)->grabbed = 0;
#ifdef USE_GTK
current_hold_quit = NULL;
-#endif
-#ifdef HAVE_X_I18N
- FRAME_XIC (f) = ic;
#endif
/* Restore the old event mask. */
XSelectInput (FRAME_X_DISPLAY (f),
quit ();
}
}
-#ifdef HAVE_X_I18N
- FRAME_XIC (f) = ic;
-#endif
x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
f1 = x_any_window_to_frame (dpyinfo,
event->xclient.window);
- if (x_dnd_in_progress || x_dnd_waiting_for_finish)
- return 0;
-
#ifdef USE_GTK
if (!x_gtk_use_native_input
&& !dpyinfo->prefer_native_input)
#ifdef HAVE_X_I18N
/* Filter events for the current X input method. */
#ifdef HAVE_XINPUT2
- if (event.type != GenericEvent)
+ if (event.type != GenericEvent
+ || !dpyinfo->supports_xi2
+ || event.xgeneric.extension != dpyinfo->xi2_opcode)
{
/* Input extension key events are filtered inside
handle_one_xevent. */