summaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell_v6.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r--sway/desktop/xdg_shell_v6.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index d098c797..47e4162a 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -97,6 +97,7 @@ static void configure(struct sway_view *view, double ox, double oy, int width,
97 xdg_shell_v6_view->pending_width = width; 97 xdg_shell_v6_view->pending_width = width;
98 xdg_shell_v6_view->pending_height = height; 98 xdg_shell_v6_view->pending_height = height;
99 wlr_xdg_toplevel_v6_set_size(view->wlr_xdg_surface_v6, width, height); 99 wlr_xdg_toplevel_v6_set_size(view->wlr_xdg_surface_v6, width, height);
100 view_update_position(view, ox, oy);
100} 101}
101 102
102static void set_activated(struct sway_view *view, bool activated) { 103static void set_activated(struct sway_view *view, bool activated) {
@@ -109,6 +110,14 @@ static void set_activated(struct sway_view *view, bool activated) {
109 } 110 }
110} 111}
111 112
113static void set_maximized(struct sway_view *view, bool maximized) {
114 if (xdg_shell_v6_view_from_view(view) == NULL) {
115 return;
116 }
117 struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6;
118 wlr_xdg_toplevel_v6_set_maximized(surface, maximized);
119}
120
112static void set_fullscreen(struct sway_view *view, bool fullscreen) { 121static void set_fullscreen(struct sway_view *view, bool fullscreen) {
113 if (xdg_shell_v6_view_from_view(view) == NULL) { 122 if (xdg_shell_v6_view_from_view(view) == NULL) {
114 return; 123 return;
@@ -117,6 +126,11 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
117 wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen); 126 wlr_xdg_toplevel_v6_set_fullscreen(surface, fullscreen);
118} 127}
119 128
129static bool wants_floating(struct sway_view *view) {
130 // TODO
131 return false;
132}
133
120static void for_each_surface(struct sway_view *view, 134static void for_each_surface(struct sway_view *view,
121 wlr_surface_iterator_func_t iterator, void *user_data) { 135 wlr_surface_iterator_func_t iterator, void *user_data) {
122 if (xdg_shell_v6_view_from_view(view) == NULL) { 136 if (xdg_shell_v6_view_from_view(view) == NULL) {
@@ -153,7 +167,9 @@ static const struct sway_view_impl view_impl = {
153 .get_string_prop = get_string_prop, 167 .get_string_prop = get_string_prop,
154 .configure = configure, 168 .configure = configure,
155 .set_activated = set_activated, 169 .set_activated = set_activated,
170 .set_maximized = set_maximized,
156 .set_fullscreen = set_fullscreen, 171 .set_fullscreen = set_fullscreen,
172 .wants_floating = wants_floating,
157 .for_each_surface = for_each_surface, 173 .for_each_surface = for_each_surface,
158 .close = _close, 174 .close = _close,
159 .destroy = destroy, 175 .destroy = destroy,
@@ -163,11 +179,17 @@ static void handle_commit(struct wl_listener *listener, void *data) {
163 struct sway_xdg_shell_v6_view *xdg_shell_v6_view = 179 struct sway_xdg_shell_v6_view *xdg_shell_v6_view =
164 wl_container_of(listener, xdg_shell_v6_view, commit); 180 wl_container_of(listener, xdg_shell_v6_view, commit);
165 struct sway_view *view = &xdg_shell_v6_view->view; 181 struct sway_view *view = &xdg_shell_v6_view->view;
166 // NOTE: We intentionally discard the view's desired width here 182 struct wlr_box *geometry = &view->wlr_xdg_surface_v6->geometry;
167 // TODO: Store this for restoration when moving to floating plane 183 if (!view->natural_width && !view->natural_height) {
168 // TODO: Let floating views do whatever 184 view->natural_width = geometry->width;
169 view_update_size(view, xdg_shell_v6_view->pending_width, 185 view->natural_height = geometry->height;
170 xdg_shell_v6_view->pending_height); 186 }
187 if (view->swayc && view->swayc->is_floating) {
188 view_update_size(view, geometry->width, geometry->height);
189 } else {
190 view_update_size(view, xdg_shell_v6_view->pending_width,
191 xdg_shell_v6_view->pending_height);
192 }
171 view_update_title(view, false); 193 view_update_title(view, false);
172 view_damage_from(view); 194 view_damage_from(view);
173} 195}