commit 2c47a28

Michael Forney  ·  2014-02-17 07:41:43 +0000 UTC
parent 03de3e2
pointer: Drop swc_ prefix for non-public structures/functions
7 files changed,  +69, -75
+4, -4
 1@@ -88,11 +88,11 @@ struct view
 2     struct wl_list link;
 3 };
 4 
 5-static bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
 6+static bool handle_motion(struct pointer_handler * handler, uint32_t time,
 7                           wl_fixed_t x, wl_fixed_t y);
 8 static void perform_update(void * data);
 9 
10-static struct swc_pointer_handler pointer_handler = {
11+static struct pointer_handler pointer_handler = {
12     .motion = &handle_motion
13 };
14 
15@@ -756,7 +756,7 @@ static void perform_update(void * data)
16     compositor.updating = false;
17 }
18 
19-bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
20+bool handle_motion(struct pointer_handler * handler, uint32_t time,
21                    wl_fixed_t fx, wl_fixed_t fy)
22 {
23     struct view * view;
24@@ -778,7 +778,7 @@ bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
25         }
26     }
27 
28-    swc_pointer_set_focus(swc.seat->pointer, surface);
29+    pointer_set_focus(swc.seat->pointer, surface);
30 
31     return false;
32 }
+1, -1
1@@ -30,7 +30,7 @@ struct swc_surface;
2 
3 struct swc_compositor
4 {
5-    struct swc_pointer_handler * pointer_handler;
6+    struct pointer_handler * pointer_handler;
7 };
8 
9 bool swc_compositor_initialize();
+33, -35
  1@@ -36,13 +36,13 @@
  2 struct button_press
  3 {
  4     uint32_t value;
  5-    struct swc_pointer_handler * handler;
  6+    struct pointer_handler * handler;
  7 };
  8 
  9 static void enter(struct input_focus_handler * handler,
 10                   struct wl_resource * resource, struct swc_surface * surface)
 11 {
 12-    struct swc_pointer * pointer;
 13+    struct pointer * pointer;
 14     struct wl_client * client;
 15     struct wl_display * display;
 16     uint32_t serial;
 17@@ -77,8 +77,8 @@ static void leave(struct input_focus_handler * handler,
 18 static void handle_cursor_surface_destroy(struct wl_listener * listener,
 19                                           void * data)
 20 {
 21-    struct swc_pointer * pointer = CONTAINER_OF(listener, typeof(*pointer),
 22-                                                cursor.destroy_listener);
 23+    struct pointer * pointer
 24+        = CONTAINER_OF(listener, typeof(*pointer), cursor.destroy_listener);
 25 
 26     swc_view_attach(&pointer->cursor.view, NULL);
 27 }
 28@@ -90,7 +90,7 @@ static bool update(struct swc_view * view)
 29 
 30 static bool attach(struct swc_view * view, struct wld_buffer * buffer)
 31 {
 32-    struct swc_pointer * pointer
 33+    struct pointer * pointer
 34         = CONTAINER_OF(view, typeof(*pointer), cursor.view);
 35     struct swc_surface * surface = pointer->cursor.surface;
 36 
 37@@ -128,7 +128,7 @@ static const struct swc_view_impl view_impl = {
 38 
 39 static void handle_view_event(struct wl_listener * listener, void * data)
 40 {
 41-    struct swc_pointer * pointer
 42+    struct pointer * pointer
 43         = CONTAINER_OF(listener, typeof(*pointer), cursor.view_listener);
 44     struct swc_event * event = data;
 45     struct swc_view_event_data * event_data = event->data;
 46@@ -164,14 +164,14 @@ static void handle_view_event(struct wl_listener * listener, void * data)
 47     }
 48 }
 49 
 50-static inline void update_cursor(struct swc_pointer * pointer)
 51+static inline void update_cursor(struct pointer * pointer)
 52 {
 53     swc_view_move(&pointer->cursor.view,
 54                   wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot.x,
 55                   wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot.y);
 56 }
 57 
 58-void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id)
 59+void pointer_set_cursor(struct pointer * pointer, uint32_t id)
 60 {
 61     struct cursor * cursor = &cursor_metadata[id];
 62     union wld_object object = { .ptr = &cursor_data[cursor->offset] };
 63@@ -195,10 +195,10 @@ void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id)
 64     swc_view_attach(&pointer->cursor.view, pointer->cursor.internal_buffer);
 65 }
 66 
 67-static bool client_handle_button(struct swc_pointer_handler * handler,
 68+static bool client_handle_button(struct pointer_handler * handler,
 69                                  uint32_t time, uint32_t button, uint32_t state)
 70 {
 71-    struct swc_pointer * pointer
 72+    struct pointer * pointer
 73         = CONTAINER_OF(handler, typeof(*pointer), client_handler);
 74     uint32_t serial;
 75 
 76@@ -212,10 +212,10 @@ static bool client_handle_button(struct swc_pointer_handler * handler,
 77     return true;
 78 }
 79 
 80-static bool client_handle_axis(struct swc_pointer_handler * handler,
 81+static bool client_handle_axis(struct pointer_handler * handler,
 82                                uint32_t time, uint32_t axis, wl_fixed_t amount)
 83 {
 84-    struct swc_pointer * pointer
 85+    struct pointer * pointer
 86         = CONTAINER_OF(handler, typeof(*pointer), client_handler);
 87 
 88     if (!pointer->focus.resource)
 89@@ -226,10 +226,10 @@ static bool client_handle_axis(struct swc_pointer_handler * handler,
 90     return true;
 91 }
 92 
 93-static bool client_handle_motion(struct swc_pointer_handler * handler,
 94+static bool client_handle_motion(struct pointer_handler * handler,
 95                                  uint32_t time, wl_fixed_t x, wl_fixed_t y)
 96 {
 97-    struct swc_pointer * pointer
 98+    struct pointer * pointer
 99         = CONTAINER_OF(handler, typeof(*pointer), client_handler);
100 
101     if (!pointer->focus.resource)
102@@ -243,7 +243,7 @@ static bool client_handle_motion(struct swc_pointer_handler * handler,
103     return true;
104 }
105 
106-bool swc_pointer_initialize(struct swc_pointer * pointer)
107+bool pointer_initialize(struct pointer * pointer)
108 {
109     struct screen * screen;
110 
111@@ -276,7 +276,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
112     if (!pointer->cursor.buffer)
113         return false;
114 
115-    swc_pointer_set_cursor(pointer, cursor_left_ptr);
116+    pointer_set_cursor(pointer, cursor_left_ptr);
117 
118     input_focus_initialize(&pointer->focus, &pointer->focus_handler);
119     pixman_region32_init(&pointer->region);
120@@ -284,7 +284,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
121     return true;
122 }
123 
124-void swc_pointer_finalize(struct swc_pointer * pointer)
125+void pointer_finalize(struct pointer * pointer)
126 {
127     input_focus_finalize(&pointer->focus);
128     pixman_region32_fini(&pointer->region);
129@@ -293,13 +293,12 @@ void swc_pointer_finalize(struct swc_pointer * pointer)
130 /**
131  * Sets the focus of the pointer to the specified surface.
132  */
133-void swc_pointer_set_focus(struct swc_pointer * pointer,
134-                           struct swc_surface * surface)
135+void pointer_set_focus(struct pointer * pointer, struct swc_surface * surface)
136 {
137     input_focus_set(&pointer->focus, surface);
138 }
139 
140-static void clip_position(struct swc_pointer * pointer,
141+static void clip_position(struct pointer * pointer,
142                           wl_fixed_t fx, wl_fixed_t fy)
143 {
144     int32_t x, y, last_x, last_y;
145@@ -324,8 +323,7 @@ static void clip_position(struct swc_pointer * pointer,
146     pointer->y = wl_fixed_from_int(y);
147 }
148 
149-void swc_pointer_set_region(struct swc_pointer * pointer,
150-                            pixman_region32_t * region)
151+void pointer_set_region(struct pointer * pointer, pixman_region32_t * region)
152 {
153     pixman_region32_copy(&pointer->region, region);
154     clip_position(pointer, pointer->x, pointer->y);
155@@ -336,7 +334,7 @@ static void set_cursor(struct wl_client * client,
156                        struct wl_resource * surface_resource,
157                        int32_t hotspot_x, int32_t hotspot_y)
158 {
159-    struct swc_pointer * pointer = wl_resource_get_user_data(resource);
160+    struct pointer * pointer = wl_resource_get_user_data(resource);
161     struct swc_surface * surface;
162 
163     if (pointer->cursor.surface)
164@@ -363,13 +361,13 @@ static struct wl_pointer_interface pointer_implementation = {
165 
166 static void unbind(struct wl_resource * resource)
167 {
168-    struct swc_pointer * pointer = wl_resource_get_user_data(resource);
169+    struct pointer * pointer = wl_resource_get_user_data(resource);
170 
171     input_focus_remove_resource(&pointer->focus, resource);
172 }
173 
174-struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
175-                                      struct wl_client * client, uint32_t id)
176+struct wl_resource * pointer_bind(struct pointer * pointer,
177+                                  struct wl_client * client, uint32_t id)
178 {
179     struct wl_resource * client_resource;
180 
181@@ -381,10 +379,10 @@ struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
182     return client_resource;
183 }
184 
185-void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
186-                               uint32_t value, uint32_t state)
187+void pointer_handle_button(struct pointer * pointer, uint32_t time,
188+                           uint32_t value, uint32_t state)
189 {
190-    struct swc_pointer_handler * handler;
191+    struct pointer_handler * handler;
192     struct button_press * button;
193     uint32_t serial;
194 
195@@ -423,10 +421,10 @@ void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
196     }
197 }
198 
199-void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
200-                             uint32_t axis, wl_fixed_t amount)
201+void pointer_handle_axis(struct pointer * pointer, uint32_t time,
202+                         uint32_t axis, wl_fixed_t amount)
203 {
204-    struct swc_pointer_handler * handler;
205+    struct pointer_handler * handler;
206 
207     wl_list_for_each(handler, &pointer->handlers, link)
208     {
209@@ -435,10 +433,10 @@ void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
210     }
211 }
212 
213-void swc_pointer_handle_relative_motion
214-    (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
215+void pointer_handle_relative_motion(struct pointer * pointer, uint32_t time,
216+                                    wl_fixed_t dx, wl_fixed_t dy)
217 {
218-    struct swc_pointer_handler * handler;
219+    struct pointer_handler * handler;
220 
221     clip_position(pointer, pointer->x + dx, pointer->y + dy);
222 
+21, -25
 1@@ -31,21 +31,19 @@
 2 #include <wayland-server.h>
 3 #include <pixman.h>
 4 
 5-struct swc_pointer;
 6-
 7-struct swc_pointer_handler
 8+struct pointer_handler
 9 {
10-    bool (* motion)(struct swc_pointer_handler * handler, uint32_t time,
11+    bool (* motion)(struct pointer_handler * handler, uint32_t time,
12                     wl_fixed_t x, wl_fixed_t y);
13-    bool (* button)(struct swc_pointer_handler * handler, uint32_t time,
14+    bool (* button)(struct pointer_handler * handler, uint32_t time,
15                     uint32_t button, uint32_t state);
16-    bool (* axis)(struct swc_pointer_handler * handler, uint32_t time,
17+    bool (* axis)(struct pointer_handler * handler, uint32_t time,
18                   enum wl_pointer_axis axis, wl_fixed_t amount);
19 
20     struct wl_list link;
21 };
22 
23-struct swc_pointer
24+struct pointer
25 {
26     struct input_focus focus;
27     struct input_focus_handler focus_handler;
28@@ -58,7 +56,7 @@ struct swc_pointer
29         struct wl_listener destroy_listener;
30         struct wld_buffer * buffer;
31 
32-        /* Used for cursors set with swc_pointer_set_cursor */
33+        /* Used for cursors set with pointer_set_cursor */
34         struct wld_buffer * internal_buffer;
35 
36         struct
37@@ -69,28 +67,26 @@ struct swc_pointer
38 
39     struct wl_array buttons;
40     struct wl_list handlers;
41-    struct swc_pointer_handler client_handler;
42+    struct pointer_handler client_handler;
43 
44     wl_fixed_t x, y;
45     pixman_region32_t region;
46 };
47 
48-bool swc_pointer_initialize(struct swc_pointer * pointer);
49-void swc_pointer_finalize(struct swc_pointer * pointer);
50-void swc_pointer_set_focus(struct swc_pointer * pointer,
51-                           struct swc_surface * surface);
52-void swc_pointer_set_region(struct swc_pointer * pointer,
53-                            pixman_region32_t * region);
54-void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id);
55-
56-struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
57-                                      struct wl_client * client, uint32_t id);
58-void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
59-                               uint32_t button, uint32_t state);
60-void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
61-                             uint32_t axis, wl_fixed_t amount);
62-void swc_pointer_handle_relative_motion
63-    (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy);
64+bool pointer_initialize(struct pointer * pointer);
65+void pointer_finalize(struct pointer * pointer);
66+void pointer_set_focus(struct pointer * pointer, struct swc_surface * surface);
67+void pointer_set_region(struct pointer * pointer, pixman_region32_t * region);
68+void pointer_set_cursor(struct pointer * pointer, uint32_t id);
69+
70+struct wl_resource * pointer_bind(struct pointer * pointer,
71+                                  struct wl_client * client, uint32_t id);
72+void pointer_handle_button(struct pointer * pointer, uint32_t time,
73+                           uint32_t button, uint32_t state);
74+void pointer_handle_axis(struct pointer * pointer, uint32_t time,
75+                         uint32_t axis, wl_fixed_t amount);
76+void pointer_handle_relative_motion(struct pointer * pointer, uint32_t time,
77+                                    wl_fixed_t dx, wl_fixed_t dy);
78 
79 #endif
80 
+8, -8
 1@@ -51,7 +51,7 @@ static struct
 2 #endif
 3 
 4     struct swc_keyboard keyboard;
 5-    struct swc_pointer pointer;
 6+    struct pointer pointer;
 7     struct swc_data_device data_device;
 8 
 9     struct wl_global * global;
10@@ -72,17 +72,17 @@ static void handle_key(uint32_t time, uint32_t key, uint32_t state)
11 
12 static void handle_button(uint32_t time, uint32_t button, uint32_t state)
13 {
14-    swc_pointer_handle_button(&seat.pointer, time, button, state);
15+    pointer_handle_button(&seat.pointer, time, button, state);
16 }
17 
18 static void handle_axis(uint32_t time, uint32_t axis, wl_fixed_t amount)
19 {
20-    swc_pointer_handle_axis(&seat.pointer, time, axis, amount);
21+    pointer_handle_axis(&seat.pointer, time, axis, amount);
22 }
23 
24 static void handle_relative_motion(uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
25 {
26-    swc_pointer_handle_relative_motion(&seat.pointer, time, dx, dy);
27+    pointer_handle_relative_motion(&seat.pointer, time, dx, dy);
28 }
29 
30 const static struct swc_evdev_device_handler evdev_handler = {
31@@ -168,7 +168,7 @@ static struct wl_listener launch_listener = {
32 static void get_pointer(struct wl_client * client, struct wl_resource * resource,
33                         uint32_t id)
34 {
35-    swc_pointer_bind(&seat.pointer, client, id);
36+    pointer_bind(&seat.pointer, client, id);
37 }
38 
39 static void get_keyboard(struct wl_client * client, struct wl_resource * resource,
40@@ -398,7 +398,7 @@ bool swc_seat_initialize(const char * seat_name)
41 
42     wl_signal_add(&seat.keyboard.focus.event_signal, &keyboard_focus_listener);
43 
44-    if (!swc_pointer_initialize(&seat.pointer))
45+    if (!pointer_initialize(&seat.pointer))
46     {
47         ERROR("Could not initialize pointer\n");
48         goto error4;
49@@ -419,7 +419,7 @@ bool swc_seat_initialize(const char * seat_name)
50     finalize_monitor();
51   error5:
52 #endif
53-    swc_pointer_finalize(&seat.pointer);
54+    pointer_finalize(&seat.pointer);
55   error4:
56     swc_keyboard_finalize(&seat.keyboard);
57   error3:
58@@ -439,7 +439,7 @@ void swc_seat_finalize()
59 #ifdef ENABLE_HOTPLUGGING
60     finalize_monitor();
61 #endif
62-    swc_pointer_finalize(&seat.pointer);
63+    pointer_finalize(&seat.pointer);
64     swc_keyboard_finalize(&seat.keyboard);
65 
66     wl_list_for_each_safe(device, tmp, &seat.devices, link)
+1, -1
1@@ -28,7 +28,7 @@
2 
3 struct swc_seat
4 {
5-    struct swc_pointer * pointer;
6+    struct pointer * pointer;
7     struct swc_keyboard * keyboard;
8     struct swc_data_device * data_device;
9 };
+1, -1
1@@ -81,7 +81,7 @@ static void setup_compositor()
2                                    geometry->width, geometry->height);
3     }
4 
5-    swc_pointer_set_region(swc.seat->pointer, &pointer_region);
6+    pointer_set_region(swc.seat->pointer, &pointer_region);
7     pixman_region32_fini(&pointer_region);
8 }
9