aboutsummaryrefslogtreecommitdiff
path: root/rootston/seat.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-01-23 18:05:41 -0500
committerGitHub <noreply@github.com>2018-01-23 18:05:41 -0500
commitc09c2dfbc4a33aed90bf4c033a2a75e8a0cecb64 (patch)
treecb6279425d64e395590753fec23aae948ef91b8b /rootston/seat.c
parent03440bbd83b5d68404db8ebc2df310ec0f8c9b32 (diff)
parenta4d601e3d6d6600bc4c26697d282616537ef9b02 (diff)
Merge pull request #570 from acrisci/decorations
Decorations
Diffstat (limited to 'rootston/seat.c')
-rw-r--r--rootston/seat.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index 1a0e6253..e6e505b5 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -573,6 +573,10 @@ static void seat_view_destroy(struct roots_seat_view *seat_view) {
seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
}
+ if (seat_view == seat->cursor->pointer_view) {
+ seat->cursor->pointer_view = NULL;
+ }
+
wl_list_remove(&seat_view->view_destroy.link);
wl_list_remove(&seat_view->link);
free(seat_view);
@@ -601,7 +605,7 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
seat_view->seat = seat;
seat_view->view = view;
- wl_list_insert(&seat->views, &seat_view->link);
+ wl_list_insert(seat->views.prev, &seat_view->link);
seat_view->view_destroy.notify = seat_view_handle_destroy;
wl_signal_add(&view->events.destroy, &seat_view->view_destroy);
@@ -609,6 +613,31 @@ static struct roots_seat_view *seat_add_view(struct roots_seat *seat,
return seat_view;
}
+struct roots_seat_view *roots_seat_view_from_view(
+ struct roots_seat *seat, struct roots_view *view) {
+ if (view == NULL) {
+ return NULL;
+ }
+
+ bool found = false;
+ struct roots_seat_view *seat_view = NULL;
+ wl_list_for_each(seat_view, &seat->views, link) {
+ if (seat_view->view == view) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ seat_view = seat_add_view(seat, view);
+ if (seat_view == NULL) {
+ wlr_log(L_ERROR, "Allocation failed");
+ return NULL;
+ }
+ }
+
+ return seat_view;
+}
+
void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
// Make sure the view will be rendered on top of others, even if it's
// already focused in this seat
@@ -626,22 +655,11 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
view->xwayland_surface->override_redirect) {
return;
}
-
struct roots_seat_view *seat_view = NULL;
if (view != NULL) {
- bool found = false;
- wl_list_for_each(seat_view, &seat->views, link) {
- if (seat_view->view == view) {
- found = true;
- break;
- }
- }
- if (!found) {
- seat_view = seat_add_view(seat, view);
- if (seat_view == NULL) {
- wlr_log(L_ERROR, "Allocation failed");
- return;
- }
+ seat_view = roots_seat_view_from_view(seat, view);
+ if (seat_view == NULL) {
+ return;
}
}