summaryrefslogtreecommitdiff
path: root/network/surf/getkbdevice.diff
blob: 14bef9460d1fc2e3f94fada231f971d8ef89098e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff -Naur surf-2.0/surf.c surf-2.0.patched/surf.c
--- surf-2.0/surf.c	2017-03-28 12:17:45.000000000 -0400
+++ surf-2.0.patched/surf.c	2017-06-25 01:23:41.445168316 -0400
@@ -174,6 +174,7 @@
 static void cleanup(void);
 
 /* GTK/WebKit */
+static GdkDevice *getkbdevice(void);
 static WebKitWebView *newview(Client *c, WebKitWebView *rv);
 static void initwebextensions(WebKitWebContext *wc, Client *c);
 static GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a,
@@ -263,7 +264,6 @@
 void
 setup(void)
 {
-	GdkDisplay *gdpy;
 	int i, j;
 
 	/* clean up any zombies immediately */
@@ -281,8 +281,6 @@
 
 	gtk_init(NULL, NULL);
 
-	gdpy = gdk_display_get_default();
-
 	curconfig = defconfig;
 
 	/* dirs and files */
@@ -290,7 +288,7 @@
 	scriptfile = buildfile(scriptfile);
 	cachedir   = buildpath(cachedir);
 
-	gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
+	gdkkb = getkbdevice();
 
 	if (!stylefile) {
 		styledir = buildpath(styledir);
@@ -329,6 +327,23 @@
 	}
 }
 
+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;
+}
+
+
 void
 sigchld(int unused)
 {