summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2011-08-05 12:32:42 -0400
committerEitan Isaacson <eitan@monotonous.org>2011-08-12 09:19:41 +0200
commit1e6448d0c33462cf668563922cd22ab6f3e826eb (patch)
tree9d31bb6abffeb1adbbfc13e40c1752a820b9e1da /modules
parentde6517b8d1bf16ec9ee87aacc96adf2d8c836870 (diff)
downloadcaribou-1e6448d0c33462cf668563922cd22ab6f3e826eb.tar.gz
Use gdk_x11_display_get_user_time() instead of gtk_get_current_event_time()
XFocusChangeEvents don't have timestamps, so gtk_get_current_event_time() will return 0 inside the has-toplevel-focus notification handler. So use the last user interaction time instead.
Diffstat (limited to 'modules')
-rw-r--r--modules/gtk2/Makefile.am1
-rw-r--r--modules/gtk3/Makefile.am1
-rw-r--r--modules/gtk3/caribou-gtk-module.vala10
3 files changed, 11 insertions, 1 deletions
diff --git a/modules/gtk2/Makefile.am b/modules/gtk2/Makefile.am
index 2580827..f59aabd 100644
--- a/modules/gtk2/Makefile.am
+++ b/modules/gtk2/Makefile.am
@@ -9,6 +9,7 @@ libcaribou_gtk_module_la_SOURCES = \
libcaribou_gtk_module_la_VALAFLAGS = \
-h caribou-gtk-module.h \
--vapidir=. \
+ --pkg gdk-x11-2.0 \
--pkg gtk+-2.0 \
-D GTK2 \
$(VALAGLAFS)
diff --git a/modules/gtk3/Makefile.am b/modules/gtk3/Makefile.am
index c7a86f5..0f5aa1b 100644
--- a/modules/gtk3/Makefile.am
+++ b/modules/gtk3/Makefile.am
@@ -9,6 +9,7 @@ libcaribou_gtk_module_la_SOURCES = \
libcaribou_gtk_module_la_VALAFLAGS = \
-h caribou-gtk-module.h \
--vapidir=. \
+ --pkg gdk-x11-3.0 \
--pkg gtk+-3.0 \
$(VALAGLAFS)
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index 4441f97..bbbac05 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -12,10 +12,13 @@ namespace Caribou {
class GtkModule {
private GLib.HashTable<Gtk.Window, bool> windows;
private Keyboard keyboard;
+ private Gdk.Display display;
public GtkModule () {
windows = new GLib.HashTable<Gtk.Window, bool> (null, null);
try {
+ display = Gdk.Display.get_default ();
+
keyboard = Bus.get_proxy_sync (BusType.SESSION,
"org.gnome.Caribou.Keyboard",
"/org/gnome/Caribou/Keyboard");
@@ -58,7 +61,12 @@ namespace Caribou {
}
private void do_focus_change (Gtk.Widget? widget) {
- uint32 timestamp = Gtk.get_current_event_time ();
+#if GTK2
+ uint32 timestamp = Gdk.x11_display_get_user_time (display);
+#else
+ uint32 timestamp = Gdk.X11Display.get_user_time (display);
+#endif
+
if (widget != null && (widget is Gtk.Entry || widget is Gtk.TextView) && widget is Gtk.Editable) {
Gdk.Window current_window = widget.get_window ();
int x = 0, y = 0, w = 0, h = 0;