From: Johan Malm Date: Mon, 6 Dec 2021 21:23:49 +0000 (+0000) Subject: desktop: rename functions to increase consistency X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=238062a85920d901199569dbf874678bdc2d305b;p=proto%2Flabwc.git desktop: rename functions to increase consistency ...from - desktop_raise_view() - desktop_move_view_to_end_of_cycle() to - desktop_move_to_front() - desktop_move_to_back() --- diff --git a/include/labwc.h b/include/labwc.h index cff99900..d649e09e 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -396,8 +396,8 @@ void foreign_toplevel_handle_create(struct view *view); * or pointer focus, in this compositor are they called together. */ -void desktop_raise_view(struct view *view); -void desktop_move_view_to_end_of_cycle(struct view *to_end); +void desktop_move_to_front(struct view *view); +void desktop_move_to_back(struct view *view); void desktop_focus_and_activate_view(struct seat *seat, struct view *view); enum lab_cycle_dir { diff --git a/src/action.c b/src/action.c index e2ef598b..44fdba68 100644 --- a/src/action.c +++ b/src/action.c @@ -96,7 +96,7 @@ action(struct view *activator, struct server *server, const char *action, const } else if (!strcasecmp(action, "Raise")) { struct view *view = activator_or_focused_view(activator, server); if (view) { - desktop_raise_view(view); + desktop_move_to_front(view); damage_all_outputs(server); } } else if (!strcasecmp(action, "Resize")) { diff --git a/src/cursor.c b/src/cursor.c index a9384bc0..78ad2389 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -220,7 +220,7 @@ process_cursor_motion(struct server *server, uint32_t time) if (view && rc.focus_follow_mouse) { desktop_focus_and_activate_view(&server->seat, view); if (rc.raise_on_focus) { - desktop_raise_view(view); + desktop_move_to_front(view); } } diff --git a/src/desktop.c b/src/desktop.c index 43e5da66..ba4aec95 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -52,7 +52,7 @@ move_xwayland_sub_views_to_front(struct view *parent) #endif void -desktop_raise_view(struct view *view) +desktop_move_to_front(struct view *view) { if (!view) { return; @@ -63,6 +63,25 @@ desktop_raise_view(struct view *view) #endif } +static void +wl_list_insert_tail(struct wl_list *list, struct wl_list *elm) +{ + elm->prev = list->prev; + elm->next = list; + list->prev = elm; + elm->prev->next = elm; +} + +void +desktop_move_to_back(struct view *view) +{ + if (!view) { + return; + } + wl_list_remove(&view->link); + wl_list_insert_tail(&view->server->views, &view->link); +} + static void deactivate_all_views(struct server *server) { @@ -170,22 +189,6 @@ desktop_cycle_view(struct server *server, struct view *current, enum lab_cycle_d return view; } -static void -wl_list_insert_tail(struct wl_list *list, struct wl_list *elm) -{ - elm->prev = list->prev; - elm->next = list; - list->prev = elm; - elm->prev->next = elm; -} - -void -desktop_move_view_to_end_of_cycle(struct view *to_end) -{ - wl_list_remove(&to_end->link); - wl_list_insert_tail(&to_end->server->views, &to_end->link); -} - static bool has_mapped_view(struct wl_list *wl_list) { @@ -237,7 +240,7 @@ desktop_focus_topmost_mapped_view(struct server *server) { struct view *view = topmost_mapped_view(server); desktop_focus_and_activate_view(&server->seat, view); - desktop_raise_view(view); + desktop_move_to_front(view); } static bool diff --git a/src/foreign.c b/src/foreign.c index 3568237b..c61df26d 100644 --- a/src/foreign.c +++ b/src/foreign.c @@ -36,7 +36,7 @@ handle_toplevel_handle_request_activate(struct wl_listener *listener, void *data // struct wlr_foreign_toplevel_handle_v1_activated_event *event = data; /* In a multi-seat world we would select seat based on event->seat here. */ desktop_focus_and_activate_view(&view->server->seat, view); - desktop_raise_view(view); + desktop_move_to_front(view); } void diff --git a/src/keyboard.c b/src/keyboard.c index b1b7cef8..b0b8b563 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -45,7 +45,7 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data) /* end cycle */ desktop_focus_and_activate_view(&server->seat, server->cycle_view); - desktop_raise_view(server->cycle_view); + desktop_move_to_front(server->cycle_view); server->cycle_view = NULL; } } diff --git a/src/view-impl.c b/src/view-impl.c index 8b948b12..d10dd2a4 100644 --- a/src/view-impl.c +++ b/src/view-impl.c @@ -8,7 +8,7 @@ void view_impl_map(struct view *view) { desktop_focus_and_activate_view(&view->server->seat, view); - desktop_raise_view(view); + desktop_move_to_front(view); view_update_title(view); view_update_app_id(view); diff --git a/src/view.c b/src/view.c index 7a5ad203..ff36b6cb 100644 --- a/src/view.c +++ b/src/view.c @@ -79,7 +79,7 @@ view_minimize(struct view *view, bool minimized) view->minimized = minimized; if (minimized) { view->impl->unmap(view); - desktop_move_view_to_end_of_cycle(view); + desktop_move_to_back(view); } else { view->impl->map(view); }