aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c35
-rw-r--r--sway/desktop/wl_shell.c6
2 files changed, 38 insertions, 3 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 9182f8d5..ec204c6f 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -5,6 +5,7 @@
#include <wayland-server.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_surface.h>
+#include <wlr/types/wlr_wl_shell.h>
#include <wlr/render.h>
#include <wlr/render/matrix.h>
#include "log.h"
@@ -145,6 +146,34 @@ static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface,
}
}
+static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface,
+ struct wlr_output *wlr_output, struct timespec *when,
+ double lx, double ly, float rotation,
+ bool is_child) {
+ if (is_child || surface->state != WLR_WL_SHELL_SURFACE_STATE_POPUP) {
+ render_surface(surface->surface, wlr_output, when,
+ lx, ly, rotation);
+
+ double width = surface->surface->current->width;
+ double height = surface->surface->current->height;
+
+ struct wlr_wl_shell_surface *popup;
+ wl_list_for_each(popup, &surface->popups, popup_link) {
+ double popup_width = popup->surface->current->width;
+ double popup_height = popup->surface->current->height;
+
+ double popup_x = popup->transient_state->x;
+ double popup_y = popup->transient_state->y;
+ rotate_child_position(&popup_x, &popup_y, popup_width, popup_height,
+ width, height, rotation);
+
+ render_wl_shell_surface(popup, wlr_output, when,
+ lx + popup_x, ly + popup_y, rotation, true);
+ }
+ }
+}
+
+
static void output_frame_view(swayc_t *view, void *data) {
struct sway_output *output = data;
struct wlr_output *wlr_output = output->wlr_output;
@@ -166,10 +195,14 @@ static void output_frame_view(swayc_t *view, void *data) {
break;
}
case SWAY_WL_SHELL_VIEW:
+ render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output,
+ &output->last_frame, view->x, view->y, 0, false);
break;
case SWAY_XWAYLAND_VIEW:
+ render_surface(surface, wlr_output, &output->last_frame, view->x,
+ view->y, 0);
break;
- case SWAY_VIEW_TYPES:
+ default:
break;
}
}
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c
index 345a1398..e34f5160 100644
--- a/sway/desktop/wl_shell.c
+++ b/sway/desktop/wl_shell.c
@@ -77,11 +77,13 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
listener, server, wl_shell_surface);
struct wlr_wl_shell_surface *shell_surface = data;
- if (shell_surface->state != WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
- // TODO: transient and popups should be floating
+ if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_POPUP) {
+ // popups don't get views
return;
}
+ // TODO make transient windows floating
+
wlr_log(L_DEBUG, "New wl_shell toplevel title='%s' app_id='%s'",
shell_surface->title, shell_surface->class);
wlr_wl_shell_surface_ping(shell_surface);