swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 5009ed3dcc749dae5ceb72c98c3dd606dcc48f5f
parent 83c6548f416ead61997104b74f7e361cc887450d
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 21 Mar 2015 18:53:31 +0000

Drop swc_ prefix from internal structures and functions

Diffstat:
Mlibswc/bindings.c | 4++--
Mlibswc/bindings.h | 4++--
Mlibswc/compositor.c | 23+++++++++++------------
Mlibswc/compositor.h | 13++++++-------
Mlibswc/cursor_plane.c | 2+-
Mlibswc/data.c | 2+-
Mlibswc/data_device.c | 10+++++-----
Mlibswc/drm.c | 14+++++++-------
Mlibswc/drm.h | 10+++++-----
Mlibswc/evdev_device.c | 26+++++++++++++-------------
Mlibswc/evdev_device.h | 16++++++++--------
Mlibswc/event.h | 8++++----
Mlibswc/framebuffer_plane.c | 8++++----
Mlibswc/framebuffer_plane.h | 6+++---
Mlibswc/input.c | 5++---
Mlibswc/keyboard.c | 6+++---
Mlibswc/mode.c | 6+++---
Mlibswc/mode.h | 8++++----
Mlibswc/output.c | 23+++++++++++------------
Mlibswc/output.h | 8++++----
Mlibswc/panel.c | 4++--
Mlibswc/panel.h | 2+-
Mlibswc/panel_manager.c | 2+-
Mlibswc/pointer.c | 8++++----
Mlibswc/pointer.h | 2+-
Mlibswc/region.c | 12++++++------
Mlibswc/region.h | 6+++---
Mlibswc/screen.c | 13++++++-------
Mlibswc/screen.h | 4++--
Mlibswc/seat.c | 28++++++++++++++--------------
Mlibswc/seat.h | 6+++---
Mlibswc/shell.c | 6+++---
Mlibswc/shell.h | 4++--
Mlibswc/shell_surface.c | 8++++----
Mlibswc/shell_surface.h | 4++--
Mlibswc/shm.c | 6+++---
Mlibswc/shm.h | 4++--
Mlibswc/surface.c | 67+++++++++++++++++++++++++++++++++----------------------------------
Mlibswc/surface.h | 24++++++++++++------------
Mlibswc/swc.c | 42+++++++++++++++++++++---------------------
Mlibswc/util.c | 2+-
Mlibswc/util.h | 14+++++++-------
Mlibswc/view.c | 2+-
Mlibswc/wayland_buffer.c | 4++--
Mlibswc/wayland_buffer.h | 4++--
Mlibswc/window.c | 8++++----
Mlibswc/window.h | 2+-
Mlibswc/xdg_popup.c | 6+++---
Mlibswc/xdg_popup.h | 6+++---
Mlibswc/xdg_shell.c | 6+++---
Mlibswc/xdg_surface.c | 4++--
Mlibswc/xdg_surface.h | 4++--
Mlibswc/xwm.c | 4++--
53 files changed, 257 insertions(+), 263 deletions(-)

diff --git a/libswc/bindings.c b/libswc/bindings.c @@ -147,7 +147,7 @@ bool handle_button(struct pointer_handler * handler, uint32_t time, return handle_binding(time, &button->press, state, &find_button_binding); } -bool swc_bindings_initialize(void) +bool bindings_initialize(void) { wl_array_init(&key_bindings); wl_array_init(&button_bindings); @@ -155,7 +155,7 @@ bool swc_bindings_initialize(void) return true; } -void swc_bindings_finalize(void) +void bindings_finalize(void) { wl_array_release(&key_bindings); wl_array_release(&button_bindings); diff --git a/libswc/bindings.h b/libswc/bindings.h @@ -32,8 +32,8 @@ struct swc_bindings struct pointer_handler * pointer_handler; }; -bool swc_bindings_initialize(void); -void swc_bindings_finalize(void); +bool bindings_initialize(void); +void bindings_finalize(void); #endif diff --git a/libswc/compositor.c b/libswc/compositor.c @@ -456,8 +456,7 @@ const static struct view_impl view_impl = { .move = &move }; -struct compositor_view * swc_compositor_create_view - (struct swc_surface * surface) +struct compositor_view * compositor_create_view(struct surface * surface) { struct compositor_view * view; @@ -481,7 +480,7 @@ struct compositor_view * swc_compositor_create_view view->border.damaged = false; pixman_region32_init(&view->clip); wl_signal_init(&view->destroy_signal); - swc_surface_set_view(surface, &view->base); + surface_set_view(surface, &view->base); wl_list_insert(&compositor.views, &view->link); return view; @@ -491,7 +490,7 @@ void compositor_view_destroy(struct compositor_view * view) { wl_signal_emit(&view->destroy_signal, NULL); compositor_view_hide(view); - swc_surface_set_view(view->surface, NULL); + surface_set_view(view->surface, NULL); view_finalize(&view->base); pixman_region32_fini(&view->clip); wl_list_remove(&view->link); @@ -741,7 +740,7 @@ bool handle_motion(struct pointer_handler * handler, uint32_t time, if (!view->visible) continue; - if (swc_rectangle_contains_point(&view->base.geometry, x, y) + if (rectangle_contains_point(&view->base.geometry, x, y) && pixman_region32_contains_point(&view->surface->state.input, x - view->base.geometry.x, y - view->base.geometry.y, NULL)) @@ -774,7 +773,7 @@ static void handle_switch_vt(void * data, uint32_t time, static void handle_swc_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; switch (event->type) { @@ -790,10 +789,10 @@ static void handle_swc_event(struct wl_listener * listener, void * data) static void create_surface(struct wl_client * client, struct wl_resource * resource, uint32_t id) { - struct swc_surface * surface; + struct surface * surface; /* Initialize surface. */ - surface = swc_surface_new(client, wl_resource_get_version(resource), id); + surface = surface_new(client, wl_resource_get_version(resource), id); if (!surface) { @@ -807,9 +806,9 @@ static void create_surface(struct wl_client * client, static void create_region(struct wl_client * client, struct wl_resource * resource, uint32_t id) { - struct swc_region * region; + struct region * region; - region = swc_region_new(client, wl_resource_get_version(resource), id); + region = region_new(client, wl_resource_get_version(resource), id); if (!region) wl_resource_post_no_memory(resource); @@ -834,7 +833,7 @@ static void bind_compositor(struct wl_client * client, void * data, NULL, NULL); } -bool swc_compositor_initialize(void) +bool compositor_initialize(void) { struct screen * screen; uint32_t keysym; @@ -874,7 +873,7 @@ bool swc_compositor_initialize(void) return true; } -void swc_compositor_finalize(void) +void compositor_finalize(void) { pixman_region32_fini(&compositor.damage); pixman_region32_fini(&compositor.opaque); diff --git a/libswc/compositor.h b/libswc/compositor.h @@ -37,20 +37,20 @@ struct swc_compositor /** * Emitted when a new surface is created. * - * The data argument of the signal refers to the swc_surface that has - * been created. + * The data argument of the signal refers to the surface that has been + * created. */ struct wl_signal new_surface; } signal; }; -bool swc_compositor_initialize(void); -void swc_compositor_finalize(void); +bool compositor_initialize(void); +void compositor_finalize(void); struct compositor_view { struct view base; - struct swc_surface * surface; + struct surface * surface; struct wld_buffer * buffer; struct window * window; struct compositor_view * parent; @@ -76,8 +76,7 @@ struct compositor_view struct wl_signal destroy_signal; }; -struct compositor_view * swc_compositor_create_view - (struct swc_surface * surface); +struct compositor_view * compositor_create_view(struct surface * surface); void compositor_view_destroy(struct compositor_view * view); diff --git a/libswc/cursor_plane.c b/libswc/cursor_plane.c @@ -98,7 +98,7 @@ static const struct view_impl view_impl = { static void handle_swc_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; struct cursor_plane * plane = wl_container_of(listener, plane, swc_listener); diff --git a/libswc/data.c b/libswc/data.c @@ -169,7 +169,7 @@ struct wl_resource * data_offer_new(struct wl_client * client, offer = wl_resource_create(client, &wl_data_offer_interface, version, 0); wl_resource_set_implementation(offer, &data_offer_implementation, - data, &swc_remove_resource); + data, &remove_resource); wl_list_insert(&data->offers, wl_resource_get_link(offer)); return offer; diff --git a/libswc/data_device.c b/libswc/data_device.c @@ -57,8 +57,8 @@ static void set_selection(struct wl_client * client, (data_source, &data_device->selection_destroy_listener); } - swc_send_event(&data_device->event_signal, - DATA_DEVICE_EVENT_SELECTION_CHANGED, NULL); + send_event(&data_device->event_signal, + DATA_DEVICE_EVENT_SELECTION_CHANGED, NULL); } static struct wl_data_device_interface data_device_implementation = { @@ -72,8 +72,8 @@ static void handle_selection_destroy(struct wl_listener * listener, void * data) = wl_container_of(listener, data_device, selection_destroy_listener); data_device->selection = NULL; - swc_send_event(&data_device->event_signal, - DATA_DEVICE_EVENT_SELECTION_CHANGED, NULL); + send_event(&data_device->event_signal, + DATA_DEVICE_EVENT_SELECTION_CHANGED, NULL); } bool data_device_initialize(struct data_device * data_device) @@ -101,7 +101,7 @@ void data_device_bind(struct data_device * data_device, resource = wl_resource_create(client, &wl_data_device_interface, version, id); wl_resource_set_implementation(resource, &data_device_implementation, - data_device, &swc_remove_resource); + data_device, &remove_resource); wl_list_insert(&data_device->resources, &resource->link); } diff --git a/libswc/drm.c b/libswc/drm.c @@ -103,7 +103,7 @@ static void create_prime_buffer(struct wl_client * client, if (!buffer) goto error0; - buffer_resource = swc_wayland_buffer_create_resource + buffer_resource = wayland_buffer_create_resource (client, wl_resource_get_version(resource), id, buffer); if (!buffer_resource) @@ -231,7 +231,7 @@ static void handle_vblank(int fd, unsigned int sequence, unsigned int sec, static void handle_page_flip(int fd, unsigned int sequence, unsigned int sec, unsigned int usec, void * data) { - struct swc_drm_handler * handler = data; + struct drm_handler * handler = data; handler->page_flip(handler, sec * 1000 + usec / 1000); } @@ -268,7 +268,7 @@ static void bind_drm(struct wl_client * client, void * data, uint32_t version, wl_drm_send_format(resource, WL_DRM_FORMAT_ARGB8888); } -bool swc_drm_initialize(void) +bool drm_initialize(void) { struct stat master, render; @@ -361,7 +361,7 @@ bool swc_drm_initialize(void) return false; } -void swc_drm_finalize(void) +void drm_finalize(void) { if (drm.global) wl_global_destroy(drm.global); @@ -371,12 +371,12 @@ void swc_drm_finalize(void) close(swc.drm->fd); } -bool swc_drm_create_screens(struct wl_list * screens) +bool drm_create_screens(struct wl_list * screens) { drmModeRes * resources; drmModeConnector * connector; uint32_t index; - struct swc_output * output; + struct output * output; uint32_t taken_crtcs = 0; if (!(resources = drmModeGetResources(swc.drm->fd))) @@ -410,7 +410,7 @@ bool swc_drm_create_screens(struct wl_list * screens) break; } - if (!(output = swc_output_new(connector))) + if (!(output = output_new(connector))) continue; output->screen = screen_new(resources->crtcs[crtc_index], output); diff --git a/libswc/drm.h b/libswc/drm.h @@ -5,9 +5,9 @@ #include <stdint.h> #include <wayland-server.h> -struct swc_drm_handler +struct drm_handler { - void (* page_flip)(struct swc_drm_handler * handler, uint32_t time); + void (* page_flip)(struct drm_handler * handler, uint32_t time); }; struct swc_drm @@ -17,10 +17,10 @@ struct swc_drm struct wld_renderer * renderer; }; -bool swc_drm_initialize(void); -void swc_drm_finalize(void); +bool drm_initialize(void); +void drm_finalize(void); -bool swc_drm_create_screens(struct wl_list * screens); +bool drm_create_screens(struct wl_list * screens); #endif diff --git a/libswc/evdev_device.c b/libswc/evdev_device.c @@ -48,7 +48,7 @@ static inline uint32_t timeval_to_msec(struct timeval * time) return time->tv_sec * 1000 + time->tv_usec / 1000; } -static void handle_key_event(struct swc_evdev_device * device, +static void handle_key_event(struct evdev_device * device, struct input_event * input_event) { uint32_t time = timeval_to_msec(&input_event->time); @@ -69,7 +69,7 @@ static void handle_key_event(struct swc_evdev_device * device, } } -static void handle_rel_event(struct swc_evdev_device * device, +static void handle_rel_event(struct evdev_device * device, struct input_event * input_event) { uint32_t time = timeval_to_msec(&input_event->time); @@ -99,12 +99,12 @@ static void handle_rel_event(struct swc_evdev_device * device, device->handler->axis(time, axis, amount); } -static void handle_abs_event(struct swc_evdev_device * device, +static void handle_abs_event(struct evdev_device * device, struct input_event * input_event) { } -static void (* event_handlers[])(struct swc_evdev_device * device, +static void (* event_handlers[])(struct evdev_device * device, struct input_event * input_event) = { [EV_KEY] = &handle_key_event, [EV_REL] = &handle_rel_event, @@ -117,7 +117,7 @@ static bool is_motion_event(struct input_event * event) || (event->type == EV_ABS && (event->code == ABS_X || event->code == ABS_Y)); } -static void handle_motion_events(struct swc_evdev_device * device, +static void handle_motion_events(struct evdev_device * device, uint32_t time) { if (device->motion.rel.pending) @@ -133,7 +133,7 @@ static void handle_motion_events(struct swc_evdev_device * device, } } -static void handle_event(struct swc_evdev_device * device, +static void handle_event(struct evdev_device * device, struct input_event * event) { if (!is_motion_event(event)) @@ -146,7 +146,7 @@ static void handle_event(struct swc_evdev_device * device, } } -static void close_device(struct swc_evdev_device * device) +static void close_device(struct evdev_device * device) { wl_event_source_remove(device->source); close(device->fd); @@ -156,7 +156,7 @@ static void close_device(struct swc_evdev_device * device) static int handle_data(int fd, uint32_t mask, void * data) { - struct swc_evdev_device * device = data; + struct evdev_device * device = data; struct input_event event; unsigned flags = device->needs_sync ? LIBEVDEV_READ_FLAG_FORCE_SYNC : LIBEVDEV_READ_FLAG_NORMAL; @@ -196,10 +196,10 @@ static int handle_data(int fd, uint32_t mask, void * data) return 1; } -struct swc_evdev_device * swc_evdev_device_new - (const char * path, const struct swc_evdev_device_handler * handler) +struct evdev_device * evdev_device_new + (const char * path, const struct evdev_device_handler * handler) { - struct swc_evdev_device * device; + struct evdev_device * device; if (!(device = malloc(sizeof *device))) goto error0; @@ -267,7 +267,7 @@ struct swc_evdev_device * swc_evdev_device_new return NULL; } -void swc_evdev_device_destroy(struct swc_evdev_device * device) +void evdev_device_destroy(struct evdev_device * device) { if (device->source) close_device(device); @@ -277,7 +277,7 @@ void swc_evdev_device_destroy(struct swc_evdev_device * device) free(device); } -bool swc_evdev_device_reopen(struct swc_evdev_device * device) +bool evdev_device_reopen(struct evdev_device * device) { if (device->source) close_device(device); diff --git a/libswc/evdev_device.h b/libswc/evdev_device.h @@ -32,10 +32,10 @@ #include <linux/input.h> #include <wayland-util.h> -struct swc_evdev_device; +struct evdev_device; struct wl_event_loop; -struct swc_evdev_device_handler +struct evdev_device_handler { void (* key)(uint32_t time, uint32_t key, uint32_t state); void (* button)(uint32_t time, uint32_t key, uint32_t state); @@ -43,14 +43,14 @@ struct swc_evdev_device_handler void (* relative_motion)(uint32_t time, wl_fixed_t dx, wl_fixed_t dy); }; -struct swc_evdev_device +struct evdev_device { char * path; int fd; struct libevdev * dev; bool needs_sync; - const struct swc_evdev_device_handler * handler; + const struct evdev_device_handler * handler; struct { @@ -78,12 +78,12 @@ struct swc_evdev_device struct wl_list link; }; -struct swc_evdev_device * swc_evdev_device_new - (const char * path, const struct swc_evdev_device_handler * handler); +struct evdev_device * evdev_device_new + (const char * path, const struct evdev_device_handler * handler); -void swc_evdev_device_destroy(struct swc_evdev_device * device); +void evdev_device_destroy(struct evdev_device * device); -bool swc_evdev_device_reopen(struct swc_evdev_device * device); +bool evdev_device_reopen(struct evdev_device * device); #endif diff --git a/libswc/event.h b/libswc/event.h @@ -10,7 +10,7 @@ * An event is the data passed to the listeners of the event_signals of various * objects. */ -struct swc_event +struct event { /** * The type of event that was sent. @@ -29,10 +29,10 @@ struct swc_event void * data; }; -static inline void swc_send_event(struct wl_signal * signal, uint32_t type, - void * event_data) +static inline void send_event(struct wl_signal * signal, uint32_t type, + void * event_data) { - struct swc_event event = { .type = type, .data = event_data }; + struct event event = { .type = type, .data = event_data }; wl_signal_emit(signal, &event); } diff --git a/libswc/framebuffer_plane.c b/libswc/framebuffer_plane.c @@ -82,7 +82,7 @@ static void send_frame(void * data) { struct framebuffer_plane * plane = data; - view_frame(&plane->view, swc_time()); + view_frame(&plane->view, get_time()); } static int attach(struct view * view, struct wld_buffer * buffer) @@ -167,7 +167,7 @@ const static struct view_impl view_impl = { .move = &move }; -static void handle_page_flip(struct swc_drm_handler * handler, uint32_t time) +static void handle_page_flip(struct drm_handler * handler, uint32_t time) { struct framebuffer_plane * plane = wl_container_of(handler, plane, drm_handler); @@ -177,7 +177,7 @@ static void handle_page_flip(struct swc_drm_handler * handler, uint32_t time) static void handle_swc_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; struct framebuffer_plane * plane = wl_container_of(listener, plane, swc_listener); @@ -190,7 +190,7 @@ static void handle_swc_event(struct wl_listener * listener, void * data) } bool framebuffer_plane_initialize(struct framebuffer_plane * plane, - uint32_t crtc, struct swc_mode * mode, + uint32_t crtc, struct mode * mode, uint32_t * connectors, uint32_t num_connectors) { diff --git a/libswc/framebuffer_plane.h b/libswc/framebuffer_plane.h @@ -33,16 +33,16 @@ struct framebuffer_plane { uint32_t crtc; drmModeCrtcPtr original_crtc_state; - struct swc_mode mode; + struct mode mode; struct view view; struct wl_array connectors; bool need_modeset; - struct swc_drm_handler drm_handler; + struct drm_handler drm_handler; struct wl_listener swc_listener; }; bool framebuffer_plane_initialize(struct framebuffer_plane * plane, - uint32_t crtc, struct swc_mode * mode, + uint32_t crtc, struct mode * mode, uint32_t * connectors, uint32_t num_connectors); diff --git a/libswc/input.c b/libswc/input.c @@ -121,7 +121,7 @@ void input_focus_remove_resource(struct input_focus * input_focus, if (resource == input_focus->resource) input_focus->resource = NULL; - swc_remove_resource(resource); + remove_resource(resource); } void input_focus_set(struct input_focus * input_focus, @@ -141,8 +141,7 @@ void input_focus_set(struct input_focus * input_focus, /* Focus new view, if given. */ focus(input_focus, view); - swc_send_event(&input_focus->event_signal, INPUT_FOCUS_EVENT_CHANGED, - &data); + send_event(&input_focus->event_signal, INPUT_FOCUS_EVENT_CHANGED, &data); return; } diff --git a/libswc/keyboard.c b/libswc/keyboard.c @@ -80,7 +80,7 @@ static bool client_handle_key(struct keyboard * keyboard, uint32_t time, { if (*value == key->press.value) { - swc_array_remove(&keyboard->client_keys, value, sizeof *value); + array_remove(&keyboard->client_keys, value, sizeof *value); break; } } @@ -156,7 +156,7 @@ void keyboard_finalize(struct keyboard * keyboard) void keyboard_reset(struct keyboard * keyboard) { struct key * key; - uint32_t time = swc_time(); + uint32_t time = get_time(); /* Send simulated key release events for all current key handlers. */ wl_array_for_each(key, &keyboard->keys) @@ -259,7 +259,7 @@ void keyboard_handle_key(struct keyboard * keyboard, uint32_t time, key->handler->key(keyboard, time, key, state); } - swc_array_remove(&keyboard->keys, key, sizeof *key); + array_remove(&keyboard->keys, key, sizeof *key); goto update_xkb_state; } } diff --git a/libswc/mode.c b/libswc/mode.c @@ -23,7 +23,7 @@ #include "mode.h" -bool swc_mode_initialize(struct swc_mode * mode, drmModeModeInfo * mode_info) +bool mode_initialize(struct mode * mode, drmModeModeInfo * mode_info) { mode->width = mode_info->hdisplay; mode->height = mode_info->vdisplay; @@ -35,11 +35,11 @@ bool swc_mode_initialize(struct swc_mode * mode, drmModeModeInfo * mode_info) return true; } -void swc_mode_finish(struct swc_mode * mode) +void mode_finish(struct mode * mode) { } -bool swc_mode_equal(const struct swc_mode * mode1, const struct swc_mode * mode2) +bool mode_equal(const struct mode * mode1, const struct mode * mode2) { return mode1->width == mode2->width && mode1->height == mode2->height diff --git a/libswc/mode.h b/libswc/mode.h @@ -31,7 +31,7 @@ #include <wayland-util.h> -struct swc_mode +struct mode { uint16_t width, height; uint32_t refresh; @@ -41,10 +41,10 @@ struct swc_mode drmModeModeInfo info; }; -bool swc_mode_initialize(struct swc_mode * mode, drmModeModeInfo * mode_info); -void swc_mode_finish(struct swc_mode * mode); +bool mode_initialize(struct mode * mode, drmModeModeInfo * mode_info); +void mode_finish(struct mode * mode); -bool swc_mode_equal(const struct swc_mode * mode1, const struct swc_mode * mode2); +bool mode_equal(const struct mode * mode1, const struct mode * mode2); #endif diff --git a/libswc/output.c b/libswc/output.c @@ -14,9 +14,9 @@ static void bind_output(struct wl_client * client, void * data, uint32_t version, uint32_t id) { - struct swc_output * output = data; + struct output * output = data; struct screen * screen = output->screen; - struct swc_mode * mode; + struct mode * mode; struct wl_resource * resource; uint32_t flags; @@ -31,8 +31,7 @@ static void bind_output(struct wl_client * client, void * data, return; } - wl_resource_set_implementation(resource, NULL, output, - &swc_remove_resource); + wl_resource_set_implementation(resource, NULL, output, &remove_resource); wl_list_insert(&output->resources, wl_resource_get_link(resource)); wl_output_send_geometry @@ -45,7 +44,7 @@ static void bind_output(struct wl_client * client, void * data, flags = 0; if (mode->preferred) flags |= WL_OUTPUT_MODE_PREFERRED; - if (swc_mode_equal(&screen->planes.framebuffer.mode, mode)) + if (mode_equal(&screen->planes.framebuffer.mode, mode)) flags |= WL_OUTPUT_MODE_CURRENT; wl_output_send_mode(resource, flags, @@ -56,10 +55,10 @@ static void bind_output(struct wl_client * client, void * data, wl_output_send_done(resource); } -struct swc_output * swc_output_new(drmModeConnectorPtr connector) +struct output * output_new(drmModeConnectorPtr connector) { - struct swc_output * output; - struct swc_mode * modes; + struct output * output; + struct mode * modes; uint32_t index; if (!(output = malloc(sizeof *output))) @@ -94,7 +93,7 @@ struct swc_output * swc_output_new(drmModeConnectorPtr connector) for (index = 0; index < connector->count_modes; ++index) { - swc_mode_initialize(&modes[index], &connector->modes[index]); + mode_initialize(&modes[index], &connector->modes[index]); if (modes[index].preferred) output->preferred_mode = &modes[index]; @@ -110,12 +109,12 @@ struct swc_output * swc_output_new(drmModeConnectorPtr connector) return NULL; } -void swc_output_destroy(struct swc_output * output) +void output_destroy(struct output * output) { - struct swc_mode * mode; + struct mode * mode; wl_array_for_each(mode, &output->modes) - swc_mode_finish(mode); + mode_finish(mode); wl_array_release(&output->modes); wl_global_destroy(output->global); diff --git a/libswc/output.h b/libswc/output.h @@ -8,7 +8,7 @@ struct wl_display; -struct swc_output +struct output { struct screen * screen; @@ -16,7 +16,7 @@ struct swc_output uint32_t physical_width, physical_height; struct wl_array modes; - struct swc_mode * preferred_mode; + struct mode * preferred_mode; pixman_region32_t current_damage, previous_damage; @@ -28,8 +28,8 @@ struct swc_output struct wl_list link; }; -struct swc_output * swc_output_new(drmModeConnector * connector); -void swc_output_destroy(struct swc_output * output); +struct output * output_new(drmModeConnector * connector); +void output_destroy(struct output * output); #endif diff --git a/libswc/panel.c b/libswc/panel.c @@ -227,7 +227,7 @@ static void handle_surface_destroy(struct wl_listener * listener, void * data) } struct panel * panel_new(struct wl_client * client, uint32_t version, - uint32_t id, struct swc_surface * surface) + uint32_t id, struct surface * surface) { struct panel * panel; @@ -242,7 +242,7 @@ struct panel * panel_new(struct wl_client * client, uint32_t version, if (!panel->resource) goto error1; - if (!(panel->view = swc_compositor_create_view(surface))) + if (!(panel->view = compositor_create_view(surface))) goto error2; wl_resource_set_implementation(panel->resource, &panel_implementation, diff --git a/libswc/panel.h b/libswc/panel.h @@ -30,7 +30,7 @@ #include <wayland-server.h> struct panel * panel_new(struct wl_client * client, uint32_t version, - uint32_t id, struct swc_surface * surface); + uint32_t id, struct surface * surface); #endif diff --git a/libswc/panel_manager.c b/libswc/panel_manager.c @@ -37,7 +37,7 @@ static void create_panel(struct wl_client * client, struct wl_resource * resource, uint32_t id, struct wl_resource * surface_resource) { - struct swc_surface * surface = wl_resource_get_user_data(surface_resource); + struct surface * surface = wl_resource_get_user_data(surface_resource); if (!panel_new(client, wl_resource_get_version(resource), id, surface)) wl_client_post_no_memory(client); diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -76,7 +76,7 @@ static bool update(struct view * view) static int attach(struct view * view, struct wld_buffer * buffer) { struct pointer * pointer = wl_container_of(view, pointer, cursor.view); - struct swc_surface * surface = pointer->cursor.surface; + struct surface * surface = pointer->cursor.surface; if (surface && !pixman_region32_not_empty(&surface->state.damage)) return 0; @@ -292,7 +292,7 @@ static void set_cursor(struct wl_client * client, int32_t hotspot_x, int32_t hotspot_y) { struct pointer * pointer = wl_resource_get_user_data(resource); - struct swc_surface * surface; + struct surface * surface; if (pointer->cursor.surface) wl_list_remove(&pointer->cursor.destroy_listener.link); @@ -305,7 +305,7 @@ static void set_cursor(struct wl_client * client, if (surface) { - swc_surface_set_view(surface, &pointer->cursor.view); + surface_set_view(surface, &pointer->cursor.view); wl_resource_add_destroy_listener(surface->resource, &pointer->cursor.destroy_listener); update_cursor(pointer); @@ -379,7 +379,7 @@ void pointer_handle_button(struct pointer * pointer, uint32_t time, button, state); } - swc_array_remove(&pointer->buttons, button, sizeof *button); + array_remove(&pointer->buttons, button, sizeof *button); break; } } diff --git a/libswc/pointer.h b/libswc/pointer.h @@ -57,7 +57,7 @@ struct pointer struct { struct view view; - struct swc_surface * surface; + struct surface * surface; struct wl_listener destroy_listener; struct wld_buffer * buffer; diff --git a/libswc/region.c b/libswc/region.c @@ -11,7 +11,7 @@ static void destroy(struct wl_client * client, struct wl_resource * resource) static void add(struct wl_client * client, struct wl_resource * resource, int32_t x, int32_t y, int32_t width, int32_t height) { - struct swc_region * region = wl_resource_get_user_data(resource); + struct region * region = wl_resource_get_user_data(resource); pixman_region32_union_rect(&region->region, &region->region, x, y, width, height); @@ -20,7 +20,7 @@ static void add(struct wl_client * client, struct wl_resource * resource, static void subtract(struct wl_client * client, struct wl_resource * resource, int32_t x, int32_t y, int32_t width, int32_t height) { - struct swc_region * region = wl_resource_get_user_data(resource); + struct region * region = wl_resource_get_user_data(resource); pixman_region32_t operand; pixman_region32_init_rect(&operand, x, y, width, height); @@ -35,7 +35,7 @@ static const struct wl_region_interface region_implementation = { static void region_destroy(struct wl_resource * resource) { - struct swc_region * region = wl_resource_get_user_data(resource); + struct region * region = wl_resource_get_user_data(resource); /* Finish the region. */ pixman_region32_fini(&region->region); @@ -43,10 +43,10 @@ static void region_destroy(struct wl_resource * resource) free(region); } -struct swc_region * swc_region_new(struct wl_client * client, - uint32_t version, uint32_t id) +struct region * region_new(struct wl_client * client, + uint32_t version, uint32_t id) { - struct swc_region * region; + struct region * region; region = malloc(sizeof *region); diff --git a/libswc/region.h b/libswc/region.h @@ -6,14 +6,14 @@ struct wl_client; -struct swc_region +struct region { struct wl_resource * resource; pixman_region32_t region; }; -struct swc_region * swc_region_new(struct wl_client * client, - uint32_t version, uint32_t id); +struct region * region_new(struct wl_client * client, + uint32_t version, uint32_t id); #endif diff --git a/libswc/screen.c b/libswc/screen.c @@ -61,7 +61,7 @@ bool screens_initialize(void) { wl_list_init(&swc.screens); - if (!swc_drm_create_screens(&swc.screens)) + if (!drm_create_screens(&swc.screens)) return false; if (wl_list_empty(&swc.screens)) @@ -95,12 +95,11 @@ static void bind_screen(struct wl_client * client, void * data, return; } - wl_resource_set_implementation(resource, NULL, - screen, &swc_remove_resource); + wl_resource_set_implementation(resource, NULL, screen, &remove_resource); wl_list_insert(&screen->resources, wl_resource_get_link(resource)); } -struct screen * screen_new(uint32_t crtc, struct swc_output * output) +struct screen * screen_new(uint32_t crtc, struct output * output) { struct screen * screen; int32_t x = 0; @@ -163,7 +162,7 @@ struct screen * screen_new(uint32_t crtc, struct swc_output * output) void screen_destroy(struct screen * screen) { - struct swc_output * output, * next; + struct output * output, * next; if (active_screen == screen) active_screen = NULL; @@ -171,7 +170,7 @@ void screen_destroy(struct screen * screen) screen->handler->destroy(screen->handler_data); wl_signal_emit(&screen->destroy_signal, NULL); wl_list_for_each_safe(output, next, &screen->outputs, link) - swc_output_destroy(output); + output_destroy(output); framebuffer_plane_finalize(&screen->planes.framebuffer); cursor_plane_finalize(&screen->planes.cursor); free(screen); @@ -222,7 +221,7 @@ bool handle_motion(struct pointer_handler * handler, uint32_t time, wl_list_for_each(screen, &swc.screens, link) { - if (swc_rectangle_contains_point(&screen->base.geometry, x, y)) + if (rectangle_contains_point(&screen->base.geometry, x, y)) { if (screen != active_screen) { diff --git a/libswc/screen.h b/libswc/screen.h @@ -30,7 +30,7 @@ #include <wayland-util.h> -struct swc_output; +struct output; struct pixman_region32; struct screen_modifier @@ -72,7 +72,7 @@ struct screen bool screens_initialize(void); void screens_finalize(void); -struct screen * screen_new(uint32_t crtc, struct swc_output * output); +struct screen * screen_new(uint32_t crtc, struct output * output); void screen_destroy(struct screen * screen); static inline uint32_t screen_mask(struct screen * screen) diff --git a/libswc/seat.c b/libswc/seat.c @@ -95,7 +95,7 @@ static void handle_relative_motion(uint32_t time, wl_fixed_t dx, wl_fixed_t dy) static void handle_keyboard_focus_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; struct input_focus_event_data * event_data = event->data; switch (event->type) @@ -119,7 +119,7 @@ static struct wl_listener keyboard_focus_listener = { static void handle_data_device_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; switch (event->type) { @@ -140,7 +140,7 @@ static struct wl_listener data_device_listener = { static void handle_swc_event(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; switch (event->type) { @@ -156,15 +156,15 @@ static void handle_swc_event(struct wl_listener * listener, void * data) if (libinput_resume(seat.libinput) != 0) WARNING("Failed to resume libinput context\n"); #else - struct swc_evdev_device * device, * next; + struct evdev_device * device, * next; /* Re-open all input devices */ wl_list_for_each_safe(device, next, &seat.devices, link) { - if (!swc_evdev_device_reopen(device)) + if (!evdev_device_reopen(device)) { wl_list_remove(&device->link); - swc_evdev_device_destroy(device); + evdev_device_destroy(device); } } #endif @@ -209,7 +209,7 @@ static void bind_seat(struct wl_client * client, void * data, uint32_t version, resource = wl_resource_create(client, &wl_seat_interface, version, id); wl_resource_set_implementation(resource, &seat_implementation, NULL, - &swc_remove_resource); + &remove_resource); wl_list_insert(&seat.resources, wl_resource_get_link(resource)); if (version >= 2) @@ -404,7 +404,7 @@ void finalize_libinput(void) udev_unref(seat.udev); } #else -const static struct swc_evdev_device_handler evdev_handler = { +const static struct evdev_device_handler evdev_handler = { .key = &handle_key, .button = &handle_button, .axis = &handle_axis, @@ -413,9 +413,9 @@ const static struct swc_evdev_device_handler evdev_handler = { static void add_device(const char * path) { - struct swc_evdev_device * device; + struct evdev_device * device; - if (!(device = swc_evdev_device_new(path, &evdev_handler))) + if (!(device = evdev_device_new(path, &evdev_handler))) { ERROR("Could not create evdev device\n"); return; @@ -460,7 +460,7 @@ static bool add_devices(void) } #endif -bool swc_seat_initialize(const char * seat_name) +bool seat_initialize(const char * seat_name) { if (!(seat.name = strdup(seat_name))) { @@ -527,14 +527,14 @@ bool swc_seat_initialize(const char * seat_name) return false; } -void swc_seat_finalize(void) +void seat_finalize(void) { #ifdef ENABLE_LIBINPUT finalize_libinput(); #else - struct swc_evdev_device * device, * tmp; + struct evdev_device * device, * tmp; wl_list_for_each_safe(device, tmp, &seat.devices, link) - swc_evdev_device_destroy(device); + evdev_device_destroy(device); #endif pointer_finalize(&seat.pointer); diff --git a/libswc/seat.h b/libswc/seat.h @@ -33,9 +33,9 @@ struct swc_seat struct data_device * data_device; }; -bool swc_seat_initialize(const char * seat_name); -void swc_seat_finalize(void); -void swc_seat_reopen_devices(void); +bool seat_initialize(const char * seat_name); +void seat_finalize(void); +void seat_reopen_devices(void); #endif diff --git a/libswc/shell.c b/libswc/shell.c @@ -36,7 +36,7 @@ static void get_shell_surface(struct wl_client * client, struct wl_resource * resource, uint32_t id, struct wl_resource * surface_resource) { - struct swc_surface * surface = wl_resource_get_user_data(surface_resource); + struct surface * surface = wl_resource_get_user_data(surface_resource); struct shell_surface * shell_surface; shell_surface = shell_surface_new(client, wl_resource_get_version(resource), @@ -62,7 +62,7 @@ static void bind_shell(struct wl_client * client, void * data, wl_resource_set_implementation(resource, &shell_implementation, NULL, NULL); } -bool swc_shell_initialize(void) +bool shell_initialize(void) { shell.global = wl_global_create(swc.display, &wl_shell_interface, 1, NULL, &bind_shell); @@ -70,7 +70,7 @@ bool swc_shell_initialize(void) return shell.global; } -void swc_shell_finalize(void) +void shell_finalize(void) { wl_global_destroy(shell.global); } diff --git a/libswc/shell.h b/libswc/shell.h @@ -26,8 +26,8 @@ #include <stdbool.h> -bool swc_shell_initialize(void); -void swc_shell_finalize(void); +bool shell_initialize(void); +void shell_finalize(void); #endif diff --git a/libswc/shell_surface.c b/libswc/shell_surface.c @@ -118,7 +118,7 @@ static void set_transient(struct wl_client * client, int32_t x, int32_t y, uint32_t flags) { struct shell_surface * shell_surface = wl_resource_get_user_data(resource); - struct swc_surface * parent_surface + struct surface * parent_surface = wl_resource_get_user_data(parent_resource); struct compositor_view * parent_view = compositor_view(parent_surface->view); @@ -136,7 +136,7 @@ static void set_fullscreen(struct wl_client * client, struct wl_resource * output_resource) { struct shell_surface * shell_surface = wl_resource_get_user_data(resource); - struct swc_output * output = output_resource + struct output * output = output_resource ? wl_resource_get_user_data(output_resource) : NULL; struct screen * screen; @@ -155,7 +155,7 @@ static void set_popup(struct wl_client * client, struct wl_resource * resource, int32_t x, int32_t y, uint32_t flags) { struct shell_surface * shell_surface = wl_resource_get_user_data(resource); - struct swc_surface * parent_surface + struct surface * parent_surface = wl_resource_get_user_data(parent_resource); struct compositor_view * parent_view = compositor_view(parent_surface->view); @@ -229,7 +229,7 @@ static void destroy_shell_surface(struct wl_resource * resource) struct shell_surface * shell_surface_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface) + struct surface * surface) { struct shell_surface * shell_surface; diff --git a/libswc/shell_surface.h b/libswc/shell_surface.h @@ -26,12 +26,12 @@ #include <stdint.h> -struct swc_surface; +struct surface; struct wl_client; struct shell_surface * shell_surface_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface); + struct surface * surface); #endif diff --git a/libswc/shm.c b/libswc/shm.c @@ -121,7 +121,7 @@ static void create_buffer(struct wl_client * client, if (!buffer) goto error0; - buffer_resource = swc_wayland_buffer_create_resource + buffer_resource = wayland_buffer_create_resource (client, wl_resource_get_version(resource), id, buffer); if (!buffer_resource) @@ -237,7 +237,7 @@ static void bind_shm(struct wl_client * client, void * data, uint32_t version, wl_shm_send_format(resource, WL_SHM_FORMAT_ARGB8888); } -bool swc_shm_initialize(void) +bool shm_initialize(void) { if (!(swc.shm->context = wld_pixman_create_context())) goto error0; @@ -261,7 +261,7 @@ bool swc_shm_initialize(void) return false; } -void swc_shm_finalize(void) +void shm_finalize(void) { wl_global_destroy(shm.global); wld_destroy_renderer(swc.shm->renderer); diff --git a/libswc/shm.h b/libswc/shm.h @@ -32,9 +32,9 @@ struct swc_shm struct wld_renderer * renderer; }; -bool swc_shm_initialize(void); +bool shm_initialize(void); -void swc_shm_finalize(void); +void shm_finalize(void); #endif diff --git a/libswc/surface.c b/libswc/surface.c @@ -40,13 +40,13 @@ */ static void handle_buffer_destroy(struct wl_listener * listener, void * data) { - struct swc_surface_state * state; + struct surface_state * state; state = wl_container_of(listener, state, buffer_destroy_listener); state->buffer = NULL; } -static void state_initialize(struct swc_surface_state * state) +static void state_initialize(struct surface_state * state) { state->buffer = NULL; state->buffer_destroy_listener.notify = &handle_buffer_destroy; @@ -58,7 +58,7 @@ static void state_initialize(struct swc_surface_state * state) wl_list_init(&state->frame_callbacks); } -static void state_finalize(struct swc_surface_state * state) +static void state_finalize(struct surface_state * state) { struct wl_resource * resource, * tmp; @@ -81,11 +81,10 @@ static void state_finalize(struct swc_surface_state * state) * In order to set the buffer of a surface state (current or pending), we need * to manage the destroy listeners we have for the new and old buffer. */ -static void state_set_buffer(struct swc_surface_state * state, +static void state_set_buffer(struct surface_state * state, struct wl_resource * resource) { - struct wld_buffer * buffer = resource ? swc_wayland_buffer_get(resource) - : NULL; + struct wld_buffer * buffer = resource ? wayland_buffer_get(resource) : NULL; if (state->buffer) { @@ -107,7 +106,7 @@ static void state_set_buffer(struct swc_surface_state * state, static void handle_frame(struct view_handler * handler, uint32_t time) { - struct swc_surface * surface + struct surface * surface = wl_container_of(handler, surface, view_handler); struct wl_resource * resource, * tmp; @@ -124,10 +123,10 @@ static void handle_frame(struct view_handler * handler, uint32_t time) static void handle_screens(struct view_handler * handler, uint32_t entered, uint32_t left) { - struct swc_surface * surface + struct surface * surface = wl_container_of(handler, surface, view_handler); struct screen * screen; - struct swc_output * output; + struct output * output; struct wl_client * client; struct wl_resource * resource; @@ -167,9 +166,9 @@ static void destroy(struct wl_client * client, struct wl_resource * resource) static void attach(struct wl_client * client, struct wl_resource * resource, struct wl_resource * buffer_resource, int32_t x, int32_t y) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); - surface->pending.commit |= SWC_SURFACE_COMMIT_ATTACH; + surface->pending.commit |= SURFACE_COMMIT_ATTACH; state_set_buffer(&surface->pending.state, buffer_resource); surface->pending.x = x; @@ -179,9 +178,9 @@ static void attach(struct wl_client * client, struct wl_resource * resource, static void damage(struct wl_client * client, struct wl_resource * resource, int32_t x, int32_t y, int32_t width, int32_t height) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); - surface->pending.commit |= SWC_SURFACE_COMMIT_DAMAGE; + surface->pending.commit |= SURFACE_COMMIT_DAMAGE; pixman_region32_union_rect(&surface->pending.state.damage, &surface->pending.state.damage, @@ -191,15 +190,15 @@ static void damage(struct wl_client * client, struct wl_resource * resource, static void frame(struct wl_client * client, struct wl_resource * resource, uint32_t id) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); struct wl_resource * callback_resource; - surface->pending.commit |= SWC_SURFACE_COMMIT_FRAME; + surface->pending.commit |= SURFACE_COMMIT_FRAME; callback_resource = wl_resource_create(client, &wl_callback_interface, 1, id); wl_resource_set_implementation(callback_resource, NULL, NULL, - &swc_remove_resource); + &remove_resource); wl_list_insert(surface->pending.state.frame_callbacks.prev, wl_resource_get_link(callback_resource)); } @@ -208,13 +207,13 @@ static void set_opaque_region(struct wl_client * client, struct wl_resource * resource, struct wl_resource * region_resource) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); - surface->pending.commit |= SWC_SURFACE_COMMIT_OPAQUE; + surface->pending.commit |= SURFACE_COMMIT_OPAQUE; if (region_resource) { - struct swc_region * region = wl_resource_get_user_data(region_resource); + struct region * region = wl_resource_get_user_data(region_resource); pixman_region32_copy(&surface->pending.state.opaque, &region->region); } @@ -226,13 +225,13 @@ static void set_input_region(struct wl_client * client, struct wl_resource * resource, struct wl_resource * region_resource) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); - surface->pending.commit |= SWC_SURFACE_COMMIT_INPUT; + surface->pending.commit |= SURFACE_COMMIT_INPUT; if (region_resource) { - struct swc_region * region = wl_resource_get_user_data(region_resource); + struct region * region = wl_resource_get_user_data(region_resource); pixman_region32_copy(&surface->pending.state.input, &region->region); } @@ -250,11 +249,11 @@ static inline void trim_region(pixman_region32_t * region, static void commit(struct wl_client * client, struct wl_resource * resource) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); struct wld_buffer * buffer; /* Attach */ - if (surface->pending.commit & SWC_SURFACE_COMMIT_ATTACH) + if (surface->pending.commit & SURFACE_COMMIT_ATTACH) { if (surface->state.buffer && surface->state.buffer != surface->pending.state.buffer) @@ -269,7 +268,7 @@ static void commit(struct wl_client * client, struct wl_resource * resource) buffer = surface->state.buffer; /* Damage */ - if (surface->pending.commit & SWC_SURFACE_COMMIT_DAMAGE) + if (surface->pending.commit & SURFACE_COMMIT_DAMAGE) { pixman_region32_union(&surface->state.damage, &surface->state.damage, &surface->pending.state.damage); @@ -277,21 +276,21 @@ static void commit(struct wl_client * client, struct wl_resource * resource) } /* Opaque */ - if (surface->pending.commit & SWC_SURFACE_COMMIT_OPAQUE) + if (surface->pending.commit & SURFACE_COMMIT_OPAQUE) { pixman_region32_copy(&surface->state.opaque, &surface->pending.state.opaque); } /* Input */ - if (surface->pending.commit & SWC_SURFACE_COMMIT_INPUT) + if (surface->pending.commit & SURFACE_COMMIT_INPUT) { pixman_region32_copy(&surface->state.input, &surface->pending.state.input); } /* Frame */ - if (surface->pending.commit & SWC_SURFACE_COMMIT_FRAME) + if (surface->pending.commit & SURFACE_COMMIT_FRAME) { wl_list_insert_list(&surface->state.frame_callbacks, &surface->pending.state.frame_callbacks); @@ -303,7 +302,7 @@ static void commit(struct wl_client * client, struct wl_resource * resource) if (surface->view) { - if (surface->pending.commit & SWC_SURFACE_COMMIT_ATTACH) + if (surface->pending.commit & SURFACE_COMMIT_ATTACH) view_attach(surface->view, buffer); view_update(surface->view); } @@ -337,7 +336,7 @@ static struct wl_surface_interface surface_implementation = { static void surface_destroy(struct wl_resource * resource) { - struct swc_surface * surface = wl_resource_get_user_data(resource); + struct surface * surface = wl_resource_get_user_data(resource); state_finalize(&surface->state); state_finalize(&surface->pending.state); @@ -355,10 +354,10 @@ static void surface_destroy(struct wl_resource * resource) * * @return The newly allocated surface. */ -struct swc_surface * swc_surface_new(struct wl_client * client, - uint32_t version, uint32_t id) +struct surface * surface_new(struct wl_client * client, + uint32_t version, uint32_t id) { - struct swc_surface * surface; + struct surface * surface; surface = malloc(sizeof *surface); @@ -382,7 +381,7 @@ struct swc_surface * swc_surface_new(struct wl_client * client, return surface; } -void swc_surface_set_view(struct swc_surface * surface, struct view * view) +void surface_set_view(struct surface * surface, struct view * view) { if (surface->view == view) return; diff --git a/libswc/surface.h b/libswc/surface.h @@ -32,14 +32,14 @@ enum { - SWC_SURFACE_COMMIT_ATTACH = (1 << 0), - SWC_SURFACE_COMMIT_DAMAGE = (1 << 1), - SWC_SURFACE_COMMIT_OPAQUE = (1 << 2), - SWC_SURFACE_COMMIT_INPUT = (1 << 3), - SWC_SURFACE_COMMIT_FRAME = (1 << 4) + SURFACE_COMMIT_ATTACH = (1 << 0), + SURFACE_COMMIT_DAMAGE = (1 << 1), + SURFACE_COMMIT_OPAQUE = (1 << 2), + SURFACE_COMMIT_INPUT = (1 << 3), + SURFACE_COMMIT_FRAME = (1 << 4) }; -struct swc_surface_state +struct surface_state { struct wld_buffer * buffer; struct wl_resource * buffer_resource; @@ -57,15 +57,15 @@ struct swc_surface_state struct wl_list frame_callbacks; }; -struct swc_surface +struct surface { struct wl_resource * resource; - struct swc_surface_state state; + struct surface_state state; struct { - struct swc_surface_state state; + struct surface_state state; uint32_t commit; int32_t x, y; } pending; @@ -74,10 +74,10 @@ struct swc_surface struct view_handler view_handler; }; -struct swc_surface * swc_surface_new(struct wl_client * client, - uint32_t version, uint32_t id); +struct surface * surface_new(struct wl_client * client, + uint32_t version, uint32_t id); -void swc_surface_set_view(struct swc_surface * surface, struct view * view); +void surface_set_view(struct surface * surface, struct view * view); #endif diff --git a/libswc/swc.c b/libswc/swc.c @@ -101,13 +101,13 @@ static void setup_compositor(void) void swc_activate(void) { swc.active = true; - swc_send_event(&swc.event_signal, SWC_EVENT_ACTIVATED, NULL); + send_event(&swc.event_signal, SWC_EVENT_ACTIVATED, NULL); } void swc_deactivate(void) { swc.active = false; - swc_send_event(&swc.event_signal, SWC_EVENT_DEACTIVATED, NULL); + send_event(&swc.event_signal, SWC_EVENT_DEACTIVATED, NULL); } EXPORT @@ -121,25 +121,25 @@ bool swc_initialize(struct wl_display * display, const char * default_seat = "seat0"; wl_signal_init(&swc.event_signal); - if (!(launch_initialize())) + if (!launch_initialize()) { ERROR("Could not connect to swc-launch\n"); goto error0; } - if (!swc_drm_initialize()) + if (!drm_initialize()) { ERROR("Could not initialize DRM\n"); goto error1; } - if (!swc_shm_initialize()) + if (!shm_initialize()) { ERROR("Could not initialize SHM\n"); goto error2; } - if (!swc_bindings_initialize()) + if (!bindings_initialize()) { ERROR("Could not initialize bindings\n"); goto error3; @@ -151,7 +151,7 @@ bool swc_initialize(struct wl_display * display, goto error4; } - if (!swc_compositor_initialize()) + if (!compositor_initialize()) { ERROR("Could not initialize compositor\n"); goto error5; @@ -163,13 +163,13 @@ bool swc_initialize(struct wl_display * display, goto error6; } - if (!swc_seat_initialize(default_seat)) + if (!seat_initialize(default_seat)) { ERROR("Could not initialize seat\n"); goto error7; } - if (!swc_shell_initialize()) + if (!shell_initialize()) { ERROR("Could not initialize shell\n"); goto error8; @@ -206,21 +206,21 @@ bool swc_initialize(struct wl_display * display, error10: xdg_shell_finalize(); error9: - swc_shell_finalize(); + shell_finalize(); error8: - swc_seat_finalize(); + seat_finalize(); error7: data_device_manager_finalize(); error6: - swc_compositor_finalize(); + compositor_finalize(); error5: screens_finalize(); error4: - swc_bindings_finalize(); + bindings_finalize(); error3: - swc_shm_finalize(); + shm_finalize(); error2: - swc_drm_finalize(); + drm_finalize(); error1: launch_finalize(); error0: @@ -234,14 +234,14 @@ void swc_finalize(void) xserver_finalize(); #endif panel_manager_finalize(); - swc_shell_finalize(); - swc_seat_finalize(); + shell_finalize(); + seat_finalize(); data_device_manager_finalize(); - swc_compositor_finalize(); + compositor_finalize(); screens_finalize(); - swc_bindings_finalize(); - swc_shm_finalize(); - swc_drm_finalize(); + bindings_finalize(); + shm_finalize(); + drm_finalize(); launch_finalize(); } diff --git a/libswc/util.c b/libswc/util.c @@ -30,7 +30,7 @@ pixman_box32_t infinite_extents = { .x2 = INT32_MAX, .y2 = INT32_MAX }; -void swc_remove_resource(struct wl_resource * resource) +void remove_resource(struct wl_resource * resource) { wl_list_remove(wl_resource_get_link(resource)); } diff --git a/libswc/util.h b/libswc/util.h @@ -62,9 +62,9 @@ struct wl_resource; -void swc_remove_resource(struct wl_resource * resource); +void remove_resource(struct wl_resource * resource); -static inline uint32_t swc_time(void) +static inline uint32_t get_time(void) { struct timeval timeval; @@ -74,15 +74,15 @@ static inline uint32_t swc_time(void) extern pixman_box32_t infinite_extents; -static inline bool swc_rectangle_contains_point +static inline bool rectangle_contains_point (const struct swc_rectangle * rectangle, int32_t x, int32_t y) { return x > rectangle->x && x < rectangle->x + rectangle->width && y > rectangle->y && y < rectangle->y + rectangle->height; } -static inline bool swc_rectangle_overlap - (const struct swc_rectangle * r1, const struct swc_rectangle * r2) +static inline bool rectangle_overlap(const struct swc_rectangle * r1, + const struct swc_rectangle * r2) { return (MAX(r1->x + r1->width, r2->x + r2->width) - MIN(r1->x, r2->x) < r1->width + r2->width) @@ -90,8 +90,8 @@ static inline bool swc_rectangle_overlap < r1->height + r2->height); } -static inline void swc_array_remove(struct wl_array * array, - void * item, size_t size) +static inline void array_remove(struct wl_array * array, + void * item, size_t size) { size_t bytes = array->size - ((intptr_t) item + size - (intptr_t) array->data); if (bytes > 0) diff --git a/libswc/view.c b/libswc/view.c @@ -144,7 +144,7 @@ void view_update_screens(struct view * view) wl_list_for_each(screen, &swc.screens, link) { - if (swc_rectangle_overlap(&screen->base.geometry, &view->geometry)) + if (rectangle_overlap(&screen->base.geometry, &view->geometry)) screens |= screen_mask(screen); } diff --git a/libswc/wayland_buffer.c b/libswc/wayland_buffer.c @@ -38,7 +38,7 @@ static const struct wl_buffer_interface buffer_implementation = { .destroy = &destroy }; -struct wld_buffer * swc_wayland_buffer_get(struct wl_resource * resource) +struct wld_buffer * wayland_buffer_get(struct wl_resource * resource) { if (wl_resource_instance_of(resource, &wl_buffer_interface, &buffer_implementation)) @@ -56,7 +56,7 @@ static void destroy_buffer(struct wl_resource * resource) wld_buffer_unreference(buffer); } -struct wl_resource * swc_wayland_buffer_create_resource +struct wl_resource * wayland_buffer_create_resource (struct wl_client * client, uint32_t version, uint32_t id, struct wld_buffer * buffer) { diff --git a/libswc/wayland_buffer.h b/libswc/wayland_buffer.h @@ -29,9 +29,9 @@ struct wl_client; struct wl_resource; -struct wld_buffer * swc_wayland_buffer_get(struct wl_resource * resource); +struct wld_buffer * wayland_buffer_get(struct wl_resource * resource); -struct wl_resource * swc_wayland_buffer_create_resource +struct wl_resource * wayland_buffer_create_resource (struct wl_client * client, uint32_t version, uint32_t id, struct wld_buffer * buffer); diff --git a/libswc/window.c b/libswc/window.c @@ -40,7 +40,7 @@ static const struct swc_window_handler null_handler; static void handle_window_enter(struct wl_listener * listener, void * data) { - struct swc_event * event = data; + struct event * event = data; struct input_focus_event_data * event_data = event->data; struct window * window; @@ -96,7 +96,7 @@ static void end_interaction(struct window_pointer_interaction * interaction, } interaction->original_handler->button(interaction->original_handler, - swc_time(), button, + get_time(), button, WL_POINTER_BUTTON_STATE_RELEASED); } @@ -384,7 +384,7 @@ static const struct view_handler_impl view_handler_impl = { }; bool window_initialize(struct window * window, const struct window_impl * impl, - struct swc_surface * surface) + struct surface * surface) { DEBUG("Initializing window, %p\n", window); @@ -392,7 +392,7 @@ bool window_initialize(struct window * window, const struct window_impl * impl, window->base.app_id = NULL; window->base.parent = NULL; - if (!(window->view = swc_compositor_create_view(surface))) + if (!(window->view = compositor_create_view(surface))) return false; window->impl = impl; diff --git a/libswc/window.h b/libswc/window.h @@ -92,7 +92,7 @@ struct window_impl extern struct wl_listener window_enter_listener; bool window_initialize(struct window * window, const struct window_impl * impl, - struct swc_surface * surface); + struct surface * surface); void window_finalize(struct window * window); diff --git a/libswc/xdg_popup.c b/libswc/xdg_popup.c @@ -65,8 +65,8 @@ static void destroy_popup(struct wl_resource * resource) struct xdg_popup * xdg_popup_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface, - struct swc_surface * parent_surface, + struct surface * surface, + struct surface * parent_surface, int32_t x, int32_t y) { struct xdg_popup * popup; @@ -92,7 +92,7 @@ struct xdg_popup * xdg_popup_new(struct wl_client * client, wl_resource_set_implementation(popup->resource, &xdg_popup_implementation, popup, &destroy_popup); - if (!(popup->view = swc_compositor_create_view(surface))) + if (!(popup->view = compositor_create_view(surface))) goto error2; view_move(&popup->view->base, diff --git a/libswc/xdg_popup.h b/libswc/xdg_popup.h @@ -26,13 +26,13 @@ #include <stdint.h> -struct swc_surface; +struct surface; struct wl_client; struct xdg_popup * xdg_popup_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface, - struct swc_surface * parent, + struct surface * surface, + struct surface * parent, int32_t x, int32_t y); #endif diff --git a/libswc/xdg_shell.c b/libswc/xdg_shell.c @@ -54,7 +54,7 @@ static void get_xdg_surface(struct wl_client * client, struct wl_resource * resource, uint32_t id, struct wl_resource * surface_resource) { - struct swc_surface * surface = wl_resource_get_user_data(surface_resource); + struct surface * surface = wl_resource_get_user_data(surface_resource); struct xdg_surface * xdg_surface; xdg_surface = xdg_surface_new(client, wl_resource_get_version(resource), id, @@ -71,8 +71,8 @@ static void get_xdg_popup(struct wl_client * client, struct wl_resource * seat_resource, uint32_t serial, int32_t x, int32_t y) { - struct swc_surface * surface = wl_resource_get_user_data(surface_resource); - struct swc_surface * parent = wl_resource_get_user_data(parent_resource); + struct surface * surface = wl_resource_get_user_data(surface_resource); + struct surface * parent = wl_resource_get_user_data(parent_resource); struct xdg_popup * popup; popup = xdg_popup_new(client, wl_resource_get_version(resource), id, diff --git a/libswc/xdg_surface.c b/libswc/xdg_surface.c @@ -70,7 +70,7 @@ static bool remove_state(struct xdg_surface * xdg_surface, uint32_t state) { if (*current_state == state) { - swc_array_remove(&xdg_surface->states, current_state, sizeof state); + array_remove(&xdg_surface->states, current_state, sizeof state); return true; } } @@ -303,7 +303,7 @@ static void destroy_xdg_surface(struct wl_resource * resource) struct xdg_surface * xdg_surface_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface) + struct surface * surface) { struct xdg_surface * xdg_surface; diff --git a/libswc/xdg_surface.h b/libswc/xdg_surface.h @@ -26,12 +26,12 @@ #include <stdint.h> -struct swc_surface; +struct surface; struct wl_client; struct xdg_surface * xdg_surface_new(struct wl_client * client, uint32_t version, uint32_t id, - struct swc_surface * surface); + struct surface * surface); #endif diff --git a/libswc/xwm.c b/libswc/xwm.c @@ -260,7 +260,7 @@ static void handle_surface_destroy(struct wl_listener * listener, void * data) static bool manage_window(struct xwl_window * xwl_window) { struct wl_resource * resource; - struct swc_surface * surface; + struct surface * surface; xcb_get_geometry_cookie_t geometry_cookie; xcb_get_geometry_reply_t * geometry_reply; @@ -311,7 +311,7 @@ static bool manage_window(struct xwl_window * xwl_window) static void handle_new_surface(struct wl_listener * listener, void * data) { - struct swc_surface * surface = data; + struct surface * surface = data; struct xwl_window * window; window = find_window_by_surface_id(&xwm.unpaired_windows,