From 61bd79200cc3892b143b7321886db77e97c9f69f Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 16 Jan 2018 19:04:26 -0500 Subject: basic decorations --- rootston/seat.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index 130c7b27..06c0caa6 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -580,7 +580,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); @@ -588,6 +588,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 @@ -605,22 +630,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; } } -- cgit v1.2.3 From fc627afd1842a8288cec620daa729c170be2af17 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 23 Jan 2018 07:11:54 -0500 Subject: fix decorations on wayland backend --- rootston/cursor.c | 4 ++-- rootston/desktop.c | 3 ++- rootston/seat.c | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'rootston/seat.c') diff --git a/rootston/cursor.c b/rootston/cursor.c index 5430afe5..d8753f44 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -115,7 +115,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, seat_view_deco_leave(cursor->pointer_view); cursor->pointer_view = NULL; } - bool set_compositor_cursor = !view && cursor->cursor_client; + bool set_compositor_cursor = !view && !surface && cursor->cursor_client; if (view && surface) { struct wl_client *view_client = wl_resource_get_client(view->wlr_surface->resource); @@ -211,7 +211,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, struct roots_desktop *desktop = seat->input->server->desktop; bool is_touch = device->type == WLR_INPUT_DEVICE_TOUCH; - struct wlr_surface *surface; + struct wlr_surface *surface = NULL; double sx, sy; struct roots_view *view = desktop_view_at(desktop, lx, ly, &surface, &sx, &sy); diff --git a/rootston/desktop.c b/rootston/desktop.c index 5fa27db2..70dafec4 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -400,7 +400,8 @@ static bool view_at(struct roots_view *view, double lx, double ly, if (view_get_deco_part(view, view_sx, view_sy)) { *sx = view_sx; *sy = view_sy; - return view; + *surface = NULL; + return true; } if (wlr_box_contains_point(&box, view_sx, view_sy) && diff --git a/rootston/seat.c b/rootston/seat.c index 41ae6c9f..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); -- cgit v1.2.3