aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-02 09:15:21 -0400
committerTony Crisci <tony@dubstepdish.com>2017-10-02 19:10:36 -0400
commite003296c23fb0a974a13121cd940d6bf3fe63fac (patch)
tree8c00004c3b44f610f1b596bf5a1656d1b45720ad /rootston
parent86b66f1d6fbfc50be89b1e4987747fb7aa21cd31 (diff)
xdg-popup: render popups in the right place
Diffstat (limited to 'rootston')
-rw-r--r--rootston/output.c23
-rw-r--r--rootston/xdg_shell_v6.c11
2 files changed, 32 insertions, 2 deletions
diff --git a/rootston/output.c b/rootston/output.c
index 14d1783e..06786395 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -53,10 +53,33 @@ static void render_surface(struct wlr_surface *surface,
}
}
+static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface,
+ struct roots_desktop *desktop, struct wlr_output *wlr_output,
+ struct timespec *when, double base_x, double base_y) {
+ struct wlr_xdg_surface_v6 *popup;
+ wl_list_for_each(popup, &surface->popups, popup_link) {
+ if (!popup->configured) {
+ continue;
+ }
+
+ double popup_x = base_x + surface->geometry->x +
+ popup->popup_state->geometry.x - popup->geometry->x;
+ double popup_y = base_y + surface->geometry->y +
+ popup->popup_state->geometry.y - popup->geometry->y;
+ render_surface(popup->surface, desktop, wlr_output, when, popup_x,
+ popup_y);
+ render_xdg_v6_popups(popup, desktop, wlr_output, when, popup_x, popup_y);
+ }
+}
+
static void render_view(struct roots_view *view, struct roots_desktop *desktop,
struct wlr_output *wlr_output, struct timespec *when) {
render_surface(view->wlr_surface, desktop, wlr_output, when,
view->x, view->y);
+ if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
+ render_xdg_v6_popups(view->xdg_surface_v6, desktop, wlr_output,
+ when, view->x, view->y);
+ }
}
static void output_frame_notify(struct wl_listener *listener, void *data) {
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index ab34f52a..ff0dd090 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -73,11 +73,18 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
}
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
+ struct wlr_xdg_surface_v6 *surface = data;
+ assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE);
+
+ if (surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
+ wlr_log(L_DEBUG, "new xdg popup");
+ return;
+ }
+
struct roots_desktop *desktop =
wl_container_of(listener, desktop, xdg_shell_v6_surface);
- struct wlr_xdg_surface_v6 *surface = data;
- wlr_log(L_DEBUG, "new xdg surface: title=%s, app_id=%s",
+ wlr_log(L_DEBUG, "new xdg toplevel: title=%s, app_id=%s",
surface->title, surface->app_id);
wlr_xdg_surface_v6_ping(surface);