swc

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

commit c396572288d2986c144e8429c3da203ef952e581
parent 5234b837be457ddf8138b389826750d329bc2cb9
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 24 Feb 2014 00:35:16 -0800

view: Drop swc_ prefix for non-public structures/functions

Diffstat:
Mlibswc/compositor.c | 38+++++++++++++++++++-------------------
Mlibswc/compositor.h | 2+-
Mlibswc/cursor_plane.c | 14+++++++-------
Mlibswc/cursor_plane.h | 2+-
Mlibswc/framebuffer_plane.c | 16++++++++--------
Mlibswc/framebuffer_plane.h | 2+-
Mlibswc/panel.c | 4++--
Mlibswc/pointer.c | 48++++++++++++++++++++++++------------------------
Mlibswc/pointer.h | 2+-
Mlibswc/screen.c | 2+-
Mlibswc/surface.c | 18+++++++++---------
Mlibswc/surface.h | 4++--
Mlibswc/view.c | 46++++++++++++++++++++++------------------------
Mlibswc/view.h | 66++++++++++++++++++++++++++++++++----------------------------------
Mlibswc/window.c | 7+++----
Mlibswc/xwm.c | 2+-
16 files changed, 134 insertions(+), 139 deletions(-)

diff --git a/libswc/compositor.c b/libswc/compositor.c @@ -54,7 +54,7 @@ struct target { struct wld_surface * surface; struct wld_buffer * next_buffer, * current_buffer; - struct swc_view * view; + struct view * view; struct wl_listener view_listener; uint32_t mask; @@ -118,11 +118,11 @@ static struct target * target_get(struct screen * screen) static void handle_screen_view_event(struct wl_listener * listener, void * data) { struct swc_event * event = data; - struct swc_view_event_data * event_data = event->data; + struct view_event_data * event_data = event->data; switch (event->type) { - case SWC_VIEW_EVENT_FRAME: + case VIEW_EVENT_FRAME: { struct screen * screen = CONTAINER_OF (event_data->view, typeof(*screen), planes.framebuffer.view); @@ -137,7 +137,7 @@ static void handle_screen_view_event(struct wl_listener * listener, void * data) wl_list_for_each(view, &compositor.views, link) { if (view->base.screens & screen_mask(screen)) - swc_view_frame(&view->base, event_data->frame.time); + view_frame(&view->base, event_data->frame.time); } if (target->current_buffer) @@ -158,7 +158,7 @@ static bool target_swap_buffers(struct target * target) { target->next_buffer = wld_surface_take(target->surface); - if (!swc_view_attach(target->view, target->next_buffer)) + if (!view_attach(target->view, target->next_buffer)) { ERROR("Failed to attach next frame to screen\n"); return false; @@ -402,7 +402,7 @@ static void schedule_updates(uint32_t screens) compositor.scheduled_updates |= screens; } -static bool update(struct swc_view * base) +static bool update(struct view * base) { struct compositor_view * view = (void *) base; @@ -414,7 +414,7 @@ static bool update(struct swc_view * base) return true; } -static bool attach(struct swc_view * base, struct wld_buffer * buffer) +static bool attach(struct view * base, struct wld_buffer * buffer) { struct compositor_view * view = (void *) base; @@ -427,12 +427,12 @@ static bool attach(struct swc_view * base, struct wld_buffer * buffer) update(&view->base); } - swc_view_set_size_from_buffer(&view->base, buffer); + view_set_size_from_buffer(&view->base, buffer); return true; } -static bool move(struct swc_view * base, int32_t x, int32_t y) +static bool move(struct view * base, int32_t x, int32_t y) { struct compositor_view * view = (void *) base; @@ -442,12 +442,12 @@ static bool move(struct swc_view * base, int32_t x, int32_t y) update(&view->base); } - swc_view_set_position(&view->base, x, y); + view_set_position(&view->base, x, y); return true; } -const static struct swc_view_impl view_impl = { +const static struct view_impl view_impl = { .update = &update, .attach = &attach, .move = &move @@ -461,7 +461,7 @@ static void handle_view_event(struct wl_listener * listener, void * data) switch (event->type) { - case SWC_VIEW_EVENT_MOVED: + case VIEW_EVENT_MOVED: update_extents(view); if (view->visible) @@ -471,17 +471,17 @@ static void handle_view_event(struct wl_listener * listener, void * data) pixman_region32_init(&view->clip); damage_below_view(view); - swc_view_update_screens(&view->base); + view_update_screens(&view->base); update(&view->base); } break; - case SWC_VIEW_EVENT_RESIZED: + case VIEW_EVENT_RESIZED: update_extents(view); if (view->visible) { damage_below_view(view); - swc_view_update_screens(&view->base); + view_update_screens(&view->base); update(&view->base); } break; @@ -498,7 +498,7 @@ struct compositor_view * swc_compositor_create_view if (!view) return NULL; - swc_view_initialize(&view->base, &view_impl); + view_initialize(&view->base, &view_impl); view->event_listener.notify = &handle_view_event; wl_signal_add(&view->base.event_signal, &view->event_listener); view->surface = surface; @@ -521,7 +521,7 @@ void compositor_view_destroy(struct compositor_view * view) { compositor_view_hide(view); swc_surface_set_view(view->surface, NULL); - swc_view_finalize(&view->base); + view_finalize(&view->base); pixman_region32_fini(&view->clip); free(view); } @@ -536,7 +536,7 @@ void compositor_view_show(struct compositor_view * view) pixman_region32_clear(&view->clip); view->visible = true; - swc_view_update_screens(&view->base); + view_update_screens(&view->base); damage_view(view); update(&view->base); @@ -553,7 +553,7 @@ void compositor_view_hide(struct compositor_view * view) damage_below_view(view); wl_list_remove(&view->link); - swc_view_set_screens(&view->base, 0); + view_set_screens(&view->base, 0); view->visible = false; } diff --git a/libswc/compositor.h b/libswc/compositor.h @@ -39,7 +39,7 @@ void swc_compositor_finalize(); struct compositor_view { - struct swc_view base; + struct view base; struct wl_listener event_listener; struct swc_surface * surface; struct wld_buffer * buffer; diff --git a/libswc/cursor_plane.c b/libswc/cursor_plane.c @@ -33,12 +33,12 @@ #include <wld/drm.h> #include <xf86drmMode.h> -static bool update(struct swc_view * view) +static bool update(struct view * view) { return true; } -static bool attach(struct swc_view * view, struct wld_buffer * buffer) +static bool attach(struct view * view, struct wld_buffer * buffer) { struct cursor_plane * plane = CONTAINER_OF(view, typeof(*plane), view); @@ -68,12 +68,12 @@ static bool attach(struct swc_view * view, struct wld_buffer * buffer) } } - swc_view_set_size_from_buffer(view, buffer); + view_set_size_from_buffer(view, buffer); return true; } -static bool move(struct swc_view * view, int32_t x, int32_t y) +static bool move(struct view * view, int32_t x, int32_t y) { struct cursor_plane * plane = CONTAINER_OF(view, typeof(*plane), view); @@ -84,12 +84,12 @@ static bool move(struct swc_view * view, int32_t x, int32_t y) return false; } - swc_view_set_position(view, x, y); + view_set_position(view, x, y); return true; } -static const struct swc_view_impl view_impl = { +static const struct view_impl view_impl = { .update = &update, .attach = &attach, .move = &move @@ -120,7 +120,7 @@ bool cursor_plane_initialize(struct cursor_plane * plane, uint32_t crtc, plane->crtc = crtc; plane->launch_listener.notify = &handle_launch_event; wl_signal_add(&swc.launch->event_signal, &plane->launch_listener); - swc_view_initialize(&plane->view, &view_impl); + view_initialize(&plane->view, &view_impl); return true; } diff --git a/libswc/cursor_plane.h b/libswc/cursor_plane.h @@ -28,7 +28,7 @@ struct cursor_plane { - struct swc_view view; + struct view view; const struct swc_rectangle * origin; uint32_t crtc; struct wl_listener launch_listener; diff --git a/libswc/framebuffer_plane.c b/libswc/framebuffer_plane.c @@ -71,7 +71,7 @@ static void framebuffer_destroy(struct wld_destructor * destructor) free(framebuffer); } -static bool update(struct swc_view * view) +static bool update(struct view * view) { return true; } @@ -80,10 +80,10 @@ static void send_frame(void * data) { struct framebuffer_plane * plane = data; - swc_view_frame(&plane->view, swc_time()); + view_frame(&plane->view, swc_time()); } -static bool attach(struct swc_view * view, struct wld_buffer * buffer) +static bool attach(struct view * view, struct wld_buffer * buffer) { struct framebuffer_plane * plane = CONTAINER_OF(view, typeof(*plane), view); @@ -146,14 +146,14 @@ static bool attach(struct swc_view * view, struct wld_buffer * buffer) return true; } -static bool move(struct swc_view * view, int32_t x, int32_t y) +static bool move(struct view * view, int32_t x, int32_t y) { - swc_view_set_position(view, x, y); + view_set_position(view, x, y); return true; } -const static struct swc_view_impl view_impl = { +const static struct view_impl view_impl = { .update = &update, .attach = &attach, .move = &move @@ -164,7 +164,7 @@ static void handle_page_flip(struct swc_drm_handler * handler, uint32_t time) struct framebuffer_plane * plane = CONTAINER_OF(handler, typeof(*plane), drm_handler); - swc_view_frame(&plane->view, time); + view_frame(&plane->view, time); } bool framebuffer_plane_initialize(struct framebuffer_plane * plane, @@ -203,7 +203,7 @@ bool framebuffer_plane_initialize(struct framebuffer_plane * plane, plane->crtc = crtc; plane->drm_handler.page_flip = &handle_page_flip; plane->need_modeset = true; - swc_view_initialize(&plane->view, &view_impl); + view_initialize(&plane->view, &view_impl); plane->view.geometry.width = mode->width; plane->view.geometry.height = mode->height; plane->mode = *mode; diff --git a/libswc/framebuffer_plane.h b/libswc/framebuffer_plane.h @@ -34,7 +34,7 @@ struct framebuffer_plane uint32_t crtc; drmModeCrtcPtr original_crtc_state; struct swc_mode mode; - struct swc_view view; + struct view view; struct wl_array connectors; bool need_modeset; struct swc_drm_handler drm_handler; diff --git a/libswc/panel.c b/libswc/panel.c @@ -78,7 +78,7 @@ static void update_position(struct panel * panel) default: return; } - swc_view_move(&panel->view->base, x, y); + view_move(&panel->view->base, x, y); } static void dock(struct wl_client * client, struct wl_resource * resource, @@ -229,7 +229,7 @@ static void handle_view_event(struct wl_listener * listener, void * data) switch (event->type) { - case SWC_VIEW_EVENT_RESIZED: + case VIEW_EVENT_RESIZED: update_position(panel); break; } diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -74,15 +74,15 @@ static void handle_cursor_surface_destroy(struct wl_listener * listener, struct pointer * pointer = CONTAINER_OF(listener, typeof(*pointer), cursor.destroy_listener); - swc_view_attach(&pointer->cursor.view, NULL); + view_attach(&pointer->cursor.view, NULL); } -static bool update(struct swc_view * view) +static bool update(struct view * view) { return true; } -static bool attach(struct swc_view * view, struct wld_buffer * buffer) +static bool attach(struct view * view, struct wld_buffer * buffer) { struct pointer * pointer = CONTAINER_OF(view, typeof(*pointer), cursor.view); @@ -102,19 +102,19 @@ static bool attach(struct swc_view * view, struct wld_buffer * buffer) /* TODO: Send an early release to the buffer */ - swc_view_set_size_from_buffer(view, buffer); + view_set_size_from_buffer(view, buffer); return true; } -static bool move(struct swc_view * view, int32_t x, int32_t y) +static bool move(struct view * view, int32_t x, int32_t y) { - swc_view_set_position(view, x, y); + view_set_position(view, x, y); return true; } -static const struct swc_view_impl view_impl = { +static const struct view_impl view_impl = { .update = &update, .attach = &attach, .move = &move, @@ -125,34 +125,34 @@ static void handle_view_event(struct wl_listener * listener, void * data) 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; - struct swc_view * view = event_data->view; + struct view_event_data * event_data = event->data; + struct view * view = event_data->view; struct screen * screen; switch (event->type) { - case SWC_VIEW_EVENT_MOVED: + case VIEW_EVENT_MOVED: wl_list_for_each(screen, &swc.screens, link) { - swc_view_move(&screen->planes.cursor.view, - view->geometry.x, view->geometry.y); + view_move(&screen->planes.cursor.view, + view->geometry.x, view->geometry.y); } - swc_view_update_screens(view); + view_update_screens(view); break; - case SWC_VIEW_EVENT_RESIZED: - swc_view_update_screens(view); + case VIEW_EVENT_RESIZED: + view_update_screens(view); break; - case SWC_VIEW_EVENT_SCREENS_CHANGED: + case VIEW_EVENT_SCREENS_CHANGED: wl_list_for_each(screen, &swc.screens, link) { if (event_data->screens_changed.entered & screen_mask(screen)) { - swc_view_attach(&screen->planes.cursor.view, - pointer->cursor.buffer); + view_attach(&screen->planes.cursor.view, + pointer->cursor.buffer); } else if (event_data->screens_changed.left & screen_mask(screen)) - swc_view_attach(&screen->planes.cursor.view, NULL); + view_attach(&screen->planes.cursor.view, NULL); } break; } @@ -160,9 +160,9 @@ static void handle_view_event(struct wl_listener * listener, void * data) 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); + 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 pointer_set_cursor(struct pointer * pointer, uint32_t id) @@ -186,7 +186,7 @@ void pointer_set_cursor(struct pointer * pointer, uint32_t id) pointer->cursor.hotspot.x = cursor->hotspot_x; pointer->cursor.hotspot.y = cursor->hotspot_y; update_cursor(pointer); - swc_view_attach(&pointer->cursor.view, pointer->cursor.internal_buffer); + view_attach(&pointer->cursor.view, pointer->cursor.internal_buffer); } static bool client_handle_button(struct pointer_handler * handler, @@ -257,7 +257,7 @@ bool pointer_initialize(struct pointer * pointer) wl_list_insert(&pointer->handlers, &pointer->client_handler.link); wl_array_init(&pointer->buttons); - swc_view_initialize(&pointer->cursor.view, &view_impl); + view_initialize(&pointer->cursor.view, &view_impl); pointer->cursor.view_listener.notify = &handle_view_event; wl_signal_add(&pointer->cursor.view.event_signal, &pointer->cursor.view_listener); diff --git a/libswc/pointer.h b/libswc/pointer.h @@ -57,7 +57,7 @@ struct pointer struct { - struct swc_view view; + struct view view; struct wl_listener view_listener; struct swc_surface * surface; struct wl_listener destroy_listener; diff --git a/libswc/screen.c b/libswc/screen.c @@ -87,7 +87,7 @@ struct screen * screen_new(uint32_t crtc, struct swc_output * output) goto error2; } - swc_view_move(&screen->planes.framebuffer.view, x, 0); + view_move(&screen->planes.framebuffer.view, x, 0); screen->base.geometry = screen->planes.framebuffer.view.geometry; screen->base.usable_geometry = screen->base.geometry; diff --git a/libswc/surface.c b/libswc/surface.c @@ -247,8 +247,8 @@ static void commit(struct wl_client * client, struct wl_resource * resource) if (surface->view) { if (surface->pending.commit & SWC_SURFACE_COMMIT_ATTACH) - swc_view_attach(surface->view, surface->state.buffer); - swc_view_update(surface->view); + view_attach(surface->view, surface->state.buffer); + view_update(surface->view); } surface->pending.commit = 0; @@ -297,11 +297,11 @@ static void handle_view_event(struct wl_listener * listener, void * data) struct swc_surface * surface = CONTAINER_OF(listener, typeof(*surface), view_listener); struct swc_event * event = data; - struct swc_view_event_data * event_data = event->data; + struct view_event_data * event_data = event->data; switch (event->type) { - case SWC_VIEW_EVENT_FRAME: + case VIEW_EVENT_FRAME: { struct wl_resource * resource, * tmp; @@ -315,7 +315,7 @@ static void handle_view_event(struct wl_listener * listener, void * data) wl_list_init(&surface->state.frame_callbacks); break; } - case SWC_VIEW_EVENT_SCREENS_CHANGED: + case VIEW_EVENT_SCREENS_CHANGED: { struct screen * screen; struct swc_output * output; @@ -347,7 +347,7 @@ static void handle_view_event(struct wl_listener * listener, void * data) } break; } - case SWC_VIEW_EVENT_RESIZED: + case VIEW_EVENT_RESIZED: pixman_region32_intersect_rect (&surface->state.opaque, &surface->state.opaque, 0, 0, surface->view->geometry.width, surface->view->geometry.height); @@ -393,7 +393,7 @@ struct swc_surface * swc_surface_new(struct wl_client * client, return surface; } -void swc_surface_set_view(struct swc_surface * surface, struct swc_view * view) +void swc_surface_set_view(struct swc_surface * surface, struct view * view) { if (surface->view == view) return; @@ -406,8 +406,8 @@ void swc_surface_set_view(struct swc_surface * surface, struct swc_view * view) if (view) { wl_signal_add(&view->event_signal, &surface->view_listener); - swc_view_attach(view, surface->state.buffer); - swc_view_update(surface->view); + view_attach(view, surface->state.buffer); + view_update(surface->view); } } diff --git a/libswc/surface.h b/libswc/surface.h @@ -69,7 +69,7 @@ struct swc_surface } pending; struct window * window; - struct swc_view * view; + struct view * view; struct wl_listener view_listener; struct wl_list link; @@ -78,7 +78,7 @@ struct swc_surface struct swc_surface * swc_surface_new(struct wl_client * client, uint32_t version, uint32_t id); -void swc_surface_set_view(struct swc_surface * surface, struct swc_view * view); +void swc_surface_set_view(struct swc_surface * surface, struct view * view); #endif diff --git a/libswc/view.c b/libswc/view.c @@ -29,8 +29,7 @@ #include <wld/wld.h> -void swc_view_initialize(struct swc_view * view, - const struct swc_view_impl * impl) +void view_initialize(struct view * view, const struct view_impl * impl) { view->impl = impl; view->geometry.x = 0; @@ -42,13 +41,13 @@ void swc_view_initialize(struct swc_view * view, wl_signal_init(&view->event_signal); } -void swc_view_finalize(struct swc_view * view) +void view_finalize(struct view * view) { if (view->buffer) wld_buffer_unreference(view->buffer); } -bool swc_view_attach(struct swc_view * view, struct wld_buffer * buffer) +bool view_attach(struct view * view, struct wld_buffer * buffer) { if (view->impl->attach(view, buffer)) { @@ -65,55 +64,54 @@ bool swc_view_attach(struct swc_view * view, struct wld_buffer * buffer) return false; } -bool swc_view_update(struct swc_view * view) +bool view_update(struct view * view) { return view->impl->update(view); } -bool swc_view_move(struct swc_view * view, int32_t x, int32_t y) +bool view_move(struct view * view, int32_t x, int32_t y) { return view->impl->move(view, x, y); } -void swc_view_set_position(struct swc_view * view, int32_t x, int32_t y) +void view_set_position(struct view * view, int32_t x, int32_t y) { - struct swc_view_event_data data = { .view = view }; + struct view_event_data data = { .view = view }; if (x == view->geometry.x && y == view->geometry.y) return; view->geometry.x = x; view->geometry.y = y; - swc_send_event(&view->event_signal, SWC_VIEW_EVENT_MOVED, &data); + swc_send_event(&view->event_signal, VIEW_EVENT_MOVED, &data); } -void swc_view_set_size(struct swc_view * view, uint32_t width, uint32_t height) +void view_set_size(struct view * view, uint32_t width, uint32_t height) { - struct swc_view_event_data data = { .view = view }; + struct view_event_data data = { .view = view }; if (view->geometry.width == width && view->geometry.height == height) return; view->geometry.width = width; view->geometry.height = height; - swc_send_event(&view->event_signal, SWC_VIEW_EVENT_RESIZED, &data); + swc_send_event(&view->event_signal, VIEW_EVENT_RESIZED, &data); } -void swc_view_set_size_from_buffer(struct swc_view * view, - struct wld_buffer * buffer) +void view_set_size_from_buffer(struct view * view, struct wld_buffer * buffer) { if (buffer) - swc_view_set_size(view, buffer->width, buffer->height); + view_set_size(view, buffer->width, buffer->height); else - swc_view_set_size(view, 0, 0); + view_set_size(view, 0, 0); } -void swc_view_set_screens(struct swc_view * view, uint32_t screens) +void view_set_screens(struct view * view, uint32_t screens) { if (view->screens == screens) return; - struct swc_view_event_data data = { + struct view_event_data data = { .view = view, .screens_changed = { .entered = screens & ~view->screens, @@ -122,10 +120,10 @@ void swc_view_set_screens(struct swc_view * view, uint32_t screens) }; view->screens = screens; - swc_send_event(&view->event_signal, SWC_VIEW_EVENT_SCREENS_CHANGED, &data); + swc_send_event(&view->event_signal, VIEW_EVENT_SCREENS_CHANGED, &data); } -void swc_view_update_screens(struct swc_view * view) +void view_update_screens(struct view * view) { uint32_t screens = 0; struct screen * screen; @@ -136,13 +134,13 @@ void swc_view_update_screens(struct swc_view * view) screens |= screen_mask(screen); } - swc_view_set_screens(view, screens); + view_set_screens(view, screens); } -void swc_view_frame(struct swc_view * view, uint32_t time) +void view_frame(struct view * view, uint32_t time) { - struct swc_view_event_data data = { .view = view, .frame = { time } }; + struct view_event_data data = { .view = view, .frame = { time } }; - swc_send_event(&view->event_signal, SWC_VIEW_EVENT_FRAME, &data); + swc_send_event(&view->event_signal, VIEW_EVENT_FRAME, &data); } diff --git a/libswc/view.h b/libswc/view.h @@ -29,16 +29,16 @@ enum { /* Sent when the view has displayed the next frame. */ - SWC_VIEW_EVENT_FRAME, + VIEW_EVENT_FRAME, /* Sent when the origin of the view has moved. */ - SWC_VIEW_EVENT_MOVED, + VIEW_EVENT_MOVED, /* Sent when the view's size changes. */ - SWC_VIEW_EVENT_RESIZED, + VIEW_EVENT_RESIZED, /* Sent when the set of screens the view is visible on changes. */ - SWC_VIEW_EVENT_SCREENS_CHANGED + VIEW_EVENT_SCREENS_CHANGED }; /** @@ -47,9 +47,9 @@ enum * Extra data correspending to the particular event is stored in the * corresponding struct inside the union. */ -struct swc_view_event_data +struct view_event_data { - struct swc_view * view; + struct view * view; union { struct @@ -76,9 +76,9 @@ struct swc_view_event_data * way, allowing operations like setting the output view of a surface directly * to an output's framebuffer plane, bypassing the compositor. */ -struct swc_view +struct view { - const struct swc_view_impl * impl; + const struct view_impl * impl; struct wl_signal event_signal; struct swc_rectangle geometry; @@ -90,57 +90,55 @@ struct swc_view /** * Every view must have an implementation containing these functions. * - * For descriptions, see the corresponding swc_view_* function. + * For descriptions, see the corresponding view_* function. */ -struct swc_view_impl +struct view_impl { - bool (* update)(struct swc_view * view); - bool (* attach)(struct swc_view * view, struct wld_buffer * buffer); - bool (* move)(struct swc_view * view, int32_t x, int32_t y); + bool (* update)(struct view * view); + bool (* attach)(struct view * view, struct wld_buffer * buffer); + bool (* move)(struct view * view, int32_t x, int32_t y); }; /** - * Initialize a new view with the specified implementation. - */ -void swc_view_initialize(struct swc_view * view, - const struct swc_view_impl * impl); - -/** - * Release any resources associated with this view. - */ -void swc_view_finalize(struct swc_view * view); - -/** * Attach a new buffer to the view. * * If buffer is NULL, the previous buffer is removed from the view. * * @return Whether or not the buffer was successfully attached to the view. */ -bool swc_view_attach(struct swc_view * view, struct wld_buffer * buffer); +bool view_attach(struct view * view, struct wld_buffer * buffer); /** * Display a new frame consisting of the currently attached buffer. * * @return Whether or not the update succeeds. */ -bool swc_view_update(struct swc_view * view); +bool view_update(struct view * view); /** * Move the view to the specified coordinates, if supported. * * @return Whether or not the move succeeds. */ -bool swc_view_move(struct swc_view * view, int32_t x, int32_t y); +bool view_move(struct view * view, int32_t x, int32_t y); /**** For internal view use only ****/ -void swc_view_set_position(struct swc_view * view, int32_t x, int32_t y); -void swc_view_set_size(struct swc_view * view, uint32_t width, uint32_t height); -void swc_view_set_size_from_buffer(struct swc_view * view, - struct wld_buffer * bufer); -void swc_view_set_screens(struct swc_view * view, uint32_t screens); -void swc_view_update_screens(struct swc_view * view); +/** + * Initialize a new view with the specified implementation. + */ +void view_initialize(struct view * view, const struct view_impl * impl); + +/** + * Release any resources associated with this view. + */ +void view_finalize(struct view * view); + +void view_set_position(struct view * view, int32_t x, int32_t y); +void view_set_size(struct view * view, uint32_t width, uint32_t height); +void view_set_size_from_buffer(struct view * view, struct wld_buffer * bufer); +void view_set_screens(struct view * view, uint32_t screens); +void view_update_screens(struct view * view); /** * Send a new frame event through the view's event signal. @@ -149,7 +147,7 @@ void swc_view_update_screens(struct swc_view * view); * the user. If time information is not available, swc_time() can be passed * instead. */ -void swc_view_frame(struct swc_view * view, uint32_t time); +void view_frame(struct view * view, uint32_t time); #endif diff --git a/libswc/window.c b/libswc/window.c @@ -99,7 +99,7 @@ void swc_window_set_geometry(struct swc_window * base, if (window->impl->configure) window->impl->configure(window, geometry); - swc_view_move(&window->view->base, geometry->x, geometry->y); + view_move(&window->view->base, geometry->x, geometry->y); } EXPORT @@ -190,9 +190,8 @@ static bool move_motion(struct pointer_handler * handler, uint32_t time, struct window * window = CONTAINER_OF(handler, typeof(*window), move.interaction.handler); - swc_view_move(&window->view->base, - wl_fixed_to_int(fx) + window->move.offset.x, - wl_fixed_to_int(fy) + window->move.offset.y); + view_move(&window->view->base, wl_fixed_to_int(fx) + window->move.offset.x, + wl_fixed_to_int(fy) + window->move.offset.y); return true; } diff --git a/libswc/xwm.c b/libswc/xwm.c @@ -344,7 +344,7 @@ void swc_xwm_manage_window(xcb_window_t id, struct swc_surface * surface) if ((geometry_reply = xcb_get_geometry_reply(xwm.connection, geometry_cookie, NULL))) { - swc_view_move(surface->view, geometry_reply->x, geometry_reply->y); + view_move(surface->view, geometry_reply->x, geometry_reply->y); free(geometry_reply); }