mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
s/focused_view/active_view/
This commit is contained in:
parent
447c67df62
commit
3a959cc74b
9 changed files with 28 additions and 24 deletions
|
|
@ -245,10 +245,14 @@ struct server {
|
||||||
uint32_t resize_edges;
|
uint32_t resize_edges;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Currently focused view. Updated with each "focus change"
|
* 'active_view' is generally the view with keyboard-focus, updated with
|
||||||
* event. This view is drawn with "active" SSD coloring.
|
* 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
|
* Most recently raised view. Used to avoid unnecessarily
|
||||||
* raising the same view over and over.
|
* raising the same view over and over.
|
||||||
|
|
|
||||||
|
|
@ -599,7 +599,7 @@ view_for_action(struct view *activator, struct server *server,
|
||||||
return ctx.view;
|
return ctx.view;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return server->focused_view;
|
return server->active_view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ desktop_cycle_view(struct server *server, struct view *start_view,
|
||||||
|
|
||||||
if (!start_view) {
|
if (!start_view) {
|
||||||
start_view = first_view(server);
|
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 */
|
return start_view; /* may be NULL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ static void
|
||||||
warp_cursor_to_constraint_hint(struct seat *seat,
|
warp_cursor_to_constraint_hint(struct seat *seat,
|
||||||
struct wlr_pointer_constraint_v1 *constraint)
|
struct wlr_pointer_constraint_v1 *constraint)
|
||||||
{
|
{
|
||||||
if (!seat->server->focused_view) {
|
if (!seat->server->active_view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -594,8 +594,8 @@ warp_cursor_to_constraint_hint(struct seat *seat,
|
||||||
double sx = constraint->current.cursor_hint.x;
|
double sx = constraint->current.cursor_hint.x;
|
||||||
double sy = constraint->current.cursor_hint.y;
|
double sy = constraint->current.cursor_hint.y;
|
||||||
wlr_cursor_warp(seat->cursor, NULL,
|
wlr_cursor_warp(seat->cursor, NULL,
|
||||||
seat->server->focused_view->current.x + sx,
|
seat->server->active_view->current.x + sx,
|
||||||
seat->server->focused_view->current.y + sy);
|
seat->server->active_view->current.y + sy);
|
||||||
|
|
||||||
/* Make sure we are not sending unnecessary surface movements */
|
/* Make sure we are not sending unnecessary surface movements */
|
||||||
wlr_seat_pointer_warp(seat->seat, sx, sy);
|
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;
|
constraint->destroy.notify = destroy_constraint;
|
||||||
wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
|
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) {
|
if (view && view->surface == wlr_constraint->surface) {
|
||||||
constrain_cursor(server, wlr_constraint);
|
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 sx = seat->cursor->x;
|
||||||
double sy = seat->cursor->y;
|
double sy = seat->cursor->y;
|
||||||
|
|
||||||
sx -= seat->server->focused_view->current.x;
|
sx -= seat->server->active_view->current.x;
|
||||||
sy -= seat->server->focused_view->current.y;
|
sy -= seat->server->active_view->current.y;
|
||||||
|
|
||||||
double sx_confined, sy_confined;
|
double sx_confined, sy_confined;
|
||||||
if (!wlr_region_confine(&seat->current_constraint->region, sx, sy,
|
if (!wlr_region_confine(&seat->current_constraint->region, sx, sy,
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ match_keybinding_for_sym(struct server *server, uint32_t modifiers,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (server->seat.nr_inhibited_keybind_views
|
if (server->seat.nr_inhibited_keybind_views
|
||||||
&& server->focused_view
|
&& server->active_view
|
||||||
&& server->focused_view->inhibits_keybinds
|
&& server->active_view->inhibits_keybinds
|
||||||
&& !actions_contain_toggle_keybinds(&keybind->actions)) {
|
&& !actions_contain_toggle_keybinds(&keybind->actions)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/seat.c
12
src/seat.c
|
|
@ -358,20 +358,20 @@ focus_change_notify(struct wl_listener *listener, void *data)
|
||||||
* active. This fixes an issue with menus immediately closing in
|
* active. This fixes an issue with menus immediately closing in
|
||||||
* some X11 apps (try LibreOffice with SAL_USE_VCLPLUGIN=gen).
|
* some X11 apps (try LibreOffice with SAL_USE_VCLPLUGIN=gen).
|
||||||
*/
|
*/
|
||||||
if (!view && server->focused_view && event->new_surface
|
if (!view && server->active_view && event->new_surface
|
||||||
&& view_is_related(server->focused_view,
|
&& view_is_related(server->active_view,
|
||||||
event->new_surface)) {
|
event->new_surface)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view != server->focused_view) {
|
if (view != server->active_view) {
|
||||||
if (server->focused_view) {
|
if (server->active_view) {
|
||||||
view_set_activated(server->focused_view, false);
|
view_set_activated(server->active_view, false);
|
||||||
}
|
}
|
||||||
if (view) {
|
if (view) {
|
||||||
view_set_activated(view, true);
|
view_set_activated(view, true);
|
||||||
}
|
}
|
||||||
server->focused_view = view;
|
server->active_view = view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ void
|
||||||
view_impl_unmap(struct view *view)
|
view_impl_unmap(struct view *view)
|
||||||
{
|
{
|
||||||
struct server *server = view->server;
|
struct server *server = view->server;
|
||||||
if (view == server->focused_view) {
|
if (view == server->active_view) {
|
||||||
desktop_focus_topmost_view(server);
|
desktop_focus_topmost_view(server);
|
||||||
}
|
}
|
||||||
if (view == server->last_raised_view) {
|
if (view == server->last_raised_view) {
|
||||||
|
|
|
||||||
|
|
@ -1071,7 +1071,7 @@ decorate(struct view *view)
|
||||||
{
|
{
|
||||||
if (!view->ssd) {
|
if (!view->ssd) {
|
||||||
view->ssd = ssd_create(view,
|
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);
|
regions_hide_overlay(&server->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server->focused_view == view) {
|
if (server->active_view == view) {
|
||||||
server->focused_view = NULL;
|
server->active_view = NULL;
|
||||||
need_cursor_update = true;
|
need_cursor_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* Only refocus if the focus is not already on an always-on-top view.
|
||||||
*/
|
*/
|
||||||
if (update_focus) {
|
if (update_focus) {
|
||||||
struct view *view = server->focused_view;
|
struct view *view = server->active_view;
|
||||||
if (!view || !view_is_always_on_top(view)) {
|
if (!view || !view_is_always_on_top(view)) {
|
||||||
desktop_focus_topmost_view(server);
|
desktop_focus_topmost_view(server);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue