swayfx/include/sway/view.h

102 lines
2.3 KiB
C
Raw Normal View History

#ifndef _SWAY_VIEW_H
#define _SWAY_VIEW_H
#include <wayland-server.h>
2017-11-23 13:06:08 +11:00
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
2017-12-04 22:19:36 +11:00
#include <wlr/xwayland.h>
struct sway_container;
struct sway_view;
struct sway_xdg_surface_v6 {
struct sway_view *view;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
2017-11-26 08:30:15 +11:00
struct wl_listener destroy;
int pending_width, pending_height;
};
2017-12-04 22:19:36 +11:00
struct sway_xwayland_surface {
struct sway_view *view;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_configure;
2018-01-15 05:19:21 +11:00
struct wl_listener unmap_notify;
struct wl_listener map_notify;
2017-12-04 22:19:36 +11:00
struct wl_listener destroy;
int pending_width, pending_height;
};
2017-12-04 06:21:26 +11:00
struct sway_wl_shell_surface {
struct sway_view *view;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
2017-11-26 08:30:15 +11:00
struct wl_listener destroy;
int pending_width, pending_height;
};
enum sway_view_type {
SWAY_WL_SHELL_VIEW,
SWAY_XDG_SHELL_V6_VIEW,
SWAY_XWAYLAND_VIEW,
// Keep last
SWAY_VIEW_TYPES,
};
enum sway_view_prop {
VIEW_PROP_TITLE,
VIEW_PROP_APP_ID,
VIEW_PROP_CLASS,
VIEW_PROP_INSTANCE,
};
/**
* sway_view is a state container for surfaces that are arranged in the sway
* tree (shell surfaces).
*/
struct sway_view {
enum sway_view_type type;
struct sway_container *swayc;
2017-11-23 13:06:08 +11:00
struct wlr_surface *surface;
int width, height;
union {
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
2017-12-04 22:19:36 +11:00
struct wlr_xwayland_surface *wlr_xwayland_surface;
2017-12-04 02:49:13 +11:00
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
};
union {
struct sway_xdg_surface_v6 *sway_xdg_surface_v6;
2017-12-04 22:19:36 +11:00
struct sway_xwayland_surface *sway_xwayland_surface;
2017-12-04 02:49:13 +11:00
struct sway_wl_shell_surface *sway_wl_shell_surface;
};
struct {
const char *(*get_prop)(struct sway_view *view,
enum sway_view_prop prop);
2017-12-04 03:01:44 +11:00
void (*set_size)(struct sway_view *view,
2017-11-26 02:59:49 +11:00
int width, int height);
2017-12-06 03:02:31 +11:00
void (*set_position)(struct sway_view *view,
double ox, double oy);
2017-12-06 23:34:33 +11:00
void (*set_activated)(struct sway_view *view, bool activated);
} iface;
2018-01-15 05:19:21 +11:00
// only used for unmanaged views (shell specific)
struct wl_list unmanaged_view_link; // sway_root::unmanaged views
};
#endif