]> git.mdlowis.com Git - proto/labwc.git/commitdiff
s/focused_view/active_view/
authorJohan Malm <jgm323@gmail.com>
Tue, 19 Dec 2023 17:45:11 +0000 (17:45 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Tue, 19 Dec 2023 20:34:07 +0000 (20:34 +0000)
include/labwc.h
src/action.c
src/desktop.c
src/input/cursor.c
src/input/keyboard.c
src/seat.c
src/view-impl-common.c
src/view.c
src/workspaces.c

index a4729178cbd5dc626b95265ae4807611a93ef09f..da92242202c4f17fc86f445488d6bcbaf1934539 100644 (file)
@@ -245,10 +245,14 @@ struct server {
        uint32_t resize_edges;
 
        /*
-        * Currently focused view. Updated with each "focus change"
-        * event. This view is drawn with "active" SSD coloring.
+        * 'active_view' is generally the view with keyboard-focus, updated with
+        * each "focus change". This view is drawn with "active" SSD coloring.
+        *
+        * The exception is when a layer-shell client takes keyboard-focus in
+        * which case the currently active view stays active. This is important
+        * for foreign-toplevel protocol.
         */
-       struct view *focused_view;
+       struct view *active_view;
        /*
         * Most recently raised view. Used to avoid unnecessarily
         * raising the same view over and over.
index 7762bc928135641841bf019e5498c4b7d9b3a982..fb442ac6e5694e88d5798e9ca8835ca261b31c5d 100644 (file)
@@ -599,7 +599,7 @@ view_for_action(struct view *activator, struct server *server,
                return ctx.view;
        }
        default:
-               return server->focused_view;
+               return server->active_view;
        }
 }
 
index 66b1372bbbfb92d1b0aafb776399960aa1ea13f6..08f8ff59b1fe1f93ea728eb7b7948a6cffe30f33 100644 (file)
@@ -173,7 +173,7 @@ desktop_cycle_view(struct server *server, struct view *start_view,
 
        if (!start_view) {
                start_view = first_view(server);
-               if (!start_view || start_view != server->focused_view) {
+               if (!start_view || start_view != server->active_view) {
                        return start_view;  /* may be NULL */
                }
        }
index 22680461f0a5f7685000bbc317b339059c84db33..da48c12b959be400023d1ca0d3ba2da668d085f7 100644 (file)
@@ -585,7 +585,7 @@ static void
 warp_cursor_to_constraint_hint(struct seat *seat,
                struct wlr_pointer_constraint_v1 *constraint)
 {
-       if (!seat->server->focused_view) {
+       if (!seat->server->active_view) {
                return;
        }
 
@@ -594,8 +594,8 @@ warp_cursor_to_constraint_hint(struct seat *seat,
                double sx = constraint->current.cursor_hint.x;
                double sy = constraint->current.cursor_hint.y;
                wlr_cursor_warp(seat->cursor, NULL,
-                       seat->server->focused_view->current.x + sx,
-                       seat->server->focused_view->current.y + sy);
+                       seat->server->active_view->current.x + sx,
+                       seat->server->active_view->current.y + sy);
 
                /* Make sure we are not sending unnecessary surface movements */
                wlr_seat_pointer_warp(seat->seat, sx, sy);
@@ -645,7 +645,7 @@ create_constraint(struct wl_listener *listener, void *data)
        constraint->destroy.notify = destroy_constraint;
        wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
 
-       struct view *view = server->focused_view;
+       struct view *view = server->active_view;
        if (view && view->surface == wlr_constraint->surface) {
                constrain_cursor(server, wlr_constraint);
        }
@@ -693,8 +693,8 @@ apply_constraint(struct seat *seat, struct wlr_pointer *pointer, double *x, doub
        double sx = seat->cursor->x;
        double sy = seat->cursor->y;
 
-       sx -= seat->server->focused_view->current.x;
-       sy -= seat->server->focused_view->current.y;
+       sx -= seat->server->active_view->current.x;
+       sy -= seat->server->active_view->current.y;
 
        double sx_confined, sy_confined;
        if (!wlr_region_confine(&seat->current_constraint->region, sx, sy,
index 8c0fe1d37c4ce46cdd9be4239035c5927b047da5..b9d01ac509fd8e76b0814c9cd77a4c7d8c18243d 100644 (file)
@@ -104,8 +104,8 @@ match_keybinding_for_sym(struct server *server, uint32_t modifiers,
                        continue;
                }
                if (server->seat.nr_inhibited_keybind_views
-                               && server->focused_view
-                               && server->focused_view->inhibits_keybinds
+                               && server->active_view
+                               && server->active_view->inhibits_keybinds
                                && !actions_contain_toggle_keybinds(&keybind->actions)) {
                        continue;
                }
index cc170da59cc4c2794cf7120bdac2c7cf42718922..36aa31511ed071596c9ed4055a0bc45d2dece454 100644 (file)
@@ -358,20 +358,20 @@ focus_change_notify(struct wl_listener *listener, void *data)
         * active. This fixes an issue with menus immediately closing in
         * some X11 apps (try LibreOffice with SAL_USE_VCLPLUGIN=gen).
         */
-       if (!view && server->focused_view && event->new_surface
-                       && view_is_related(server->focused_view,
+       if (!view && server->active_view && event->new_surface
+                       && view_is_related(server->active_view,
                                event->new_surface)) {
                return;
        }
 
-       if (view != server->focused_view) {
-               if (server->focused_view) {
-                       view_set_activated(server->focused_view, false);
+       if (view != server->active_view) {
+               if (server->active_view) {
+                       view_set_activated(server->active_view, false);
                }
                if (view) {
                        view_set_activated(view, true);
                }
-               server->focused_view = view;
+               server->active_view = view;
        }
 }
 
index ede58bf1b0566ccff6f8cc9f866d860bfe2ca958..6e6ae5c9d0cf61976b747e101384abf64da69fac 100644 (file)
@@ -56,7 +56,7 @@ void
 view_impl_unmap(struct view *view)
 {
        struct server *server = view->server;
-       if (view == server->focused_view) {
+       if (view == server->active_view) {
                desktop_focus_topmost_view(server);
        }
        if (view == server->last_raised_view) {
index 97675cf00d4d8c248b81fea1acb613a45f91ccad..58d77e100f4a56e38cac74c87fad8136aea390ff 100644 (file)
@@ -1071,7 +1071,7 @@ decorate(struct view *view)
 {
        if (!view->ssd) {
                view->ssd = ssd_create(view,
-                       view == view->server->focused_view);
+                       view == view->server->active_view);
        }
 }
 
@@ -1797,8 +1797,8 @@ view_destroy(struct view *view)
                regions_hide_overlay(&server->seat);
        }
 
-       if (server->focused_view == view) {
-               server->focused_view = NULL;
+       if (server->active_view == view) {
+               server->active_view = NULL;
                need_cursor_update = true;
        }
 
index 2ca5f9f1e2006dd2b2be3ccd7f8a96754bf34620..92656ee8894602c970b584b5f6e015513e9b5822 100644 (file)
@@ -310,7 +310,7 @@ workspaces_switch_to(struct workspace *target, bool update_focus)
         * Only refocus if the focus is not already on an always-on-top view.
         */
        if (update_focus) {
-               struct view *view = server->focused_view;
+               struct view *view = server->active_view;
                if (!view || !view_is_always_on_top(view)) {
                        desktop_focus_topmost_view(server);
                }