summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-14 10:47:19 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-14 10:47:19 -0500
commit76ce62919830b2917c696f599e7710ce05d109c0 (patch)
tree3bc06a2cafc611dd436ec8a8255452a63ff81cfe
parentrender xdg surface (diff)
downloadsway-76ce62919830b2917c696f599e7710ce05d109c0.tar.gz
sway-76ce62919830b2917c696f599e7710ce05d109c0.tar.zst
sway-76ce62919830b2917c696f599e7710ce05d109c0.zip
xdg-popups
-rw-r--r--sway/desktop/output.c31
-rw-r--r--sway/tree/container.c15
2 files changed, 45 insertions, 1 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 1e9a823a..9182f8d5 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -118,6 +118,33 @@ static void render_surface(struct wlr_surface *surface,
118 } 118 }
119} 119}
120 120
121static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface,
122 struct wlr_output *wlr_output, struct timespec *when, double base_x,
123 double base_y, float rotation) {
124 double width = surface->surface->current->width;
125 double height = surface->surface->current->height;
126
127 struct wlr_xdg_surface_v6 *popup;
128 wl_list_for_each(popup, &surface->popups, popup_link) {
129 if (!popup->configured) {
130 continue;
131 }
132
133 double popup_width = popup->surface->current->width;
134 double popup_height = popup->surface->current->height;
135
136 double popup_sx, popup_sy;
137 wlr_xdg_surface_v6_popup_get_position(popup, &popup_sx, &popup_sy);
138 rotate_child_position(&popup_sx, &popup_sy, popup_width, popup_height,
139 width, height, rotation);
140
141 render_surface(popup->surface, wlr_output, when,
142 base_x + popup_sx, base_y + popup_sy, rotation);
143 render_xdg_v6_popups(popup, wlr_output, when,
144 base_x + popup_sx, base_y + popup_sy, rotation);
145 }
146}
147
121static void output_frame_view(swayc_t *view, void *data) { 148static void output_frame_view(swayc_t *view, void *data) {
122 struct sway_output *output = data; 149 struct sway_output *output = data;
123 struct wlr_output *wlr_output = output->wlr_output; 150 struct wlr_output *wlr_output = output->wlr_output;
@@ -132,6 +159,10 @@ static void output_frame_view(swayc_t *view, void *data) {
132 view->x - window_offset_x, 159 view->x - window_offset_x,
133 view->y - window_offset_y, 160 view->y - window_offset_y,
134 0); 161 0);
162 render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output,
163 &output->last_frame,
164 view->x - window_offset_x, view->y - window_offset_y,
165 0);
135 break; 166 break;
136 } 167 }
137 case SWAY_WL_SHELL_VIEW: 168 case SWAY_WL_SHELL_VIEW:
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 31ec2ce5..82f68519 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -259,7 +259,6 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
259 int width = swayc->sway_view->surface->current->width; 259 int width = swayc->sway_view->surface->current->width;
260 int height = swayc->sway_view->surface->current->height; 260 int height = swayc->sway_view->surface->current->height;
261 261
262 // TODO popups and subsurfaces
263 switch (sview->type) { 262 switch (sview->type) {
264 case SWAY_WL_SHELL_VIEW: 263 case SWAY_WL_SHELL_VIEW:
265 break; 264 break;
@@ -268,6 +267,20 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
268 // coordinate of the top left corner of the window geometry 267 // coordinate of the top left corner of the window geometry
269 view_sx += sview->wlr_xdg_surface_v6->geometry->x; 268 view_sx += sview->wlr_xdg_surface_v6->geometry->x;
270 view_sy += sview->wlr_xdg_surface_v6->geometry->y; 269 view_sy += sview->wlr_xdg_surface_v6->geometry->y;
270
271 // check for popups
272 double popup_sx, popup_sy;
273 struct wlr_xdg_surface_v6 *popup =
274 wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6,
275 view_sx, view_sy, &popup_sx, &popup_sy);
276
277 if (popup) {
278 *sx = view_sx - popup_sx;
279 *sy = view_sy - popup_sy;
280 *surface = popup->surface;
281 list_free(queue);
282 return swayc;
283 }
271 break; 284 break;
272 case SWAY_XWAYLAND_VIEW: 285 case SWAY_XWAYLAND_VIEW:
273 break; 286 break;