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.
return ctx.view;
}
default:
- return server->focused_view;
+ return server->active_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 */
}
}
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;
}
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);
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);
}
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,
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;
}
* 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_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) {
{
if (!view->ssd) {
view->ssd = ssd_create(view,
- view == view->server->focused_view);
+ view == view->server->active_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;
}
* 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);
}