commit 166eccd

Michael Forney  ·  2013-11-26 02:05:56 +0000 UTC
parent 873a3bc
Move compositor pointer_handler to compositor struct
2 files changed,  +8, -6
+5, -6
 1@@ -181,11 +181,6 @@ static bool handle_motion(struct swc_pointer * pointer, uint32_t time)
 2     return false;
 3 }
 4 
 5-struct swc_pointer_handler pointer_handler = {
 6-    .focus = &handle_focus,
 7-    .motion = &handle_motion
 8-};
 9-
10 static void handle_drm_event(struct wl_listener * listener, void * data)
11 {
12     struct swc_event * event = data;
13@@ -321,6 +316,10 @@ bool swc_compositor_initialize(struct swc_compositor * compositor,
14     compositor->compositor_class.interface
15         = &swc_compositor_class_implementation;
16     compositor->cursor_class.interface = &swc_cursor_class_implementation;
17+    compositor->pointer_handler = (struct swc_pointer_handler) {
18+        .focus = &handle_focus,
19+        .motion = &handle_motion
20+    };
21 
22     /* TODO: configurable seat */
23     if (!swc_seat_initialize(&compositor->seat, default_seat))
24@@ -330,7 +329,7 @@ bool swc_compositor_initialize(struct swc_compositor * compositor,
25     }
26 
27     swc_seat_add_event_sources(&compositor->seat, event_loop);
28-    compositor->seat.pointer.handler = &pointer_handler;
29+    compositor->seat.pointer.handler = &compositor->pointer_handler;
30     wl_signal_add(&compositor->seat.pointer.event_signal,
31                   &compositor->pointer_listener);
32 
+3, -0
 1@@ -2,6 +2,7 @@
 2 #define SWC_COMPOSITOR_H
 3 
 4 #include "drm.h"
 5+#include "pointer.h"
 6 #include "seat.h"
 7 #include "renderer.h"
 8 
 9@@ -36,6 +37,8 @@ struct swc_compositor
10     struct swc_surface_class compositor_class;
11     struct swc_surface_class cursor_class;
12 
13+    struct swc_pointer_handler pointer_handler;
14+
15     struct wl_listener drm_listener;
16     struct wl_listener pointer_listener;
17