s/focused_view/active_view/

This commit is contained in:
Johan Malm 2023-12-19 17:45:11 +00:00 committed by Johan Malm
parent 447c67df62
commit 3a959cc74b
9 changed files with 28 additions and 24 deletions

View 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.

View 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;
}
}

View 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 */
}
}

View 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,

View 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;
}

View 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;
}
}

View 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) {

View 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;
}

View 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);
}