diff --git a/app/egl_wayland.go b/app/egl_wayland.go index 05a5fe79..2f5aab4a 100644 --- a/app/egl_wayland.go +++ b/app/egl_wayland.go @@ -1,7 +1,8 @@ // SPDX-License-Identifier: Unlicense OR MIT -//go:build (linux && !android && !nowayland) || freebsd -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland package app diff --git a/app/egl_x11.go b/app/egl_x11.go index 763bd965..b25886d7 100644 --- a/app/egl_x11.go +++ b/app/egl_x11.go @@ -1,7 +1,8 @@ // SPDX-License-Identifier: Unlicense OR MIT -//go:build (linux && !android && !nox11) || freebsd || openbsd -// +build linux,!android,!nox11 freebsd openbsd +//go:build ((linux && !android) || freebsd || openbsd) && !nox11 +// +build linux,!android freebsd openbsd +// +build !nox11 package app diff --git a/app/os_wayland.c b/app/os_wayland.c index 5c1c0755..b137e1f9 100644 --- a/app/os_wayland.c +++ b/app/os_wayland.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: Unlicense OR MIT -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland #include #include "wayland_xdg_shell.h" diff --git a/app/os_wayland.go b/app/os_wayland.go index e3c95829..0f857ea1 100644 --- a/app/os_wayland.go +++ b/app/os_wayland.go @@ -1,7 +1,8 @@ // SPDX-License-Identifier: Unlicense OR MIT -//go:build (linux && !android && !nowayland) || freebsd -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland package app @@ -42,9 +43,9 @@ import ( //go:generate wayland-scanner client-header /usr/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wayland_xdg_decoration.h //go:generate wayland-scanner private-code /usr/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wayland_xdg_decoration.c -//go:generate sed -i "1s;^;// +build linux,!android,!nowayland freebsd\\n\\n;" wayland_xdg_shell.c -//go:generate sed -i "1s;^;// +build linux,!android,!nowayland freebsd\\n\\n;" wayland_xdg_decoration.c -//go:generate sed -i "1s;^;// +build linux,!android,!nowayland freebsd\\n\\n;" wayland_text_input.c +//go:generate sed -i "1s;^;//go:build ((linux \\&\\& !android) || freebsd) \\&\\& !nowayland\\n// +build linux,!android freebsd\\n// +build !nowayland\\n\\n;" wayland_xdg_shell.c +//go:generate sed -i "1s;^;//go:build ((linux \\&\\& !android) || freebsd) \\&\\& !nowayland\\n// +build linux,!android freebsd\\n// +build !nowayland\\n\\n;" wayland_xdg_decoration.c +//go:generate sed -i "1s;^;//go:build ((linux \\&\\& !android) || freebsd) \\&\\& !nowayland\\n// +build linux,!android freebsd\\n// +build !nowayland\\n\\n;" wayland_text_input.c /* #cgo linux pkg-config: wayland-client wayland-cursor diff --git a/app/os_x11.go b/app/os_x11.go index f3716010..0e55b796 100644 --- a/app/os_x11.go +++ b/app/os_x11.go @@ -1,7 +1,8 @@ // SPDX-License-Identifier: Unlicense OR MIT -//go:build (linux && !android && !nox11) || freebsd || openbsd -// +build linux,!android,!nox11 freebsd openbsd +//go:build ((linux && !android) || freebsd || openbsd) && !nox11 +// +build linux,!android freebsd openbsd +// +build !nox11 package app diff --git a/app/wayland_text_input.c b/app/wayland_text_input.c index a69af09f..65de0bb0 100644 --- a/app/wayland_text_input.c +++ b/app/wayland_text_input.c @@ -1,6 +1,8 @@ -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ /* * Copyright © 2012, 2013 Intel Corporation @@ -48,7 +50,7 @@ extern const struct wl_interface wl_seat_interface; extern const struct wl_interface wl_surface_interface; extern const struct wl_interface zwp_text_input_v3_interface; -static const struct wl_interface *types[] = { +static const struct wl_interface *text_input_unstable_v3_types[] = { NULL, NULL, NULL, @@ -60,23 +62,23 @@ static const struct wl_interface *types[] = { }; static const struct wl_message zwp_text_input_v3_requests[] = { - { "destroy", "", types + 0 }, - { "enable", "", types + 0 }, - { "disable", "", types + 0 }, - { "set_surrounding_text", "sii", types + 0 }, - { "set_text_change_cause", "u", types + 0 }, - { "set_content_type", "uu", types + 0 }, - { "set_cursor_rectangle", "iiii", types + 0 }, - { "commit", "", types + 0 }, + { "destroy", "", text_input_unstable_v3_types + 0 }, + { "enable", "", text_input_unstable_v3_types + 0 }, + { "disable", "", text_input_unstable_v3_types + 0 }, + { "set_surrounding_text", "sii", text_input_unstable_v3_types + 0 }, + { "set_text_change_cause", "u", text_input_unstable_v3_types + 0 }, + { "set_content_type", "uu", text_input_unstable_v3_types + 0 }, + { "set_cursor_rectangle", "iiii", text_input_unstable_v3_types + 0 }, + { "commit", "", text_input_unstable_v3_types + 0 }, }; static const struct wl_message zwp_text_input_v3_events[] = { - { "enter", "o", types + 4 }, - { "leave", "o", types + 5 }, - { "preedit_string", "?sii", types + 0 }, - { "commit_string", "?s", types + 0 }, - { "delete_surrounding_text", "uu", types + 0 }, - { "done", "u", types + 0 }, + { "enter", "o", text_input_unstable_v3_types + 4 }, + { "leave", "o", text_input_unstable_v3_types + 5 }, + { "preedit_string", "?sii", text_input_unstable_v3_types + 0 }, + { "commit_string", "?s", text_input_unstable_v3_types + 0 }, + { "delete_surrounding_text", "uu", text_input_unstable_v3_types + 0 }, + { "done", "u", text_input_unstable_v3_types + 0 }, }; WL_PRIVATE const struct wl_interface zwp_text_input_v3_interface = { @@ -86,8 +88,8 @@ WL_PRIVATE const struct wl_interface zwp_text_input_v3_interface = { }; static const struct wl_message zwp_text_input_manager_v3_requests[] = { - { "destroy", "", types + 0 }, - { "get_text_input", "no", types + 6 }, + { "destroy", "", text_input_unstable_v3_types + 0 }, + { "get_text_input", "no", text_input_unstable_v3_types + 6 }, }; WL_PRIVATE const struct wl_interface zwp_text_input_manager_v3_interface = { diff --git a/app/wayland_text_input.h b/app/wayland_text_input.h index 8a6f8ddc..882da437 100644 --- a/app/wayland_text_input.h +++ b/app/wayland_text_input.h @@ -1,4 +1,4 @@ -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ #ifndef TEXT_INPUT_UNSTABLE_V3_CLIENT_PROTOCOL_H #define TEXT_INPUT_UNSTABLE_V3_CLIENT_PROTOCOL_H @@ -71,6 +71,8 @@ struct wl_surface; struct zwp_text_input_manager_v3; struct zwp_text_input_v3; +#ifndef ZWP_TEXT_INPUT_V3_INTERFACE +#define ZWP_TEXT_INPUT_V3_INTERFACE /** * @page page_iface_zwp_text_input_v3 zwp_text_input_v3 * @section page_iface_zwp_text_input_v3_desc Description @@ -135,6 +137,9 @@ struct zwp_text_input_v3; * needs to be resent by the client. */ extern const struct wl_interface zwp_text_input_v3_interface; +#endif +#ifndef ZWP_TEXT_INPUT_MANAGER_V3_INTERFACE +#define ZWP_TEXT_INPUT_MANAGER_V3_INTERFACE /** * @page page_iface_zwp_text_input_manager_v3 zwp_text_input_manager_v3 * @section page_iface_zwp_text_input_manager_v3_desc Description @@ -149,6 +154,7 @@ extern const struct wl_interface zwp_text_input_v3_interface; * A factory for text-input objects. This object is a global singleton. */ extern const struct wl_interface zwp_text_input_manager_v3_interface; +#endif #ifndef ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_ENUM #define ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_ENUM @@ -310,6 +316,9 @@ struct zwp_text_input_v3_listener { * Notification that this seat's text-input focus is on a certain * surface. * + * If client has created multiple text input objects, compositor + * must send this event to all of them. + * * When the seat has the keyboard capability the text-input focus * follows the keyboard focus. This event sets the current surface * for the text-input object. @@ -325,7 +334,9 @@ struct zwp_text_input_v3_listener { * previously set. * * The leave notification clears the current surface. It is sent - * before the enter notification for the new focus. + * before the enter notification for the new focus. After leave + * event, compositor must ignore requests from any text input + * instances until next enter event. * * When the seat has the keyboard capability the text-input focus * follows the keyboard focus. @@ -559,6 +570,12 @@ zwp_text_input_v3_destroy(struct zwp_text_input_v3 *zwp_text_input_v3) * zwp_text_input_v3.disable when there is no longer any input focus on * the current surface. * + * Clients must not enable more than one text input on the single seat + * and should disable the current text input before enabling the new one. + * At most one instance of text input may be in enabled state per instance, + * Requests to enable the another text input when some text input is active + * must be ignored by compositor. + * * This request resets all state associated with previous enable, disable, * set_surrounding_text, set_text_change_cause, set_content_type, and * set_cursor_rectangle requests, as well as the state associated with diff --git a/app/wayland_xdg_decoration.c b/app/wayland_xdg_decoration.c index fa13d7cc..ee94c608 100644 --- a/app/wayland_xdg_decoration.c +++ b/app/wayland_xdg_decoration.c @@ -1,6 +1,8 @@ -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ /* * Copyright © 2018 Simon Ser @@ -42,15 +44,15 @@ extern const struct wl_interface xdg_toplevel_interface; extern const struct wl_interface zxdg_toplevel_decoration_v1_interface; -static const struct wl_interface *types[] = { +static const struct wl_interface *xdg_decoration_unstable_v1_types[] = { NULL, &zxdg_toplevel_decoration_v1_interface, &xdg_toplevel_interface, }; static const struct wl_message zxdg_decoration_manager_v1_requests[] = { - { "destroy", "", types + 0 }, - { "get_toplevel_decoration", "no", types + 1 }, + { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, + { "get_toplevel_decoration", "no", xdg_decoration_unstable_v1_types + 1 }, }; WL_PRIVATE const struct wl_interface zxdg_decoration_manager_v1_interface = { @@ -60,13 +62,13 @@ WL_PRIVATE const struct wl_interface zxdg_decoration_manager_v1_interface = { }; static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = { - { "destroy", "", types + 0 }, - { "set_mode", "u", types + 0 }, - { "unset_mode", "", types + 0 }, + { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, + { "set_mode", "u", xdg_decoration_unstable_v1_types + 0 }, + { "unset_mode", "", xdg_decoration_unstable_v1_types + 0 }, }; static const struct wl_message zxdg_toplevel_decoration_v1_events[] = { - { "configure", "u", types + 0 }, + { "configure", "u", xdg_decoration_unstable_v1_types + 0 }, }; WL_PRIVATE const struct wl_interface zxdg_toplevel_decoration_v1_interface = { diff --git a/app/wayland_xdg_decoration.h b/app/wayland_xdg_decoration.h index 044ea2ec..004d342a 100644 --- a/app/wayland_xdg_decoration.h +++ b/app/wayland_xdg_decoration.h @@ -1,4 +1,4 @@ -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ #ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H #define XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H @@ -45,6 +45,8 @@ struct xdg_toplevel; struct zxdg_decoration_manager_v1; struct zxdg_toplevel_decoration_v1; +#ifndef ZXDG_DECORATION_MANAGER_V1_INTERFACE +#define ZXDG_DECORATION_MANAGER_V1_INTERFACE /** * @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1 * @section page_iface_zxdg_decoration_manager_v1_desc Description @@ -101,6 +103,9 @@ struct zxdg_toplevel_decoration_v1; * interface version number is reset. */ extern const struct wl_interface zxdg_decoration_manager_v1_interface; +#endif +#ifndef ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE +#define ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE /** * @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1 * @section page_iface_zxdg_toplevel_decoration_v1_desc Description @@ -125,6 +130,7 @@ extern const struct wl_interface zxdg_decoration_manager_v1_interface; * xdg_toplevel. */ extern const struct wl_interface zxdg_toplevel_decoration_v1_interface; +#endif #define ZXDG_DECORATION_MANAGER_V1_DESTROY 0 #define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1 @@ -332,7 +338,7 @@ zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_top * that the client prefers the provided decoration mode. * * After requesting a decoration mode, the compositor will respond by - * emitting a xdg_surface.configure event. The client should then update + * emitting an xdg_surface.configure event. The client should then update * its content, drawing it without decorations if the received mode is * server-side decorations. The client must also acknowledge the configure * when committing the new content (see xdg_surface.ack_configure). @@ -341,7 +347,7 @@ zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_top * different mode instead. * * Clients whose decoration mode depend on the xdg_toplevel state may send - * a set_mode request in response to a xdg_surface.configure event and wait + * a set_mode request in response to an xdg_surface.configure event and wait * for the next xdg_surface.configure event to prevent unwanted state. * Such clients are responsible for preventing configure loops and must * make sure not to send multiple successive set_mode requests with the diff --git a/app/wayland_xdg_shell.c b/app/wayland_xdg_shell.c index 19478471..54fe5cf3 100644 --- a/app/wayland_xdg_shell.c +++ b/app/wayland_xdg_shell.c @@ -1,6 +1,8 @@ -// +build linux,!android,!nowayland freebsd +//go:build ((linux && !android) || freebsd) && !nowayland +// +build linux,!android freebsd +// +build !nowayland -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ /* * Copyright © 2008-2013 Kristian Høgsberg @@ -52,7 +54,7 @@ extern const struct wl_interface xdg_positioner_interface; extern const struct wl_interface xdg_surface_interface; extern const struct wl_interface xdg_toplevel_interface; -static const struct wl_interface *types[] = { +static const struct wl_interface *xdg_shell_types[] = { NULL, NULL, NULL, @@ -77,100 +79,107 @@ static const struct wl_interface *types[] = { &wl_output_interface, &wl_seat_interface, NULL, + &xdg_positioner_interface, + NULL, }; static const struct wl_message xdg_wm_base_requests[] = { - { "destroy", "", types + 0 }, - { "create_positioner", "n", types + 4 }, - { "get_xdg_surface", "no", types + 5 }, - { "pong", "u", types + 0 }, + { "destroy", "", xdg_shell_types + 0 }, + { "create_positioner", "n", xdg_shell_types + 4 }, + { "get_xdg_surface", "no", xdg_shell_types + 5 }, + { "pong", "u", xdg_shell_types + 0 }, }; static const struct wl_message xdg_wm_base_events[] = { - { "ping", "u", types + 0 }, + { "ping", "u", xdg_shell_types + 0 }, }; WL_PRIVATE const struct wl_interface xdg_wm_base_interface = { - "xdg_wm_base", 2, + "xdg_wm_base", 3, 4, xdg_wm_base_requests, 1, xdg_wm_base_events, }; static const struct wl_message xdg_positioner_requests[] = { - { "destroy", "", types + 0 }, - { "set_size", "ii", types + 0 }, - { "set_anchor_rect", "iiii", types + 0 }, - { "set_anchor", "u", types + 0 }, - { "set_gravity", "u", types + 0 }, - { "set_constraint_adjustment", "u", types + 0 }, - { "set_offset", "ii", types + 0 }, + { "destroy", "", xdg_shell_types + 0 }, + { "set_size", "ii", xdg_shell_types + 0 }, + { "set_anchor_rect", "iiii", xdg_shell_types + 0 }, + { "set_anchor", "u", xdg_shell_types + 0 }, + { "set_gravity", "u", xdg_shell_types + 0 }, + { "set_constraint_adjustment", "u", xdg_shell_types + 0 }, + { "set_offset", "ii", xdg_shell_types + 0 }, + { "set_reactive", "3", xdg_shell_types + 0 }, + { "set_parent_size", "3ii", xdg_shell_types + 0 }, + { "set_parent_configure", "3u", xdg_shell_types + 0 }, }; WL_PRIVATE const struct wl_interface xdg_positioner_interface = { - "xdg_positioner", 2, - 7, xdg_positioner_requests, + "xdg_positioner", 3, + 10, xdg_positioner_requests, 0, NULL, }; static const struct wl_message xdg_surface_requests[] = { - { "destroy", "", types + 0 }, - { "get_toplevel", "n", types + 7 }, - { "get_popup", "n?oo", types + 8 }, - { "set_window_geometry", "iiii", types + 0 }, - { "ack_configure", "u", types + 0 }, + { "destroy", "", xdg_shell_types + 0 }, + { "get_toplevel", "n", xdg_shell_types + 7 }, + { "get_popup", "n?oo", xdg_shell_types + 8 }, + { "set_window_geometry", "iiii", xdg_shell_types + 0 }, + { "ack_configure", "u", xdg_shell_types + 0 }, }; static const struct wl_message xdg_surface_events[] = { - { "configure", "u", types + 0 }, + { "configure", "u", xdg_shell_types + 0 }, }; WL_PRIVATE const struct wl_interface xdg_surface_interface = { - "xdg_surface", 2, + "xdg_surface", 3, 5, xdg_surface_requests, 1, xdg_surface_events, }; static const struct wl_message xdg_toplevel_requests[] = { - { "destroy", "", types + 0 }, - { "set_parent", "?o", types + 11 }, - { "set_title", "s", types + 0 }, - { "set_app_id", "s", types + 0 }, - { "show_window_menu", "ouii", types + 12 }, - { "move", "ou", types + 16 }, - { "resize", "ouu", types + 18 }, - { "set_max_size", "ii", types + 0 }, - { "set_min_size", "ii", types + 0 }, - { "set_maximized", "", types + 0 }, - { "unset_maximized", "", types + 0 }, - { "set_fullscreen", "?o", types + 21 }, - { "unset_fullscreen", "", types + 0 }, - { "set_minimized", "", types + 0 }, + { "destroy", "", xdg_shell_types + 0 }, + { "set_parent", "?o", xdg_shell_types + 11 }, + { "set_title", "s", xdg_shell_types + 0 }, + { "set_app_id", "s", xdg_shell_types + 0 }, + { "show_window_menu", "ouii", xdg_shell_types + 12 }, + { "move", "ou", xdg_shell_types + 16 }, + { "resize", "ouu", xdg_shell_types + 18 }, + { "set_max_size", "ii", xdg_shell_types + 0 }, + { "set_min_size", "ii", xdg_shell_types + 0 }, + { "set_maximized", "", xdg_shell_types + 0 }, + { "unset_maximized", "", xdg_shell_types + 0 }, + { "set_fullscreen", "?o", xdg_shell_types + 21 }, + { "unset_fullscreen", "", xdg_shell_types + 0 }, + { "set_minimized", "", xdg_shell_types + 0 }, }; static const struct wl_message xdg_toplevel_events[] = { - { "configure", "iia", types + 0 }, - { "close", "", types + 0 }, + { "configure", "iia", xdg_shell_types + 0 }, + { "close", "", xdg_shell_types + 0 }, }; WL_PRIVATE const struct wl_interface xdg_toplevel_interface = { - "xdg_toplevel", 2, + "xdg_toplevel", 3, 14, xdg_toplevel_requests, 2, xdg_toplevel_events, }; static const struct wl_message xdg_popup_requests[] = { - { "destroy", "", types + 0 }, - { "grab", "ou", types + 22 }, + { "destroy", "", xdg_shell_types + 0 }, + { "grab", "ou", xdg_shell_types + 22 }, + { "reposition", "3ou", xdg_shell_types + 24 }, }; static const struct wl_message xdg_popup_events[] = { - { "configure", "iiii", types + 0 }, - { "popup_done", "", types + 0 }, + { "configure", "iiii", xdg_shell_types + 0 }, + { "popup_done", "", xdg_shell_types + 0 }, + { "repositioned", "3u", xdg_shell_types + 0 }, }; WL_PRIVATE const struct wl_interface xdg_popup_interface = { - "xdg_popup", 2, - 2, xdg_popup_requests, - 2, xdg_popup_events, + "xdg_popup", 3, + 3, xdg_popup_requests, + 3, xdg_popup_events, }; diff --git a/app/wayland_xdg_shell.h b/app/wayland_xdg_shell.h index 1f4bfb5d..1db8fd93 100644 --- a/app/wayland_xdg_shell.h +++ b/app/wayland_xdg_shell.h @@ -1,4 +1,4 @@ -/* Generated by wayland-scanner 1.17.0 */ +/* Generated by wayland-scanner 1.19.0 */ #ifndef XDG_SHELL_CLIENT_PROTOCOL_H #define XDG_SHELL_CLIENT_PROTOCOL_H @@ -58,6 +58,8 @@ struct xdg_surface; struct xdg_toplevel; struct xdg_wm_base; +#ifndef XDG_WM_BASE_INTERFACE +#define XDG_WM_BASE_INTERFACE /** * @page page_iface_xdg_wm_base xdg_wm_base * @section page_iface_xdg_wm_base_desc Description @@ -80,6 +82,9 @@ struct xdg_wm_base; * creating transient windows such as popup menus. */ extern const struct wl_interface xdg_wm_base_interface; +#endif +#ifndef XDG_POSITIONER_INTERFACE +#define XDG_POSITIONER_INTERFACE /** * @page page_iface_xdg_positioner xdg_positioner * @section page_iface_xdg_positioner_desc Description @@ -130,6 +135,9 @@ extern const struct wl_interface xdg_wm_base_interface; * positioning a surface raises an error. */ extern const struct wl_interface xdg_positioner_interface; +#endif +#ifndef XDG_SURFACE_INTERFACE +#define XDG_SURFACE_INTERFACE /** * @page page_iface_xdg_surface xdg_surface * @section page_iface_xdg_surface_desc Description @@ -159,6 +167,11 @@ extern const struct wl_interface xdg_positioner_interface; * manipulate a buffer prior to the first xdg_surface.configure call must * also be treated as errors. * + * After creating a role-specific object and setting it up, the client must + * perform an initial commit without any buffer attached. The compositor + * will reply with an xdg_surface.configure event. The client must + * acknowledge it and is then allowed to attach a buffer to map the surface. + * * Mapping an xdg_surface-based role surface is defined as making it * possible for the surface to be shown by the compositor. Note that * a mapped surface is not guaranteed to be visible once it is mapped. @@ -204,6 +217,11 @@ extern const struct wl_interface xdg_positioner_interface; * manipulate a buffer prior to the first xdg_surface.configure call must * also be treated as errors. * + * After creating a role-specific object and setting it up, the client must + * perform an initial commit without any buffer attached. The compositor + * will reply with an xdg_surface.configure event. The client must + * acknowledge it and is then allowed to attach a buffer to map the surface. + * * Mapping an xdg_surface-based role surface is defined as making it * possible for the surface to be shown by the compositor. Note that * a mapped surface is not guaranteed to be visible once it is mapped. @@ -220,6 +238,9 @@ extern const struct wl_interface xdg_positioner_interface; * has not been destroyed. */ extern const struct wl_interface xdg_surface_interface; +#endif +#ifndef XDG_TOPLEVEL_INTERFACE +#define XDG_TOPLEVEL_INTERFACE /** * @page page_iface_xdg_toplevel xdg_toplevel * @section page_iface_xdg_toplevel_desc Description @@ -234,7 +255,11 @@ extern const struct wl_interface xdg_surface_interface; * by the compositor until it is explicitly mapped again. * All active operations (e.g., move, resize) are canceled and all * attributes (e.g. title, state, stacking, ...) are discarded for - * an xdg_toplevel surface when it is unmapped. + * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to + * the state it had right after xdg_surface.get_toplevel. The client + * can re-map the toplevel by perfoming a commit without any buffer + * attached, waiting for a configure event and handling it as usual (see + * xdg_surface description). * * Attaching a null buffer to a toplevel unmaps the surface. * @section page_iface_xdg_toplevel_api API @@ -253,11 +278,18 @@ extern const struct wl_interface xdg_surface_interface; * by the compositor until it is explicitly mapped again. * All active operations (e.g., move, resize) are canceled and all * attributes (e.g. title, state, stacking, ...) are discarded for - * an xdg_toplevel surface when it is unmapped. + * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to + * the state it had right after xdg_surface.get_toplevel. The client + * can re-map the toplevel by perfoming a commit without any buffer + * attached, waiting for a configure event and handling it as usual (see + * xdg_surface description). * * Attaching a null buffer to a toplevel unmaps the surface. */ extern const struct wl_interface xdg_toplevel_interface; +#endif +#ifndef XDG_POPUP_INTERFACE +#define XDG_POPUP_INTERFACE /** * @page page_iface_xdg_popup xdg_popup * @section page_iface_xdg_popup_desc Description @@ -284,12 +316,6 @@ extern const struct wl_interface xdg_toplevel_interface; * The parent of an xdg_popup must be mapped (see the xdg_surface * description) before the xdg_popup itself. * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_surface.get_popup. An xdg_popup must intersect with or be at least - * partially adjacent to its parent surface. - * * The client must call wl_surface.commit on the corresponding wl_surface * for the xdg_popup state to take effect. * @section page_iface_xdg_popup_api API @@ -320,16 +346,11 @@ extern const struct wl_interface xdg_toplevel_interface; * The parent of an xdg_popup must be mapped (see the xdg_surface * description) before the xdg_popup itself. * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_surface.get_popup. An xdg_popup must intersect with or be at least - * partially adjacent to its parent surface. - * * The client must call wl_surface.commit on the corresponding wl_surface * for the xdg_popup state to take effect. */ extern const struct wl_interface xdg_popup_interface; +#endif #ifndef XDG_WM_BASE_ERROR_ENUM #define XDG_WM_BASE_ERROR_ENUM @@ -587,6 +608,9 @@ enum xdg_positioner_constraint_adjustment { #define XDG_POSITIONER_SET_GRAVITY 4 #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5 #define XDG_POSITIONER_SET_OFFSET 6 +#define XDG_POSITIONER_SET_REACTIVE 7 +#define XDG_POSITIONER_SET_PARENT_SIZE 8 +#define XDG_POSITIONER_SET_PARENT_CONFIGURE 9 /** @@ -617,6 +641,18 @@ enum xdg_positioner_constraint_adjustment { * @ingroup iface_xdg_positioner */ #define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_positioner + */ +#define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3 +/** + * @ingroup iface_xdg_positioner + */ +#define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3 +/** + * @ingroup iface_xdg_positioner + */ +#define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3 /** @ingroup iface_xdg_positioner */ static inline void @@ -769,6 +805,56 @@ xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int3 XDG_POSITIONER_SET_OFFSET, x, y); } +/** + * @ingroup iface_xdg_positioner + * + * When set reactive, the surface is reconstrained if the conditions used + * for constraining changed, e.g. the parent window moved. + * + * If the conditions changed and the popup was reconstrained, an + * xdg_popup.configure event is sent with updated geometry, followed by an + * xdg_surface.configure event. + */ +static inline void +xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_positioner, + XDG_POSITIONER_SET_REACTIVE); +} + +/** + * @ingroup iface_xdg_positioner + * + * Set the parent window geometry the compositor should use when + * positioning the popup. The compositor may use this information to + * determine the future state the popup should be constrained using. If + * this doesn't match the dimension of the parent the popup is eventually + * positioned against, the behavior is undefined. + * + * The arguments are given in the surface-local coordinate space. + */ +static inline void +xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_positioner, + XDG_POSITIONER_SET_PARENT_SIZE, parent_width, parent_height); +} + +/** + * @ingroup iface_xdg_positioner + * + * Set the serial of an xdg_surface.configure event this positioner will be + * used in response to. The compositor may use this information together + * with set_parent_size to determine what future state the popup should be + * constrained using. + */ +static inline void +xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_positioner, + XDG_POSITIONER_SET_PARENT_CONFIGURE, serial); +} + #ifndef XDG_SURFACE_ERROR_ENUM #define XDG_SURFACE_ERROR_ENUM enum xdg_surface_error { @@ -1691,6 +1777,12 @@ struct xdg_popup_listener { * The x and y arguments represent the position the popup was * placed at given the xdg_positioner rule, relative to the upper * left corner of the window geometry of the parent surface. + * + * For version 2 or older, the configure event for an xdg_popup is + * only ever sent once for the initial configuration. Starting with + * version 3, it may be sent again if the popup is setup with an + * xdg_positioner with set_reactive requested, or in response to + * xdg_popup.reposition requests. * @param x x position relative to parent surface window geometry * @param y y position relative to parent surface window geometry * @param width window geometry width @@ -1711,6 +1803,32 @@ struct xdg_popup_listener { */ void (*popup_done)(void *data, struct xdg_popup *xdg_popup); + /** + * signal the completion of a repositioned request + * + * The repositioned event is sent as part of a popup + * configuration sequence, together with xdg_popup.configure and + * lastly xdg_surface.configure to notify the completion of a + * reposition request. + * + * The repositioned event is to notify about the completion of a + * xdg_popup.reposition request. The token argument is the token + * passed in the xdg_popup.reposition request. + * + * Immediately after this event is emitted, xdg_popup.configure and + * xdg_surface.configure will be sent with the updated size and + * position, as well as a new configure serial. + * + * The client should optionally update the content of the popup, + * but must acknowledge the new popup configuration for the new + * position to take effect. See xdg_surface.ack_configure for + * details. + * @param token reposition request token + * @since 3 + */ + void (*repositioned)(void *data, + struct xdg_popup *xdg_popup, + uint32_t token); }; /** @@ -1726,6 +1844,7 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup, #define XDG_POPUP_DESTROY 0 #define XDG_POPUP_GRAB 1 +#define XDG_POPUP_REPOSITION 2 /** * @ingroup iface_xdg_popup @@ -1735,6 +1854,10 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup, * @ingroup iface_xdg_popup */ #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_popup + */ +#define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3 /** * @ingroup iface_xdg_popup @@ -1744,6 +1867,10 @@ xdg_popup_add_listener(struct xdg_popup *xdg_popup, * @ingroup iface_xdg_popup */ #define XDG_POPUP_GRAB_SINCE_VERSION 1 +/** + * @ingroup iface_xdg_popup + */ +#define XDG_POPUP_REPOSITION_SINCE_VERSION 3 /** @ingroup iface_xdg_popup */ static inline void @@ -1835,6 +1962,40 @@ xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t seria XDG_POPUP_GRAB, seat, serial); } +/** + * @ingroup iface_xdg_popup + * + * Reposition an already-mapped popup. The popup will be placed given the + * details in the passed xdg_positioner object, and a + * xdg_popup.repositioned followed by xdg_popup.configure and + * xdg_surface.configure will be emitted in response. Any parameters set + * by the previous positioner will be discarded. + * + * The passed token will be sent in the corresponding + * xdg_popup.repositioned event. The new popup position will not take + * effect until the corresponding configure event is acknowledged by the + * client. See xdg_popup.repositioned for details. The token itself is + * opaque, and has no other special meaning. + * + * If multiple reposition requests are sent, the compositor may skip all + * but the last one. + * + * If the popup is repositioned in response to a configure event for its + * parent, the client should send an xdg_positioner.set_parent_configure + * and possibly an xdg_positioner.set_parent_size request to allow the + * compositor to properly constrain the popup. + * + * If the popup is repositioned together with a parent that is being + * resized, but not in response to a configure event, the client should + * send an xdg_positioner.set_parent_size request. + */ +static inline void +xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token) +{ + wl_proxy_marshal((struct wl_proxy *) xdg_popup, + XDG_POPUP_REPOSITION, positioner, token); +} + #ifdef __cplusplus } #endif