From d831743b250b07e6aed4ec9eda4c94a603b8c5f1 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 3 Sep 2020 21:40:27 +0100 Subject: [PATCH] xdg,xwl: rename functions --- src/xdg.c | 20 ++++++++++---------- src/xwl.c | 54 +++++++++++++++++++++++++++--------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/xdg.c b/src/xdg.c index 67e436dc..2dd88809 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -72,26 +72,26 @@ static void handle_commit(struct wl_listener *listener, void *data) view->h = view->surface->current.height; } -void xdg_surface_map(struct wl_listener *listener, void *data) +static void handle_map(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, map); view->impl->map(view); } -void xdg_surface_unmap(struct wl_listener *listener, void *data) +static void handle_unmap(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, unmap); view->impl->unmap(view); } -void xdg_surface_destroy(struct wl_listener *listener, void *data) +static void handle_destroy(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, destroy); wl_list_remove(&view->link); free(view); } -void xdg_toplevel_request_move(struct wl_listener *listener, void *data) +static void handle_request_move(struct wl_listener *listener, void *data) { /* This event is raised when a client would like to begin an interactive * move, typically because the user clicked on their client-side @@ -104,7 +104,7 @@ void xdg_toplevel_request_move(struct wl_listener *listener, void *data) interactive_begin(view, LAB_CURSOR_MOVE, 0); } -void xdg_toplevel_request_resize(struct wl_listener *listener, void *data) +static void handle_request_resize(struct wl_listener *listener, void *data) { /* This event is raised when a client would like to begin an interactive * resize, typically because the user clicked on their client-side @@ -172,17 +172,17 @@ void xdg_surface_new(struct wl_listener *listener, void *data) view->impl = &xdg_toplevel_view_impl; view->xdg_surface = xdg_surface; - view->map.notify = xdg_surface_map; + view->map.notify = handle_map; wl_signal_add(&xdg_surface->events.map, &view->map); - view->unmap.notify = xdg_surface_unmap; + view->unmap.notify = handle_unmap; wl_signal_add(&xdg_surface->events.unmap, &view->unmap); - view->destroy.notify = xdg_surface_destroy; + view->destroy.notify = handle_destroy; wl_signal_add(&xdg_surface->events.destroy, &view->destroy); struct wlr_xdg_toplevel *toplevel = xdg_surface->toplevel; - view->request_move.notify = xdg_toplevel_request_move; + view->request_move.notify = handle_request_move; wl_signal_add(&toplevel->events.request_move, &view->request_move); - view->request_resize.notify = xdg_toplevel_request_resize; + view->request_resize.notify = handle_request_resize; wl_signal_add(&toplevel->events.request_resize, &view->request_resize); wl_list_insert(&server->views, &view->link); diff --git a/src/xwl.c b/src/xwl.c index 04df2692..3b9dae5a 100644 --- a/src/xwl.c +++ b/src/xwl.c @@ -2,16 +2,6 @@ #include "common/log.h" #include "common/bug-on.h" -static bool has_ssd(struct view *view) -{ - if (view->xwayland_surface->override_redirect) - return false; - if (view->xwayland_surface->decorations != - WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) - return false; - return true; -} - static void handle_commit(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, commit); @@ -22,19 +12,19 @@ static void handle_commit(struct wl_listener *listener, void *data) view->h = view->surface->current.height; } -void xwl_surface_map(struct wl_listener *listener, void *data) +static void handle_map(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, map); view->impl->map(view); } -void xwl_surface_unmap(struct wl_listener *listener, void *data) +static void handle_unmap(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, unmap); view->impl->unmap(view); } -void xwl_surface_destroy(struct wl_listener *listener, void *data) +static void handle_destroy(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, destroy); if (view->been_mapped) @@ -46,7 +36,7 @@ void xwl_surface_destroy(struct wl_listener *listener, void *data) free(view); } -void xwl_surface_configure(struct wl_listener *listener, void *data) +static void handle_request_configure(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, request_configure); struct wlr_xwayland_surface_configure_event *event = data; @@ -54,26 +44,36 @@ void xwl_surface_configure(struct wl_listener *listener, void *data) event->y, event->width, event->height); } -static void xwl_view_configure(struct view *view, struct wlr_box geo) +static void configure(struct view *view, struct wlr_box geo) { wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x, (int16_t)geo.y, (uint16_t)geo.width, (uint16_t)geo.height); } -static void xwl_view_close(struct view *view) +static void _close(struct view *view) { wlr_xwayland_surface_close(view->xwayland_surface); } -static void xwl_view_map(struct view *view) +static bool want_ssd(struct view *view) +{ + if (view->xwayland_surface->override_redirect) + return false; + if (view->xwayland_surface->decorations != + WLR_XWAYLAND_SURFACE_DECORATIONS_ALL) + return false; + return true; +} + +static void map(struct view *view) { view->mapped = true; view->x = view->xwayland_surface->x; view->y = view->xwayland_surface->y; view->surface = view->xwayland_surface->surface; if (!view->been_mapped) { - view->show_server_side_deco = has_ssd(view); + view->show_server_side_deco = want_ssd(view); view_init_position(view); wl_list_insert(&view->server->views, &view->link); } @@ -90,7 +90,7 @@ static void xwl_view_map(struct view *view) view_focus(view); } -static void xwl_view_unmap(struct view *view) +static void unmap(struct view *view) { view->mapped = false; wl_list_remove(&view->commit.link); @@ -98,10 +98,10 @@ static void xwl_view_unmap(struct view *view) } static const struct view_impl xwl_view_impl = { - .configure = xwl_view_configure, - .close = xwl_view_close, - .map = xwl_view_map, - .unmap = xwl_view_unmap, + .configure = configure, + .close = _close, + .map = map, + .unmap = unmap, }; void xwl_surface_new(struct wl_listener *listener, void *data) @@ -117,13 +117,13 @@ void xwl_surface_new(struct wl_listener *listener, void *data) view->impl = &xwl_view_impl; view->xwayland_surface = xwayland_surface; - view->map.notify = xwl_surface_map; + view->map.notify = handle_map; wl_signal_add(&xwayland_surface->events.map, &view->map); - view->unmap.notify = xwl_surface_unmap; + view->unmap.notify = handle_unmap; wl_signal_add(&xwayland_surface->events.unmap, &view->unmap); - view->destroy.notify = xwl_surface_destroy; + view->destroy.notify = handle_destroy; wl_signal_add(&xwayland_surface->events.destroy, &view->destroy); - view->request_configure.notify = xwl_surface_configure; + view->request_configure.notify = handle_request_configure; wl_signal_add(&xwayland_surface->events.request_configure, &view->request_configure); } -- 2.52.0