The new xdg-shell present/present_from_event() requests specify that the compositor may notify the user. Thus, we need a way to pass requests and events between the compositor-side shell plugin and the shell client (which does the drawing).
Define a "managed_surface" interface, which will keep track of server-side shell surfaces, and is able to send requests and receive events. Signed-off-by: Manuel Bachmann <[email protected]> --- clients/desktop-shell.c | 37 ++++++++++++++++++++++++++++++- desktop-shell/shell.c | 18 ++++++++++++++++ protocol/desktop-shell.xml | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index ac2928f..c5baf52 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -942,6 +942,32 @@ unlock_dialog_finish(struct task *task, uint32_t events) } static void +managed_surface_presented(void *data, + struct managed_surface *managed_surface) +{ +} + +static void +managed_surface_title_changed(void *data, + struct managed_surface *managed_surface, + const char *title) +{ +} + +static void +managed_surface_removed(void *data, + struct managed_surface *managed_surface) +{ + managed_surface_destroy(managed_surface); +} + +static const struct managed_surface_listener managed_surface_listener = { + managed_surface_presented, + managed_surface_title_changed, + managed_surface_removed +}; + +static void desktop_shell_configure(void *data, struct desktop_shell *desktop_shell, uint32_t edges, @@ -1018,10 +1044,19 @@ desktop_shell_grab_cursor(void *data, } } +static void +desktop_shell_add_managed_surface(void *data, + struct desktop_shell *desktop_shell, + struct managed_surface *managed_surface, + const char *title) +{ +} + static const struct desktop_shell_listener listener = { desktop_shell_configure, desktop_shell_prepare_lock_surface, - desktop_shell_grab_cursor + desktop_shell_grab_cursor, + desktop_shell_add_managed_surface }; static void diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index d1d3f3c..e48d63d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3509,6 +3509,24 @@ static const struct wl_shell_surface_interface shell_surface_implementation = { }; static void +managed_surface_activate(struct wl_client *client, + struct wl_resource *resource) +{ +} + +static void +managed_surface_destroy(struct wl_client *client, + struct wl_resource *resource) +{ + wl_resource_destroy(resource); +} + +static const struct managed_surface_interface managed_surface_implementation = { + managed_surface_activate, + managed_surface_destroy +}; + +static void destroy_shell_surface(struct shell_surface *shsurf) { struct shell_surface *child, *next; diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml index fb0b748..7fc2307 100644 --- a/protocol/desktop-shell.xml +++ b/protocol/desktop-shell.xml @@ -117,6 +117,60 @@ </description> </request> + <!-- Version 4 additions --> + + <event name="add_managed_surface" since="4"> + <description summary="manage a new surface"> + Tell the shell to create a new managed_surface object. + </description> + <arg name="id" type="new_id" interface="managed_surface"/> + <arg name="title" type="string" allow-null="true"/> + </event> + + </interface> + + <interface name="managed_surface" version="1"> + <description summary="interface for handling shell surfaces"> + A managed surface is an abstraction for a shell surface, + susceptible to send events requiring shell feedback, and + also to which the shell might want to send requests back. + </description> + + <request name="activate"> + <description summary="activate a managed surface"> + Tell the server that the shell wants to activate a + managed surface. + </description> + </request> + + <request name="destroy" type="destructor"/> + + <event name="presented"> + <description summary="a managed surface needs attention"> + This event will be sent immediately after a "present" + request has been issued on the corresponding shell surface. + + The shell will draw a tooltip specifying the title of the + surface. If the user clicks on this tooltip, the shell will + send an "activate" request back to the server. + </description> + </event> + + <event name="title_changed"> + <description summary="a managed surface has a new title"> + This event will be sent immediately after the title of the + corresponding shell surface has been modified. + </description> + <arg name="title" type="string" allow-null="true"/> + </event> + + <event name="removed"> + <description summary="a managed surface has been removed"> + This event will be sent immediately after the corresponding + shell surface has been destroyed by the server. + </description> + </event> + </interface> <interface name="screensaver" version="1"> -- 1.8.3.1 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
