[PATCH weston 8/8] westoy: Port the toy toolkit over to xdg-shell
Jasper St. Pierre
jstpierre at mecheye.net
Tue Nov 12 17:20:04 PST 2013
---
clients/.gitignore | 2 +
clients/Makefile.am | 8 +-
clients/window.c | 306 +++++++++++++++++----------------------
protocol/Makefile.am | 3 +-
protocol/xdg-shell.xml | 385 +++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 530 insertions(+), 174 deletions(-)
create mode 100644 protocol/xdg-shell.xml
diff --git a/clients/.gitignore b/clients/.gitignore
index 23959cc..d2ff0a2 100644
--- a/clients/.gitignore
+++ b/clients/.gitignore
@@ -45,3 +45,5 @@ weston-multi-resource
workspaces-client-protocol.h
workspaces-protocol.c
weston-simple-im
+xdg-shell-client-protocol.h
+xdg-shell-protocol.c
diff --git a/clients/Makefile.am b/clients/Makefile.am
index 4f9dc48..489e740 100644
--- a/clients/Makefile.am
+++ b/clients/Makefile.am
@@ -100,7 +100,9 @@ libtoytoolkit_la_SOURCES = \
subsurface-protocol.c \
subsurface-client-protocol.h \
workspaces-protocol.c \
- workspaces-client-protocol.h
+ workspaces-client-protocol.h \
+ xdg-shell-protocol.c \
+ xdg-shell-client-protocol.h
libtoytoolkit_la_LIBADD = \
$(CLIENT_LIBS) \
@@ -230,7 +232,9 @@ BUILT_SOURCES = \
subsurface-client-protocol.h \
subsurface-protocol.c \
workspaces-client-protocol.h \
- workspaces-protocol.c
+ workspaces-protocol.c \
+ xdg-shell-protocol.c \
+ xdg-shell-client-protocol.h
CLEANFILES = $(BUILT_SOURCES)
endif
diff --git a/clients/window.c b/clients/window.c
index df56bd9..5a85deb 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -65,6 +65,7 @@ typedef void *EGLContext;
#include <linux/input.h>
#include <wayland-client.h>
#include "../shared/cairo-util.h"
+#include "xdg-shell-client-protocol.h"
#include "text-cursor-position-client-protocol.h"
#include "workspaces-client-protocol.h"
#include "../shared/os-compatibility.h"
@@ -85,11 +86,11 @@ struct display {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_subcompositor *subcompositor;
- struct wl_shell *shell;
struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position;
struct workspace_manager *workspace_manager;
+ struct xdg_shell *xdg_shell;
EGLDisplay dpy;
EGLConfig argb_config;
EGLContext argb_ctx;
@@ -134,13 +135,6 @@ struct display {
int seat_version;
};
-enum {
- TYPE_NONE,
- TYPE_TOPLEVEL,
- TYPE_MENU,
- TYPE_CUSTOM
-};
-
struct window_output {
struct output *output;
struct wl_list link;
@@ -229,11 +223,10 @@ struct window {
int redraw_task_scheduled;
struct task redraw_task;
int resize_needed;
- int type;
- int focus_count;
+ int custom;
+ int focused;
int resizing;
- int configure_requests;
int fullscreen;
int maximized;
@@ -249,7 +242,8 @@ struct window {
window_output_handler_t output_handler;
struct surface *main_surface;
- struct wl_shell_surface *shell_surface;
+ struct xdg_surface *xdg_surface;
+ struct xdg_popup *xdg_popup;
struct window_frame *frame;
@@ -1350,28 +1344,7 @@ surface_flush(struct surface *surface)
int
window_has_focus(struct window *window)
{
- return window->focus_count > 0;
-}
-
-static void
-window_flush(struct window *window)
-{
- struct surface *surface;
-
- if (window->type == TYPE_NONE) {
- window->type = TYPE_TOPLEVEL;
- if (window->shell_surface)
- wl_shell_surface_set_toplevel(window->shell_surface);
- }
-
- wl_list_for_each(surface, &window->subsurface_list, link) {
- if (surface == window->main_surface)
- continue;
-
- surface_flush(surface);
- }
-
- surface_flush(window->main_surface);
+ return window->focused;
}
struct display *
@@ -1535,8 +1508,10 @@ window_destroy(struct window *window)
if (window->frame)
window_frame_destroy(window->frame);
- if (window->shell_surface)
- wl_shell_surface_destroy(window->shell_surface);
+ if (window->xdg_surface)
+ xdg_surface_destroy(window->xdg_surface);
+ if (window->xdg_popup)
+ xdg_popup_destroy(window->xdg_popup);
surface_destroy(window->main_surface);
@@ -2202,7 +2177,7 @@ frame_redraw_handler(struct widget *widget, void *data)
if (window->fullscreen)
return;
- if (window->focus_count) {
+ if (window->focused) {
frame_set_flag(frame->frame, FRAME_FLAG_ACTIVE);
} else {
frame_unset_flag(frame->frame, FRAME_FLAG_ACTIVE);
@@ -2221,7 +2196,7 @@ frame_get_pointer_image_for_location(struct window_frame *frame,
{
struct window *window = frame->widget->window;
- if (window->type != TYPE_TOPLEVEL)
+ if (window->custom)
return CURSOR_LEFT_PTR;
switch (location) {
@@ -2380,23 +2355,23 @@ frame_handle_status(struct window_frame *frame, struct input *input,
return;
}
- if ((status & FRAME_STATUS_MOVE) && window->shell_surface) {
+ if ((status & FRAME_STATUS_MOVE) && window->xdg_surface) {
input_ungrab(input);
- wl_shell_surface_move(window->shell_surface,
- input_get_seat(input),
- window->display->serial);
+ xdg_surface_move(window->xdg_surface,
+ input_get_seat(input),
+ window->display->serial);
frame_status_clear(frame->frame, FRAME_STATUS_MOVE);
}
- if ((status & FRAME_STATUS_RESIZE) && window->shell_surface) {
+ if ((status & FRAME_STATUS_RESIZE) && window->xdg_surface) {
input_ungrab(input);
window->resizing = 1;
- wl_shell_surface_resize(window->shell_surface,
- input_get_seat(input),
- window->display->serial,
- location);
+ xdg_surface_resize(window->xdg_surface,
+ input_get_seat(input),
+ window->display->serial,
+ location);
frame_status_clear(frame->frame, FRAME_STATUS_RESIZE);
}
@@ -2724,7 +2699,6 @@ input_remove_keyboard_focus(struct input *input)
if (!window)
return;
- window->focus_count--;
if (window->keyboard_focus_handler)
(*window->keyboard_focus_handler)(window, NULL,
window->user_data);
@@ -2823,7 +2797,6 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
input->keyboard_focus = wl_surface_get_user_data(surface);
window = input->keyboard_focus;
- window->focus_count++;
if (window->keyboard_focus_handler)
(*window->keyboard_focus_handler)(window,
input, window->user_data);
@@ -3563,10 +3536,10 @@ input_receive_selection_data_to_fd(struct input *input,
void
window_move(struct window *window, struct input *input, uint32_t serial)
{
- if (!window->shell_surface)
+ if (!window->xdg_surface)
return;
- wl_shell_surface_move(window->shell_surface, input->seat, serial);
+ xdg_surface_move(window->xdg_surface, input->seat, serial);
}
static void
@@ -3746,51 +3719,80 @@ widget_schedule_resize(struct widget *widget, int32_t width, int32_t height)
}
static void
-handle_ping(void *data, struct wl_shell_surface *shell_surface,
- uint32_t serial)
+handle_surface_ping(void *data, struct xdg_surface *xdg_surface, uint32_t serial)
{
- wl_shell_surface_pong(shell_surface, serial);
+ xdg_surface_pong(xdg_surface, serial);
}
static void
-handle_configure(void *data, struct wl_shell_surface *shell_surface,
- uint32_t edges, int32_t width, int32_t height)
+handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
+ uint32_t edges, int32_t width, int32_t height,
+ uint32_t maximized, uint32_t fullscreen)
{
struct window *window = data;
window->resize_edges = edges;
+
+ window->maximized = maximized;
+ window->fullscreen = fullscreen;
+
window_schedule_resize(window, width, height);
}
static void
-menu_destroy(struct menu *menu)
+handle_surface_focused_set(void *data, struct xdg_surface *xdg_surface)
{
- widget_destroy(menu->widget);
- window_destroy(menu->window);
- frame_destroy(menu->frame);
- free(menu);
+ struct window *window = data;
+ window->focused = 1;
}
static void
-handle_popup_done(void *data, struct wl_shell_surface *shell_surface)
+handle_surface_focused_unset(void *data, struct xdg_surface *xdg_surface)
{
struct window *window = data;
- struct menu *menu = window->main_surface->widget->user_data;
+ window->focused = 0;
+}
- /* FIXME: Need more context in this event, at least the input
- * device. Or just use wl_callback. And this really needs to
- * be a window vfunc that the menu can set. And we need the
- * time. */
+static const struct xdg_surface_listener xdg_surface_listener = {
+ handle_surface_ping,
+ handle_surface_configure,
+ handle_surface_focused_set,
+ handle_surface_focused_unset,
+};
- input_ungrab(menu->input);
- menu_destroy(menu);
+static void
+window_flush(struct window *window)
+{
+ struct surface *surface;
+
+ if (!window->xdg_popup && !window->xdg_surface) {
+ window->xdg_surface = xdg_shell_get_xdg_surface(window->display->xdg_shell,
+ window->main_surface->surface);
+ fail_on_null(window->xdg_surface);
+
+ xdg_surface_set_user_data(window->xdg_surface, window);
+ xdg_surface_add_listener(window->xdg_surface,
+ &xdg_surface_listener, window);
+ }
+
+ wl_list_for_each(surface, &window->subsurface_list, link) {
+ if (surface == window->main_surface)
+ continue;
+
+ surface_flush(surface);
+ }
+
+ surface_flush(window->main_surface);
}
-static const struct wl_shell_surface_listener shell_surface_listener = {
- handle_ping,
- handle_configure,
- handle_popup_done
-};
+static void
+menu_destroy(struct menu *menu)
+{
+ widget_destroy(menu->widget);
+ window_destroy(menu->window);
+ frame_destroy(menu->frame);
+ free(menu);
+}
void
window_get_allocation(struct window *window,
@@ -3895,8 +3897,6 @@ idle_redraw(struct task *task, uint32_t events)
static void
window_schedule_redraw_task(struct window *window)
{
- if (window->configure_requests)
- return;
if (!window->redraw_task_scheduled) {
window->redraw_task.run = idle_redraw;
display_defer(window->display, &window->redraw_task);
@@ -3923,69 +3923,16 @@ window_is_fullscreen(struct window *window)
return window->fullscreen;
}
-static void
-configure_request_completed(void *data, struct wl_callback *callback, uint32_t time)
-{
- struct window *window = data;
-
- wl_callback_destroy(callback);
- window->configure_requests--;
-
- if (!window->configure_requests)
- window_schedule_redraw(window);
-}
-
-static struct wl_callback_listener configure_request_listener = {
- configure_request_completed,
-};
-
-static void
-window_defer_redraw_until_configure(struct window* window)
-{
- struct wl_callback *callback;
-
- if (window->redraw_task_scheduled) {
- wl_list_remove(&window->redraw_task.link);
- window->redraw_task_scheduled = 0;
- }
-
- callback = wl_display_sync(window->display->display);
- wl_callback_add_listener(callback, &configure_request_listener, window);
- window->configure_requests++;
-}
-
-static void
-window_sync_type(struct window *window)
-{
- if (window->fullscreen) {
- window->saved_allocation = window->main_surface->allocation;
- wl_shell_surface_set_fullscreen(window->shell_surface,
- WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
- 0, NULL);
- } else if (window->maximized) {
- window->saved_allocation = window->main_surface->allocation;
- wl_shell_surface_set_maximized(window->shell_surface, NULL);
- } else {
- wl_shell_surface_set_toplevel(window->shell_surface);
- window_schedule_resize(window,
- window->saved_allocation.width,
- window->saved_allocation.height);
- }
-
- window_defer_redraw_until_configure(window);
-}
-
void
window_set_fullscreen(struct window *window, int fullscreen)
{
- if (!window->display->shell)
+ if (!window->xdg_surface)
return;
- if (window->fullscreen == fullscreen)
- return;
-
- window->fullscreen = fullscreen;
- window_sync_type(window);
+ if (fullscreen)
+ xdg_surface_set_fullscreen(window->xdg_surface);
+ else
+ xdg_surface_unset_fullscreen(window->xdg_surface);
}
int
@@ -3997,15 +3944,13 @@ window_is_maximized(struct window *window)
void
window_set_maximized(struct window *window, int maximized)
{
- if (!window->display->shell)
+ if (!window->xdg_surface)
return;
- if (window->maximized == maximized)
- return;
-
- window->maximized = maximized;
- if (!window->fullscreen)
- window_sync_type(window);
+ if (maximized)
+ xdg_surface_set_maximized(window->xdg_surface);
+ else
+ xdg_surface_unset_maximized(window->xdg_surface);
}
void
@@ -4076,8 +4021,8 @@ window_set_title(struct window *window, const char *title)
frame_set_title(window->frame->frame, title);
widget_schedule_redraw(window->frame->widget);
}
- if (window->shell_surface)
- wl_shell_surface_set_title(window->shell_surface, title);
+ if (window->xdg_surface)
+ xdg_surface_set_title(window->xdg_surface, title);
}
const char *
@@ -4190,7 +4135,7 @@ surface_create(struct window *window)
}
static struct window *
-window_create_internal(struct display *display, int type)
+window_create_internal(struct display *display, int custom)
{
struct window *window;
struct surface *surface;
@@ -4202,15 +4147,9 @@ window_create_internal(struct display *display, int type)
surface = surface_create(window);
window->main_surface = surface;
- if (type != TYPE_CUSTOM && display->shell) {
- window->shell_surface =
- wl_shell_get_shell_surface(display->shell,
- surface->surface);
- fail_on_null(window->shell_surface);
- }
+ fail_on_null(display->xdg_shell);
- window->type = type;
- window->configure_requests = 0;
+ window->custom = custom;
window->preferred_format = WINDOW_PREFERRED_FORMAT_NONE;
if (display->argb_device)
@@ -4226,12 +4165,6 @@ window_create_internal(struct display *display, int type)
wl_list_insert(display->window_list.prev, &window->link);
wl_list_init(&window->redraw_task.link);
- if (window->shell_surface) {
- wl_shell_surface_set_user_data(window->shell_surface, window);
- wl_shell_surface_add_listener(window->shell_surface,
- &shell_surface_listener, window);
- }
-
wl_list_init (&window->window_output_list);
return window;
@@ -4240,13 +4173,13 @@ window_create_internal(struct display *display, int type)
struct window *
window_create(struct display *display)
{
- return window_create_internal(display, TYPE_NONE);
+ return window_create_internal(display, 0);
}
struct window *
window_create_custom(struct display *display)
{
- return window_create_internal(display, TYPE_CUSTOM);
+ return window_create_internal(display, 1);
}
static void
@@ -4359,6 +4292,27 @@ menu_redraw_handler(struct widget *widget, void *data)
cairo_destroy(cr);
}
+static void
+handle_popup_ping(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
+{
+ xdg_popup_pong(xdg_popup, serial);
+}
+
+static void
+handle_popup_popup_done(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
+{
+ struct window *window = data;
+ struct menu *menu = window->main_surface->widget->user_data;
+
+ input_ungrab(menu->input);
+ menu_destroy(menu);
+}
+
+static const struct xdg_popup_listener xdg_popup_listener = {
+ handle_popup_ping,
+ handle_popup_popup_done,
+};
+
void
window_show_menu(struct display *display,
struct input *input, uint32_t time, struct window *parent,
@@ -4373,7 +4327,7 @@ window_show_menu(struct display *display,
if (!menu)
return;
- window = window_create_internal(parent->display, TYPE_MENU);
+ window = window_create_internal(parent->display, 0);
if (!window) {
free(menu);
return;
@@ -4393,7 +4347,6 @@ window_show_menu(struct display *display,
menu->time = time;
menu->func = func;
menu->input = input;
- window->type = TYPE_MENU;
window->x = x;
window->y = y;
@@ -4412,10 +4365,20 @@ window_show_menu(struct display *display,
frame_height(menu->frame));
frame_interior(menu->frame, &ix, &iy, NULL, NULL);
- wl_shell_surface_set_popup(window->shell_surface, input->seat,
- display_get_serial(window->display),
- parent->main_surface->surface,
- window->x - ix, window->y - iy, 0);
+
+ window->xdg_popup = xdg_shell_get_xdg_popup(display->xdg_shell,
+ window->main_surface->surface,
+ parent->main_surface->surface,
+ input->seat,
+ display_get_serial(window->display),
+ window->x - ix,
+ window->y - iy,
+ 0);
+ fail_on_null(window->xdg_popup);
+
+ xdg_popup_set_user_data(window->xdg_popup, window);
+ xdg_popup_add_listener(window->xdg_popup,
+ &xdg_popup_listener, window);
}
void
@@ -4790,9 +4753,6 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
} else if (strcmp(interface, "wl_seat") == 0) {
d->seat_version = version;
display_add_input(d, id);
- } else if (strcmp(interface, "wl_shell") == 0) {
- d->shell = wl_registry_bind(registry,
- id, &wl_shell_interface, 1);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
wl_shm_add_listener(d->shm, &shm_listener, d);
@@ -4800,6 +4760,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->data_device_manager =
wl_registry_bind(registry, id,
&wl_data_device_manager_interface, 1);
+ } else if (strcmp(interface, "xdg_shell") == 0) {
+ d->xdg_shell = wl_registry_bind(registry, id,
+ &xdg_shell_interface, 1);
+ xdg_shell_use_unstable_version(d->xdg_shell, XDG_SHELL_VERSION_CURRENT);
} else if (strcmp(interface, "text_cursor_position") == 0) {
d->text_cursor_position =
wl_registry_bind(registry, id,
@@ -5106,8 +5070,8 @@ display_destroy(struct display *display)
if (display->subcompositor)
wl_subcompositor_destroy(display->subcompositor);
- if (display->shell)
- wl_shell_destroy(display->shell);
+ if (display->xdg_shell)
+ xdg_shell_destroy(display->xdg_shell);
if (display->shm)
wl_shm_destroy(display->shm);
diff --git a/protocol/Makefile.am b/protocol/Makefile.am
index d09d8eb..c3a9591 100644
--- a/protocol/Makefile.am
+++ b/protocol/Makefile.am
@@ -8,7 +8,8 @@ protocol_sources = \
workspaces.xml \
subsurface.xml \
text-cursor-position.xml \
- wayland-test.xml
+ wayland-test.xml \
+ xdg-shell.xml
if HAVE_XMLLINT
.PHONY: validate
diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
new file mode 100644
index 0000000..fbd4f6d
--- /dev/null
+++ b/protocol/xdg-shell.xml
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_surface">
+
+ <copyright>
+ Copyright © 2008-2013 Kristian Høgsberg
+ Copyright © 2013 Rafael Antognolli
+ Copyright © 2013 Jasper St. Pierre
+ Copyright © 2010-2013 Intel Corporation
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <interface name="xdg_shell" version="1">
+ <description summary="create desktop-style surfaces">
+ This interface is implemented by servers that provide
+ desktop-style user interfaces.
+
+ It allows clients to associate a xdg_surface with
+ a basic surface.
+ </description>
+
+ <enum name="version">
+ <description summary="latest protocol version">
+ Use this enum to check the protocol version, and it will be updated
+ automatically.
+ </description>
+ <entry name="current" value="1" summary="Always the latest version"/>
+ </enum>
+
+
+ <request name="use_unstable_version">
+ <description summary="enable use of this unstable version">
+ Use this request in order to enable use of this interface.
+
+ Understand and agree that one is using an unstable interface,
+ that will likely change in the future, breaking the API.
+ </description>
+ <arg name="version" type="int"/>
+ </request>
+
+ <request name="get_xdg_surface">
+ <description summary="create a shell surface from a surface">
+ Create a shell surface for an existing surface.
+
+ Only one shell or popup surface can be associated with a given
+ surface.
+ </description>
+ <arg name="id" type="new_id" interface="xdg_surface"/>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+
+ <request name="get_xdg_popup">
+ <description summary="create a shell surface from a surface">
+ Create a popup surface for an existing surface.
+
+ Only one shell or popup surface can be associated with a given
+ surface.
+ </description>
+ <arg name="id" type="new_id" interface="xdg_popup"/>
+ <arg name="surface" type="object" interface="wl_surface"/>
+ <arg name="parent" type="object" interface="wl_surface"/>
+ <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat whose pointer is used"/>
+ <arg name="serial" type="uint" summary="serial of the implicit grab on the pointer"/>
+ <arg name="x" type="int"/>
+ <arg name="y" type="int"/>
+ <arg name="flags" type="uint"/>
+ </request>
+ </interface>
+
+ <interface name="xdg_surface" version="1">
+
+ <description summary="desktop-style metadata interface">
+ An interface that may be implemented by a wl_surface, for
+ implementations that provide a desktop-style user interface.
+
+ It provides requests to treat surfaces like windows, allowing to set
+ properties like maximized, fullscreen, minimized, and to move and resize
+ them, and associate metadata like title and app id.
+
+ On the server side the object is automatically destroyed when
+ the related wl_surface is destroyed. On client side,
+ xdg_surface.destroy() must be called before destroying
+ the wl_surface object.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="remove xdg_surface interface">
+ The xdg_surface interface is removed from the wl_surface object
+ that was turned into a xdg_surface with
+ xdg_shell.get_xdg_surface request. The xdg_surface properties,
+ like maximized and fullscreen, are lost. The wl_surface loses
+ its role as a xdg_surface. The wl_surface is unmapped.
+ </description>
+ </request>
+
+ <request name="set_transient_for">
+ <description summary="surface is a child of another surface">
+ Setting a surface as transient of another means that it is child
+ of another surface.
+
+ Child surfaces are stacked above their parents, and will be
+ unmapped if the parent is unmapped too. They should not appear
+ on task bars and alt+tab.
+ </description>
+ <arg name="parent" type="object" interface="wl_surface"/>
+ </request>
+
+ <request name="set_title">
+ <description summary="set surface title">
+ Set a short title for the surface.
+
+ This string may be used to identify the surface in a task bar,
+ window list, or other user interface elements provided by the
+ compositor.
+
+ The string must be encoded in UTF-8.
+ </description>
+ <arg name="title" type="string"/>
+ </request>
+
+ <request name="set_app_id">
+ <description summary="set surface class">
+ Set an id for the surface.
+
+ The app id identifies the general class of applications to which
+ the surface belongs.
+
+ It should be the ID that appears in the new desktop entry
+ specification, the interface name.
+ </description>
+ <arg name="app_id" type="string"/>
+ </request>
+
+ <request name="pong">
+ <description summary="respond to a ping event">
+ A client must respond to a ping event with a pong request or
+ the client may be deemed unresponsive.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the ping event"/>
+ </request>
+
+ <event name="ping">
+ <description summary="ping client">
+ Ping a client to check if it is receiving events and sending
+ requests. A client is expected to reply with a pong request.
+ </description>
+ <arg name="serial" type="uint"/>
+ </event>
+
+ <request name="move">
+ <description summary="start an interactive move">
+ Start a pointer-driven move of the surface.
+
+ This request must be used in response to a button press event.
+ The server may ignore move requests depending on the state of
+ the surface (e.g. fullscreen or maximized).
+ </description>
+ <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat whose pointer is used"/>
+ <arg name="serial" type="uint" summary="serial of the implicit grab on the pointer"/>
+ </request>
+
+ <enum name="resize_edge">
+ <description summary="edge values for resizing">
+ These values are used to indicate which edge of a surface
+ is being dragged in a resize operation. The server may
+ use this information to adapt its behavior, e.g. choose
+ an appropriate cursor image.
+ </description>
+ <entry name="none" value="0"/>
+ <entry name="top" value="1"/>
+ <entry name="bottom" value="2"/>
+ <entry name="left" value="4"/>
+ <entry name="top_left" value="5"/>
+ <entry name="bottom_left" value="6"/>
+ <entry name="right" value="8"/>
+ <entry name="top_right" value="9"/>
+ <entry name="bottom_right" value="10"/>
+ </enum>
+
+ <request name="resize">
+ <description summary="start an interactive resize">
+ Start a pointer-driven resizing of the surface.
+
+ This request must be used in response to a button press event.
+ The server may ignore resize requests depending on the state of
+ the surface (e.g. fullscreen or maximized).
+ </description>
+ <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat whose pointer is used"/>
+ <arg name="serial" type="uint" summary="serial of the implicit grab on the pointer"/>
+ <arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
+ </request>
+
+ <event name="configure">
+ <description summary="suggest resize">
+ The configure event asks the client to resize its surface.
+
+ The size is a hint, in the sense that the client is free to
+ ignore it if it doesn't resize, pick a smaller size (to
+ satisfy aspect ratio or resize in steps of NxM pixels).
+
+ The edges parameter provides a hint about how the surface
+ was resized. The client may use this information to decide
+ how to adjust its content to the new size (e.g. a scrolling
+ area might adjust its content position to leave the viewable
+ content unmoved). Valid edge values are from resize_edge enum.
+
+ The maximized parameter informs if the surface is in a maximized
+ state. Same for the fullscreen parameter.
+
+ The client is free to dismiss all but the last configure
+ event it received.
+
+ The width and height arguments specify the size of the window
+ in surface local coordinates.
+ </description>
+
+ <arg name="edges" type="uint"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ <arg name="maximized" type="uint"/>
+ <arg name="fullscreen" type="uint"/>
+ </event>
+
+ <request name="set_output">
+ <description summary="set the default output used by this surface">
+ Set the default output used by this surface when it is first mapped.
+
+ If this value is NULL (default), it's up to the compositor to choose
+ which display will be used to map this surface.
+
+ When fullscreen or maximized state are set on this surface, and it
+ wasn't mapped yet, the output set with this method will be used.
+ Otherwise, the output where the surface is currently mapped will be
+ used.
+ </description>
+ <arg name="output" type="object" interface="wl_output" allow-null="true"/>
+ </request>
+
+ <request name="set_fullscreen">
+ <description summary="set the surface state as fullscreen">
+ Set the surface as fullscreen.
+
+ The compositor must reply to this request with a configure event
+ with the dimensions for the output on which the surface will be
+ made fullscreen.
+
+ Once the fullscreen state is set, a "fullscreen_set" event will
+ be sent to the client.
+
+ Setting one state won't unset another state. Use
+ xdg_surface.unset_fullscreen for unsetting it.
+ </description>
+ </request>
+
+ <request name="unset_fullscreen">
+ <description summary="unset the surface state as fullscreen">
+ Unset the surface fullscreen state.
+ </description>
+ </request>
+
+ <request name="set_maximized">
+ <description summary="set the surface state as maximized">
+ Set the surface as maximized.
+
+ The compositor must reply to this request with a configure event
+ with the dimensions for the output on which the surface will be
+ made maximized.
+
+ Once the maximized state is set, a "maximized_set" event will be
+ sent to the client.
+
+ Setting one state won't unset another state. Use
+ xdg_surface.unset_maximized for unsetting it.
+ </description>
+ </request>
+
+ <request name="unset_maximized">
+ <description summary="unset the surface state as maximized">
+ Unset the surface maximized state.
+ </description>
+ </request>
+
+ <request name="set_minimized">
+ <description summary="set the surface state as minimized">
+ Set the surface minimized state.
+
+ Setting one state won't unset another state.
+ </description>
+ </request>
+
+ <event name="focused_set">
+ <description summary="surface was focused">
+ The focused_set event is sent when this surface has been
+ activated. Window decorations should be updated accordingly.
+ </description>
+ </event>
+
+ <event name="focused_unset">
+ <description summary="surface was unfocused">
+ The focused_unset event is sent when this surface has been
+ deactivated, because another surface has been activated. Window
+ decorations should be updated accordingly.
+ </description>
+ </event>
+ </interface>
+
+ <interface name="xdg_popup" version="1">
+ <description summary="desktop-style metadata interface">
+ An interface that may be implemented by a wl_surface, for
+ implementations that provide a desktop-style popups/menus. A popup
+ surface is a transient surface with an added pointer grab.
+
+ An existing implicit grab will be changed to owner-events mode,
+ and the popup grab will continue after the implicit grab ends
+ (i.e. releasing the mouse button does not cause the popup to be
+ unmapped).
+
+ The popup grab continues until the window is destroyed or a mouse
+ button is pressed in any other clients window. A click in any of
+ the clients surfaces is reported as normal, however, clicks in
+ other clients surfaces will be discarded and trigger the callback.
+
+ The x and y arguments specify the locations of the upper left
+ corner of the surface relative to the upper left corner of the
+ parent surface, in surface local coordinates.
+
+ xdg_popup surfaces are always transient for another surface.
+ </description>
+
+ <request name="destroy" type="destructor">
+ <description summary="remove xdg_surface interface">
+ The xdg_surface interface is removed from the wl_surface object
+ that was turned into a xdg_surface with
+ xdg_shell.get_xdg_surface request. The xdg_surface properties,
+ like maximized and fullscreen, are lost. The wl_surface loses
+ its role as a xdg_surface. The wl_surface is unmapped.
+ </description>
+ </request>
+
+ <request name="pong">
+ <description summary="respond to a ping event">
+ A client must respond to a ping event with a pong request or
+ the client may be deemed unresponsive.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the ping event"/>
+ </request>
+
+ <event name="ping">
+ <description summary="ping client">
+ Ping a client to check if it is receiving events and sending
+ requests. A client is expected to reply with a pong request.
+ </description>
+ <arg name="serial" type="uint"/>
+ </event>
+
+ <event name="popup_done">
+ <description summary="popup interaction is done">
+ The popup_done event is sent out when a popup grab is broken,
+ that is, when the users clicks a surface that doesn't belong
+ to the client owning the popup surface.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the implicit grab on the pointer"/>
+ </event>
+
+ </interface>
+</protocol>
--
1.8.4.2
More information about the wayland-devel
mailing list