commit 94a8b91

Michael Forney  ·  2014-02-08 11:57:03 +0000 UTC
parent 78ae79d
pointer: Remove focus method from handler
3 files changed,  +5, -13
+5, -9
 1@@ -88,12 +88,10 @@ struct view
 2     struct wl_list link;
 3 };
 4 
 5-static void handle_focus(struct swc_pointer * pointer);
 6 static bool handle_motion(struct swc_pointer * pointer, uint32_t time);
 7 static void perform_update(void * data);
 8 
 9 static const struct swc_pointer_handler pointer_handler = {
10-    .focus = &handle_focus,
11     .motion = &handle_motion
12 };
13 
14@@ -761,9 +759,10 @@ static void perform_update(void * data)
15     compositor.updating = false;
16 }
17 
18-void handle_focus(struct swc_pointer * pointer)
19+bool handle_motion(struct swc_pointer * pointer, uint32_t time)
20 {
21     struct view * view;
22+    struct swc_surface * surface = NULL;
23     int32_t x, y;
24 
25     wl_list_for_each(view, &compositor.views, link)
26@@ -776,16 +775,13 @@ void handle_focus(struct swc_pointer * pointer)
27                                               x - view->base.geometry.x,
28                                               y - view->base.geometry.y, NULL))
29         {
30-            swc_pointer_set_focus(pointer, view->surface);
31-            return;
32+            surface = view->surface;
33+            break;
34         }
35     }
36 
37-    swc_pointer_set_focus(pointer, NULL);
38-}
39+    swc_pointer_set_focus(pointer, surface);
40 
41-bool handle_motion(struct swc_pointer * pointer, uint32_t time)
42-{
43     return false;
44 }
45 
+0, -3
 1@@ -354,9 +354,6 @@ void swc_pointer_handle_relative_motion
 2 {
 3     clip_position(pointer, pointer->x + dx, pointer->y + dy);
 4 
 5-    if (pointer->handler && pointer->handler->focus)
 6-        pointer->handler->focus(pointer);
 7-
 8     if ((!pointer->handler || !pointer->handler->motion
 9          || !pointer->handler->motion(pointer, time))
10         && pointer->focus.resource)
+0, -1
1@@ -35,7 +35,6 @@ struct swc_pointer;
2 
3 struct swc_pointer_handler
4 {
5-    void (* focus)(struct swc_pointer * pointer);
6     bool (* motion)(struct swc_pointer * pointer, uint32_t time);
7     bool (* button)(struct swc_pointer * pointer, uint32_t time,
8                     uint32_t button, uint32_t state);