aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-11-07 16:42:04 -0500
committerTony Crisci <tony@dubstepdish.com>2017-11-07 16:42:04 -0500
commit86b86f07143132a399f28c13c6e86db027bb0486 (patch)
tree8a1a2fda1ae6c16c88a689bc92c927a0bf11b488
parentfc6c3310e812afdc7c9754894e9e09c2fca20046 (diff)
rootston: multiple activated views
-rw-r--r--rootston/seat.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index 3a009a51..9a725dfa 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -430,12 +430,35 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
if (seat->focus == view) {
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) {
+ seat->focus = NULL;
+ seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
return;
}
+ seat->focus = view;
+
if (view->type == ROOTS_XWAYLAND_VIEW &&
view->xwayland_surface->override_redirect) {
return;
@@ -444,12 +467,12 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
size_t index = 0;
for (size_t i = 0; i < desktop->views->length; ++i) {
struct roots_view *_view = desktop->views->items[i];
- if (_view != view) {
- view_activate(_view, false);
- } else {
+ if (_view == view) {
index = i;
+ break;
}
}
+
view_activate(view, true);
// TODO: list_swap
wlr_list_del(desktop->views, index);