commit 26ab4aa
Michael Forney
·
2013-11-25 22:42:23 +0000 UTC
parent 974114c
Access bindings globals from swc struct
4 files changed,
+12,
-5
+4,
-1
1@@ -81,7 +81,10 @@ static bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
2 static const struct swc_keyboard_handler binding_handler = {
3 .key = &handle_key,
4 };
5-const struct swc_keyboard_handler * swc_binding_handler = &binding_handler;
6+
7+const struct swc_bindings_global swc_bindings_global = {
8+ .keyboard_handler = &binding_handler
9+};
10
11 bool swc_bindings_initialize()
12 {
+4,
-3
1@@ -26,9 +26,10 @@
2
3 #include <stdbool.h>
4
5-struct swc_keyboard_handler;
6-
7-extern const struct swc_keyboard_handler * swc_binding_handler;
8+struct swc_bindings_global
9+{
10+ const struct swc_keyboard_handler * keyboard_handler;
11+};
12
13 bool swc_bindings_initialize();
14 void swc_bindings_finalize();
+1,
-0
1@@ -32,6 +32,7 @@ struct swc
2
3 struct udev * udev;
4
5+ const struct swc_bindings_global * const bindings;
6 struct swc_compositor * compositor;
7 };
8
+3,
-1
1@@ -30,15 +30,17 @@
2
3 #include <libudev.h>
4
5+extern const struct swc_bindings_global swc_bindings_global;
6 static struct swc_compositor compositor;
7
8 struct swc swc = {
9+ .bindings = &swc_bindings_global,
10 .compositor = &compositor
11 };
12
13 static void setup_compositor()
14 {
15- compositor.seat.keyboard.handler = swc_binding_handler;
16+ compositor.seat.keyboard.handler = swc.bindings->keyboard_handler;
17 wl_signal_add(&compositor.seat.pointer.focus.event_signal,
18 swc_window_enter_listener);
19 }