The webkit2 branch of surf recently started using a function that 
requires GTK 3.20+, which was only released on 2016-03-21. I'm 
running Debian Jessie, which means it would be rather non-trivial to 
install such a version, so I'd prefer that the old method is used 
instead.

This patch reverts that commit, and surf is now buildable again on 
my system with GTK 3.14. Whether you want to take this patch 
upstream, I don't know, but it's here if you do.

Nick
>From 908b464eb8a8871125a52e565cd4d02b6cd8f54c Mon Sep 17 00:00:00 2001
From: Nick White <[email protected]>
Date: Thu, 18 Aug 2016 10:14:56 +0100
Subject: [PATCH] Revert "Get rid of getkbdevice"

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
@@ -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);
@@ -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);
@@ -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

Reply via email to