[PATCH] Revert "Get rid of getkbdevice"

From: Nick White <git_AT_njw.name>
Date: Thu, 18 Aug 2016 10:14:56 +0100

This reverts commit f9714ab838e362a74e02916317cf22ef0ebdcdb6.

That commit bumped the minimum version requirement of GTK to 3.20,
which was released on 2016-03-21.

Conflicts:
        surf.c
---
 surf.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/surf.c b/surf.c
index 29b9ede..e8ccaa6 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -174,6 +174,7 @@ static void destroyclient(Client *c);
 static void cleanup(void);
 
 /* GTK/WebKit */
+static GdkDevice *getkbdevice(void);
 static WebKitWebView *newview(Client *c, WebKitWebView *rv);
 static GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a,
                              Client *c);
_AT_@ -287,7 +288,7 @@ setup(void)
 	scriptfile = buildfile(scriptfile);
 	cachedir   = buildpath(cachedir);
 
-	gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
+	gdkkb = getkbdevice();
 
 	if (!stylefile) {
 		styledir = buildpath(styledir);
_AT_@ -902,6 +903,22 @@ cleanup(void)
 	g_free(cachedir);
 }
 
+static GdkDevice *
+getkbdevice(void)
+{
+	GList *l, *gdl = gdk_device_manager_list_devices(
+	           gdk_display_get_device_manager(gdk_display_get_default()),
+		   GDK_DEVICE_TYPE_MASTER);
+	GdkDevice *gd = NULL;
+
+	for (l = gdl; l != NULL; l = l->next)
+		if (gdk_device_get_source(l->data) == GDK_SOURCE_KEYBOARD)
+			gd = l->data;
+
+	g_list_free(gdl);
+	return gd;
+}
+
 WebKitWebView *
 newview(Client *c, WebKitWebView *rv)
 {
-- 
2.1.4
--k1lZvvs/B4yU6o8G--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 18 2016 - 12:36:13 CEST