Commit 3b68662a authored by Po Lu's avatar Po Lu
Browse files

Fix xwidgets with XInput 2 builds

* src/xwidget.c (Fmake_xwidget): Refrain from synthesizing
a focus event here on XI2 builds.
(Fxwidget_perform_lispy_event): Try to set embedder on XI2
builds and do nothing otherwise.
(synthesize_focus_in_event): Use focus_change.window as opposed
to any.window.
(x_draw_xwidget_glyph_string): Synthesize focus event here
instead on XI2 builds.
parent a3a3d3dd
Pipeline #14065 failed with stages
in 83 minutes and 21 seconds
......@@ -226,8 +226,9 @@ fails. */)
gtk_widget_show (xw->widget_osr);
gtk_widget_show (xw->widgetwindow_osr);
#ifndef HAVE_XINPUT2
synthesize_focus_in_event (xw->widgetwindow_osr);
g_signal_connect (G_OBJECT (gtk_widget_get_window (xw->widgetwindow_osr)),
"from-embedder", G_CALLBACK (from_embedder), NULL);
......@@ -326,6 +327,10 @@ selected frame is not an X-Windows frame. */)
GtkContainerClass *klass;
GtkWidget *widget;
GtkWidget *temp = NULL;
GdkWindow *embedder;
GdkWindow *osw;
......@@ -337,6 +342,16 @@ selected frame is not an X-Windows frame. */)
#ifdef USE_GTK
/* XI2 GDK devices crash if we try this without an embedder set. */
if (!f)
return Qnil;
osw = gtk_widget_get_window (xw->widgetwindow_osr);
embedder = gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f));
gdk_offscreen_window_set_embedder (osw, embedder);
widget = gtk_window_get_focus (GTK_WINDOW (xw->widgetwindow_osr));
if (!widget)
......@@ -1012,7 +1027,7 @@ synthesize_focus_in_event (GtkWidget *offscreen_window)
wnd = gtk_widget_get_window (offscreen_window);
focus_event = gdk_event_new (GDK_FOCUS_CHANGE);
focus_event->any.window = wnd;
focus_event->focus_change.window = wnd;
focus_event-> = TRUE;
......@@ -1781,6 +1796,11 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
record_osr_embedder (xv);
synthesize_focus_in_event (xww->widget_osr);
#ifdef USE_GTK
unblock_input ();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment