summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2011-09-02 11:00:15 -0400
committerDan Winship <danw@gnome.org>2011-09-15 12:35:48 -0400
commitae678cf9a39239eaa508dad9c8eb068cfae1d06c (patch)
tree045c3cccd0ca877e9a981aa624f87c0487987e95 /modules
parentb90526c57e3967a802c77e72f5cabbc1dda96f46 (diff)
downloadcaribou-ae678cf9a39239eaa508dad9c8eb068cfae1d06c.tar.gz
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
Diffstat (limited to 'modules')
-rw-r--r--modules/gtk3/caribou-gtk-module.vala16
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index 17ef41b..a33f1a0 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -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) {