diff options
Diffstat (limited to 'include/sway/tree/view.h')
-rw-r--r-- | include/sway/tree/view.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h new file mode 100644 index 00000000..e5f53f4e --- /dev/null +++ b/include/sway/tree/view.h | |||
@@ -0,0 +1,116 @@ | |||
1 | #ifndef _SWAY_VIEW_H | ||
2 | #define _SWAY_VIEW_H | ||
3 | #include <wayland-server.h> | ||
4 | #include <wlr/types/wlr_surface.h> | ||
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | ||
6 | #include <wlr/xwayland.h> | ||
7 | |||
8 | struct sway_container; | ||
9 | struct sway_view; | ||
10 | |||
11 | struct sway_xdg_surface_v6 { | ||
12 | struct sway_view *view; | ||
13 | |||
14 | struct wl_listener commit; | ||
15 | struct wl_listener request_move; | ||
16 | struct wl_listener request_resize; | ||
17 | struct wl_listener request_maximize; | ||
18 | struct wl_listener destroy; | ||
19 | |||
20 | int pending_width, pending_height; | ||
21 | }; | ||
22 | |||
23 | struct sway_xwayland_surface { | ||
24 | struct sway_view *view; | ||
25 | |||
26 | struct wl_listener commit; | ||
27 | struct wl_listener request_move; | ||
28 | struct wl_listener request_resize; | ||
29 | struct wl_listener request_maximize; | ||
30 | struct wl_listener request_configure; | ||
31 | struct wl_listener unmap_notify; | ||
32 | struct wl_listener map_notify; | ||
33 | struct wl_listener destroy; | ||
34 | |||
35 | int pending_width, pending_height; | ||
36 | }; | ||
37 | |||
38 | struct sway_wl_shell_surface { | ||
39 | struct sway_view *view; | ||
40 | |||
41 | struct wl_listener commit; | ||
42 | struct wl_listener request_move; | ||
43 | struct wl_listener request_resize; | ||
44 | struct wl_listener request_maximize; | ||
45 | struct wl_listener destroy; | ||
46 | |||
47 | int pending_width, pending_height; | ||
48 | }; | ||
49 | |||
50 | enum sway_view_type { | ||
51 | SWAY_WL_SHELL_VIEW, | ||
52 | SWAY_XDG_SHELL_V6_VIEW, | ||
53 | SWAY_XWAYLAND_VIEW, | ||
54 | // Keep last | ||
55 | SWAY_VIEW_TYPES, | ||
56 | }; | ||
57 | |||
58 | enum sway_view_prop { | ||
59 | VIEW_PROP_TITLE, | ||
60 | VIEW_PROP_APP_ID, | ||
61 | VIEW_PROP_CLASS, | ||
62 | VIEW_PROP_INSTANCE, | ||
63 | }; | ||
64 | |||
65 | struct sway_view { | ||
66 | enum sway_view_type type; | ||
67 | struct sway_container *swayc; | ||
68 | struct wlr_surface *surface; | ||
69 | int width, height; | ||
70 | |||
71 | union { | ||
72 | struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6; | ||
73 | struct wlr_xwayland_surface *wlr_xwayland_surface; | ||
74 | struct wlr_wl_shell_surface *wlr_wl_shell_surface; | ||
75 | }; | ||
76 | |||
77 | union { | ||
78 | struct sway_xdg_surface_v6 *sway_xdg_surface_v6; | ||
79 | struct sway_xwayland_surface *sway_xwayland_surface; | ||
80 | struct sway_wl_shell_surface *sway_wl_shell_surface; | ||
81 | }; | ||
82 | |||
83 | struct { | ||
84 | const char *(*get_prop)(struct sway_view *view, | ||
85 | enum sway_view_prop prop); | ||
86 | void (*set_size)(struct sway_view *view, | ||
87 | int width, int height); | ||
88 | void (*set_position)(struct sway_view *view, | ||
89 | double ox, double oy); | ||
90 | void (*set_activated)(struct sway_view *view, bool activated); | ||
91 | void (*close)(struct sway_view *view); | ||
92 | } iface; | ||
93 | |||
94 | // only used for unmanaged views (shell specific) | ||
95 | struct wl_list unmanaged_view_link; // sway_root::unmanaged views | ||
96 | }; | ||
97 | |||
98 | const char *view_get_title(struct sway_view *view); | ||
99 | |||
100 | const char *view_get_app_id(struct sway_view *view); | ||
101 | |||
102 | const char *view_get_class(struct sway_view *view); | ||
103 | |||
104 | const char *view_get_instance(struct sway_view *view); | ||
105 | |||
106 | void view_set_size(struct sway_view *view, int width, int height); | ||
107 | |||
108 | void view_set_position(struct sway_view *view, double ox, double oy); | ||
109 | |||
110 | void view_set_activated(struct sway_view *view, bool activated); | ||
111 | |||
112 | void view_close(struct sway_view *view); | ||
113 | |||
114 | void view_update_outputs(struct sway_view *view, const struct wlr_box *before); | ||
115 | |||
116 | #endif | ||