commit 19ac923

Michael Forney  ·  2014-02-17 08:07:53 +0000 UTC
parent 2c47a28
keyboard: Drop swc_ prefix for non-public structures/functions
8 files changed,  +45, -46
+3, -3
 1@@ -36,10 +36,10 @@ struct binding
 2     void * data;
 3 };
 4 
 5-static bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
 6+static bool handle_key(struct keyboard * keyboard, uint32_t time,
 7                        uint32_t key, uint32_t state);
 8 
 9-static struct swc_keyboard_handler binding_handler = {
10+static struct keyboard_handler binding_handler = {
11     .key = &handle_key,
12 };
13 
14@@ -68,7 +68,7 @@ static bool handle_binding(struct wl_array * bindings, uint32_t time,
15     return false;
16 }
17 
18-bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
19+bool handle_key(struct keyboard * keyboard, uint32_t time,
20                 uint32_t key, uint32_t state)
21 {
22     xkb_keysym_t keysym;
+1, -1
1@@ -28,7 +28,7 @@
2 
3 struct swc_bindings
4 {
5-    struct swc_keyboard_handler * keyboard_handler;
6+    struct keyboard_handler * keyboard_handler;
7 };
8 
9 bool swc_bindings_initialize();
+14, -15
  1@@ -35,7 +35,7 @@
  2 static void enter(struct input_focus_handler * handler,
  3                   struct wl_resource * resource, struct swc_surface * surface)
  4 {
  5-    struct swc_keyboard * keyboard;
  6+    struct keyboard * keyboard;
  7     struct wl_client * client;
  8     struct wl_display * display;
  9     uint32_t serial;
 10@@ -63,7 +63,7 @@ static void leave(struct input_focus_handler * handler,
 11     wl_keyboard_send_leave(resource, serial, surface->resource);
 12 }
 13 
 14-static bool client_handle_key(struct swc_keyboard * keyboard, uint32_t time,
 15+static bool client_handle_key(struct keyboard * keyboard, uint32_t time,
 16                               uint32_t key, uint32_t state)
 17 {
 18     struct wl_client * client;
 19@@ -82,8 +82,7 @@ static bool client_handle_key(struct swc_keyboard * keyboard, uint32_t time,
 20 }
 21 
 22 static bool client_handle_modifiers
 23-    (struct swc_keyboard * keyboard,
 24-     const struct swc_keyboard_modifier_state * state)
 25+    (struct keyboard * keyboard, const struct keyboard_modifier_state * state)
 26 {
 27     struct wl_client * client;
 28     struct wl_display * display;
 29@@ -102,7 +101,7 @@ static bool client_handle_modifiers
 30     return true;
 31 }
 32 
 33-bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
 34+bool keyboard_initialize(struct keyboard * keyboard)
 35 {
 36     if (!swc_xkb_initialize(&keyboard->xkb))
 37     {
 38@@ -113,7 +112,7 @@ bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
 39     if (!input_focus_initialize(&keyboard->focus, &keyboard->focus_handler))
 40         goto error1;
 41 
 42-    keyboard->modifier_state = (struct swc_keyboard_modifier_state) { 0 };
 43+    keyboard->modifier_state = (struct keyboard_modifier_state) { };
 44     keyboard->modifiers = 0;
 45     keyboard->focus_handler.enter = &enter;
 46     keyboard->focus_handler.leave = &leave;
 47@@ -131,7 +130,7 @@ bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
 48     return false;
 49 }
 50 
 51-void swc_keyboard_finalize(struct swc_keyboard * keyboard)
 52+void keyboard_finalize(struct keyboard * keyboard)
 53 {
 54     wl_array_release(&keyboard->client_handler.keys);
 55     input_focus_finalize(&keyboard->focus);
 56@@ -141,7 +140,7 @@ void swc_keyboard_finalize(struct swc_keyboard * keyboard)
 57 /**
 58  * Sets the focus of the keyboard to the specified surface.
 59  */
 60-void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
 61+void keyboard_set_focus(struct keyboard * keyboard,
 62                             struct swc_surface * surface)
 63 {
 64     input_focus_set(&keyboard->focus, surface);
 65@@ -149,13 +148,13 @@ void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
 66 
 67 static void unbind(struct wl_resource * resource)
 68 {
 69-    struct swc_keyboard * keyboard = wl_resource_get_user_data(resource);
 70+    struct keyboard * keyboard = wl_resource_get_user_data(resource);
 71 
 72     input_focus_remove_resource(&keyboard->focus, resource);
 73 }
 74 
 75-struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
 76-                                       struct wl_client * client, uint32_t id)
 77+struct wl_resource * keyboard_bind(struct keyboard * keyboard,
 78+                                   struct wl_client * client, uint32_t id)
 79 {
 80     struct wl_resource * client_resource;
 81 
 82@@ -171,14 +170,14 @@ struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
 83     return client_resource;
 84 }
 85 
 86-void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
 87-                             uint32_t key, uint32_t state)
 88+void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
 89+                         uint32_t key, uint32_t state)
 90 {
 91     uint32_t * pressed_key;
 92-    struct swc_keyboard_modifier_state modifier_state;
 93+    struct keyboard_modifier_state modifier_state;
 94     enum xkb_key_direction direction;
 95     struct swc_xkb * xkb = &keyboard->xkb;
 96-    struct swc_keyboard_handler * handler;
 97+    struct keyboard_handler * handler;
 98 
 99     /* First handle key events associated with a particular handler. */
100     wl_list_for_each(handler, &keyboard->handlers, link)
+18, -18
 1@@ -1,6 +1,6 @@
 2 /* swc: libswc/keyboard.h
 3  *
 4- * Copyright (c) 2013 Michael Forney
 5+ * Copyright (c) 2013, 2014 Michael Forney
 6  *
 7  * Permission is hereby granted, free of charge, to any person obtaining a copy
 8  * of this software and associated documentation files (the "Software"), to deal
 9@@ -30,10 +30,10 @@
10 
11 #include <wayland-util.h>
12 
13-struct swc_keyboard;
14+struct keyboard;
15 struct wl_client;
16 
17-struct swc_keyboard_modifier_state
18+struct keyboard_modifier_state
19 {
20     uint32_t depressed;
21     uint32_t latched;
22@@ -41,38 +41,38 @@ struct swc_keyboard_modifier_state
23     uint32_t group;
24 };
25 
26-struct swc_keyboard_handler
27+struct keyboard_handler
28 {
29-    bool (* key)(struct swc_keyboard * keyboard, uint32_t time,
30+    bool (* key)(struct keyboard * keyboard, uint32_t time,
31                  uint32_t key, uint32_t state);
32-    bool (* modifiers)(struct swc_keyboard * keyboard,
33-                       const struct swc_keyboard_modifier_state * state);
34+    bool (* modifiers)(struct keyboard * keyboard,
35+                       const struct keyboard_modifier_state * state);
36 
37     struct wl_array keys;
38     struct wl_list link;
39 };
40 
41-struct swc_keyboard
42+struct keyboard
43 {
44     struct input_focus focus;
45     struct input_focus_handler focus_handler;
46     struct swc_xkb xkb;
47 
48     struct wl_list handlers;
49-    struct swc_keyboard_handler client_handler;
50+    struct keyboard_handler client_handler;
51 
52-    struct swc_keyboard_modifier_state modifier_state;
53+    struct keyboard_modifier_state modifier_state;
54     uint32_t modifiers;
55 };
56 
57-bool swc_keyboard_initialize(struct swc_keyboard * keyboard);
58-void swc_keyboard_finalize(struct swc_keyboard * keyboard);
59-void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
60-                            struct swc_surface * surface);
61-struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
62-                                       struct wl_client * client, uint32_t id);
63-void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
64-                             uint32_t key, uint32_t state);
65+bool keyboard_initialize(struct keyboard * keyboard);
66+void keyboard_finalize(struct keyboard * keyboard);
67+void keyboard_set_focus(struct keyboard * keyboard,
68+                        struct swc_surface * surface);
69+struct wl_resource * keyboard_bind(struct keyboard * keyboard,
70+                                   struct wl_client * client, uint32_t id);
71+void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
72+                         uint32_t key, uint32_t state);
73 
74 #endif
75 
+1, -1
1@@ -132,7 +132,7 @@ static void dock(struct wl_client * client, struct wl_resource * resource,
2     wl_list_insert(&screen->modifiers, &panel->modifier.link);
3 
4     if (focus)
5-        swc_keyboard_set_focus(swc.seat->keyboard, panel->surface);
6+        keyboard_set_focus(swc.seat->keyboard, panel->surface);
7 
8     swc_panel_send_docked(resource, length);
9 }
+6, -6
 1@@ -50,7 +50,7 @@ static struct
 2     struct wl_event_source * monitor_source;
 3 #endif
 4 
 5-    struct swc_keyboard keyboard;
 6+    struct keyboard keyboard;
 7     struct pointer pointer;
 8     struct swc_data_device data_device;
 9 
10@@ -67,7 +67,7 @@ const struct swc_seat swc_seat = {
11 
12 static void handle_key(uint32_t time, uint32_t key, uint32_t state)
13 {
14-    swc_keyboard_handle_key(&seat.keyboard, time, key, state);
15+    keyboard_handle_key(&seat.keyboard, time, key, state);
16 }
17 
18 static void handle_button(uint32_t time, uint32_t button, uint32_t state)
19@@ -174,7 +174,7 @@ static void get_pointer(struct wl_client * client, struct wl_resource * resource
20 static void get_keyboard(struct wl_client * client, struct wl_resource * resource,
21                          uint32_t id)
22 {
23-    swc_keyboard_bind(&seat.keyboard, client, id);
24+    keyboard_bind(&seat.keyboard, client, id);
25 }
26 
27 static void get_touch(struct wl_client * client, struct wl_resource * resource,
28@@ -390,7 +390,7 @@ bool swc_seat_initialize(const char * seat_name)
29 
30     wl_signal_add(&seat.data_device.event_signal, &data_device_listener);
31 
32-    if (!swc_keyboard_initialize(&seat.keyboard))
33+    if (!keyboard_initialize(&seat.keyboard))
34     {
35         ERROR("Could not initialize keyboard\n");
36         goto error3;
37@@ -421,7 +421,7 @@ bool swc_seat_initialize(const char * seat_name)
38 #endif
39     pointer_finalize(&seat.pointer);
40   error4:
41-    swc_keyboard_finalize(&seat.keyboard);
42+    keyboard_finalize(&seat.keyboard);
43   error3:
44     swc_data_device_finalize(&seat.data_device);
45   error2:
46@@ -440,7 +440,7 @@ void swc_seat_finalize()
47     finalize_monitor();
48 #endif
49     pointer_finalize(&seat.pointer);
50-    swc_keyboard_finalize(&seat.keyboard);
51+    keyboard_finalize(&seat.keyboard);
52 
53     wl_list_for_each_safe(device, tmp, &seat.devices, link)
54         swc_evdev_device_destroy(device);
+1, -1
1@@ -29,7 +29,7 @@
2 struct swc_seat
3 {
4     struct pointer * pointer;
5-    struct swc_keyboard * keyboard;
6+    struct keyboard * keyboard;
7     struct swc_data_device * data_device;
8 };
9 
+1, -1
1@@ -87,7 +87,7 @@ void swc_window_focus(struct swc_window * base)
2     if (window && window->impl->focus)
3         window->impl->focus(window);
4 
5-    swc_keyboard_set_focus(swc.seat->keyboard, new_focus);
6+    keyboard_set_focus(swc.seat->keyboard, new_focus);
7 }
8 
9 EXPORT