aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-01-15 10:19:49 -0500
committerGitHub <noreply@github.com>2018-01-15 10:19:49 -0500
commiteb0f432a840dbe860b8c20f7a16e0281f9026326 (patch)
treea8b8e1a5a92a4203503ead496d8d50fd72fcf850 /sway/tree
parent5a23959242419169fa4af032d85ee3f65e7041e4 (diff)
parentddc49ede4636b01dad8d8bfb7d0314bf1eb88258 (diff)
Merge pull request #1566 from acrisci/render-loop
Subsurfaces and popups
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c30
-rw-r--r--sway/tree/layout.c1
2 files changed, 29 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 31ec2ce5..d241f69a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -207,7 +207,7 @@ swayc_t *destroy_output(swayc_t *output) {
}
swayc_t *destroy_view(swayc_t *view) {
- if (!sway_assert(view, "null view passed to destroy_view")) {
+ if (!view) {
return NULL;
}
wlr_log(L_DEBUG, "Destroying view '%s'", view->name);
@@ -259,7 +259,6 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
int width = swayc->sway_view->surface->current->width;
int height = swayc->sway_view->surface->current->height;
- // TODO popups and subsurfaces
switch (sview->type) {
case SWAY_WL_SHELL_VIEW:
break;
@@ -268,6 +267,20 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
// coordinate of the top left corner of the window geometry
view_sx += sview->wlr_xdg_surface_v6->geometry->x;
view_sy += sview->wlr_xdg_surface_v6->geometry->y;
+
+ // check for popups
+ double popup_sx, popup_sy;
+ struct wlr_xdg_surface_v6 *popup =
+ wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6,
+ view_sx, view_sy, &popup_sx, &popup_sy);
+
+ if (popup) {
+ *sx = view_sx - popup_sx;
+ *sy = view_sy - popup_sy;
+ *surface = popup->surface;
+ list_free(queue);
+ return swayc;
+ }
break;
case SWAY_XWAYLAND_VIEW:
break;
@@ -275,6 +288,19 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly,
break;
}
+ // check for subsurfaces
+ double sub_x, sub_y;
+ struct wlr_subsurface *subsurface =
+ wlr_surface_subsurface_at(sview->surface,
+ view_sx, view_sy, &sub_x, &sub_y);
+ if (subsurface) {
+ *sx = view_sx - sub_x;
+ *sy = view_sy - sub_y;
+ *surface = subsurface->surface;
+ list_free(queue);
+ return swayc;
+ }
+
if (view_sx > 0 && view_sx < width &&
view_sy > 0 && view_sy < height &&
pixman_region32_contains_point(
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 13b8a395..01535f2d 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -51,6 +51,7 @@ void init_layout(void) {
root_container.sway_root = calloc(1, sizeof(*root_container.sway_root));
root_container.sway_root->output_layout = wlr_output_layout_create();
+ wl_list_init(&root_container.sway_root->unmanaged_views);
root_container.sway_root->output_layout_change.notify =
output_layout_change_notify;