From 3a8c7f283d042abb88aef225f3631ff4f35d57c0 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 3 Apr 2018 11:29:32 -0400 Subject: Add input-inhibitor example client --- rootston/desktop.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'rootston') diff --git a/rootston/desktop.c b/rootston/desktop.c index ab16ed3d..ed4abf0a 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -854,6 +855,8 @@ struct roots_desktop *desktop_create(struct roots_server *server, wlr_primary_selection_device_manager_create(server->wl_display); desktop->idle = wlr_idle_create(server->wl_display); desktop->idle_inhibit = wlr_idle_inhibit_v1_create(server->wl_display); + desktop->input_inhibit = + wlr_input_inhibit_manager_create(server->wl_display); struct wlr_egl *egl = wlr_backend_get_egl(server->backend); desktop->linux_dmabuf = wlr_linux_dmabuf_create(server->wl_display, egl); -- cgit v1.2.3 From 56deff41b6c2c6190894068994ba403978068bad Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 3 Apr 2018 12:50:05 -0400 Subject: Implement input inhibit in rootston --- backend/backend.c | 4 ---- backend/libinput/backend.c | 4 ++++ include/backend/libinput.h | 2 ++ include/rootston/desktop.h | 2 ++ include/rootston/seat.h | 9 +++++++ include/wlr/backend.h | 2 -- include/wlr/types/wlr_seat.h | 3 ++- rootston/cursor.c | 7 ++++-- rootston/desktop.c | 26 ++++++++++++++++++++ rootston/seat.c | 57 +++++++++++++++++++++++++++++++++++++++++++- 10 files changed, 106 insertions(+), 10 deletions(-) (limited to 'rootston') diff --git a/backend/backend.c b/backend/backend.c index 93d7e0df..23e212b6 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -182,7 +182,3 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { return backend; } - -uint32_t usec_to_msec(uint64_t usec) { - return (uint32_t)(usec / 1000); -} diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 1e7c1ad4..ef33df0a 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -191,3 +191,7 @@ struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device * struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev; return dev->handle; } + +uint32_t usec_to_msec(uint64_t usec) { + return (uint32_t)(usec / 1000); +} diff --git a/include/backend/libinput.h b/include/backend/libinput.h index f828c310..4eee7eb8 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -29,6 +29,8 @@ struct wlr_libinput_input_device { struct libinput_device *handle; }; +uint32_t usec_to_msec(uint64_t usec); + void wlr_libinput_event(struct wlr_libinput_backend *state, struct libinput_event *event); diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index d07cb99b..f150147b 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -59,6 +59,8 @@ struct roots_desktop { struct wl_listener wl_shell_surface; struct wl_listener layer_shell_surface; struct wl_listener decoration_new; + struct wl_listener input_inhibit_activate; + struct wl_listener input_inhibit_deactivate; #ifdef WLR_HAS_XWAYLAND struct wlr_xwayland *xwayland; diff --git a/include/rootston/seat.h b/include/rootston/seat.h index 6f482723..d2ef90f3 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -19,6 +19,9 @@ struct roots_seat { // If the focused layer is set, views cannot receive keyboard focus struct wlr_layer_surface *focused_layer; + // If non-null, only this client can receive input events + struct wl_client *exclusive_client; + struct wl_list views; // roots_seat_view::link bool has_focus; @@ -125,4 +128,10 @@ void roots_drag_icon_update_position(struct roots_drag_icon *icon); void roots_drag_icon_damage_whole(struct roots_drag_icon *icon); +void roots_seat_set_exclusive_client(struct roots_seat *seat, + struct wl_client *client); + +bool roots_seat_allow_input(struct roots_seat *seat, + struct wl_resource *resource); + #endif diff --git a/include/wlr/backend.h b/include/wlr/backend.h index e3b14add..f5482e04 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -46,6 +46,4 @@ struct wlr_egl *wlr_backend_get_egl(struct wlr_backend *backend); */ struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend); -uint32_t usec_to_msec(uint64_t usec); - #endif diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 124c1cb8..4c7e34b9 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -530,6 +530,7 @@ bool wlr_seat_touch_has_grab(struct wlr_seat *seat); */ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial); -struct wlr_seat_client *wlr_seat_client_from_resource(struct wl_resource *resource); +struct wlr_seat_client *wlr_seat_client_from_resource( + struct wl_resource *resource); #endif diff --git a/rootston/cursor.c b/rootston/cursor.c index ac46ff5d..21e32a09 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -111,6 +111,9 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor, if (surface) { client = wl_resource_get_client(surface->resource); } + if (surface && !roots_seat_allow_input(cursor->seat, surface->resource)) { + return; + } if (cursor->cursor_client != client) { wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager, @@ -327,7 +330,7 @@ void roots_cursor_handle_touch_down(struct roots_cursor *cursor, desktop, lx, ly, &sx, &sy, NULL); uint32_t serial = 0; - if (surface) { + if (surface && roots_seat_allow_input(cursor->seat, surface->resource)) { serial = wlr_seat_touch_notify_down(cursor->seat->seat, surface, event->time_msec, event->touch_id, sx, sy); } @@ -378,7 +381,7 @@ void roots_cursor_handle_touch_motion(struct roots_cursor *cursor, struct wlr_surface *surface = desktop_surface_at( desktop, lx, ly, &sx, &sy, NULL); - if (surface) { + if (surface && roots_seat_allow_input(cursor->seat, surface->resource)) { wlr_seat_touch_point_focus(cursor->seat->seat, surface, event->time_msec, event->touch_id, sx, sy); wlr_seat_touch_notify_motion(cursor->seat->seat, event->time_msec, diff --git a/rootston/desktop.c b/rootston/desktop.c index ed4abf0a..f6801332 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -756,6 +756,25 @@ static void handle_layout_change(struct wl_listener *listener, void *data) { } } +static void input_inhibit_activate(struct wl_listener *listener, void *data) { + struct roots_desktop *desktop = wl_container_of( + listener, desktop, input_inhibit_activate); + struct roots_seat *seat; + wl_list_for_each(seat, &desktop->server->input->seats, link) { + roots_seat_set_exclusive_client(seat, + desktop->input_inhibit->active_client); + } +} + +static void input_inhibit_deactivate(struct wl_listener *listener, void *data) { + struct roots_desktop *desktop = wl_container_of( + listener, desktop, input_inhibit_deactivate); + struct roots_seat *seat; + wl_list_for_each(seat, &desktop->server->input->seats, link) { + roots_seat_set_exclusive_client(seat, NULL); + } +} + struct roots_desktop *desktop_create(struct roots_server *server, struct roots_config *config) { wlr_log(L_DEBUG, "Initializing roots desktop"); @@ -855,8 +874,15 @@ struct roots_desktop *desktop_create(struct roots_server *server, wlr_primary_selection_device_manager_create(server->wl_display); desktop->idle = wlr_idle_create(server->wl_display); desktop->idle_inhibit = wlr_idle_inhibit_v1_create(server->wl_display); + desktop->input_inhibit = wlr_input_inhibit_manager_create(server->wl_display); + desktop->input_inhibit_activate.notify = input_inhibit_activate; + wl_signal_add(&desktop->input_inhibit->events.activate, + &desktop->input_inhibit_activate); + desktop->input_inhibit_deactivate.notify = input_inhibit_deactivate; + wl_signal_add(&desktop->input_inhibit->events.deactivate, + &desktop->input_inhibit_deactivate); struct wlr_egl *egl = wlr_backend_get_egl(server->backend); desktop->linux_dmabuf = wlr_linux_dmabuf_create(server->wl_display, egl); diff --git a/rootston/seat.c b/rootston/seat.c index cfdeab00..e12df7d6 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -1,6 +1,8 @@ +#define _POSIX_C_SOURCE 199309L #include #include #include +#include #include #include #include @@ -716,7 +718,17 @@ struct roots_seat_view *roots_seat_view_from_view( return seat_view; } +bool roots_seat_allow_input(struct roots_seat *seat, + struct wl_resource *resource) { + return !seat->exclusive_client || + wl_resource_get_client(resource) == seat->exclusive_client; +} + void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { + if (view && !roots_seat_allow_input(seat, view->wlr_surface->resource)) { + return; + } + // Make sure the view will be rendered on top of others, even if it's // already focused in this seat if (view != NULL) { @@ -811,11 +823,14 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { */ void roots_seat_set_focus_layer(struct roots_seat *seat, struct wlr_layer_surface *layer) { - struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->seat); if (!layer) { seat->focused_layer = NULL; return; } + struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->seat); + if (!roots_seat_allow_input(seat, layer->resource)) { + return; + } if (seat->has_focus) { struct roots_view *prev_focus = roots_seat_get_focus(seat); wlr_seat_keyboard_clear_focus(seat->seat); @@ -835,6 +850,46 @@ void roots_seat_set_focus_layer(struct roots_seat *seat, } } +void roots_seat_set_exclusive_client(struct roots_seat *seat, + struct wl_client *client) { + if (!client) { + seat->exclusive_client = client; + // Triggers a refocus of the topmost surface layer if necessary + // TODO: Make layer surface focus per-output based on cursor position + struct roots_output *output; + wl_list_for_each(output, &seat->input->server->desktop->outputs, link) { + arrange_layers(output); + } + return; + } + if (seat->focused_layer) { + if (wl_resource_get_client(seat->focused_layer->resource) != client) { + roots_seat_set_focus_layer(seat, NULL); + } + } + if (seat->has_focus) { + struct roots_view *focus = roots_seat_get_focus(seat); + if (wl_resource_get_client(focus->wlr_surface->resource) != client) { + roots_seat_set_focus(seat, NULL); + } + } + if (seat->seat->pointer_state.focused_client) { + if (seat->seat->pointer_state.focused_client->client != client) { + wlr_seat_pointer_clear_focus(seat->seat); + } + } + struct timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + struct wlr_touch_point *point; + wl_list_for_each(point, &seat->seat->touch_state.touch_points, link) { + if (point->client->client != client) { + wlr_seat_touch_point_clear_focus(seat->seat, + now.tv_nsec / 1000, point->touch_id); + } + } + seat->exclusive_client = client; +} + void roots_seat_cycle_focus(struct roots_seat *seat) { if (wl_list_empty(&seat->views)) { return; -- cgit v1.2.3 From f7539b9d142c8945e37436a346a31d507416d2ea Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 3 Apr 2018 20:18:04 -0400 Subject: rootston: send enter event for layer surfaces --- rootston/layer_shell.c | 1 + 1 file changed, 1 insertion(+) (limited to 'rootston') diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 1cd93b3c..9794071b 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -281,6 +281,7 @@ static void handle_map(struct wl_listener *listener, void *data) { struct wlr_output *wlr_output = layer_surface->output; struct roots_output *output = wlr_output->data; wlr_output_damage_add_box(output->damage, &layer->geo); + wlr_surface_send_enter(layer_surface->surface, wlr_output); } static void handle_unmap(struct wl_listener *listener, void *data) { -- cgit v1.2.3 From d16127b3cb0dc58099f77fb2bf6070c4fe4eefb8 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 4 Apr 2018 16:48:23 -0400 Subject: Fix wlr_surface_subsurface_at, change it to be wlr_surface_surface_at --- include/wlr/types/wlr_surface.h | 22 +++++++++++--------- rootston/desktop.c | 22 +++++++------------- types/wlr_compositor.c | 2 +- types/wlr_surface.c | 45 +++++++++++++++++------------------------ 4 files changed, 39 insertions(+), 52 deletions(-) (limited to 'rootston') diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 4d03df73..6ece247a 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -122,20 +122,24 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface, struct wlr_surface *parent, uint32_t id); /** - * Get the top of the subsurface tree for this surface. + * Get the root of the subsurface tree for this surface. */ -struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface); +struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface); /** - * Find a subsurface within this surface at the surface-local coordinates. - * Returns the surface and coordinates in the topmost surface coordinate system - * or NULL if no subsurface is found at that location. + * Check if the surface accepts input events at the given surface-local + * coordinates. */ -struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface, - double sx, double sy, double *sub_x, double *sub_y); +bool wlr_surface_point_accepts_input(struct wlr_surface *surface, + double sx, double sy); -bool wlr_surface_point_accepts_input( - struct wlr_surface *surface, double sx, double sy); +/** + * Find a surface in this surface's tree that accepts input events at the given + * surface-local coordinates. Returns the surface and coordinates in the leaf + * surface coordinate system or NULL if no surface is found at that location. + */ +struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, + double sx, double sy, double *sub_x, double *sub_y); void wlr_surface_send_enter(struct wlr_surface *surface, struct wlr_output *output); diff --git a/rootston/desktop.c b/rootston/desktop.c index f6801332..60426474 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -605,14 +605,13 @@ static bool view_at(struct roots_view *view, double lx, double ly, } } - double sub_x, sub_y; - struct wlr_subsurface *subsurface = - wlr_surface_subsurface_at(view->wlr_surface, - view_sx, view_sy, &sub_x, &sub_y); - if (subsurface) { - *sx = view_sx - sub_x; - *sy = view_sy - sub_y; - *surface = subsurface->surface; + double _sx, _sy; + struct wlr_surface *_surface = wlr_surface_surface_at(view->wlr_surface, + view_sx, view_sy, &_sx, &_sy); + if (surface != NULL) { + *sx = _sx; + *sy = _sy; + *surface = _surface; return true; } @@ -623,13 +622,6 @@ static bool view_at(struct roots_view *view, double lx, double ly, return true; } - if (wlr_surface_point_accepts_input(view->wlr_surface, view_sx, view_sy)) { - *sx = view_sx; - *sy = view_sy; - *surface = view->wlr_surface; - return true; - } - return false; } diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index f27655c0..181d0323 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -126,7 +126,7 @@ static void subcompositor_get_subsurface(struct wl_client *client, return; } - if (wlr_surface_get_main_surface(parent) == surface) { + if (wlr_surface_get_root_surface(parent) == surface) { wl_resource_post_error(resource, WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, "%s%d: wl_surface@%d is an ancestor of parent", diff --git a/types/wlr_surface.c b/types/wlr_surface.c index e9bd6a66..ddcf86f8 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -868,43 +868,34 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface, } -struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface) { - struct wlr_subsurface *sub; - - while (surface && (sub = surface->subsurface)) { +struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface) { + while (surface != NULL) { + struct wlr_subsurface *sub = surface->subsurface; + if (sub == NULL) { + return surface; + } surface = sub->parent; } - - return surface; + return NULL; } -struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface, +struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, double sx, double sy, double *sub_x, double *sub_y) { struct wlr_subsurface *subsurface; wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) { double _sub_x = subsurface->surface->current->subsurface_position.x; double _sub_y = subsurface->surface->current->subsurface_position.y; - struct wlr_subsurface *sub = - wlr_surface_subsurface_at(subsurface->surface, _sub_x + sx, - _sub_y + sy, sub_x, sub_y); - if (sub) { - // TODO: This won't work for nested subsurfaces. Convert sub_x and - // sub_y to the parent coordinate system + struct wlr_surface *sub = wlr_surface_surface_at(subsurface->surface, + sx - _sub_x, sy - _sub_y, sub_x, sub_y); + if (sub != NULL) { return sub; } + } - int sub_width = subsurface->surface->current->buffer_width; - int sub_height = subsurface->surface->current->buffer_height; - if ((sx > _sub_x && sx < _sub_x + sub_width) && - (sy > _sub_y && sy < _sub_y + sub_height)) { - if (pixman_region32_contains_point( - &subsurface->surface->current->input, - sx - _sub_x, sy - _sub_y, NULL)) { - *sub_x = _sub_x; - *sub_y = _sub_y; - return subsurface; - } - } + if (wlr_surface_point_accepts_input(surface, sx, sy)) { + *sub_x = sx; + *sub_y = sy; + return surface; } return NULL; @@ -953,8 +944,8 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface, surface->role_data = role_data; } -bool wlr_surface_point_accepts_input( - struct wlr_surface *surface, double sx, double sy) { +bool wlr_surface_point_accepts_input(struct wlr_surface *surface, + double sx, double sy) { return sx >= 0 && sx <= surface->current->width && sy >= 0 && sy <= surface->current->height && pixman_region32_contains_point(&surface->current->input, sx, sy, NULL); -- cgit v1.2.3 From 1a8b24bdd268a13bd2977356d6f2e872260709c3 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 4 Apr 2018 17:16:35 -0400 Subject: rootston: fix view_at --- include/wlr/types/wlr_surface.h | 2 +- rootston/desktop.c | 2 +- types/wlr_surface.c | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'rootston') diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 6ece247a..380e5e03 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -128,7 +128,7 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface); /** * Check if the surface accepts input events at the given surface-local - * coordinates. + * coordinates. Does not check the surface's subsurfaces. */ bool wlr_surface_point_accepts_input(struct wlr_surface *surface, double sx, double sy); diff --git a/rootston/desktop.c b/rootston/desktop.c index 60426474..cfeb809b 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -608,7 +608,7 @@ static bool view_at(struct roots_view *view, double lx, double ly, double _sx, _sy; struct wlr_surface *_surface = wlr_surface_surface_at(view->wlr_surface, view_sx, view_sy, &_sx, &_sy); - if (surface != NULL) { + if (_surface != NULL) { *sx = _sx; *sy = _sy; *surface = _surface; diff --git a/types/wlr_surface.c b/types/wlr_surface.c index ddcf86f8..4d2a20e7 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -137,6 +137,7 @@ static void surface_set_input_region(struct wl_client *client, pixman_region32_t *region = wlr_region_from_resource(region_resource); pixman_region32_copy(&surface->pending->input, region); } else { + pixman_region32_fini(&surface->pending->input); pixman_region32_init_rect(&surface->pending->input, INT32_MIN, INT32_MIN, UINT32_MAX, UINT32_MAX); } @@ -879,6 +880,13 @@ struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface) { return NULL; } +bool wlr_surface_point_accepts_input(struct wlr_surface *surface, + double sx, double sy) { + return sx >= 0 && sx <= surface->current->width && + sy >= 0 && sy <= surface->current->height && + pixman_region32_contains_point(&surface->current->input, sx, sy, NULL); +} + struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, double sx, double sy, double *sub_x, double *sub_y) { struct wlr_subsurface *subsurface; @@ -943,10 +951,3 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface, surface->role_committed = role_committed; surface->role_data = role_data; } - -bool wlr_surface_point_accepts_input(struct wlr_surface *surface, - double sx, double sy) { - return sx >= 0 && sx <= surface->current->width && - sy >= 0 && sy <= surface->current->height && - pixman_region32_contains_point(&surface->current->input, sx, sy, NULL); -} -- cgit v1.2.3 From c9d21106b4ea85558db06c8e0bff4c6e3fbc203e Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 4 Apr 2018 17:42:16 -0400 Subject: Add wlr_xdg_surface_v6_surface_at and wlr_wl_shell_surface_surface_at --- include/wlr/types/wlr_wl_shell.h | 10 ++++---- include/wlr/types/wlr_xdg_shell_v6.h | 12 +++++----- rootston/desktop.c | 46 +++++++++++++----------------------- types/wlr_wl_shell.c | 37 +++++++---------------------- types/wlr_xdg_shell_v6.c | 43 +++++++++------------------------ 5 files changed, 47 insertions(+), 101 deletions(-) (limited to 'rootston') diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index 63b1a837..89e950c9 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -142,13 +142,13 @@ void wlr_wl_shell_surface_configure(struct wlr_wl_shell_surface *surface, enum wl_shell_surface_resize edges, int32_t width, int32_t height); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this wl-shell surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_wl_shell_surface *wlr_wl_shell_surface_popup_at( +struct wlr_surface *wlr_wl_shell_surface_surface_at( struct wlr_wl_shell_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_sx, double *sub_sy); bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface); diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 04c1f324..b646f3fe 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -233,19 +233,19 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface); /** - * Compute the popup position in surface-local coordinates. + * Compute the popup position in its parent's surface-local coordinate system. */ void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface, double *popup_sx, double *popup_sy); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this xdg-surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at( +struct wlr_surface *wlr_xdg_surface_v6_surface_at( struct wlr_xdg_surface_v6 *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_x, double *sub_y); /** * Get the geometry for this positioner based on the anchor rect, gravity, and diff --git a/rootston/desktop.c b/rootston/desktop.c index cfeb809b..e2127764 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -577,37 +577,23 @@ static bool view_at(struct roots_view *view, double lx, double ly, view_sy = ry + (double)box.height/2; } - if (view->type == ROOTS_XDG_SHELL_V6_VIEW) { - double popup_sx, popup_sy; - struct wlr_xdg_surface_v6 *popup = - wlr_xdg_surface_v6_popup_at(view->xdg_surface_v6, - view_sx, view_sy, &popup_sx, &popup_sy); - - if (popup) { - *sx = view_sx - popup_sx; - *sy = view_sy - popup_sy; - *surface = popup->surface; - return true; - } - } - - if (view->type == ROOTS_WL_SHELL_VIEW) { - double popup_sx, popup_sy; - struct wlr_wl_shell_surface *popup = - wlr_wl_shell_surface_popup_at(view->wl_shell_surface, - view_sx, view_sy, &popup_sx, &popup_sy); - - if (popup) { - *sx = view_sx - popup_sx; - *sy = view_sy - popup_sy; - *surface = popup->surface; - return true; - } - } - double _sx, _sy; - struct wlr_surface *_surface = wlr_surface_surface_at(view->wlr_surface, - view_sx, view_sy, &_sx, &_sy); + struct wlr_surface *_surface; + switch (view->type) { + case ROOTS_XDG_SHELL_V6_VIEW: + _surface = wlr_xdg_surface_v6_surface_at(view->xdg_surface_v6, + view_sx, view_sy, &_sx, &_sy); + break; + case ROOTS_WL_SHELL_VIEW: + _surface = wlr_wl_shell_surface_surface_at(view->wl_shell_surface, + view_sx, view_sy, &_sx, &_sy); + break; + case ROOTS_XWAYLAND_VIEW: + case ROOTS_XDG_SHELL_VIEW: // TODO + _surface = wlr_surface_surface_at(view->wlr_surface, + view_sx, view_sy, &_sx, &_sy); + break; + } if (_surface != NULL) { *sx = _sx; *sy = _sy; diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c index a2123bce..2cbdaf3a 100644 --- a/types/wlr_wl_shell.c +++ b/types/wlr_wl_shell.c @@ -658,42 +658,23 @@ void wlr_wl_shell_surface_configure(struct wlr_wl_shell_surface *surface, wl_shell_surface_send_configure(surface->resource, edges, width, height); } -struct wlr_wl_shell_surface *wlr_wl_shell_surface_popup_at( +struct wlr_surface *wlr_wl_shell_surface_surface_at( struct wlr_wl_shell_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy) { + double *sub_sx, double *sub_sy) { struct wlr_wl_shell_surface *popup; wl_list_for_each(popup, &surface->popups, popup_link) { if (!popup->popup_mapped) { continue; } - double _popup_sx = popup->transient_state->x; - double _popup_sy = popup->transient_state->y; - int popup_width = - popup->surface->current->buffer_width; - int popup_height = - popup->surface->current->buffer_height; - - struct wlr_wl_shell_surface *_popup = - wlr_wl_shell_surface_popup_at(popup, - popup->transient_state->x, - popup->transient_state->y, - popup_sx, popup_sy); - if (_popup) { - *popup_sx = sx + _popup_sx; - *popup_sy = sy + _popup_sy; - return _popup; - } - if ((sx > _popup_sx && sx < _popup_sx + popup_width) && - (sy > _popup_sy && sy < _popup_sy + popup_height)) { - if (pixman_region32_contains_point(&popup->surface->current->input, - sx - _popup_sx, sy - _popup_sy, NULL)) { - *popup_sx = _popup_sx; - *popup_sy = _popup_sy; - return popup; - } + double popup_sx = popup->transient_state->x; + double popup_sy = popup->transient_state->y; + struct wlr_surface *sub = wlr_wl_shell_surface_surface_at(popup, + sx - popup_sx, sy - popup_sy, sub_sx, sub_sy); + if (sub != NULL) { + return sub; } } - return NULL; + return wlr_surface_surface_at(surface->surface, sx, sy, sub_sx, sub_sy); } diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 5c83db70..fa5523fc 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -1602,47 +1602,26 @@ void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface, surface->geometry.y; } -struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at( +struct wlr_surface *wlr_xdg_surface_v6_surface_at( struct wlr_xdg_surface_v6 *surface, double sx, double sy, - double *popup_sx, double *popup_sy) { - // XXX: I think this is so complicated because we're mixing geometry - // coordinates with surface coordinates. Input handling should only deal - // with surface coordinates. + double *sub_x, double *sub_y) { struct wlr_xdg_popup_v6 *popup_state; wl_list_for_each(popup_state, &surface->popups, link) { struct wlr_xdg_surface_v6 *popup = popup_state->base; - double _popup_sx = - surface->geometry.x + popup_state->geometry.x; - double _popup_sy = - surface->geometry.y + popup_state->geometry.y; - int popup_width = popup_state->geometry.width; - int popup_height = popup_state->geometry.height; - - struct wlr_xdg_surface_v6 *_popup = - wlr_xdg_surface_v6_popup_at(popup, - sx - _popup_sx + popup->geometry.x, - sy - _popup_sy + popup->geometry.y, - popup_sx, popup_sy); - if (_popup) { - *popup_sx = *popup_sx + _popup_sx - popup->geometry.x; - *popup_sy = *popup_sy + _popup_sy - popup->geometry.y; - return _popup; - } + double popup_sx, popup_sy; + wlr_xdg_surface_v6_popup_get_position(popup, &popup_sx, &popup_sy); - if ((sx > _popup_sx && sx < _popup_sx + popup_width) && - (sy > _popup_sy && sy < _popup_sy + popup_height)) { - if (pixman_region32_contains_point(&popup->surface->current->input, - sx - _popup_sx + popup->geometry.x, - sy - _popup_sy + popup->geometry.y, NULL)) { - *popup_sx = _popup_sx - popup->geometry.x; - *popup_sy = _popup_sy - popup->geometry.y; - return popup; - } + struct wlr_surface *sub = wlr_xdg_surface_v6_surface_at(popup, + sx - popup_sx + popup->geometry.x, + sy - popup_sy + popup->geometry.y, + sub_x, sub_y); + if (sub != NULL) { + return sub; } } - return NULL; + return wlr_surface_surface_at(surface->surface, sx, sy, sub_x, sub_y); } void wlr_xdg_popup_v6_get_anchor_point(struct wlr_xdg_popup_v6 *popup, -- cgit v1.2.3 From 3ea425d4e232d4d03506e7177b0c25d9d964956d Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 4 Apr 2018 17:45:24 -0400 Subject: Fix xdg-shell popups, add wlr_xdg_surface_surface_at --- include/wlr/types/wlr_xdg_shell.h | 12 +++++------ rootston/desktop.c | 5 ++++- types/wlr_xdg_shell.c | 43 ++++++++++----------------------------- 3 files changed, 21 insertions(+), 39 deletions(-) (limited to 'rootston') diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index b779017f..29b54dba 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -215,19 +215,19 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface, void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface); /** - * Compute the popup position in surface-local coordinates. + * Compute the popup position in its parent's surface-local coordinate system. */ void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface, double *popup_sx, double *popup_sy); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this xdg-surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_xdg_surface *wlr_xdg_surface_popup_at( +struct wlr_surface *wlr_xdg_surface_surface_at( struct wlr_xdg_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_x, double *sub_y); bool wlr_surface_is_xdg_surface(struct wlr_surface *surface); diff --git a/rootston/desktop.c b/rootston/desktop.c index e2127764..e9c1ed30 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -584,12 +584,15 @@ static bool view_at(struct roots_view *view, double lx, double ly, _surface = wlr_xdg_surface_v6_surface_at(view->xdg_surface_v6, view_sx, view_sy, &_sx, &_sy); break; + case ROOTS_XDG_SHELL_VIEW: + _surface = wlr_xdg_surface_surface_at(view->xdg_surface, + view_sx, view_sy, &_sx, &_sy); + break; case ROOTS_WL_SHELL_VIEW: _surface = wlr_wl_shell_surface_surface_at(view->wl_shell_surface, view_sx, view_sy, &_sx, &_sy); break; case ROOTS_XWAYLAND_VIEW: - case ROOTS_XDG_SHELL_VIEW: // TODO _surface = wlr_surface_surface_at(view->wlr_surface, view_sx, view_sy, &_sx, &_sy); break; diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c index d70021fd..f85c6acf 100644 --- a/types/wlr_xdg_shell.c +++ b/types/wlr_xdg_shell.c @@ -1638,45 +1638,24 @@ void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface, surface->geometry.y; } -struct wlr_xdg_surface *wlr_xdg_surface_popup_at( +struct wlr_surface *wlr_xdg_surface_surface_at( struct wlr_xdg_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy) { - // XXX: I think this is so complicated because we're mixing geometry - // coordinates with surface coordinates. Input handling should only deal - // with surface coordinates. + double *sub_x, double *sub_y) { struct wlr_xdg_popup *popup_state; wl_list_for_each(popup_state, &surface->popups, link) { struct wlr_xdg_surface *popup = popup_state->base; - double _popup_sx = - surface->geometry.x + popup_state->geometry.x; - double _popup_sy = - surface->geometry.y + popup_state->geometry.y; - int popup_width = popup_state->geometry.width; - int popup_height = popup_state->geometry.height; - - struct wlr_xdg_surface *_popup = - wlr_xdg_surface_popup_at(popup, - sx - _popup_sx + popup->geometry.x, - sy - _popup_sy + popup->geometry.y, - popup_sx, popup_sy); - if (_popup) { - *popup_sx = *popup_sx + _popup_sx - popup->geometry.x; - *popup_sy = *popup_sy + _popup_sy - popup->geometry.y; - return _popup; - } + double popup_sx, popup_sy; + wlr_xdg_surface_popup_get_position(popup, &popup_sx, &popup_sy); - if ((sx > _popup_sx && sx < _popup_sx + popup_width) && - (sy > _popup_sy && sy < _popup_sy + popup_height)) { - if (pixman_region32_contains_point(&popup->surface->current->input, - sx - _popup_sx + popup->geometry.x, - sy - _popup_sy + popup->geometry.y, NULL)) { - *popup_sx = _popup_sx - popup->geometry.x; - *popup_sy = _popup_sy - popup->geometry.y; - return popup; - } + struct wlr_surface *sub = wlr_xdg_surface_surface_at(popup, + sx - popup_sx + popup->geometry.x, + sy - popup_sy + popup->geometry.y, + sub_x, sub_y); + if (sub != NULL) { + return sub; } } - return NULL; + return wlr_surface_surface_at(surface->surface, sx, sy, sub_x, sub_y); } -- cgit v1.2.3 From abfe7923c45c2a1bdb155279b922b112111f3124 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 5 Apr 2018 12:22:19 -0400 Subject: Add wlr_xdg_output_manager --- include/wlr/types/wlr_output_layout.h | 5 + include/wlr/types/wlr_xdg_output.h | 32 ++++++ protocol/meson.build | 1 + rootston/desktop.c | 2 + types/meson.build | 1 + types/wlr_xdg_output.c | 178 ++++++++++++++++++++++++++++++++++ 6 files changed, 219 insertions(+) create mode 100644 include/wlr/types/wlr_xdg_output.h create mode 100644 types/wlr_xdg_output.c (limited to 'rootston') diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 3c150fc0..f2f6e44b 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -32,6 +32,11 @@ struct wlr_output_layout_output { } events; }; +/** + * Creates a wlr_output_layout, which can be used to describing outputs in + * physical space relative to one another, and perform various useful operations + * on that state. + */ struct wlr_output_layout *wlr_output_layout_create(); void wlr_output_layout_destroy(struct wlr_output_layout *layout); diff --git a/include/wlr/types/wlr_xdg_output.h b/include/wlr/types/wlr_xdg_output.h new file mode 100644 index 00000000..27dad2b8 --- /dev/null +++ b/include/wlr/types/wlr_xdg_output.h @@ -0,0 +1,32 @@ +#ifndef WLR_TYPES_WLR_XDG_OUTPUT_H +#define WLR_TYPES_WLR_XDG_OUTPUT_H +#include +#include + +struct wlr_xdg_output { + struct wl_list link; + struct wl_list resources; + + struct wlr_xdg_output_manager *manager; + struct wlr_output_layout_output *layout_output; + + struct wl_listener destroy; +}; + +struct wlr_xdg_output_manager { + struct wl_global *global; + + struct wlr_output_layout *layout; + + struct wl_list outputs; + + struct wl_listener layout_add; + struct wl_listener layout_change; + struct wl_listener layout_destroy; +}; + +struct wlr_xdg_output_manager *wlr_xdg_output_manager_create( + struct wl_display *display, struct wlr_output_layout *layout); +void wlr_xdg_output_manager_destroy(struct wlr_xdg_output_manager *manager); + +#endif diff --git a/protocol/meson.build b/protocol/meson.build index b88b4b77..bdbde96a 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -25,6 +25,7 @@ protocols = [ [wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'], [wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'], [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], + [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], 'gamma-control.xml', 'gtk-primary-selection.xml', 'idle.xml', diff --git a/rootston/desktop.c b/rootston/desktop.c index e9c1ed30..07b80b08 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "rootston/layers.h" #include "rootston/seat.h" @@ -775,6 +776,7 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->config = config; desktop->layout = wlr_output_layout_create(); + wlr_xdg_output_manager_create(server->wl_display, desktop->layout); desktop->layout_change.notify = handle_layout_change; wl_signal_add(&desktop->layout->events.change, &desktop->layout_change); diff --git a/types/meson.build b/types/meson.build index eda5f4e4..7e089d03 100644 --- a/types/meson.build +++ b/types/meson.build @@ -33,6 +33,7 @@ lib_wlr_types = static_library( 'wlr_xcursor_manager.c', 'wlr_xdg_shell_v6.c', 'wlr_xdg_shell.c', + 'wlr_xdg_output.c', ), include_directories: wlr_inc, dependencies: [pixman, xkbcommon, wayland_server, wlr_protos], diff --git a/types/wlr_xdg_output.c b/types/wlr_xdg_output.c new file mode 100644 index 00000000..91c86b2f --- /dev/null +++ b/types/wlr_xdg_output.c @@ -0,0 +1,178 @@ +#include +#include +#include +#include +#include +#include +#include "xdg-output-unstable-v1-protocol.h" + +static void xdg_output_destroy(struct wl_client *client, + struct wl_resource *resource) { + wl_resource_destroy(resource); +} + +static const struct zxdg_output_v1_interface xdg_output_implementation = { + .destroy = xdg_output_destroy, +}; + +static void xdg_output_manager_destroy(struct wl_client *client, + struct wl_resource *resource) { + wl_resource_destroy(resource); +} + +static const struct zxdg_output_manager_v1_interface xdg_output_manager_implementation; + +static void xdg_output_send_details(struct wl_resource *resource, + struct wlr_output_layout_output *layout_output) { + zxdg_output_v1_send_logical_position(resource, + layout_output->x, layout_output->y); + zxdg_output_v1_send_logical_size(resource, + (float)layout_output->output->width / layout_output->output->scale, + (float)layout_output->output->height / layout_output->output->scale); + zxdg_output_v1_send_done(resource); +} + +static void xdg_output_manager_get_xdg_output(struct wl_client *client, + struct wl_resource *resource, uint32_t id, struct wl_resource *output) { + assert(wl_resource_instance_of(resource, &zxdg_output_manager_v1_interface, + &xdg_output_manager_implementation)); + + struct wlr_xdg_output_manager *manager = + wl_resource_get_user_data(resource); + struct wlr_output_layout *layout = manager->layout; + struct wlr_output *wlr_output = wlr_output_from_resource(output); + + struct wlr_output_layout_output *layout_output = + wlr_output_layout_get(layout, wlr_output); + assert(layout_output); + + struct wl_resource *output_resource = wl_resource_create(client, + &zxdg_output_v1_interface, wl_resource_get_version(resource), id); + if (!output_resource) { + wl_client_post_no_memory(client); + return; + } + wl_resource_set_implementation(output_resource, + &xdg_output_implementation, NULL, NULL); + xdg_output_send_details(output_resource, layout_output); +} + +static const struct zxdg_output_manager_v1_interface xdg_output_manager_implementation = { + .destroy = xdg_output_manager_destroy, + .get_xdg_output = xdg_output_manager_get_xdg_output, +}; + +static void output_manager_bind(struct wl_client *wl_client, void *data, + uint32_t version, uint32_t id) { + struct wlr_xdg_output_manager *manager = data; + assert(wl_client && manager); + + struct wl_resource *wl_resource = wl_resource_create(wl_client, + &zxdg_output_manager_v1_interface, version, id); + if (wl_resource == NULL) { + wl_client_post_no_memory(wl_client); + return; + } + wl_resource_set_implementation(wl_resource, + &xdg_output_manager_implementation, manager, NULL); +} + +static void destroy_output(struct wlr_xdg_output *output) { + struct wl_resource *resource, *tmp; + wl_resource_for_each_safe(resource, tmp, &output->resources) { + wl_list_remove(wl_resource_get_link(resource)); + wl_list_init(wl_resource_get_link(resource)); + } + wl_list_remove(&output->destroy.link); + wl_list_remove(&output->link); + free(output); +} + +static void handle_output_destroy(struct wl_listener *listener, void *data) { + struct wlr_xdg_output *output = wl_container_of(listener, output, destroy); + destroy_output(output); +} + +static void add_output(struct wlr_xdg_output_manager *manager, + struct wlr_output_layout_output *layout_output) { + struct wlr_xdg_output *output = calloc(1, sizeof(struct wlr_xdg_output)); + wl_list_init(&output->resources); + output->manager = manager; + output->layout_output = layout_output; + output->destroy.notify = handle_output_destroy; + wl_signal_add(&layout_output->events.destroy, &output->destroy); + wl_list_insert(&manager->outputs, &output->link); +} + +static void xdg_output_manager_send_details( + struct wlr_xdg_output_manager *manager) { + struct wlr_xdg_output *output; + wl_list_for_each(output, &manager->outputs, link) { + struct wl_resource *resource; + wl_resource_for_each(resource, &output->resources) { + xdg_output_send_details(resource, output->layout_output); + } + } +} + +static void handle_layout_add(struct wl_listener *listener, void *data) { + struct wlr_xdg_output_manager *manager = + wl_container_of(listener, manager, layout_add); + struct wlr_output_layout_output *layout_output = data; + add_output(manager, layout_output); +} + +static void handle_layout_change(struct wl_listener *listener, void *data) { + struct wlr_xdg_output_manager *manager = + wl_container_of(listener, manager, layout_change); + xdg_output_manager_send_details(manager); +} + +static void handle_layout_destroy(struct wl_listener *listener, void *data) { + struct wlr_xdg_output_manager *manager = + wl_container_of(listener, manager, layout_change); + wlr_xdg_output_manager_destroy(manager); +} + +struct wlr_xdg_output_manager *wlr_xdg_output_manager_create( + struct wl_display *display, struct wlr_output_layout *layout) { + assert(display && layout); + struct wlr_xdg_output_manager *manager = + calloc(1, sizeof(struct wlr_xdg_output_manager)); + if (manager == NULL) { + return NULL; + } + manager->layout = layout; + manager->global = wl_global_create(display, + &zxdg_output_manager_v1_interface, + 1, manager, output_manager_bind); + if (!manager->global) { + free(manager); + return NULL; + } + + wl_list_init(&manager->outputs); + struct wlr_output_layout_output *layout_output; + wl_list_for_each(layout_output, &layout->outputs, link) { + add_output(manager, layout_output); + } + + manager->layout_add.notify = handle_layout_add; + wl_signal_add(&layout->events.add, &manager->layout_add); + manager->layout_change.notify = handle_layout_change; + wl_signal_add(&layout->events.change, &manager->layout_change); + manager->layout_destroy.notify = handle_layout_destroy; + wl_signal_add(&layout->events.destroy, &manager->layout_destroy); + return manager; +} + +void wlr_xdg_output_manager_destroy(struct wlr_xdg_output_manager *manager) { + struct wlr_xdg_output *output, *tmp; + wl_list_for_each_safe(output, tmp, &manager->outputs, link) { + destroy_output(output); + } + wl_list_remove(&manager->layout_add.link); + wl_list_remove(&manager->layout_change.link); + wl_list_remove(&manager->layout_destroy.link); + free(manager); +} -- cgit v1.2.3 From 74a4b1702bb32732b0bc7b0c54a6e8f340c7cdd8 Mon Sep 17 00:00:00 2001 From: Tancredi Orlando Date: Thu, 5 Apr 2018 19:13:21 +0200 Subject: Initialize rootston _surface --- rootston/desktop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rootston') diff --git a/rootston/desktop.c b/rootston/desktop.c index e9c1ed30..d4c449f4 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -578,7 +578,7 @@ static bool view_at(struct roots_view *view, double lx, double ly, } double _sx, _sy; - struct wlr_surface *_surface; + struct wlr_surface *_surface = NULL; switch (view->type) { case ROOTS_XDG_SHELL_V6_VIEW: _surface = wlr_xdg_surface_v6_surface_at(view->xdg_surface_v6, -- cgit v1.2.3