mirror of
https://github.com/swaywm/sway.git
synced 2025-11-15 06:59:50 -05:00
Initial (awful) pass on xdg shell support
This commit is contained in:
parent
1efd5f819f
commit
0c8491f7d0
8 changed files with 223 additions and 37 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/types/wlr_data_device_manager.h>
|
||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||
#include <wlr/render.h>
|
||||
// TODO WLR: make Xwayland optional
|
||||
#include <wlr/xwayland.h>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
56
include/sway/view.h
Normal file
56
include/sway/view.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef _SWAY_VIEW_H
|
||||
#define _SWAY_VIEW_H
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_xdg_shell_v6.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;
|
||||
};
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue