commit 2c47a2819312f316d68f9540a4f85b9319979cbf
parent 03de3e248a78dbaf8775d462cfcafbe169c22e9e
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 16 Feb 2014 23:41:43 -0800
pointer: Drop swc_ prefix for non-public structures/functions
Diffstat:
7 files changed, 69 insertions(+), 75 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -88,11 +88,11 @@ struct view
struct wl_list link;
};
-static bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
+static bool handle_motion(struct pointer_handler * handler, uint32_t time,
wl_fixed_t x, wl_fixed_t y);
static void perform_update(void * data);
-static struct swc_pointer_handler pointer_handler = {
+static struct pointer_handler pointer_handler = {
.motion = &handle_motion
};
@@ -756,7 +756,7 @@ static void perform_update(void * data)
compositor.updating = false;
}
-bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
+bool handle_motion(struct pointer_handler * handler, uint32_t time,
wl_fixed_t fx, wl_fixed_t fy)
{
struct view * view;
@@ -778,7 +778,7 @@ bool handle_motion(struct swc_pointer_handler * handler, uint32_t time,
}
}
- swc_pointer_set_focus(swc.seat->pointer, surface);
+ pointer_set_focus(swc.seat->pointer, surface);
return false;
}
diff --git a/libswc/compositor.h b/libswc/compositor.h
@@ -30,7 +30,7 @@ struct swc_surface;
struct swc_compositor
{
- struct swc_pointer_handler * pointer_handler;
+ struct pointer_handler * pointer_handler;
};
bool swc_compositor_initialize();
diff --git a/libswc/pointer.c b/libswc/pointer.c
@@ -36,13 +36,13 @@
struct button_press
{
uint32_t value;
- struct swc_pointer_handler * handler;
+ struct pointer_handler * handler;
};
static void enter(struct input_focus_handler * handler,
struct wl_resource * resource, struct swc_surface * surface)
{
- struct swc_pointer * pointer;
+ struct pointer * pointer;
struct wl_client * client;
struct wl_display * display;
uint32_t serial;
@@ -77,8 +77,8 @@ static void leave(struct input_focus_handler * handler,
static void handle_cursor_surface_destroy(struct wl_listener * listener,
void * data)
{
- struct swc_pointer * pointer = CONTAINER_OF(listener, typeof(*pointer),
- cursor.destroy_listener);
+ struct pointer * pointer
+ = CONTAINER_OF(listener, typeof(*pointer), cursor.destroy_listener);
swc_view_attach(&pointer->cursor.view, NULL);
}
@@ -90,7 +90,7 @@ static bool update(struct swc_view * view)
static bool attach(struct swc_view * view, struct wld_buffer * buffer)
{
- struct swc_pointer * pointer
+ struct pointer * pointer
= CONTAINER_OF(view, typeof(*pointer), cursor.view);
struct swc_surface * surface = pointer->cursor.surface;
@@ -128,7 +128,7 @@ static const struct swc_view_impl view_impl = {
static void handle_view_event(struct wl_listener * listener, void * data)
{
- struct swc_pointer * pointer
+ struct pointer * pointer
= CONTAINER_OF(listener, typeof(*pointer), cursor.view_listener);
struct swc_event * event = data;
struct swc_view_event_data * event_data = event->data;
@@ -164,14 +164,14 @@ static void handle_view_event(struct wl_listener * listener, void * data)
}
}
-static inline void update_cursor(struct swc_pointer * pointer)
+static inline void update_cursor(struct pointer * pointer)
{
swc_view_move(&pointer->cursor.view,
wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot.x,
wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot.y);
}
-void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id)
+void pointer_set_cursor(struct pointer * pointer, uint32_t id)
{
struct cursor * cursor = &cursor_metadata[id];
union wld_object object = { .ptr = &cursor_data[cursor->offset] };
@@ -195,10 +195,10 @@ void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id)
swc_view_attach(&pointer->cursor.view, pointer->cursor.internal_buffer);
}
-static bool client_handle_button(struct swc_pointer_handler * handler,
+static bool client_handle_button(struct pointer_handler * handler,
uint32_t time, uint32_t button, uint32_t state)
{
- struct swc_pointer * pointer
+ struct pointer * pointer
= CONTAINER_OF(handler, typeof(*pointer), client_handler);
uint32_t serial;
@@ -212,10 +212,10 @@ static bool client_handle_button(struct swc_pointer_handler * handler,
return true;
}
-static bool client_handle_axis(struct swc_pointer_handler * handler,
+static bool client_handle_axis(struct pointer_handler * handler,
uint32_t time, uint32_t axis, wl_fixed_t amount)
{
- struct swc_pointer * pointer
+ struct pointer * pointer
= CONTAINER_OF(handler, typeof(*pointer), client_handler);
if (!pointer->focus.resource)
@@ -226,10 +226,10 @@ static bool client_handle_axis(struct swc_pointer_handler * handler,
return true;
}
-static bool client_handle_motion(struct swc_pointer_handler * handler,
+static bool client_handle_motion(struct pointer_handler * handler,
uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
- struct swc_pointer * pointer
+ struct pointer * pointer
= CONTAINER_OF(handler, typeof(*pointer), client_handler);
if (!pointer->focus.resource)
@@ -243,7 +243,7 @@ static bool client_handle_motion(struct swc_pointer_handler * handler,
return true;
}
-bool swc_pointer_initialize(struct swc_pointer * pointer)
+bool pointer_initialize(struct pointer * pointer)
{
struct screen * screen;
@@ -276,7 +276,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
if (!pointer->cursor.buffer)
return false;
- swc_pointer_set_cursor(pointer, cursor_left_ptr);
+ pointer_set_cursor(pointer, cursor_left_ptr);
input_focus_initialize(&pointer->focus, &pointer->focus_handler);
pixman_region32_init(&pointer->region);
@@ -284,7 +284,7 @@ bool swc_pointer_initialize(struct swc_pointer * pointer)
return true;
}
-void swc_pointer_finalize(struct swc_pointer * pointer)
+void pointer_finalize(struct pointer * pointer)
{
input_focus_finalize(&pointer->focus);
pixman_region32_fini(&pointer->region);
@@ -293,13 +293,12 @@ void swc_pointer_finalize(struct swc_pointer * pointer)
/**
* Sets the focus of the pointer to the specified surface.
*/
-void swc_pointer_set_focus(struct swc_pointer * pointer,
- struct swc_surface * surface)
+void pointer_set_focus(struct pointer * pointer, struct swc_surface * surface)
{
input_focus_set(&pointer->focus, surface);
}
-static void clip_position(struct swc_pointer * pointer,
+static void clip_position(struct pointer * pointer,
wl_fixed_t fx, wl_fixed_t fy)
{
int32_t x, y, last_x, last_y;
@@ -324,8 +323,7 @@ static void clip_position(struct swc_pointer * pointer,
pointer->y = wl_fixed_from_int(y);
}
-void swc_pointer_set_region(struct swc_pointer * pointer,
- pixman_region32_t * region)
+void pointer_set_region(struct pointer * pointer, pixman_region32_t * region)
{
pixman_region32_copy(&pointer->region, region);
clip_position(pointer, pointer->x, pointer->y);
@@ -336,7 +334,7 @@ static void set_cursor(struct wl_client * client,
struct wl_resource * surface_resource,
int32_t hotspot_x, int32_t hotspot_y)
{
- struct swc_pointer * pointer = wl_resource_get_user_data(resource);
+ struct pointer * pointer = wl_resource_get_user_data(resource);
struct swc_surface * surface;
if (pointer->cursor.surface)
@@ -363,13 +361,13 @@ static struct wl_pointer_interface pointer_implementation = {
static void unbind(struct wl_resource * resource)
{
- struct swc_pointer * pointer = wl_resource_get_user_data(resource);
+ struct pointer * pointer = wl_resource_get_user_data(resource);
input_focus_remove_resource(&pointer->focus, resource);
}
-struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
- struct wl_client * client, uint32_t id)
+struct wl_resource * pointer_bind(struct pointer * pointer,
+ struct wl_client * client, uint32_t id)
{
struct wl_resource * client_resource;
@@ -381,10 +379,10 @@ struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
return client_resource;
}
-void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
- uint32_t value, uint32_t state)
+void pointer_handle_button(struct pointer * pointer, uint32_t time,
+ uint32_t value, uint32_t state)
{
- struct swc_pointer_handler * handler;
+ struct pointer_handler * handler;
struct button_press * button;
uint32_t serial;
@@ -423,10 +421,10 @@ void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
}
}
-void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
- uint32_t axis, wl_fixed_t amount)
+void pointer_handle_axis(struct pointer * pointer, uint32_t time,
+ uint32_t axis, wl_fixed_t amount)
{
- struct swc_pointer_handler * handler;
+ struct pointer_handler * handler;
wl_list_for_each(handler, &pointer->handlers, link)
{
@@ -435,10 +433,10 @@ void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
}
}
-void swc_pointer_handle_relative_motion
- (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
+void pointer_handle_relative_motion(struct pointer * pointer, uint32_t time,
+ wl_fixed_t dx, wl_fixed_t dy)
{
- struct swc_pointer_handler * handler;
+ struct pointer_handler * handler;
clip_position(pointer, pointer->x + dx, pointer->y + dy);
diff --git a/libswc/pointer.h b/libswc/pointer.h
@@ -31,21 +31,19 @@
#include <wayland-server.h>
#include <pixman.h>
-struct swc_pointer;
-
-struct swc_pointer_handler
+struct pointer_handler
{
- bool (* motion)(struct swc_pointer_handler * handler, uint32_t time,
+ bool (* motion)(struct pointer_handler * handler, uint32_t time,
wl_fixed_t x, wl_fixed_t y);
- bool (* button)(struct swc_pointer_handler * handler, uint32_t time,
+ bool (* button)(struct pointer_handler * handler, uint32_t time,
uint32_t button, uint32_t state);
- bool (* axis)(struct swc_pointer_handler * handler, uint32_t time,
+ bool (* axis)(struct pointer_handler * handler, uint32_t time,
enum wl_pointer_axis axis, wl_fixed_t amount);
struct wl_list link;
};
-struct swc_pointer
+struct pointer
{
struct input_focus focus;
struct input_focus_handler focus_handler;
@@ -58,7 +56,7 @@ struct swc_pointer
struct wl_listener destroy_listener;
struct wld_buffer * buffer;
- /* Used for cursors set with swc_pointer_set_cursor */
+ /* Used for cursors set with pointer_set_cursor */
struct wld_buffer * internal_buffer;
struct
@@ -69,28 +67,26 @@ struct swc_pointer
struct wl_array buttons;
struct wl_list handlers;
- struct swc_pointer_handler client_handler;
+ struct pointer_handler client_handler;
wl_fixed_t x, y;
pixman_region32_t region;
};
-bool swc_pointer_initialize(struct swc_pointer * pointer);
-void swc_pointer_finalize(struct swc_pointer * pointer);
-void swc_pointer_set_focus(struct swc_pointer * pointer,
- struct swc_surface * surface);
-void swc_pointer_set_region(struct swc_pointer * pointer,
- pixman_region32_t * region);
-void swc_pointer_set_cursor(struct swc_pointer * pointer, uint32_t id);
-
-struct wl_resource * swc_pointer_bind(struct swc_pointer * pointer,
- struct wl_client * client, uint32_t id);
-void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time,
- uint32_t button, uint32_t state);
-void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time,
- uint32_t axis, wl_fixed_t amount);
-void swc_pointer_handle_relative_motion
- (struct swc_pointer * pointer, uint32_t time, wl_fixed_t dx, wl_fixed_t dy);
+bool pointer_initialize(struct pointer * pointer);
+void pointer_finalize(struct pointer * pointer);
+void pointer_set_focus(struct pointer * pointer, struct swc_surface * surface);
+void pointer_set_region(struct pointer * pointer, pixman_region32_t * region);
+void pointer_set_cursor(struct pointer * pointer, uint32_t id);
+
+struct wl_resource * pointer_bind(struct pointer * pointer,
+ struct wl_client * client, uint32_t id);
+void pointer_handle_button(struct pointer * pointer, uint32_t time,
+ uint32_t button, uint32_t state);
+void pointer_handle_axis(struct pointer * pointer, uint32_t time,
+ uint32_t axis, wl_fixed_t amount);
+void pointer_handle_relative_motion(struct pointer * pointer, uint32_t time,
+ wl_fixed_t dx, wl_fixed_t dy);
#endif
diff --git a/libswc/seat.c b/libswc/seat.c
@@ -51,7 +51,7 @@ static struct
#endif
struct swc_keyboard keyboard;
- struct swc_pointer pointer;
+ struct pointer pointer;
struct swc_data_device data_device;
struct wl_global * global;
@@ -72,17 +72,17 @@ static void handle_key(uint32_t time, uint32_t key, uint32_t state)
static void handle_button(uint32_t time, uint32_t button, uint32_t state)
{
- swc_pointer_handle_button(&seat.pointer, time, button, state);
+ pointer_handle_button(&seat.pointer, time, button, state);
}
static void handle_axis(uint32_t time, uint32_t axis, wl_fixed_t amount)
{
- swc_pointer_handle_axis(&seat.pointer, time, axis, amount);
+ pointer_handle_axis(&seat.pointer, time, axis, amount);
}
static void handle_relative_motion(uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
{
- swc_pointer_handle_relative_motion(&seat.pointer, time, dx, dy);
+ pointer_handle_relative_motion(&seat.pointer, time, dx, dy);
}
const static struct swc_evdev_device_handler evdev_handler = {
@@ -168,7 +168,7 @@ static struct wl_listener launch_listener = {
static void get_pointer(struct wl_client * client, struct wl_resource * resource,
uint32_t id)
{
- swc_pointer_bind(&seat.pointer, client, id);
+ pointer_bind(&seat.pointer, client, id);
}
static void get_keyboard(struct wl_client * client, struct wl_resource * resource,
@@ -398,7 +398,7 @@ bool swc_seat_initialize(const char * seat_name)
wl_signal_add(&seat.keyboard.focus.event_signal, &keyboard_focus_listener);
- if (!swc_pointer_initialize(&seat.pointer))
+ if (!pointer_initialize(&seat.pointer))
{
ERROR("Could not initialize pointer\n");
goto error4;
@@ -419,7 +419,7 @@ bool swc_seat_initialize(const char * seat_name)
finalize_monitor();
error5:
#endif
- swc_pointer_finalize(&seat.pointer);
+ pointer_finalize(&seat.pointer);
error4:
swc_keyboard_finalize(&seat.keyboard);
error3:
@@ -439,7 +439,7 @@ void swc_seat_finalize()
#ifdef ENABLE_HOTPLUGGING
finalize_monitor();
#endif
- swc_pointer_finalize(&seat.pointer);
+ pointer_finalize(&seat.pointer);
swc_keyboard_finalize(&seat.keyboard);
wl_list_for_each_safe(device, tmp, &seat.devices, link)
diff --git a/libswc/seat.h b/libswc/seat.h
@@ -28,7 +28,7 @@
struct swc_seat
{
- struct swc_pointer * pointer;
+ struct pointer * pointer;
struct swc_keyboard * keyboard;
struct swc_data_device * data_device;
};
diff --git a/libswc/swc.c b/libswc/swc.c
@@ -81,7 +81,7 @@ static void setup_compositor()
geometry->width, geometry->height);
}
- swc_pointer_set_region(swc.seat->pointer, &pointer_region);
+ pointer_set_region(swc.seat->pointer, &pointer_region);
pixman_region32_fini(&pointer_region);
}