Documentation for <wlr/types/wlr_xdg_shell.h>

Back to index

Table of contents

wlr_surface_is_xdg_surface()

bool wlr_surface_is_xdg_surface(​struct wlr_surface *surface);

struct wlr_xdg_client

struct wlr_xdg_client {
	struct wlr_xdg_shell *shell;
	struct wl_resource *resource;
	struct wl_client *client;
	struct wl_list surfaces;
	struct wl_list link;
	uint32_t ping_serial;
	struct wl_event_source *ping_timer;
};

struct wlr_xdg_popup

struct wlr_xdg_popup {
	struct wlr_xdg_surface *base;
	struct wl_list link;
	struct wl_resource *resource;
	bool committed;
	struct wlr_surface *parent;
	struct wlr_seat *seat;
	struct wlr_box geometry;
	struct wlr_xdg_positioner_rules positioner_rules;
	struct wl_list grab_link;
};

wlr_xdg_popup_destroy()

void wlr_xdg_popup_destroy(​struct wlr_xdg_popup *popup);

Request that this popup closes.

wlr_xdg_popup_from_resource()

struct wlr_xdg_popup *wlr_xdg_popup_from_resource(​struct wl_resource *resource);

Get the corresponding struct wlr_xdg_popup from a resource.

Aborts if the resource doesn't have the correct type. Returns NULL if the resource is inert.

wlr_xdg_popup_get_position()

void wlr_xdg_popup_get_position(​struct wlr_xdg_popup *popup, double *popup_sx, double *popup_sy);

Get the position for this popup in the surface parent's coordinate system.

wlr_xdg_popup_get_toplevel_coords()

void wlr_xdg_popup_get_toplevel_coords(​struct wlr_xdg_popup *popup, int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy);

Convert the given coordinates in the popup coordinate system to the toplevel surface coordinate system.

struct wlr_xdg_popup_grab

struct wlr_xdg_popup_grab {
	struct wl_client *client;
	struct wlr_seat_pointer_grab pointer_grab;
	struct wlr_seat_keyboard_grab keyboard_grab;
	struct wlr_seat_touch_grab touch_grab;
	struct wlr_seat *seat;
	struct wl_list popups;
	struct wl_list link;
	struct wl_listener seat_destroy;
};

wlr_xdg_popup_unconstrain_from_box()

void wlr_xdg_popup_unconstrain_from_box(​struct wlr_xdg_popup *popup, const struct wlr_box *toplevel_space_box);

Set the geometry of this popup to unconstrain it according to its xdg-positioner rules. The box should be in the popup's root toplevel parent surface coordinate system.

struct wlr_xdg_positioner

struct wlr_xdg_positioner {
	struct wl_resource *resource;
	struct wlr_xdg_positioner_rules rules;
};

wlr_xdg_positioner_from_resource()

struct wlr_xdg_positioner *wlr_xdg_positioner_from_resource(​struct wl_resource *resource);

Get the corresponding struct wlr_xdg_positioner from a resource.

Aborts if the resource doesn't have the correct type.

struct wlr_xdg_positioner_rules

struct wlr_xdg_positioner_rules {
	struct wlr_box anchor_rect;
	enum xdg_positioner_anchor anchor;
	enum xdg_positioner_gravity gravity;
	enum xdg_positioner_constraint_adjustment constraint_adjustment;
	struct {
		int32_t width, height;
	} size;
	struct {
		int32_t x, y;
	} offset;
};

wlr_xdg_positioner_rules_get_geometry()

void wlr_xdg_positioner_rules_get_geometry(​const struct wlr_xdg_positioner_rules *rules, struct wlr_box *box);

Get the geometry based on positioner rules.

wlr_xdg_positioner_rules_unconstrain_box()

void wlr_xdg_positioner_rules_unconstrain_box(​const struct wlr_xdg_positioner_rules *rules, const struct wlr_box *constraint, struct wlr_box *box);

Unconstrain the box from the constraint area according to positioner rules.

struct wlr_xdg_shell

struct wlr_xdg_shell {
	struct wl_global *global;
	uint32_t version;
	struct wl_list clients;
	struct wl_list popup_grabs;
	uint32_t ping_timeout;
	struct wl_listener display_destroy;
	struct {
		struct wl_signal new_surface;
		struct wl_signal destroy;
	} events;
	void *data;
};

wlr_xdg_shell_create()

struct wlr_xdg_shell *wlr_xdg_shell_create(​struct wl_display *display, uint32_t version);

Create the xdg_wm_base global with the specified version.

struct wlr_xdg_surface

struct wlr_xdg_surface {
	struct wlr_xdg_client *client;
	struct wl_resource *resource;
	struct wlr_surface *surface;
	struct wl_list link;
	enum wlr_xdg_surface_role role;
	union {
		struct wlr_xdg_toplevel *toplevel;
		struct wlr_xdg_popup *popup;
	} ;
	struct wl_list popups;
	bool added, configured, mapped;
	struct wl_event_source *configure_idle;
	uint32_t scheduled_serial;
	struct wl_list configure_list;
	struct wlr_xdg_surface_state current, pending;
	struct wl_listener surface_destroy;
	struct wl_listener surface_commit;
	struct {
		struct wl_signal destroy;
		struct wl_signal ping_timeout;
		struct wl_signal new_popup;
		struct wl_signal map;
		struct wl_signal unmap;
		struct wl_signal configure;
		struct wl_signal ack_configure;
	} events;
	void *data;
};

An xdg-surface is a user interface element requiring management by the compositor. An xdg-surface alone isn't useful, a role should be assigned to it in order to map it.

When a surface has a role and is ready to be displayed, the `map` event is emitted. When a surface should no longer be displayed, the `unmap` event is emitted. The `unmap` event is guaranteed to be emitted before the `destroy` event if the view is destroyed when mapped.

struct wlr_xdg_surface_configure

struct wlr_xdg_surface_configure {
	struct wlr_xdg_surface *surface;
	struct wl_list link;
	uint32_t serial;
	struct wlr_xdg_toplevel_configure *toplevel_configure;
};

wlr_xdg_surface_for_each_popup_surface()

void wlr_xdg_surface_for_each_popup_surface(​struct wlr_xdg_surface *surface, wlr_surface_iterator_func_t iterator, void *user_data);

Call `iterator` on each mapped popup's surface and popup's subsurface in the xdg-surface tree (whether or not this xdg-surface is mapped), with the surfaces's position relative to the root xdg-surface. The function is called from root to leaves (in rendering order).

wlr_xdg_surface_for_each_surface()

void wlr_xdg_surface_for_each_surface(​struct wlr_xdg_surface *surface, wlr_surface_iterator_func_t iterator, void *user_data);

Call `iterator` on each mapped surface and popup in the xdg-surface tree (whether or not this xdg-surface is mapped), with the surface's position relative to the root xdg-surface. The function is called from root to leaves (in rendering order).

wlr_xdg_surface_from_resource()

struct wlr_xdg_surface *wlr_xdg_surface_from_resource(​struct wl_resource *resource);

Get the corresponding struct wlr_xdg_surface from a resource.

Aborts if the resource doesn't have the correct type. Returns NULL if the resource is inert.

wlr_xdg_surface_from_wlr_surface()

struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(​struct wlr_surface *surface);

wlr_xdg_surface_get_geometry()

void wlr_xdg_surface_get_geometry(​struct wlr_xdg_surface *surface, struct wlr_box *box);

Get the surface geometry.

This is either the geometry as set by the client, or defaulted to the bounds of the surface + the subsurfaces (as specified by the protocol).

The x and y value can be < 0.

wlr_xdg_surface_ping()

void wlr_xdg_surface_ping(​struct wlr_xdg_surface *surface);

Send a ping to the surface. If the surface does not respond in a reasonable amount of time, the ping_timeout event will be emitted.

wlr_xdg_surface_popup_surface_at()

struct wlr_surface *wlr_xdg_surface_popup_surface_at(​struct wlr_xdg_surface *surface, double sx, double sy, double *sub_x, double *sub_y);

Find a surface within this xdg-surface's popup tree at the given surface-local coordinates. Returns the surface and coordinates in the leaf surface coordinate system or NULL if no surface is found at that location.

enum wlr_xdg_surface_role

enum wlr_xdg_surface_role {
	WLR_XDG_SURFACE_ROLE_NONE,
	WLR_XDG_SURFACE_ROLE_TOPLEVEL,
	WLR_XDG_SURFACE_ROLE_POPUP,
};

wlr_xdg_surface_schedule_configure()

uint32_t wlr_xdg_surface_schedule_configure(​struct wlr_xdg_surface *surface);

Schedule a surface configuration. This should only be called by protocols extending the shell.

struct wlr_xdg_surface_state

struct wlr_xdg_surface_state {
	uint32_t configure_serial;
	struct wlr_box geometry;
};

wlr_xdg_surface_surface_at()

struct wlr_surface *wlr_xdg_surface_surface_at(​struct wlr_xdg_surface *surface, double sx, double sy, double *sub_x, double *sub_y);

Find a surface within this xdg-surface tree at the given surface-local coordinates. Returns the surface and coordinates in the leaf surface coordinate system or NULL if no surface is found at that location.

struct wlr_xdg_toplevel

struct wlr_xdg_toplevel {
	struct wl_resource *resource;
	struct wlr_xdg_surface *base;
	bool added;
	struct wlr_xdg_toplevel *parent;
	struct wl_listener parent_unmap;
	struct wlr_xdg_toplevel_state current, pending;
	struct wlr_xdg_toplevel_configure scheduled;
	struct wlr_xdg_toplevel_requested requested;
	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;
		struct wl_signal set_parent;
		struct wl_signal set_title;
		struct wl_signal set_app_id;
	} events;
};

struct wlr_xdg_toplevel_configure

struct wlr_xdg_toplevel_configure {
	bool maximized, fullscreen, resizing, activated;
	uint32_t tiled;
	uint32_t width, height;
};

wlr_xdg_toplevel_from_resource()

struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource(​struct wl_resource *resource);

Get the corresponding struct wlr_xdg_toplevel from a resource.

Aborts if the resource doesn't have the correct type. Returns NULL if the resource is inert.

struct wlr_xdg_toplevel_move_event

struct wlr_xdg_toplevel_move_event {
	struct wlr_xdg_toplevel *toplevel;
	struct wlr_seat_client *seat;
	uint32_t serial;
};

struct wlr_xdg_toplevel_requested

struct wlr_xdg_toplevel_requested {
	bool maximized, minimized, fullscreen;
	struct wlr_output *fullscreen_output;
	struct wl_listener fullscreen_output_destroy;
};

struct wlr_xdg_toplevel_resize_event

struct wlr_xdg_toplevel_resize_event {
	struct wlr_xdg_toplevel *toplevel;
	struct wlr_seat_client *seat;
	uint32_t serial;
	uint32_t edges;
};

wlr_xdg_toplevel_send_close()

void wlr_xdg_toplevel_send_close(​struct wlr_xdg_toplevel *toplevel);

Request that this toplevel closes.

wlr_xdg_toplevel_set_activated()

uint32_t wlr_xdg_toplevel_set_activated(​struct wlr_xdg_toplevel *toplevel, bool activated);

Request that this toplevel show itself in an activated or deactivated state. Returns the associated configure serial.

wlr_xdg_toplevel_set_fullscreen()

uint32_t wlr_xdg_toplevel_set_fullscreen(​struct wlr_xdg_toplevel *toplevel, bool fullscreen);

Request that this toplevel consider itself fullscreen or not fullscreen. Returns the associated configure serial.

wlr_xdg_toplevel_set_maximized()

uint32_t wlr_xdg_toplevel_set_maximized(​struct wlr_xdg_toplevel *toplevel, bool maximized);

Request that this toplevel consider itself maximized or not maximized. Returns the associated configure serial.

wlr_xdg_toplevel_set_parent()

void wlr_xdg_toplevel_set_parent(​struct wlr_xdg_toplevel *toplevel, struct wlr_xdg_toplevel *parent);

Sets the parent of this toplevel. Parent can be NULL.

wlr_xdg_toplevel_set_resizing()

uint32_t wlr_xdg_toplevel_set_resizing(​struct wlr_xdg_toplevel *toplevel, bool resizing);

Request that this toplevel consider itself to be resizing or not resizing. Returns the associated configure serial.

wlr_xdg_toplevel_set_size()

uint32_t wlr_xdg_toplevel_set_size(​struct wlr_xdg_toplevel *toplevel, uint32_t width, uint32_t height);

Request that this toplevel surface be the given size. Returns the associated configure serial.

wlr_xdg_toplevel_set_tiled()

uint32_t wlr_xdg_toplevel_set_tiled(​struct wlr_xdg_toplevel *toplevel, uint32_t tiled_edges);

Request that this toplevel consider itself in a tiled layout and some edges are adjacent to another part of the tiling grid. `tiled_edges` is a bitfield of enum wlr_edges. Returns the associated configure serial.

struct wlr_xdg_toplevel_show_window_menu_event

struct wlr_xdg_toplevel_show_window_menu_event {
	struct wlr_xdg_toplevel *toplevel;
	struct wlr_seat_client *seat;
	uint32_t serial;
	uint32_t x, y;
};

struct wlr_xdg_toplevel_state

struct wlr_xdg_toplevel_state {
	bool maximized, fullscreen, resizing, activated;
	uint32_t tiled;
	uint32_t width, height;
	uint32_t max_width, max_height;
	uint32_t min_width, min_height;
};