From f53575e3a364ada15e2de213bf664d3947f7d347 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 24 Mar 2018 15:10:15 -0400 Subject: unified xdg-surface close --- rootston/xdg_shell_v6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'rootston/xdg_shell_v6.c') diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 13d25331..001232ab 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -177,9 +177,11 @@ static void set_fullscreen(struct roots_view *view, bool fullscreen) { static void close(struct roots_view *view) { assert(view->type == ROOTS_XDG_SHELL_V6_VIEW); struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6; - if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { - wlr_xdg_toplevel_v6_send_close(surface); + struct wlr_xdg_popup_v6 *popup = NULL; + wl_list_for_each(popup, &surface->popups, link) { + wlr_xdg_surface_v6_send_close(popup->base); } + wlr_xdg_surface_v6_send_close(surface); } static void destroy(struct roots_view *view) { -- cgit v1.2.3 From 334bab543d6688769a86374a1ddd3d3b36e619b4 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 26 Mar 2018 19:32:21 -0400 Subject: xdg-shell-v6: move toplevel specific fields in wlr_xdg_toplevel_v6 --- include/wlr/types/wlr_xdg_shell_v6.h | 24 +++++----- rootston/xdg_shell_v6.c | 11 ++--- types/wlr_xdg_shell_v6.c | 85 +++++++++++++++++++----------------- 3 files changed, 65 insertions(+), 55 deletions(-) (limited to 'rootston/xdg_shell_v6.c') diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 97ff4786..67d937fe 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -74,9 +74,22 @@ struct wlr_xdg_toplevel_v6 { struct wlr_xdg_surface_v6 *base; struct wlr_xdg_surface_v6 *parent; bool added; + struct wlr_xdg_toplevel_v6_state next; // client protocol requests struct wlr_xdg_toplevel_v6_state pending; // user configure requests struct wlr_xdg_toplevel_v6_state current; + + char *title; + char *app_id; + + struct { + struct wl_signal request_maximize; + struct wl_signal request_fullscreen; + struct wl_signal request_minimize; + struct wl_signal request_move; + struct wl_signal request_resize; + struct wl_signal request_show_window_menu; + } events; }; struct wlr_xdg_surface_v6_configure { @@ -106,10 +119,6 @@ struct wlr_xdg_surface_v6 { uint32_t configure_next_serial; struct wl_list configure_list; - // Only for toplevel - char *title; - char *app_id; - bool has_next_geometry; struct wlr_box next_geometry; struct wlr_box geometry; @@ -122,13 +131,6 @@ struct wlr_xdg_surface_v6 { struct wl_signal new_popup; struct wl_signal map; struct wl_signal unmap; - - struct wl_signal request_maximize; - struct wl_signal request_fullscreen; - struct wl_signal request_minimize; - struct wl_signal request_move; - struct wl_signal request_resize; - struct wl_signal request_show_window_menu; } events; void *data; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 001232ab..2be9e00e 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -339,7 +339,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { wl_container_of(listener, desktop, xdg_shell_v6_surface); wlr_log(L_DEBUG, "new xdg toplevel: title=%s, app_id=%s", - surface->title, surface->app_id); + surface->toplevel->title, surface->toplevel->app_id); wlr_xdg_surface_v6_ping(surface); struct roots_xdg_surface_v6 *roots_surface = @@ -357,15 +357,16 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { roots_surface->unmap.notify = handle_unmap; wl_signal_add(&surface->events.unmap, &roots_surface->unmap); roots_surface->request_move.notify = handle_request_move; - wl_signal_add(&surface->events.request_move, &roots_surface->request_move); + wl_signal_add(&surface->toplevel->events.request_move, + &roots_surface->request_move); roots_surface->request_resize.notify = handle_request_resize; - wl_signal_add(&surface->events.request_resize, + wl_signal_add(&surface->toplevel->events.request_resize, &roots_surface->request_resize); roots_surface->request_maximize.notify = handle_request_maximize; - wl_signal_add(&surface->events.request_maximize, + wl_signal_add(&surface->toplevel->events.request_maximize, &roots_surface->request_maximize); roots_surface->request_fullscreen.notify = handle_request_fullscreen; - wl_signal_add(&surface->events.request_fullscreen, + wl_signal_add(&surface->toplevel->events.request_fullscreen, &roots_surface->request_fullscreen); roots_surface->new_popup.notify = handle_new_popup; wl_signal_add(&surface->events.new_popup, &roots_surface->new_popup); diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 3975dd67..4c40e129 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -198,24 +198,35 @@ static void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) { wlr_signal_emit_safe(&surface->events.unmap, surface); } - if (surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP && - surface->popup->seat != NULL) { - struct wlr_xdg_popup_grab_v6 *grab = - xdg_shell_popup_grab_from_seat(surface->client->shell, - surface->popup->seat); - - wl_list_remove(&surface->popup->grab_link); - - if (wl_list_empty(&grab->popups)) { - if (grab->seat->pointer_state.grab == &grab->pointer_grab) { - wlr_seat_pointer_end_grab(grab->seat); - } - if (grab->seat->keyboard_state.grab == &grab->keyboard_grab) { - wlr_seat_keyboard_end_grab(grab->seat); + switch (surface->role) { + case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: + free(surface->toplevel->title); + surface->toplevel->title = NULL; + free(surface->toplevel->app_id); + surface->toplevel->app_id = NULL; + break; + case WLR_XDG_SURFACE_V6_ROLE_POPUP: + if (surface->popup->seat != NULL) { + struct wlr_xdg_popup_grab_v6 *grab = + xdg_shell_popup_grab_from_seat(surface->client->shell, + surface->popup->seat); + + wl_list_remove(&surface->popup->grab_link); + + if (wl_list_empty(&grab->popups)) { + if (grab->seat->pointer_state.grab == &grab->pointer_grab) { + wlr_seat_pointer_end_grab(grab->seat); + } + if (grab->seat->keyboard_state.grab == &grab->keyboard_grab) { + wlr_seat_keyboard_end_grab(grab->seat); + } } - } - surface->popup->seat = NULL; + surface->popup->seat = NULL; + } + break; + case WLR_XDG_SURFACE_V6_ROLE_NONE: + assert(false && "not reached"); } struct wlr_xdg_surface_v6_configure *configure, *tmp; @@ -223,11 +234,6 @@ static void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) { xdg_surface_configure_destroy(configure); } - free(surface->title); - surface->title = NULL; - free(surface->app_id); - surface->app_id = NULL; - surface->configured = surface->mapped = false; surface->configure_serial = 0; if (surface->configure_idle) { @@ -666,8 +672,8 @@ static void xdg_toplevel_handle_set_title(struct wl_client *client, return; } - free(surface->title); - surface->title = tmp; + free(surface->toplevel->title); + surface->toplevel->title = tmp; } static void xdg_toplevel_handle_set_app_id(struct wl_client *client, @@ -680,8 +686,8 @@ static void xdg_toplevel_handle_set_app_id(struct wl_client *client, return; } - free(surface->app_id); - surface->app_id = tmp; + free(surface->toplevel->app_id); + surface->toplevel->app_id = tmp; } static void xdg_toplevel_handle_show_window_menu(struct wl_client *client, @@ -712,7 +718,8 @@ static void xdg_toplevel_handle_show_window_menu(struct wl_client *client, .y = y, }; - wlr_signal_emit_safe(&surface->events.request_show_window_menu, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_show_window_menu, + &event); } static void xdg_toplevel_handle_move(struct wl_client *client, @@ -741,7 +748,7 @@ static void xdg_toplevel_handle_move(struct wl_client *client, .serial = serial, }; - wlr_signal_emit_safe(&surface->events.request_move, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_move, &event); } static void xdg_toplevel_handle_resize(struct wl_client *client, @@ -771,7 +778,7 @@ static void xdg_toplevel_handle_resize(struct wl_client *client, .edges = edges, }; - wlr_signal_emit_safe(&surface->events.request_resize, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_resize, &event); } static void xdg_toplevel_handle_set_max_size(struct wl_client *client, @@ -795,7 +802,7 @@ static void xdg_toplevel_handle_set_maximized(struct wl_client *client, struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); surface->toplevel->next.maximized = true; - wlr_signal_emit_safe(&surface->events.request_maximize, surface); + wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } static void xdg_toplevel_handle_unset_maximized(struct wl_client *client, @@ -803,7 +810,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client, struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); surface->toplevel->next.maximized = false; - wlr_signal_emit_safe(&surface->events.request_maximize, surface); + wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client, @@ -824,7 +831,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client, .output = output, }; - wlr_signal_emit_safe(&surface->events.request_fullscreen, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, &event); } static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, @@ -840,14 +847,14 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, .output = NULL, }; - wlr_signal_emit_safe(&surface->events.request_fullscreen, &event); + wlr_signal_emit_safe(&surface->toplevel->events.request_fullscreen, &event); } static void xdg_toplevel_handle_set_minimized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - wlr_signal_emit_safe(&surface->events.request_minimize, surface); + wlr_signal_emit_safe(&surface->toplevel->events.request_minimize, surface); } static const struct zxdg_toplevel_v6_interface @@ -897,6 +904,12 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client, wl_resource_post_no_memory(resource); return; } + wl_signal_init(&surface->toplevel->events.request_maximize); + wl_signal_init(&surface->toplevel->events.request_fullscreen); + wl_signal_init(&surface->toplevel->events.request_minimize); + wl_signal_init(&surface->toplevel->events.request_move); + wl_signal_init(&surface->toplevel->events.request_resize); + wl_signal_init(&surface->toplevel->events.request_show_window_menu); surface->role = WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL; surface->toplevel->base = surface; @@ -1341,12 +1354,6 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client, wl_list_init(&surface->configure_list); wl_list_init(&surface->popups); - wl_signal_init(&surface->events.request_maximize); - wl_signal_init(&surface->events.request_fullscreen); - wl_signal_init(&surface->events.request_minimize); - wl_signal_init(&surface->events.request_move); - wl_signal_init(&surface->events.request_resize); - wl_signal_init(&surface->events.request_show_window_menu); wl_signal_init(&surface->events.destroy); wl_signal_init(&surface->events.ping_timeout); wl_signal_init(&surface->events.new_popup); -- cgit v1.2.3 From 19a525f3b51ed16d400d92fe27553967833f85d9 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 26 Mar 2018 19:02:28 -0400 Subject: rootston: damage view when zxdg-popup-v6 is mapped/unmapped --- include/rootston/view.h | 2 ++ rootston/xdg_shell_v6.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'rootston/xdg_shell_v6.c') diff --git a/include/rootston/view.h b/include/rootston/view.h index 775f3d11..1fd7353a 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -177,6 +177,8 @@ struct roots_xdg_popup_v6 { struct roots_view_child view_child; struct wlr_xdg_popup_v6 *wlr_popup; struct wl_listener destroy; + struct wl_listener map; + struct wl_listener unmap; struct wl_listener new_popup; }; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 001232ab..8d1a340e 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -28,6 +28,18 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) { popup_destroy((struct roots_view_child *)popup); } +static void popup_handle_map(struct wl_listener *listener, void *data) { + struct roots_xdg_popup_v6 *popup = + wl_container_of(listener, popup, map); + view_damage_whole(popup->view_child.view); +} + +static void popup_handle_unmap(struct wl_listener *listener, void *data) { + struct roots_xdg_popup_v6 *popup = + wl_container_of(listener, popup, unmap); + view_damage_whole(popup->view_child.view); +} + static struct roots_xdg_popup_v6 *popup_create(struct roots_view *view, struct wlr_xdg_popup_v6 *wlr_popup); @@ -50,6 +62,10 @@ static struct roots_xdg_popup_v6 *popup_create(struct roots_view *view, view_child_init(&popup->view_child, view, wlr_popup->base->surface); popup->destroy.notify = popup_handle_destroy; wl_signal_add(&wlr_popup->base->events.destroy, &popup->destroy); + popup->map.notify = popup_handle_map; + wl_signal_add(&wlr_popup->base->events.map, &popup->map); + popup->unmap.notify = popup_handle_unmap; + wl_signal_add(&wlr_popup->base->events.unmap, &popup->unmap); popup->new_popup.notify = popup_handle_new_popup; wl_signal_add(&wlr_popup->base->events.new_popup, &popup->new_popup); return popup; -- cgit v1.2.3 From 88eec637a44ede8b521c2aa44d0196c99dd5a0e3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 18 Mar 2018 13:58:01 -0400 Subject: Address feedback --- include/wlr/types/wlr_layer_shell.h | 5 +- include/wlr/types/wlr_xdg_shell.h | 4 +- include/wlr/types/wlr_xdg_shell_v6.h | 4 +- protocol/wlr-layer-shell-unstable-v1.xml | 93 +++++++++----------------------- rootston/xdg_shell.c | 6 +-- rootston/xdg_shell_v6.c | 6 +-- types/wlr_layer_shell.c | 47 +++++++++------- types/wlr_xdg_shell.c | 64 +++++++++++----------- types/wlr_xdg_shell_v6.c | 64 +++++++++++----------- 9 files changed, 131 insertions(+), 162 deletions(-) (limited to 'rootston/xdg_shell_v6.c') diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h index 46d0b09c..0807fe8d 100644 --- a/include/wlr/types/wlr_layer_shell.h +++ b/include/wlr/types/wlr_layer_shell.h @@ -48,6 +48,7 @@ struct wlr_layer_surface_state { struct { uint32_t top, right, bottom, left; } margin; + bool keyboard_interactive; // Server uint32_t width, height; }; @@ -73,8 +74,8 @@ struct wlr_layer_surface { uint32_t configure_next_serial; struct wl_list configure_list; - struct wlr_layer_surface_state next; // client protocol requests - struct wlr_layer_surface_state pending; // our configure requests + struct wlr_layer_surface_state client_pending; + struct wlr_layer_surface_state server_pending; struct wlr_layer_surface_state current; struct wl_listener surface_destroy_listener; diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 18596462..9938f4b1 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -78,8 +78,8 @@ struct wlr_xdg_toplevel { struct wlr_xdg_surface *parent; bool added; - struct wlr_xdg_toplevel_state next; // client protocol requests - struct wlr_xdg_toplevel_state pending; // our configure requests + struct wlr_xdg_toplevel_state client_pending; + struct wlr_xdg_toplevel_state server_pending; struct wlr_xdg_toplevel_state current; char *title; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index c6820f01..0867b2f6 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -78,8 +78,8 @@ struct wlr_xdg_toplevel_v6 { struct wlr_xdg_surface_v6 *parent; bool added; - struct wlr_xdg_toplevel_v6_state next; // client protocol requests - struct wlr_xdg_toplevel_v6_state pending; // user configure requests + struct wlr_xdg_toplevel_v6_state client_pending; + struct wlr_xdg_toplevel_v6_state server_pending; struct wlr_xdg_toplevel_v6_state current; char *title; diff --git a/protocol/wlr-layer-shell-unstable-v1.xml b/protocol/wlr-layer-shell-unstable-v1.xml index 29ba9dd4..285c9b8f 100644 --- a/protocol/wlr-layer-shell-unstable-v1.xml +++ b/protocol/wlr-layer-shell-unstable-v1.xml @@ -61,7 +61,6 @@ - @@ -87,11 +86,9 @@ are designed to be rendered as a layer of a stacked desktop-like environment. - Layer surface state (anchor, exclusive zone, margin) is double-buffered. - Protocol requests modify the pending state, as opposed to the current - state in use by the compositor. The wl_surface.commit request atomically - applies all pending state, replacing the current state. After commit, the - new pending state is as documented for each related request. + Layer surface state (anchor, exclusive zone, margin, interactivity) is + double-buffered, and will be applied at the time wl_surface.commit of the + corresponding wl_surface is called. @@ -129,12 +126,31 @@ point on the output, in pixels. Setting this value for edges you are not anchored to has no effect. + The exclusive zone includes the margin. + Margin is double-buffered, see wl_surface.commit. - - - - + + + + + + + + + Set to 1 to request that the seat send keyboard events to this layer + surface. For layers below the shell surface layer, the seat will use + normal focus semantics. For layers above the shell surface layers, the + seat will always give exclusive keyboard focus to the top-most layer + which has keyboard interactivity set to true. + + Layer surfaces receive pointer, touch, and tablet events normally. If + you do not want to receive them, set the input region on your surface + to an empty region. + + Events is double-buffered, see wl_surface.commit. + + @@ -150,15 +166,6 @@ - - - This creates a layer input for this layer surface. This can be used to - control input semantics for the layer surface on the specified wl_seat. - - - - - When a configure event is received, if a client commits the @@ -228,52 +235,4 @@ - - - - Clients can use this interface to specify input semantics for a layer - surface on a given seat. By default, layer surfaces are considered - non-interactive by seats, and will not participate in their focus - semantics or receive input events for them. - - Input state is double-buffered. Protocol requests modify the pending - state, as opposed to the current state in use by the compositor. The - wl_surface.commit request for the associated layer surface atomically - applies all pending state, replacing the current state. After commit, the - new pending state is as documented for each related request. - - - - - Requests that the seat send input events for the specified input devices - to this layer surface. - - Positional events (pointer and touch) will only be sent if the layer - surface is the top-most interactive surface, and only when the position - of these events are relative to the surface. Enter and leave events will - be signalled normally in these cases. - - Keyboard events will treat the layer surface as the only focused surface - on the seat. Upon requesting keyboard events, the layer surface will - receive a keyboard enter event. A leave event is signalled when it - invokes set_events again without keyboard events specified. - - Events is double-buffered, see wl_surface.commit. - - - - - - - This request destroys the layer input. - - - - - - - - - - diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c index 62b57641..927bd018 100644 --- a/rootston/xdg_shell.c +++ b/rootston/xdg_shell.c @@ -252,7 +252,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) { return; } - view_maximize(view, surface->toplevel->next.maximized); + view_maximize(view, surface->toplevel->client_pending.maximized); } static void handle_request_fullscreen(struct wl_listener *listener, @@ -403,10 +403,10 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) { view->destroy = destroy; roots_surface->view = view; - if (surface->toplevel->next.maximized) { + if (surface->toplevel->client_pending.maximized) { view_maximize(view, true); } - if (surface->toplevel->next.fullscreen) { + if (surface->toplevel->client_pending.fullscreen) { view_set_fullscreen(view, true, NULL); } } diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 11bc0180..ad33c4b0 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -254,7 +254,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) { return; } - view_maximize(view, surface->toplevel->next.maximized); + view_maximize(view, surface->toplevel->client_pending.maximized); } static void handle_request_fullscreen(struct wl_listener *listener, @@ -405,10 +405,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { view->destroy = destroy; roots_surface->view = view; - if (surface->toplevel->next.maximized) { + if (surface->toplevel->client_pending.maximized) { view_maximize(view, true); } - if (surface->toplevel->next.fullscreen) { + if (surface->toplevel->client_pending.fullscreen) { view_set_fullscreen(view, true, NULL); } } diff --git a/types/wlr_layer_shell.c b/types/wlr_layer_shell.c index 242d3b14..8063b219 100644 --- a/types/wlr_layer_shell.c +++ b/types/wlr_layer_shell.c @@ -76,32 +76,34 @@ static void layer_surface_handle_ack_configure(struct wl_client *client, static void layer_surface_handle_set_anchor(struct wl_client *client, struct wl_resource *resource, uint32_t anchor) { struct wlr_layer_surface *surface = layer_surface_from_resource(resource); - surface->next.anchor = anchor; + surface->client_pending.anchor = anchor; } static void layer_surface_handle_set_exclusive_zone(struct wl_client *client, struct wl_resource *resource, uint32_t zone) { struct wlr_layer_surface *surface = layer_surface_from_resource(resource); - surface->next.exclusive_zone = zone; + surface->client_pending.exclusive_zone = zone; } -static void layer_surface_handle_set_margin(struct wl_client *client, - struct wl_resource *resource, uint32_t top, - uint32_t right, uint32_t bottom, uint32_t left) { +static void layer_surface_handle_set_margin( + struct wl_client *client, struct wl_resource *resource, + int32_t top, int32_t right, int32_t bottom, int32_t left) { struct wlr_layer_surface *surface = layer_surface_from_resource(resource); - surface->next.margin.top = top; - surface->next.margin.right = right; - surface->next.margin.bottom = bottom; - surface->next.margin.left = left; + surface->client_pending.margin.top = top; + surface->client_pending.margin.right = right; + surface->client_pending.margin.bottom = bottom; + surface->client_pending.margin.left = left; } -static void layer_surface_handle_get_popup(struct wl_client *client, - struct wl_resource *resource, struct wl_resource *popup) { - // TODO +static void layer_surface_handle_set_keyboard_interactivity( + struct wl_client *client, struct wl_resource *resource, + uint32_t interactive) { + struct wlr_layer_surface *surface = layer_surface_from_resource(resource); + surface->client_pending.keyboard_interactive = interactive == 1; } -static void layer_surface_handle_get_input(struct wl_client *client, - struct wl_resource *resource, uint32_t id, struct wl_resource *seat) { +static void layer_surface_handle_get_popup(struct wl_client *client, + struct wl_resource *resource, struct wl_resource *popup) { // TODO } @@ -111,8 +113,8 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation .set_anchor = layer_surface_handle_set_anchor, .set_exclusive_zone = layer_surface_handle_set_exclusive_zone, .set_margin = layer_surface_handle_set_margin, + .set_keyboard_interactivity = layer_surface_handle_set_keyboard_interactivity, .get_popup = layer_surface_handle_get_popup, - .get_input = layer_surface_handle_get_input, }; static void layer_surface_unmap(struct wlr_layer_surface *surface) { @@ -165,7 +167,7 @@ static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) { state = &configure->state; } - return !memcmp(state, &surface->pending, + return !memcmp(state, &surface->server_pending, sizeof(struct wlr_layer_surface_state)); } @@ -181,7 +183,7 @@ static void wlr_layer_surface_send_configure(void *user_data) { wl_list_insert(surface->configure_list.prev, &configure->link); configure->serial = surface->configure_next_serial; - configure->state = surface->pending; + configure->state = surface->server_pending; zwlr_layer_surface_v1_send_configure(surface->resource, configure->serial, configure->state.width, configure->state.height); @@ -216,8 +218,8 @@ static uint32_t wlr_layer_surface_schedule_configure( void wlr_layer_surface_configure(struct wlr_layer_surface *surface, uint32_t width, uint32_t height) { - surface->pending.width = width; - surface->pending.height = height; + surface->server_pending.width = width; + surface->server_pending.height = height; wlr_layer_surface_schedule_configure(surface); } @@ -231,6 +233,13 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface, "layer_surface has never been configured"); return; } + + surface->current.anchor = surface->client_pending.anchor; + surface->current.exclusive_zone = surface->client_pending.exclusive_zone; + surface->current.margin = surface->client_pending.margin; + surface->current.keyboard_interactive = + surface->client_pending.keyboard_interactive; + if (!surface->added) { surface->added = true; wlr_signal_emit_safe(&surface->client->shell->events.new_surface, diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c index 382cf839..d3be2c4f 100644 --- a/types/wlr_xdg_shell.c +++ b/types/wlr_xdg_shell.c @@ -815,23 +815,23 @@ static void xdg_toplevel_handle_set_max_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) { struct wlr_xdg_surface *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.max_width = width; - surface->toplevel->next.max_height = height; + surface->toplevel->client_pending.max_width = width; + surface->toplevel->client_pending.max_height = height; } static void xdg_toplevel_handle_set_min_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) { struct wlr_xdg_surface *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.min_width = width; - surface->toplevel->next.min_height = height; + surface->toplevel->client_pending.min_width = width; + surface->toplevel->client_pending.min_height = height; } static void xdg_toplevel_handle_set_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.maximized = true; + surface->toplevel->client_pending.maximized = true; wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } @@ -839,7 +839,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.maximized = false; + surface->toplevel->client_pending.maximized = false; wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } @@ -853,7 +853,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client, output = wlr_output_from_resource(output_resource); } - surface->toplevel->next.fullscreen = true; + surface->toplevel->client_pending.fullscreen = true; struct wlr_xdg_toplevel_set_fullscreen_event event = { .surface = surface, @@ -869,7 +869,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, struct wlr_xdg_surface *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.fullscreen = false; + surface->toplevel->client_pending.fullscreen = false; struct wlr_xdg_toplevel_set_fullscreen_event event = { .surface = surface, @@ -1087,25 +1087,25 @@ static bool wlr_xdg_surface_toplevel_state_compare( configured.height = configure->toplevel_state->height; } - if (state->pending.activated != configured.state.activated) { + if (state->server_pending.activated != configured.state.activated) { return false; } - if (state->pending.fullscreen != configured.state.fullscreen) { + if (state->server_pending.fullscreen != configured.state.fullscreen) { return false; } - if (state->pending.maximized != configured.state.maximized) { + if (state->server_pending.maximized != configured.state.maximized) { return false; } - if (state->pending.resizing != configured.state.resizing) { + if (state->server_pending.resizing != configured.state.resizing) { return false; } - if (state->pending.width == configured.width && - state->pending.height == configured.height) { + if (state->server_pending.width == configured.width && + state->server_pending.height == configured.height) { return true; } - if (state->pending.width == 0 && state->pending.height == 0) { + if (state->server_pending.width == 0 && state->server_pending.height == 0) { return true; } @@ -1123,12 +1123,12 @@ static void wlr_xdg_toplevel_send_configure( wl_resource_post_no_memory(surface->toplevel->resource); return; } - *configure->toplevel_state = surface->toplevel->pending; + *configure->toplevel_state = surface->toplevel->server_pending; uint32_t *s; struct wl_array states; wl_array_init(&states); - if (surface->toplevel->pending.maximized) { + if (surface->toplevel->server_pending.maximized) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel"); @@ -1136,7 +1136,7 @@ static void wlr_xdg_toplevel_send_configure( } *s = XDG_TOPLEVEL_STATE_MAXIMIZED; } - if (surface->toplevel->pending.fullscreen) { + if (surface->toplevel->server_pending.fullscreen) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel"); @@ -1144,7 +1144,7 @@ static void wlr_xdg_toplevel_send_configure( } *s = XDG_TOPLEVEL_STATE_FULLSCREEN; } - if (surface->toplevel->pending.resizing) { + if (surface->toplevel->server_pending.resizing) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel"); @@ -1152,7 +1152,7 @@ static void wlr_xdg_toplevel_send_configure( } *s = XDG_TOPLEVEL_STATE_RESIZING; } - if (surface->toplevel->pending.activated) { + if (surface->toplevel->server_pending.activated) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel"); @@ -1161,8 +1161,8 @@ static void wlr_xdg_toplevel_send_configure( *s = XDG_TOPLEVEL_STATE_ACTIVATED; } - uint32_t width = surface->toplevel->pending.width; - uint32_t height = surface->toplevel->pending.height; + uint32_t width = surface->toplevel->server_pending.width; + uint32_t height = surface->toplevel->server_pending.height; xdg_toplevel_send_configure(surface->toplevel->resource, width, height, &states); @@ -1270,13 +1270,13 @@ static void wlr_xdg_surface_toplevel_committed( // update state that doesn't need compositor approval surface->toplevel->current.max_width = - surface->toplevel->next.max_width; + surface->toplevel->client_pending.max_width; surface->toplevel->current.min_width = - surface->toplevel->next.min_width; + surface->toplevel->client_pending.min_width; surface->toplevel->current.max_height = - surface->toplevel->next.max_height; + surface->toplevel->client_pending.max_height; surface->toplevel->current.min_height = - surface->toplevel->next.min_height; + surface->toplevel->client_pending.min_height; } static void wlr_xdg_surface_popup_committed( @@ -1561,8 +1561,8 @@ void wlr_xdg_surface_ping(struct wlr_xdg_surface *surface) { uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface, uint32_t width, uint32_t height) { assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - surface->toplevel->pending.width = width; - surface->toplevel->pending.height = height; + surface->toplevel->server_pending.width = width; + surface->toplevel->server_pending.height = height; return wlr_xdg_surface_schedule_configure(surface); } @@ -1570,7 +1570,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface, bool activated) { assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - surface->toplevel->pending.activated = activated; + surface->toplevel->server_pending.activated = activated; return wlr_xdg_surface_schedule_configure(surface); } @@ -1578,7 +1578,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface, bool maximized) { assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - surface->toplevel->pending.maximized = maximized; + surface->toplevel->server_pending.maximized = maximized; return wlr_xdg_surface_schedule_configure(surface); } @@ -1586,7 +1586,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface, bool fullscreen) { assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - surface->toplevel->pending.fullscreen = fullscreen; + surface->toplevel->server_pending.fullscreen = fullscreen; return wlr_xdg_surface_schedule_configure(surface); } @@ -1594,7 +1594,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface, uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface, bool resizing) { assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); - surface->toplevel->pending.resizing = resizing; + surface->toplevel->server_pending.resizing = resizing; return wlr_xdg_surface_schedule_configure(surface); } diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 4c40e129..65b461b7 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -785,23 +785,23 @@ static void xdg_toplevel_handle_set_max_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) { struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.max_width = width; - surface->toplevel->next.max_height = height; + surface->toplevel->client_pending.max_width = width; + surface->toplevel->client_pending.max_height = height; } static void xdg_toplevel_handle_set_min_size(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height) { struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.min_width = width; - surface->toplevel->next.min_height = height; + surface->toplevel->client_pending.min_width = width; + surface->toplevel->client_pending.min_height = height; } static void xdg_toplevel_handle_set_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.maximized = true; + surface->toplevel->client_pending.maximized = true; wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } @@ -809,7 +809,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client, struct wl_resource *resource) { struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.maximized = false; + surface->toplevel->client_pending.maximized = false; wlr_signal_emit_safe(&surface->toplevel->events.request_maximize, surface); } @@ -823,7 +823,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client, output = wlr_output_from_resource(output_resource); } - surface->toplevel->next.fullscreen = true; + surface->toplevel->client_pending.fullscreen = true; struct wlr_xdg_toplevel_v6_set_fullscreen_event event = { .surface = surface, @@ -839,7 +839,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_toplevel_resource(resource); - surface->toplevel->next.fullscreen = false; + surface->toplevel->client_pending.fullscreen = false; struct wlr_xdg_toplevel_v6_set_fullscreen_event event = { .surface = surface, @@ -1057,25 +1057,25 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare( configured.height = configure->toplevel_state->height; } - if (state->pending.activated != configured.state.activated) { + if (state->server_pending.activated != configured.state.activated) { return false; } - if (state->pending.fullscreen != configured.state.fullscreen) { + if (state->server_pending.fullscreen != configured.state.fullscreen) { return false; } - if (state->pending.maximized != configured.state.maximized) { + if (state->server_pending.maximized != configured.state.maximized) { return false; } - if (state->pending.resizing != configured.state.resizing) { + if (state->server_pending.resizing != configured.state.resizing) { return false; } - if (state->pending.width == configured.width && - state->pending.height == configured.height) { + if (state->server_pending.width == configured.width && + state->server_pending.height == configured.height) { return true; } - if (state->pending.width == 0 && state->pending.height == 0) { + if (state->server_pending.width == 0 && state->server_pending.height == 0) { return true; } @@ -1093,12 +1093,12 @@ static void wlr_xdg_toplevel_v6_send_configure( wl_resource_post_no_memory(surface->toplevel->resource); return; } - *configure->toplevel_state = surface->toplevel->pending; + *configure->toplevel_state = surface->toplevel->server_pending; uint32_t *s; struct wl_array states; wl_array_init(&states); - if (surface->toplevel->pending.maximized) { + if (surface->toplevel->server_pending.maximized) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel"); @@ -1106,7 +1106,7 @@ static void wlr_xdg_toplevel_v6_send_configure( } *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED; } - if (surface->toplevel->pending.fullscreen) { + if (surface->toplevel->server_pending.fullscreen) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel"); @@ -1114,7 +1114,7 @@ static void wlr_xdg_toplevel_v6_send_configure( } *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN; } - if (surface->toplevel->pending.resizing) { + if (surface->toplevel->server_pending.resizing) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel"); @@ -1122,7 +1122,7 @@ static void wlr_xdg_toplevel_v6_send_configure( } *s = ZXDG_TOPLEVEL_V6_STATE_RESIZING; } - if (surface->toplevel->pending.activated) { + if (surface->toplevel->server_pending.activated) { s = wl_array_add(&states, sizeof(uint32_t)); if (!s) { wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel"); @@ -1131,8 +1131,8 @@ static void wlr_xdg_toplevel_v6_send_configure( *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; } - uint32_t width = surface->toplevel->pending.width; - uint32_t height = surface->toplevel->pending.height; + uint32_t width = surface->toplevel->server_pending.width; + uint32_t height = surface->toplevel->server_pending.height; zxdg_toplevel_v6_send_configure(surface->toplevel->resource, width, height, &states); @@ -1240,13 +1240,13 @@ static void wlr_xdg_surface_v6_toplevel_committed( // update state that doesn't need compositor approval surface->toplevel->current.max_width = - surface->toplevel->next.max_width; + surface->toplevel->client_pending.max_width; surface->toplevel->current.min_width = - surface->toplevel->next.min_width; + surface->toplevel->client_pending.min_width; surface->toplevel->current.max_height = - surface->toplevel->next.max_height; + surface->toplevel->client_pending.max_height; surface->toplevel->current.min_height = - surface->toplevel->next.min_height; + surface->toplevel->client_pending.min_height; } static void wlr_xdg_surface_v6_popup_committed( @@ -1531,8 +1531,8 @@ void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface) { uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface, uint32_t width, uint32_t height) { assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); - surface->toplevel->pending.width = width; - surface->toplevel->pending.height = height; + surface->toplevel->server_pending.width = width; + surface->toplevel->server_pending.height = height; return wlr_xdg_surface_v6_schedule_configure(surface); } @@ -1540,7 +1540,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface, bool activated) { assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); - surface->toplevel->pending.activated = activated; + surface->toplevel->server_pending.activated = activated; return wlr_xdg_surface_v6_schedule_configure(surface); } @@ -1548,7 +1548,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface, bool maximized) { assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); - surface->toplevel->pending.maximized = maximized; + surface->toplevel->server_pending.maximized = maximized; return wlr_xdg_surface_v6_schedule_configure(surface); } @@ -1556,7 +1556,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface, bool fullscreen) { assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); - surface->toplevel->pending.fullscreen = fullscreen; + surface->toplevel->server_pending.fullscreen = fullscreen; return wlr_xdg_surface_v6_schedule_configure(surface); } @@ -1564,7 +1564,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface, uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, bool resizing) { assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL); - surface->toplevel->pending.resizing = resizing; + surface->toplevel->server_pending.resizing = resizing; return wlr_xdg_surface_v6_schedule_configure(surface); } -- cgit v1.2.3