diff options
Diffstat (limited to 'include/sway/tree/view.h')
-rw-r--r-- | include/sway/tree/view.h | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 3965d2b7..4b84205e 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <wlr/types/wlr_surface.h> | 4 | #include <wlr/types/wlr_surface.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include <wlr/xwayland.h> | 6 | #include <wlr/xwayland.h> |
7 | #include "sway/input/input-manager.h" | ||
8 | #include "sway/input/seat.h" | ||
7 | 9 | ||
8 | struct sway_container; | 10 | struct sway_container; |
9 | struct sway_view; | 11 | struct sway_view; |
@@ -37,6 +39,13 @@ struct sway_xwayland_surface { | |||
37 | int pending_width, pending_height; | 39 | int pending_width, pending_height; |
38 | }; | 40 | }; |
39 | 41 | ||
42 | struct sway_xwayland_unmanaged { | ||
43 | struct wlr_xwayland_surface *wlr_xwayland_surface; | ||
44 | struct wl_list link; | ||
45 | |||
46 | struct wl_listener destroy; | ||
47 | }; | ||
48 | |||
40 | struct sway_wl_shell_surface { | 49 | struct sway_wl_shell_surface { |
41 | struct sway_view *view; | 50 | struct sway_view *view; |
42 | 51 | ||
@@ -64,10 +73,21 @@ enum sway_view_prop { | |||
64 | VIEW_PROP_INSTANCE, | 73 | VIEW_PROP_INSTANCE, |
65 | }; | 74 | }; |
66 | 75 | ||
76 | struct sway_view_impl { | ||
77 | const char *(*get_prop)(struct sway_view *view, | ||
78 | enum sway_view_prop prop); | ||
79 | void (*configure)(struct sway_view *view, double ox, double oy, int width, | ||
80 | int height); | ||
81 | void (*set_activated)(struct sway_view *view, bool activated); | ||
82 | void (*close)(struct sway_view *view); | ||
83 | }; | ||
84 | |||
67 | struct sway_view { | 85 | struct sway_view { |
68 | enum sway_view_type type; | 86 | enum sway_view_type type; |
69 | struct sway_container *swayc; | 87 | const struct sway_view_impl *impl; |
70 | struct wlr_surface *surface; | 88 | |
89 | struct sway_container *swayc; // NULL for unmanaged views | ||
90 | struct wlr_surface *surface; // NULL for unmapped views | ||
71 | int width, height; | 91 | int width, height; |
72 | 92 | ||
73 | union { | 93 | union { |
@@ -82,21 +102,15 @@ struct sway_view { | |||
82 | struct sway_wl_shell_surface *sway_wl_shell_surface; | 102 | struct sway_wl_shell_surface *sway_wl_shell_surface; |
83 | }; | 103 | }; |
84 | 104 | ||
85 | struct { | ||
86 | const char *(*get_prop)(struct sway_view *view, | ||
87 | enum sway_view_prop prop); | ||
88 | void (*set_size)(struct sway_view *view, | ||
89 | int width, int height); | ||
90 | void (*set_position)(struct sway_view *view, | ||
91 | double ox, double oy); | ||
92 | void (*set_activated)(struct sway_view *view, bool activated); | ||
93 | void (*close)(struct sway_view *view); | ||
94 | } iface; | ||
95 | |||
96 | // only used for unmanaged views (shell specific) | 105 | // only used for unmanaged views (shell specific) |
97 | struct wl_list unmanaged_view_link; // sway_root::unmanaged views | 106 | struct wl_list unmanaged_view_link; // sway_root::unmanaged_views |
98 | }; | 107 | }; |
99 | 108 | ||
109 | struct sway_view *view_create(enum sway_view_type type, | ||
110 | const struct sway_view_impl *impl); | ||
111 | |||
112 | void view_destroy(struct sway_view *view); | ||
113 | |||
100 | const char *view_get_title(struct sway_view *view); | 114 | const char *view_get_title(struct sway_view *view); |
101 | 115 | ||
102 | const char *view_get_app_id(struct sway_view *view); | 116 | const char *view_get_app_id(struct sway_view *view); |
@@ -105,18 +119,25 @@ const char *view_get_class(struct sway_view *view); | |||
105 | 119 | ||
106 | const char *view_get_instance(struct sway_view *view); | 120 | const char *view_get_instance(struct sway_view *view); |
107 | 121 | ||
108 | void view_set_size(struct sway_view *view, int width, int height); | 122 | void view_configure(struct sway_view *view, double ox, double oy, int width, |
109 | 123 | int height); | |
110 | void view_set_position(struct sway_view *view, double ox, double oy); | ||
111 | 124 | ||
112 | void view_set_activated(struct sway_view *view, bool activated); | 125 | void view_set_activated(struct sway_view *view, bool activated); |
113 | 126 | ||
114 | void view_close(struct sway_view *view); | 127 | void view_close(struct sway_view *view); |
115 | 128 | ||
116 | void view_update_outputs(struct sway_view *view, const struct wlr_box *before); | ||
117 | |||
118 | void view_damage_whole(struct sway_view *view); | 129 | void view_damage_whole(struct sway_view *view); |
119 | 130 | ||
120 | void view_damage_from(struct sway_view *view); | 131 | void view_damage_from(struct sway_view *view); |
121 | 132 | ||
133 | // view implementation | ||
134 | |||
135 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); | ||
136 | |||
137 | void view_unmap(struct sway_view *view); | ||
138 | |||
139 | void view_update_position(struct sway_view *view, double ox, double oy); | ||
140 | |||
141 | void view_update_size(struct sway_view *view, int width, int height); | ||
142 | |||
122 | #endif | 143 | #endif |