xdg-{shell,decoration}: improve events

This commit changes the behavior of `new_*` signals to better match
their names (see https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3608).
wlr_xdg_shell.events.new_surface is now emitted when an xdg_surface is
created, and wlr_xdg_shell.events.new_{toplevel,popup} events are
introduced to get notified when an xdg_{toplevel,popup} is created.
Same applies to
`wlr_xdg_decoration_manager_v1.events.new_toplevel_decoration`. As a
result, wlr_xdg_surface.added and wlr_xdg_toplevel_decoration_v1.added
are removed, as we no longer need to track whether the corresponding
event was emitted.

Additionally, this commit changes the behavior of
wlr_xdg_surface.events.destroy: it is now emitted when the xdg_surface
is destroyed, as the name suggests.
wlr_xdg_{toplevel,popup}.events.destroy events are added to get
notified when an xdg_{toplevel,popup} is destroyed.
This commit is contained in:
Kirill Primak 2023-09-05 16:14:25 +03:00
parent d61ec694b3
commit c85838892d
12 changed files with 107 additions and 134 deletions

View file

@ -45,8 +45,6 @@ struct wlr_xdg_toplevel_decoration_v1 {
enum wlr_xdg_toplevel_decoration_v1_mode scheduled_mode;
enum wlr_xdg_toplevel_decoration_v1_mode requested_mode;
bool added;
struct wl_list configure_list; // wlr_xdg_toplevel_decoration_v1_configure.link
struct {
@ -54,7 +52,7 @@ struct wlr_xdg_toplevel_decoration_v1 {
struct wl_signal request_mode;
} events;
struct wl_listener surface_destroy;
struct wl_listener toplevel_destroy;
struct wl_listener surface_configure;
struct wl_listener surface_ack_configure;
struct wl_listener surface_commit;

View file

@ -34,7 +34,7 @@ struct wlr_xdg_exported_v1 {
struct wlr_xdg_foreign_exported base;
struct wl_resource *resource;
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_toplevel_destroy;
struct wl_list link; // wlr_xdg_foreign_v1.exporter.objects
};
@ -54,7 +54,7 @@ struct wlr_xdg_imported_child_v1 {
struct wl_list link; // wlr_xdg_imported_v1.children
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_toplevel_destroy;
struct wl_listener xdg_toplevel_set_parent;
};

View file

@ -34,7 +34,7 @@ struct wlr_xdg_exported_v2 {
struct wlr_xdg_foreign_exported base;
struct wl_resource *resource;
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_toplevel_destroy;
struct wl_list link; // wlr_xdg_foreign_v2.exporter.objects
};
@ -54,7 +54,7 @@ struct wlr_xdg_imported_child_v2 {
struct wl_list link; // wlr_xdg_imported_v2.children
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_toplevel_destroy;
struct wl_listener xdg_toplevel_set_parent;
};

View file

@ -26,6 +26,8 @@ struct wlr_xdg_shell {
struct {
struct wl_signal new_surface; // struct wlr_xdg_surface
struct wl_signal new_toplevel; // struct wlr_xdg_toplevel
struct wl_signal new_popup; // struct wlr_xdg_popup
struct wl_signal destroy;
} events;
@ -102,6 +104,8 @@ struct wlr_xdg_popup {
struct wlr_xdg_popup_state current, pending;
struct {
struct wl_signal destroy;
struct wl_signal reposition;
} events;
@ -184,6 +188,8 @@ struct wlr_xdg_toplevel {
char *app_id;
struct {
struct wl_signal destroy;
// Note: as per xdg-shell protocol, the compositor has to
// handle state requests by sending a configure event,
// even if it didn't actually change the state. Therefore,
@ -249,7 +255,7 @@ struct wlr_xdg_surface {
struct wl_list popups; // wlr_xdg_popup.link
bool added, configured;
bool configured;
struct wl_event_source *configure_idle;
uint32_t scheduled_serial;
struct wl_list configure_list;