mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
rootston: multiple activated views
This commit is contained in:
parent
fc6c3310e8
commit
86b86f0714
1 changed files with 28 additions and 5 deletions
|
@ -430,12 +430,35 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
|
||||||
if (seat->focus == view) {
|
if (seat->focus == view) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
seat->focus = view;
|
|
||||||
seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
|
// unfocus the old view if it is not focused by some other seat
|
||||||
|
// TODO probably should be an input function
|
||||||
|
if (seat->focus) {
|
||||||
|
bool has_other_focus = false;
|
||||||
|
struct roots_seat *iter_seat;
|
||||||
|
wl_list_for_each(iter_seat, &seat->input->seats, link) {
|
||||||
|
if (iter_seat == seat) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (iter_seat->focus == seat->focus) {
|
||||||
|
has_other_focus = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_other_focus) {
|
||||||
|
view_activate(seat->focus, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
|
seat->focus = NULL;
|
||||||
|
seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seat->focus = view;
|
||||||
|
|
||||||
if (view->type == ROOTS_XWAYLAND_VIEW &&
|
if (view->type == ROOTS_XWAYLAND_VIEW &&
|
||||||
view->xwayland_surface->override_redirect) {
|
view->xwayland_surface->override_redirect) {
|
||||||
return;
|
return;
|
||||||
|
@ -444,12 +467,12 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
for (size_t i = 0; i < desktop->views->length; ++i) {
|
for (size_t i = 0; i < desktop->views->length; ++i) {
|
||||||
struct roots_view *_view = desktop->views->items[i];
|
struct roots_view *_view = desktop->views->items[i];
|
||||||
if (_view != view) {
|
if (_view == view) {
|
||||||
view_activate(_view, false);
|
|
||||||
} else {
|
|
||||||
index = i;
|
index = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view_activate(view, true);
|
view_activate(view, true);
|
||||||
// TODO: list_swap
|
// TODO: list_swap
|
||||||
wlr_list_del(desktop->views, index);
|
wlr_list_del(desktop->views, index);
|
||||||
|
|
Loading…
Reference in a new issue