2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_XDG_SHELL_V6_H
|
|
|
|
#define WLR_TYPES_WLR_XDG_SHELL_V6_H
|
|
|
|
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <wayland-server.h>
|
2017-09-13 14:44:32 +02:00
|
|
|
#include <wlr/types/wlr_box.h>
|
2017-10-06 12:54:43 +02:00
|
|
|
#include <wlr/types/wlr_seat.h>
|
2018-03-29 01:42:17 +02:00
|
|
|
#include "xdg-shell-unstable-v6-protocol.h"
|
2017-08-11 15:37:09 +02:00
|
|
|
|
|
|
|
struct wlr_xdg_shell_v6 {
|
|
|
|
struct wl_global *wl_global;
|
2017-09-16 18:35:49 +02:00
|
|
|
struct wl_list clients;
|
2017-10-06 12:54:43 +02:00
|
|
|
struct wl_list popup_grabs;
|
2017-09-16 18:35:49 +02:00
|
|
|
uint32_t ping_timeout;
|
2017-08-11 20:23:53 +02:00
|
|
|
|
2017-12-07 01:08:35 +01:00
|
|
|
struct wl_listener display_destroy;
|
|
|
|
|
2017-09-15 14:53:08 +02:00
|
|
|
struct {
|
|
|
|
struct wl_signal new_surface;
|
|
|
|
} events;
|
|
|
|
|
2017-08-11 20:23:53 +02:00
|
|
|
void *data;
|
2017-08-11 15:37:09 +02:00
|
|
|
};
|
|
|
|
|
2017-09-16 18:35:49 +02:00
|
|
|
struct wlr_xdg_client_v6 {
|
|
|
|
struct wlr_xdg_shell_v6 *shell;
|
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wl_client *client;
|
|
|
|
struct wl_list surfaces;
|
|
|
|
|
|
|
|
struct wl_list link; // wlr_xdg_shell_v6::clients
|
|
|
|
|
|
|
|
uint32_t ping_serial;
|
|
|
|
struct wl_event_source *ping_timer;
|
|
|
|
};
|
|
|
|
|
2018-03-29 00:30:38 +02:00
|
|
|
struct wlr_xdg_positioner_v6 {
|
2018-03-26 18:46:04 +02:00
|
|
|
struct wlr_box anchor_rect;
|
2018-03-29 01:42:17 +02:00
|
|
|
enum zxdg_positioner_v6_anchor anchor;
|
|
|
|
enum zxdg_positioner_v6_gravity gravity;
|
|
|
|
enum zxdg_positioner_v6_constraint_adjustment constraint_adjustment;
|
2018-03-26 18:46:04 +02:00
|
|
|
|
|
|
|
struct {
|
|
|
|
int32_t width, height;
|
|
|
|
} size;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
int32_t x, y;
|
|
|
|
} offset;
|
|
|
|
};
|
|
|
|
|
2017-10-01 12:47:14 +02:00
|
|
|
struct wlr_xdg_popup_v6 {
|
|
|
|
struct wlr_xdg_surface_v6 *base;
|
2018-01-21 21:06:37 +01:00
|
|
|
struct wl_list link;
|
2017-10-01 12:47:14 +02:00
|
|
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
bool committed;
|
|
|
|
struct wlr_xdg_surface_v6 *parent;
|
|
|
|
struct wlr_seat *seat;
|
2018-03-27 04:11:41 +02:00
|
|
|
|
|
|
|
// Position of the popup relative to the upper left corner of the window
|
|
|
|
// geometry of the parent surface
|
2017-10-01 12:47:14 +02:00
|
|
|
struct wlr_box geometry;
|
2017-10-06 12:54:43 +02:00
|
|
|
|
2018-03-29 00:30:38 +02:00
|
|
|
struct wlr_xdg_positioner_v6 positioner;
|
2018-03-14 00:21:08 +01:00
|
|
|
|
2017-10-06 12:54:43 +02:00
|
|
|
struct wl_list grab_link; // wlr_xdg_popup_grab_v6::popups
|
|
|
|
};
|
|
|
|
|
|
|
|
// each seat gets a popup grab
|
|
|
|
struct wlr_xdg_popup_grab_v6 {
|
|
|
|
struct wl_client *client;
|
|
|
|
struct wlr_seat_pointer_grab pointer_grab;
|
2017-10-07 17:02:11 +02:00
|
|
|
struct wlr_seat_keyboard_grab keyboard_grab;
|
2017-10-06 12:54:43 +02:00
|
|
|
struct wlr_seat *seat;
|
|
|
|
struct wl_list popups;
|
|
|
|
struct wl_list link; // wlr_xdg_shell_v6::popup_grabs
|
2017-12-30 17:16:00 +01:00
|
|
|
struct wl_listener seat_destroy;
|
2017-10-01 12:47:14 +02:00
|
|
|
};
|
2017-09-16 18:35:49 +02:00
|
|
|
|
2017-09-12 00:06:19 +02:00
|
|
|
enum wlr_xdg_surface_v6_role {
|
|
|
|
WLR_XDG_SURFACE_V6_ROLE_NONE,
|
|
|
|
WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL,
|
|
|
|
WLR_XDG_SURFACE_V6_ROLE_POPUP,
|
|
|
|
};
|
|
|
|
|
2017-09-13 15:19:10 +02:00
|
|
|
struct wlr_xdg_toplevel_v6_state {
|
2018-03-13 19:57:21 +01:00
|
|
|
bool maximized, fullscreen, resizing, activated;
|
|
|
|
uint32_t width, height;
|
|
|
|
uint32_t max_width, max_height;
|
|
|
|
uint32_t min_width, min_height;
|
2017-09-13 15:19:10 +02:00
|
|
|
};
|
|
|
|
|
2018-04-12 05:09:13 +02:00
|
|
|
/**
|
|
|
|
* 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
|
2018-05-03 22:59:43 +02:00
|
|
|
* emitted. The `unmap` event is guaranteed to be emitted before the `destroy`
|
2018-04-12 05:09:13 +02:00
|
|
|
* event if the view is destroyed when mapped.
|
|
|
|
*/
|
2017-09-13 15:19:10 +02:00
|
|
|
struct wlr_xdg_toplevel_v6 {
|
2017-09-14 22:27:14 +02:00
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wlr_xdg_surface_v6 *base;
|
2017-09-17 02:07:19 +02:00
|
|
|
struct wlr_xdg_surface_v6 *parent;
|
2017-09-15 13:50:13 +02:00
|
|
|
bool added;
|
2018-03-27 01:32:21 +02:00
|
|
|
|
2018-03-18 18:58:01 +01:00
|
|
|
struct wlr_xdg_toplevel_v6_state client_pending;
|
|
|
|
struct wlr_xdg_toplevel_v6_state server_pending;
|
2017-09-13 15:19:10 +02:00
|
|
|
struct wlr_xdg_toplevel_v6_state current;
|
2018-03-27 01:32:21 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
} events;
|
2017-09-13 15:19:10 +02:00
|
|
|
};
|
|
|
|
|
2017-09-14 22:27:14 +02:00
|
|
|
struct wlr_xdg_surface_v6_configure {
|
|
|
|
struct wl_list link; // wlr_xdg_surface_v6::configure_list
|
|
|
|
uint32_t serial;
|
2018-03-13 19:57:21 +01:00
|
|
|
|
2018-03-13 22:05:35 +01:00
|
|
|
struct wlr_xdg_toplevel_v6_state *toplevel_state;
|
2017-09-14 22:27:14 +02:00
|
|
|
};
|
|
|
|
|
2017-08-11 15:37:09 +02:00
|
|
|
struct wlr_xdg_surface_v6 {
|
2017-09-16 18:35:49 +02:00
|
|
|
struct wlr_xdg_client_v6 *client;
|
2017-08-11 15:37:09 +02:00
|
|
|
struct wl_resource *resource;
|
2017-09-12 12:18:52 +02:00
|
|
|
struct wlr_surface *surface;
|
2017-09-16 18:35:49 +02:00
|
|
|
struct wl_list link; // wlr_xdg_client_v6::surfaces
|
2017-09-12 00:06:19 +02:00
|
|
|
enum wlr_xdg_surface_v6_role role;
|
2017-10-01 12:47:14 +02:00
|
|
|
|
|
|
|
union {
|
2018-03-13 22:09:44 +01:00
|
|
|
struct wlr_xdg_toplevel_v6 *toplevel;
|
|
|
|
struct wlr_xdg_popup_v6 *popup;
|
2017-10-01 12:47:14 +02:00
|
|
|
};
|
2017-08-11 20:23:53 +02:00
|
|
|
|
2018-01-21 21:06:37 +01:00
|
|
|
struct wl_list popups; // wlr_xdg_popup_v6::link
|
2017-10-02 15:15:21 +02:00
|
|
|
|
2018-03-10 11:18:50 +01:00
|
|
|
bool added, configured, mapped;
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t configure_serial;
|
2017-09-14 22:27:14 +02:00
|
|
|
struct wl_event_source *configure_idle;
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t configure_next_serial;
|
2017-09-14 22:27:14 +02:00
|
|
|
struct wl_list configure_list;
|
|
|
|
|
2017-09-13 14:44:32 +02:00
|
|
|
bool has_next_geometry;
|
2018-03-13 22:17:25 +01:00
|
|
|
struct wlr_box next_geometry;
|
|
|
|
struct wlr_box geometry;
|
2017-09-13 14:44:32 +02:00
|
|
|
|
2017-09-11 23:24:55 +02:00
|
|
|
struct wl_listener surface_destroy_listener;
|
|
|
|
|
2017-09-14 14:39:57 +02:00
|
|
|
struct {
|
|
|
|
struct wl_signal destroy;
|
2017-09-16 18:35:49 +02:00
|
|
|
struct wl_signal ping_timeout;
|
2018-01-21 21:06:37 +01:00
|
|
|
struct wl_signal new_popup;
|
2018-03-10 11:18:50 +01:00
|
|
|
struct wl_signal map;
|
|
|
|
struct wl_signal unmap;
|
2017-09-14 14:39:57 +02:00
|
|
|
} events;
|
|
|
|
|
2017-08-11 20:23:53 +02:00
|
|
|
void *data;
|
2017-08-11 15:37:09 +02:00
|
|
|
};
|
|
|
|
|
2017-09-16 14:31:08 +02:00
|
|
|
struct wlr_xdg_toplevel_v6_move_event {
|
|
|
|
struct wlr_xdg_surface_v6 *surface;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat_client *seat;
|
2017-09-16 14:31:08 +02:00
|
|
|
uint32_t serial;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_xdg_toplevel_v6_resize_event {
|
|
|
|
struct wlr_xdg_surface_v6 *surface;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat_client *seat;
|
2017-09-16 14:31:08 +02:00
|
|
|
uint32_t serial;
|
|
|
|
uint32_t edges;
|
|
|
|
};
|
|
|
|
|
2017-11-20 17:27:36 +01:00
|
|
|
struct wlr_xdg_toplevel_v6_set_fullscreen_event {
|
|
|
|
struct wlr_xdg_surface_v6 *surface;
|
|
|
|
bool fullscreen;
|
|
|
|
struct wlr_output *output;
|
|
|
|
};
|
|
|
|
|
2017-09-16 14:31:08 +02:00
|
|
|
struct wlr_xdg_toplevel_v6_show_window_menu_event {
|
|
|
|
struct wlr_xdg_surface_v6 *surface;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat_client *seat;
|
2017-09-16 14:31:08 +02:00
|
|
|
uint32_t serial;
|
2017-11-21 09:50:00 +01:00
|
|
|
uint32_t x, y;
|
2017-09-16 14:31:08 +02:00
|
|
|
};
|
|
|
|
|
2017-08-15 15:33:54 +02:00
|
|
|
struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display);
|
2017-08-11 15:37:09 +02:00
|
|
|
void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell);
|
|
|
|
|
2017-09-16 18:35:49 +02:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface);
|
|
|
|
|
2017-09-14 22:27:14 +02:00
|
|
|
/**
|
2017-11-17 23:52:42 +01:00
|
|
|
* Request that this toplevel surface be the given size. Returns the associated
|
|
|
|
* configure serial.
|
2017-09-14 22:27:14 +02:00
|
|
|
*/
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
|
2017-09-14 22:27:14 +02:00
|
|
|
uint32_t width, uint32_t height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request that this toplevel surface show itself in an activated or deactivated
|
2017-11-17 23:52:42 +01:00
|
|
|
* state. Returns the associated configure serial.
|
2017-09-14 22:27:14 +02:00
|
|
|
*/
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
2017-09-14 22:27:14 +02:00
|
|
|
bool activated);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request that this toplevel surface consider itself maximized or not
|
2017-11-17 23:52:42 +01:00
|
|
|
* maximized. Returns the associated configure serial.
|
2017-09-14 22:27:14 +02:00
|
|
|
*/
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
2017-09-14 22:27:14 +02:00
|
|
|
bool maximized);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request that this toplevel surface consider itself fullscreen or not
|
2017-11-17 23:52:42 +01:00
|
|
|
* fullscreen. Returns the associated configure serial.
|
2017-09-14 22:27:14 +02:00
|
|
|
*/
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
2017-09-14 22:27:14 +02:00
|
|
|
bool fullscreen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request that this toplevel surface consider itself to be resizing or not
|
2017-11-17 23:52:42 +01:00
|
|
|
* resizing. Returns the associated configure serial.
|
2017-09-14 22:27:14 +02:00
|
|
|
*/
|
2017-11-17 23:52:42 +01:00
|
|
|
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
2017-09-14 22:27:14 +02:00
|
|
|
bool resizing);
|
|
|
|
|
2017-10-06 15:58:49 +02:00
|
|
|
/**
|
2018-03-24 20:10:15 +01:00
|
|
|
* Request that this xdg surface closes.
|
2017-10-06 15:58:49 +02:00
|
|
|
*/
|
2018-03-24 20:10:15 +01:00
|
|
|
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface);
|
2017-10-06 15:58:49 +02:00
|
|
|
|
2017-10-09 22:51:55 +02:00
|
|
|
/**
|
2018-04-04 23:42:16 +02:00
|
|
|
* 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.
|
2017-10-09 22:51:55 +02:00
|
|
|
*/
|
2018-04-04 23:42:16 +02:00
|
|
|
struct wlr_surface *wlr_xdg_surface_v6_surface_at(
|
2017-10-09 22:51:55 +02:00
|
|
|
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
|
2018-04-04 23:42:16 +02:00
|
|
|
double *sub_x, double *sub_y);
|
2017-11-17 23:52:42 +01:00
|
|
|
|
2018-03-28 22:27:08 +02:00
|
|
|
/**
|
|
|
|
* Get the geometry for this positioner based on the anchor rect, gravity, and
|
|
|
|
* size of this positioner.
|
|
|
|
*/
|
2018-03-27 20:49:31 +02:00
|
|
|
struct wlr_box wlr_xdg_positioner_v6_get_geometry(
|
2018-03-29 00:30:38 +02:00
|
|
|
struct wlr_xdg_positioner_v6 *positioner);
|
2018-03-27 20:49:31 +02:00
|
|
|
|
2018-03-27 05:48:32 +02:00
|
|
|
/**
|
2018-03-28 22:27:08 +02:00
|
|
|
* Get the anchor point for this popup in the toplevel parent's coordinate system.
|
2018-03-27 05:48:32 +02:00
|
|
|
*/
|
|
|
|
void wlr_xdg_popup_v6_get_anchor_point(struct wlr_xdg_popup_v6 *popup,
|
2018-03-28 22:27:08 +02:00
|
|
|
int *toplevel_sx, int *toplevel_sy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert the given coordinates in the popup coordinate system to the toplevel
|
|
|
|
* surface coordinate system.
|
|
|
|
*/
|
|
|
|
void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
|
|
|
|
int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the geometry of this popup to unconstrain it according to its
|
2018-03-29 05:24:39 +02:00
|
|
|
* xdg-positioner rules. The box should be in the popup's root toplevel parent
|
|
|
|
* surface coordinate system.
|
2018-03-28 22:27:08 +02:00
|
|
|
*/
|
|
|
|
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
|
2018-03-29 05:24:39 +02:00
|
|
|
struct wlr_box *toplevel_sx_box);
|
2018-03-27 05:48:32 +02:00
|
|
|
|
2018-03-28 22:27:08 +02:00
|
|
|
/**
|
|
|
|
Invert the right/left anchor and gravity for this positioner. This can be
|
|
|
|
used to "flip" the positioner around the anchor rect in the x direction.
|
|
|
|
*/
|
2018-03-27 20:49:31 +02:00
|
|
|
void wlr_positioner_v6_invert_x(
|
2018-03-29 00:30:38 +02:00
|
|
|
struct wlr_xdg_positioner_v6 *positioner);
|
2018-03-27 20:49:31 +02:00
|
|
|
|
2018-03-28 22:27:08 +02:00
|
|
|
/**
|
|
|
|
Invert the top/bottom anchor and gravity for this positioner. This can be
|
|
|
|
used to "flip" the positioner around the anchor rect in the y direction.
|
|
|
|
*/
|
2018-03-27 20:49:31 +02:00
|
|
|
void wlr_positioner_v6_invert_y(
|
2018-03-29 00:30:38 +02:00
|
|
|
struct wlr_xdg_positioner_v6 *positioner);
|
2018-03-27 05:48:32 +02:00
|
|
|
|
2018-04-03 02:39:33 +02:00
|
|
|
bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface);
|
|
|
|
|
|
|
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
|
|
|
|
struct wlr_surface *surface);
|
|
|
|
|
2018-04-05 02:10:47 +02:00
|
|
|
/**
|
|
|
|
* Call `iterator` on each surface in the xdg-surface tree, with the surface's
|
2018-05-03 22:59:43 +02:00
|
|
|
* position relative to the root xdg-surface. The function is called from root to
|
2018-04-05 02:10:47 +02:00
|
|
|
* leaves (in rendering order).
|
|
|
|
*/
|
|
|
|
void wlr_xdg_surface_v6_for_each_surface(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
|
2017-08-11 15:37:09 +02:00
|
|
|
#endif
|