2017-09-23 10:26:01 +02:00
|
|
|
#ifndef WLR_TYPES_WLR_WL_SHELL_H
|
|
|
|
#define WLR_TYPES_WLR_WL_SHELL_H
|
|
|
|
|
2017-09-27 23:10:33 +02:00
|
|
|
#include <stdbool.h>
|
2017-08-14 19:22:28 +02:00
|
|
|
#include <wayland-server.h>
|
2017-10-09 12:16:51 +02:00
|
|
|
#include <wlr/types/wlr_seat.h>
|
2017-08-14 19:22:28 +02:00
|
|
|
|
|
|
|
struct wlr_wl_shell {
|
|
|
|
struct wl_global *wl_global;
|
|
|
|
struct wl_list wl_resources;
|
2017-08-15 02:08:32 +02:00
|
|
|
struct wl_list surfaces;
|
2017-10-09 12:16:51 +02:00
|
|
|
struct wl_list popup_grabs;
|
2017-09-26 23:59:25 +02:00
|
|
|
uint32_t ping_timeout;
|
|
|
|
|
2017-12-07 01:05:49 +01:00
|
|
|
struct wl_listener display_destroy;
|
|
|
|
|
2017-09-26 23:59:25 +02:00
|
|
|
struct {
|
|
|
|
struct wl_signal new_surface;
|
|
|
|
} events;
|
2017-08-14 19:22:28 +02:00
|
|
|
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wlr_wl_shell_surface_transient_state {
|
|
|
|
int32_t x;
|
|
|
|
int32_t y;
|
2017-09-28 13:12:01 +02:00
|
|
|
enum wl_shell_surface_transient flags;
|
2017-09-27 21:15:31 +02:00
|
|
|
};
|
|
|
|
|
2017-09-27 23:10:33 +02:00
|
|
|
struct wlr_wl_shell_surface_popup_state {
|
2017-10-09 12:16:51 +02:00
|
|
|
struct wlr_seat *seat;
|
2017-09-27 23:10:33 +02:00
|
|
|
uint32_t serial;
|
|
|
|
};
|
|
|
|
|
2017-10-09 12:16:51 +02:00
|
|
|
// each seat gets a popup grab
|
|
|
|
struct wlr_wl_shell_popup_grab {
|
|
|
|
struct wl_client *client;
|
|
|
|
struct wlr_seat_pointer_grab pointer_grab;
|
|
|
|
struct wlr_seat *seat;
|
|
|
|
struct wl_list popups;
|
|
|
|
struct wl_list link; // wlr_wl_shell::popup_grabs
|
|
|
|
};
|
|
|
|
|
2017-09-28 12:45:47 +02:00
|
|
|
enum wlr_wl_shell_surface_state {
|
|
|
|
WLR_WL_SHELL_SURFACE_STATE_NONE,
|
|
|
|
WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL,
|
2017-11-09 20:06:05 +01:00
|
|
|
WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
|
|
|
|
WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
|
2017-09-28 12:45:47 +02:00
|
|
|
WLR_WL_SHELL_SURFACE_STATE_TRANSIENT,
|
|
|
|
WLR_WL_SHELL_SURFACE_STATE_POPUP,
|
2017-09-27 23:10:33 +02:00
|
|
|
};
|
|
|
|
|
2017-08-14 19:22:28 +02:00
|
|
|
struct wlr_wl_shell_surface {
|
2017-09-26 23:59:25 +02:00
|
|
|
struct wlr_wl_shell *shell;
|
|
|
|
struct wl_client *client;
|
2017-09-27 15:03:35 +02:00
|
|
|
struct wl_resource *resource;
|
|
|
|
struct wlr_surface *surface;
|
2017-10-10 16:28:43 +02:00
|
|
|
bool configured;
|
2017-10-10 18:24:56 +02:00
|
|
|
struct wl_list link; // wlr_wl_shell::surfaces
|
2017-08-14 19:22:28 +02:00
|
|
|
|
2017-09-26 23:59:25 +02:00
|
|
|
uint32_t ping_serial;
|
|
|
|
struct wl_event_source *ping_timer;
|
|
|
|
|
2017-09-28 12:45:47 +02:00
|
|
|
enum wlr_wl_shell_surface_state state;
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wlr_wl_shell_surface_transient_state *transient_state;
|
2017-09-27 23:10:33 +02:00
|
|
|
struct wlr_wl_shell_surface_popup_state *popup_state;
|
2017-10-09 12:16:51 +02:00
|
|
|
struct wl_list grab_link; // wlr_wl_shell_popup_grab::popups
|
2017-09-27 23:10:33 +02:00
|
|
|
|
2017-09-27 21:15:31 +02:00
|
|
|
char *title;
|
2017-09-27 23:47:39 +02:00
|
|
|
char *class;
|
2017-09-27 21:15:31 +02:00
|
|
|
|
2017-09-28 01:31:31 +02:00
|
|
|
struct wl_listener surface_destroy_listener;
|
|
|
|
|
2017-10-08 22:49:37 +02:00
|
|
|
struct wlr_wl_shell_surface *parent;
|
2017-10-10 16:54:10 +02:00
|
|
|
struct wl_list popup_link;
|
|
|
|
struct wl_list popups;
|
2017-10-10 18:20:39 +02:00
|
|
|
bool popup_mapped;
|
2017-10-08 22:49:37 +02:00
|
|
|
|
2017-09-26 23:59:25 +02:00
|
|
|
struct {
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wl_signal destroy;
|
2017-09-26 23:59:25 +02:00
|
|
|
struct wl_signal ping_timeout;
|
2018-01-22 16:01:32 +01:00
|
|
|
struct wl_signal new_popup;
|
2017-09-27 21:15:31 +02:00
|
|
|
|
|
|
|
struct wl_signal request_move;
|
|
|
|
struct wl_signal request_resize;
|
2017-11-21 09:50:00 +01:00
|
|
|
struct wl_signal request_fullscreen;
|
|
|
|
struct wl_signal request_maximize;
|
2017-09-27 23:10:33 +02:00
|
|
|
|
2017-09-28 12:45:47 +02:00
|
|
|
struct wl_signal set_state;
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wl_signal set_title;
|
|
|
|
struct wl_signal set_class;
|
2017-09-26 23:59:25 +02:00
|
|
|
} events;
|
|
|
|
|
2017-08-14 19:22:28 +02:00
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wlr_wl_shell_surface_move_event {
|
|
|
|
struct wlr_wl_shell_surface *surface;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat_client *seat;
|
2017-09-27 21:15:31 +02:00
|
|
|
uint32_t serial;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_wl_shell_surface_resize_event {
|
|
|
|
struct wlr_wl_shell_surface *surface;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat_client *seat;
|
2017-09-27 21:15:31 +02:00
|
|
|
uint32_t serial;
|
2017-09-28 13:12:01 +02:00
|
|
|
enum wl_shell_surface_resize edges;
|
2017-09-27 21:15:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct wlr_wl_shell_surface_set_fullscreen_event {
|
|
|
|
struct wlr_wl_shell_surface *surface;
|
2017-09-28 13:12:01 +02:00
|
|
|
enum wl_shell_surface_fullscreen_method method;
|
2017-09-27 21:15:31 +02:00
|
|
|
uint32_t framerate;
|
|
|
|
struct wlr_output *output;
|
|
|
|
};
|
|
|
|
|
2017-11-21 09:50:00 +01:00
|
|
|
struct wlr_wl_shell_surface_maximize_event {
|
2017-09-27 21:15:31 +02:00
|
|
|
struct wlr_wl_shell_surface *surface;
|
|
|
|
struct wlr_output *output;
|
|
|
|
};
|
|
|
|
|
2017-10-10 18:24:56 +02:00
|
|
|
/**
|
|
|
|
* Create a wl_shell for this display.
|
|
|
|
*/
|
2017-08-15 15:33:54 +02:00
|
|
|
struct wlr_wl_shell *wlr_wl_shell_create(struct wl_display *display);
|
2017-10-10 18:24:56 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy this surface.
|
|
|
|
*/
|
2017-08-14 19:22:28 +02:00
|
|
|
void wlr_wl_shell_destroy(struct wlr_wl_shell *wlr_wl_shell);
|
|
|
|
|
2017-10-10 18:24:56 +02:00
|
|
|
/**
|
|
|
|
* Send a ping to the surface. If the surface does not respond with a pong
|
|
|
|
* within a reasonable amount of time, the ping timeout event will be emitted.
|
|
|
|
*/
|
2017-09-26 23:59:25 +02:00
|
|
|
void wlr_wl_shell_surface_ping(struct wlr_wl_shell_surface *surface);
|
2017-10-10 18:24:56 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request that the surface configure itself to be the given size.
|
|
|
|
*/
|
2017-09-27 23:45:09 +02:00
|
|
|
void wlr_wl_shell_surface_configure(struct wlr_wl_shell_surface *surface,
|
2017-09-29 18:28:38 +02:00
|
|
|
enum wl_shell_surface_resize edges, int32_t width, int32_t height);
|
2017-09-26 23:59:25 +02:00
|
|
|
|
2017-10-10 16:00:09 +02:00
|
|
|
/**
|
2018-04-04 23:42:16 +02:00
|
|
|
* Find a surface within this wl-shell 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-10 16:00:09 +02:00
|
|
|
*/
|
2018-04-04 23:42:16 +02:00
|
|
|
struct wlr_surface *wlr_wl_shell_surface_surface_at(
|
2017-10-10 16:00:09 +02:00
|
|
|
struct wlr_wl_shell_surface *surface, double sx, double sy,
|
2018-04-04 23:42:16 +02:00
|
|
|
double *sub_sx, double *sub_sy);
|
2017-10-10 16:00:09 +02:00
|
|
|
|
2018-04-03 02:39:33 +02:00
|
|
|
bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface);
|
|
|
|
|
|
|
|
struct wlr_wl_surface *wlr_wl_shell_surface_from_wlr_surface(
|
|
|
|
struct wlr_surface *surface);
|
|
|
|
|
2018-04-05 02:10:47 +02:00
|
|
|
/**
|
|
|
|
* Call `iterator` on each surface in the shell 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_wl_shell_surface_for_each_surface(struct wlr_wl_shell_surface *surface,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
|
2017-08-14 19:22:28 +02:00
|
|
|
#endif
|