From 0c8491f7d0c735299a25f0ab929f5d1e0866b929 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 11 Nov 2017 18:06:50 -0500 Subject: Initial (awful) pass on xdg shell support --- include/sway/container.h | 13 ++++------- include/sway/server.h | 6 ++++++ include/sway/view.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 include/sway/view.h (limited to 'include/sway') diff --git a/include/sway/container.h b/include/sway/container.h index 09e29291..d46ffa63 100644 --- a/include/sway/container.h +++ b/include/sway/container.h @@ -11,6 +11,8 @@ typedef struct sway_container swayc_t; extern swayc_t root_container; extern swayc_t *current_focus; +struct sway_view; + /** * Different kinds of containers. * @@ -27,14 +29,6 @@ enum swayc_types { C_TYPES, }; -enum swayc_view_types { - V_WL_SHELL, - V_XDG_SHELL_V6, - V_XWAYLAND, - // Keep last - V_TYPES, -}; - /** * Different ways to arrange a container. */ @@ -76,6 +70,7 @@ struct sway_container { union { struct sway_output *output; + struct sway_view *view; } _handle; /** @@ -207,7 +202,7 @@ swayc_t *new_container(swayc_t *child, enum swayc_layouts layout); * * Pass in a sibling view, or a workspace to become this container's parent. */ -swayc_t *new_view(swayc_t *sibling, wlc_handle handle); +swayc_t *new_view(swayc_t *sibling, struct sway_view *view); /** * Allocates a new floating view in the active workspace. */ diff --git a/include/sway/server.h b/include/sway/server.h index 043c1a33..5a8a8d31 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -5,6 +5,7 @@ #include #include #include +#include #include // TODO WLR: make Xwayland optional #include @@ -24,6 +25,9 @@ struct sway_server { struct wl_listener output_add; struct wl_listener output_remove; struct wl_listener output_frame; + + struct wlr_xdg_shell_v6 *xdg_shell_v6; + struct wl_listener xdg_shell_v6_surface; }; struct sway_server server; @@ -35,4 +39,6 @@ void server_run(struct sway_server *server); void output_add_notify(struct wl_listener *listener, void *data); void output_remove_notify(struct wl_listener *listener, void *data); +void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); + #endif diff --git a/include/sway/view.h b/include/sway/view.h new file mode 100644 index 00000000..979b20a8 --- /dev/null +++ b/include/sway/view.h @@ -0,0 +1,56 @@ +#ifndef _SWAY_VIEW_H +#define _SWAY_VIEW_H +#include +#include + +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; +}; + +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_CLASS, + VIEW_PROP_INSTANCE, + VIEW_PROP_APP_ID, +}; + +/** + * sway_view is a state container for surfaces that are arranged in the sway + * tree (shell surfaces). + */ +struct sway_view { + struct wl_listener destroy; + enum sway_view_type type; + struct sway_container *swayc; + + union { + struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; + }; + + union { + struct sway_xdg_surface_v6 *sway_xdg_surface_v6; + }; + + struct { + const char *(*get_prop)(struct sway_view *view, + enum sway_view_prop prop); + } iface; +}; + +#endif -- cgit v1.2.3