commit 19ac923129bcb96df9616845ff5708b9fdfbe600
parent 2c47a2819312f316d68f9540a4f85b9319979cbf
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 17 Feb 2014 00:07:53 -0800
keyboard: Drop swc_ prefix for non-public structures/functions
Diffstat:
8 files changed, 45 insertions(+), 46 deletions(-)
diff --git a/libswc/bindings.c b/libswc/bindings.c
@@ -36,10 +36,10 @@ struct binding
void * data;
};
-static bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
+static bool handle_key(struct keyboard * keyboard, uint32_t time,
uint32_t key, uint32_t state);
-static struct swc_keyboard_handler binding_handler = {
+static struct keyboard_handler binding_handler = {
.key = &handle_key,
};
@@ -68,7 +68,7 @@ static bool handle_binding(struct wl_array * bindings, uint32_t time,
return false;
}
-bool handle_key(struct swc_keyboard * keyboard, uint32_t time,
+bool handle_key(struct keyboard * keyboard, uint32_t time,
uint32_t key, uint32_t state)
{
xkb_keysym_t keysym;
diff --git a/libswc/bindings.h b/libswc/bindings.h
@@ -28,7 +28,7 @@
struct swc_bindings
{
- struct swc_keyboard_handler * keyboard_handler;
+ struct keyboard_handler * keyboard_handler;
};
bool swc_bindings_initialize();
diff --git a/libswc/keyboard.c b/libswc/keyboard.c
@@ -35,7 +35,7 @@
static void enter(struct input_focus_handler * handler,
struct wl_resource * resource, struct swc_surface * surface)
{
- struct swc_keyboard * keyboard;
+ struct keyboard * keyboard;
struct wl_client * client;
struct wl_display * display;
uint32_t serial;
@@ -63,7 +63,7 @@ static void leave(struct input_focus_handler * handler,
wl_keyboard_send_leave(resource, serial, surface->resource);
}
-static bool client_handle_key(struct swc_keyboard * keyboard, uint32_t time,
+static bool client_handle_key(struct keyboard * keyboard, uint32_t time,
uint32_t key, uint32_t state)
{
struct wl_client * client;
@@ -82,8 +82,7 @@ static bool client_handle_key(struct swc_keyboard * keyboard, uint32_t time,
}
static bool client_handle_modifiers
- (struct swc_keyboard * keyboard,
- const struct swc_keyboard_modifier_state * state)
+ (struct keyboard * keyboard, const struct keyboard_modifier_state * state)
{
struct wl_client * client;
struct wl_display * display;
@@ -102,7 +101,7 @@ static bool client_handle_modifiers
return true;
}
-bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
+bool keyboard_initialize(struct keyboard * keyboard)
{
if (!swc_xkb_initialize(&keyboard->xkb))
{
@@ -113,7 +112,7 @@ bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
if (!input_focus_initialize(&keyboard->focus, &keyboard->focus_handler))
goto error1;
- keyboard->modifier_state = (struct swc_keyboard_modifier_state) { 0 };
+ keyboard->modifier_state = (struct keyboard_modifier_state) { };
keyboard->modifiers = 0;
keyboard->focus_handler.enter = &enter;
keyboard->focus_handler.leave = &leave;
@@ -131,7 +130,7 @@ bool swc_keyboard_initialize(struct swc_keyboard * keyboard)
return false;
}
-void swc_keyboard_finalize(struct swc_keyboard * keyboard)
+void keyboard_finalize(struct keyboard * keyboard)
{
wl_array_release(&keyboard->client_handler.keys);
input_focus_finalize(&keyboard->focus);
@@ -141,7 +140,7 @@ void swc_keyboard_finalize(struct swc_keyboard * keyboard)
/**
* Sets the focus of the keyboard to the specified surface.
*/
-void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
+void keyboard_set_focus(struct keyboard * keyboard,
struct swc_surface * surface)
{
input_focus_set(&keyboard->focus, surface);
@@ -149,13 +148,13 @@ void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
static void unbind(struct wl_resource * resource)
{
- struct swc_keyboard * keyboard = wl_resource_get_user_data(resource);
+ struct keyboard * keyboard = wl_resource_get_user_data(resource);
input_focus_remove_resource(&keyboard->focus, resource);
}
-struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
- struct wl_client * client, uint32_t id)
+struct wl_resource * keyboard_bind(struct keyboard * keyboard,
+ struct wl_client * client, uint32_t id)
{
struct wl_resource * client_resource;
@@ -171,14 +170,14 @@ struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
return client_resource;
}
-void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
- uint32_t key, uint32_t state)
+void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
+ uint32_t key, uint32_t state)
{
uint32_t * pressed_key;
- struct swc_keyboard_modifier_state modifier_state;
+ struct keyboard_modifier_state modifier_state;
enum xkb_key_direction direction;
struct swc_xkb * xkb = &keyboard->xkb;
- struct swc_keyboard_handler * handler;
+ struct keyboard_handler * handler;
/* First handle key events associated with a particular handler. */
wl_list_for_each(handler, &keyboard->handlers, link)
diff --git a/libswc/keyboard.h b/libswc/keyboard.h
@@ -1,6 +1,6 @@
/* swc: libswc/keyboard.h
*
- * Copyright (c) 2013 Michael Forney
+ * Copyright (c) 2013, 2014 Michael Forney
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,10 +30,10 @@
#include <wayland-util.h>
-struct swc_keyboard;
+struct keyboard;
struct wl_client;
-struct swc_keyboard_modifier_state
+struct keyboard_modifier_state
{
uint32_t depressed;
uint32_t latched;
@@ -41,38 +41,38 @@ struct swc_keyboard_modifier_state
uint32_t group;
};
-struct swc_keyboard_handler
+struct keyboard_handler
{
- bool (* key)(struct swc_keyboard * keyboard, uint32_t time,
+ bool (* key)(struct keyboard * keyboard, uint32_t time,
uint32_t key, uint32_t state);
- bool (* modifiers)(struct swc_keyboard * keyboard,
- const struct swc_keyboard_modifier_state * state);
+ bool (* modifiers)(struct keyboard * keyboard,
+ const struct keyboard_modifier_state * state);
struct wl_array keys;
struct wl_list link;
};
-struct swc_keyboard
+struct keyboard
{
struct input_focus focus;
struct input_focus_handler focus_handler;
struct swc_xkb xkb;
struct wl_list handlers;
- struct swc_keyboard_handler client_handler;
+ struct keyboard_handler client_handler;
- struct swc_keyboard_modifier_state modifier_state;
+ struct keyboard_modifier_state modifier_state;
uint32_t modifiers;
};
-bool swc_keyboard_initialize(struct swc_keyboard * keyboard);
-void swc_keyboard_finalize(struct swc_keyboard * keyboard);
-void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
- struct swc_surface * surface);
-struct wl_resource * swc_keyboard_bind(struct swc_keyboard * keyboard,
- struct wl_client * client, uint32_t id);
-void swc_keyboard_handle_key(struct swc_keyboard * keyboard, uint32_t time,
- uint32_t key, uint32_t state);
+bool keyboard_initialize(struct keyboard * keyboard);
+void keyboard_finalize(struct keyboard * keyboard);
+void keyboard_set_focus(struct keyboard * keyboard,
+ struct swc_surface * surface);
+struct wl_resource * keyboard_bind(struct keyboard * keyboard,
+ struct wl_client * client, uint32_t id);
+void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
+ uint32_t key, uint32_t state);
#endif
diff --git a/libswc/panel.c b/libswc/panel.c
@@ -132,7 +132,7 @@ static void dock(struct wl_client * client, struct wl_resource * resource,
wl_list_insert(&screen->modifiers, &panel->modifier.link);
if (focus)
- swc_keyboard_set_focus(swc.seat->keyboard, panel->surface);
+ keyboard_set_focus(swc.seat->keyboard, panel->surface);
swc_panel_send_docked(resource, length);
}
diff --git a/libswc/seat.c b/libswc/seat.c
@@ -50,7 +50,7 @@ static struct
struct wl_event_source * monitor_source;
#endif
- struct swc_keyboard keyboard;
+ struct keyboard keyboard;
struct pointer pointer;
struct swc_data_device data_device;
@@ -67,7 +67,7 @@ const struct swc_seat swc_seat = {
static void handle_key(uint32_t time, uint32_t key, uint32_t state)
{
- swc_keyboard_handle_key(&seat.keyboard, time, key, state);
+ keyboard_handle_key(&seat.keyboard, time, key, state);
}
static void handle_button(uint32_t time, uint32_t button, uint32_t state)
@@ -174,7 +174,7 @@ static void get_pointer(struct wl_client * client, struct wl_resource * resource
static void get_keyboard(struct wl_client * client, struct wl_resource * resource,
uint32_t id)
{
- swc_keyboard_bind(&seat.keyboard, client, id);
+ keyboard_bind(&seat.keyboard, client, id);
}
static void get_touch(struct wl_client * client, struct wl_resource * resource,
@@ -390,7 +390,7 @@ bool swc_seat_initialize(const char * seat_name)
wl_signal_add(&seat.data_device.event_signal, &data_device_listener);
- if (!swc_keyboard_initialize(&seat.keyboard))
+ if (!keyboard_initialize(&seat.keyboard))
{
ERROR("Could not initialize keyboard\n");
goto error3;
@@ -421,7 +421,7 @@ bool swc_seat_initialize(const char * seat_name)
#endif
pointer_finalize(&seat.pointer);
error4:
- swc_keyboard_finalize(&seat.keyboard);
+ keyboard_finalize(&seat.keyboard);
error3:
swc_data_device_finalize(&seat.data_device);
error2:
@@ -440,7 +440,7 @@ void swc_seat_finalize()
finalize_monitor();
#endif
pointer_finalize(&seat.pointer);
- swc_keyboard_finalize(&seat.keyboard);
+ keyboard_finalize(&seat.keyboard);
wl_list_for_each_safe(device, tmp, &seat.devices, link)
swc_evdev_device_destroy(device);
diff --git a/libswc/seat.h b/libswc/seat.h
@@ -29,7 +29,7 @@
struct swc_seat
{
struct pointer * pointer;
- struct swc_keyboard * keyboard;
+ struct keyboard * keyboard;
struct swc_data_device * data_device;
};
diff --git a/libswc/window.c b/libswc/window.c
@@ -87,7 +87,7 @@ void swc_window_focus(struct swc_window * base)
if (window && window->impl->focus)
window->impl->focus(window);
- swc_keyboard_set_focus(swc.seat->keyboard, new_focus);
+ keyboard_set_focus(swc.seat->keyboard, new_focus);
}
EXPORT