Commit ae678cf9 authored by Dan Winship's avatar Dan Winship

caribou-gtk-module: don't add the event filter until the dbus call finishes

event_filter() assumes that the D-Bus handle to the keyboard has been
initialized (and will crash if it's null), so don't set up the event
filter until after the async call returns.

https://bugzilla.gnome.org/show_bug.cgi?id=658063
parent b90526c5
......@@ -21,8 +21,6 @@ namespace Caribou {
Bus.get_proxy.begin<Keyboard> (BusType.SESSION, "org.gnome.Caribou.Keyboard",
"/org/gnome/Caribou/Keyboard", 0, null, callback);
Gdk.window_add_filter (null, event_filter);
}
private void callback (GLib.Object? obj, GLib.AsyncResult res) {
......@@ -31,7 +29,19 @@ namespace Caribou {
}
catch (Error e) {
stderr.printf ("%s\n", e.message);
}
return;
}
Gdk.window_add_filter (null, event_filter);
// Something might already be focused
GLib.List<weak Gtk.Window> toplevels = Gtk.Window.list_toplevels();
foreach (weak Gtk.Window w in toplevels) {
if (w.has_toplevel_focus) {
do_focus_change (w.get_focus ());
break;
}
}
}
private Gdk.FilterReturn event_filter (Gdk.XEvent xevent, Gdk.Event evt) {
......
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