aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-08-02 09:05:46 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-08-02 09:05:46 -0400
commit9aa258d33a9baa42895214da7e82f4568fcb8f76 (patch)
tree229419214ed67a2e4237b36cf0d1185f1406dad1 /sway/desktop
parentMerge pull request #2404 from RyanDwyer/move-containers-when-workspace-focused (diff)
downloadsway-9aa258d33a9baa42895214da7e82f4568fcb8f76.tar.gz
sway-9aa258d33a9baa42895214da7e82f4568fcb8f76.tar.zst
sway-9aa258d33a9baa42895214da7e82f4568fcb8f76.zip
Revert "Fix popups"
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c19
-rw-r--r--sway/desktop/render.c37
-rw-r--r--sway/desktop/xdg_shell.c9
-rw-r--r--sway/desktop/xdg_shell_v6.c10
4 files changed, 5 insertions, 70 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 66747a3f..31b53213 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -119,7 +119,7 @@ static void output_for_each_surface_iterator(struct wlr_surface *surface,
119 data->user_data); 119 data->user_data);
120} 120}
121 121
122void output_surface_for_each_surface(struct sway_output *output, 122static void output_surface_for_each_surface(struct sway_output *output,
123 struct wlr_surface *surface, double ox, double oy, 123 struct wlr_surface *surface, double ox, double oy,
124 sway_surface_iterator_func_t iterator, void *user_data) { 124 sway_surface_iterator_func_t iterator, void *user_data) {
125 struct surface_iterator_data data = { 125 struct surface_iterator_data data = {
@@ -155,23 +155,6 @@ void output_view_for_each_surface(struct sway_output *output,
155 output_for_each_surface_iterator, &data); 155 output_for_each_surface_iterator, &data);
156} 156}
157 157
158void output_view_for_each_popup(struct sway_output *output,
159 struct sway_view *view, sway_surface_iterator_func_t iterator,
160 void *user_data) {
161 struct surface_iterator_data data = {
162 .user_iterator = iterator,
163 .user_data = user_data,
164 .output = output,
165 .ox = view->swayc->current.view_x - output->swayc->current.swayc_x,
166 .oy = view->swayc->current.view_y - output->swayc->current.swayc_y,
167 .width = view->swayc->current.view_width,
168 .height = view->swayc->current.view_height,
169 .rotation = 0, // TODO
170 };
171
172 view_for_each_popup(view, output_for_each_surface_iterator, &data);
173}
174
175void output_layer_for_each_surface(struct sway_output *output, 158void output_layer_for_each_surface(struct sway_output *output,
176 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator, 159 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
177 void *user_data) { 160 void *user_data) {
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 1f374740..f0e47c95 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -186,36 +186,13 @@ static void premultiply_alpha(float color[4], float opacity) {
186 color[2] *= color[3]; 186 color[2] *= color[3];
187} 187}
188 188
189static void render_view_toplevels(struct sway_view *view, 189static void render_view_surfaces(struct sway_view *view,
190 struct sway_output *output, pixman_region32_t *damage, float alpha) { 190 struct sway_output *output, pixman_region32_t *damage, float alpha) {
191 struct render_data data = { 191 struct render_data data = {
192 .damage = damage, 192 .damage = damage,
193 .alpha = alpha, 193 .alpha = alpha,
194 }; 194 };
195 // Render all toplevels without descending into popups 195 output_view_for_each_surface(output, view, render_surface_iterator, &data);
196 output_surface_for_each_surface(output, view->surface,
197 view->swayc->current.view_x, view->swayc->current.view_y,
198 render_surface_iterator, &data);
199}
200
201static void render_popup_iterator(struct sway_output *output,
202 struct wlr_surface *surface, struct wlr_box *box, float rotation,
203 void *data) {
204 // Render this popup's surface
205 render_surface_iterator(output, surface, box, rotation, data);
206
207 // Render this popup's child toplevels
208 output_surface_for_each_surface(output, surface, box->x, box->y,
209 render_surface_iterator, data);
210}
211
212static void render_view_popups(struct sway_view *view,
213 struct sway_output *output, pixman_region32_t *damage, float alpha) {
214 struct render_data data = {
215 .damage = damage,
216 .alpha = alpha,
217 };
218 output_view_for_each_popup(output, view, render_popup_iterator, &data);
219} 196}
220 197
221static void render_saved_view(struct sway_view *view, 198static void render_saved_view(struct sway_view *view,
@@ -262,7 +239,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
262 if (view->saved_buffer) { 239 if (view->saved_buffer) {
263 render_saved_view(view, output, damage, view->swayc->alpha); 240 render_saved_view(view, output, damage, view->swayc->alpha);
264 } else { 241 } else {
265 render_view_toplevels(view, output, damage, view->swayc->alpha); 242 render_view_surfaces(view, output, damage, view->swayc->alpha);
266 } 243 }
267 244
268 if (view->using_csd) { 245 if (view->using_csd) {
@@ -866,7 +843,7 @@ void output_render(struct sway_output *output, struct timespec *when,
866 render_saved_view(fullscreen_con->sway_view, 843 render_saved_view(fullscreen_con->sway_view,
867 output, damage, 1.0f); 844 output, damage, 1.0f);
868 } else { 845 } else {
869 render_view_toplevels(fullscreen_con->sway_view, 846 render_view_surfaces(fullscreen_con->sway_view,
870 output, damage, 1.0f); 847 output, damage, 1.0f);
871 } 848 }
872 } else { 849 } else {
@@ -902,12 +879,6 @@ void output_render(struct sway_output *output, struct timespec *when,
902 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 879 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
903 } 880 }
904 881
905 struct sway_seat *seat = input_manager_current_seat(input_manager);
906 struct sway_container *focus = seat_get_focus(seat);
907 if (focus && focus->type == C_VIEW) {
908 render_view_popups(focus->sway_view, output, damage, focus->alpha);
909 }
910
911render_overlay: 882render_overlay:
912 render_layer(output, damage, 883 render_layer(output, damage,
913 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 884 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index b364663d..9d6b27e5 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -179,14 +179,6 @@ static void for_each_surface(struct sway_view *view,
179 user_data); 179 user_data);
180} 180}
181 181
182static void for_each_popup(struct sway_view *view,
183 wlr_surface_iterator_func_t iterator, void *user_data) {
184 if (xdg_shell_view_from_view(view) == NULL) {
185 return;
186 }
187 wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, iterator, user_data);
188}
189
190static void _close(struct sway_view *view) { 182static void _close(struct sway_view *view) {
191 if (xdg_shell_view_from_view(view) == NULL) { 183 if (xdg_shell_view_from_view(view) == NULL) {
192 return; 184 return;
@@ -227,7 +219,6 @@ static const struct sway_view_impl view_impl = {
227 .set_fullscreen = set_fullscreen, 219 .set_fullscreen = set_fullscreen,
228 .wants_floating = wants_floating, 220 .wants_floating = wants_floating,
229 .for_each_surface = for_each_surface, 221 .for_each_surface = for_each_surface,
230 .for_each_popup = for_each_popup,
231 .close = _close, 222 .close = _close,
232 .close_popups = close_popups, 223 .close_popups = close_popups,
233 .destroy = destroy, 224 .destroy = destroy,
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index ffea03ad..6e4aae62 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -175,15 +175,6 @@ static void for_each_surface(struct sway_view *view,
175 user_data); 175 user_data);
176} 176}
177 177
178static void for_each_popup(struct sway_view *view,
179 wlr_surface_iterator_func_t iterator, void *user_data) {
180 if (xdg_shell_v6_view_from_view(view) == NULL) {
181 return;
182 }
183 wlr_xdg_surface_v6_for_each_popup(view->wlr_xdg_surface_v6, iterator,
184 user_data);
185}
186
187static void _close(struct sway_view *view) { 178static void _close(struct sway_view *view) {
188 if (xdg_shell_v6_view_from_view(view) == NULL) { 179 if (xdg_shell_v6_view_from_view(view) == NULL) {
189 return; 180 return;
@@ -224,7 +215,6 @@ static const struct sway_view_impl view_impl = {
224 .set_fullscreen = set_fullscreen, 215 .set_fullscreen = set_fullscreen,
225 .wants_floating = wants_floating, 216 .wants_floating = wants_floating,
226 .for_each_surface = for_each_surface, 217 .for_each_surface = for_each_surface,
227 .for_each_popup = for_each_popup,
228 .close = _close, 218 .close = _close,
229 .close_popups = close_popups, 219 .close_popups = close_popups,
230 .destroy = destroy, 220 .destroy = destroy,