diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 35 | ||||
-rw-r--r-- | sway/desktop/wl_shell.c | 6 |
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 @@ | |||
5 | #include <wayland-server.h> | 5 | #include <wayland-server.h> |
6 | #include <wlr/types/wlr_output.h> | 6 | #include <wlr/types/wlr_output.h> |
7 | #include <wlr/types/wlr_surface.h> | 7 | #include <wlr/types/wlr_surface.h> |
8 | #include <wlr/types/wlr_wl_shell.h> | ||
8 | #include <wlr/render.h> | 9 | #include <wlr/render.h> |
9 | #include <wlr/render/matrix.h> | 10 | #include <wlr/render/matrix.h> |
10 | #include "log.h" | 11 | #include "log.h" |
@@ -145,6 +146,34 @@ static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface, | |||
145 | } | 146 | } |
146 | } | 147 | } |
147 | 148 | ||
149 | static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, | ||
150 | struct wlr_output *wlr_output, struct timespec *when, | ||
151 | double lx, double ly, float rotation, | ||
152 | bool is_child) { | ||
153 | if (is_child || surface->state != WLR_WL_SHELL_SURFACE_STATE_POPUP) { | ||
154 | render_surface(surface->surface, wlr_output, when, | ||
155 | lx, ly, rotation); | ||
156 | |||
157 | double width = surface->surface->current->width; | ||
158 | double height = surface->surface->current->height; | ||
159 | |||
160 | struct wlr_wl_shell_surface *popup; | ||
161 | wl_list_for_each(popup, &surface->popups, popup_link) { | ||
162 | double popup_width = popup->surface->current->width; | ||
163 | double popup_height = popup->surface->current->height; | ||
164 | |||
165 | double popup_x = popup->transient_state->x; | ||
166 | double popup_y = popup->transient_state->y; | ||
167 | rotate_child_position(&popup_x, &popup_y, popup_width, popup_height, | ||
168 | width, height, rotation); | ||
169 | |||
170 | render_wl_shell_surface(popup, wlr_output, when, | ||
171 | lx + popup_x, ly + popup_y, rotation, true); | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | |||
176 | |||
148 | static void output_frame_view(swayc_t *view, void *data) { | 177 | static void output_frame_view(swayc_t *view, void *data) { |
149 | struct sway_output *output = data; | 178 | struct sway_output *output = data; |
150 | struct wlr_output *wlr_output = output->wlr_output; | 179 | struct wlr_output *wlr_output = output->wlr_output; |
@@ -166,10 +195,14 @@ static void output_frame_view(swayc_t *view, void *data) { | |||
166 | break; | 195 | break; |
167 | } | 196 | } |
168 | case SWAY_WL_SHELL_VIEW: | 197 | case SWAY_WL_SHELL_VIEW: |
198 | render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, | ||
199 | &output->last_frame, view->x, view->y, 0, false); | ||
169 | break; | 200 | break; |
170 | case SWAY_XWAYLAND_VIEW: | 201 | case SWAY_XWAYLAND_VIEW: |
202 | render_surface(surface, wlr_output, &output->last_frame, view->x, | ||
203 | view->y, 0); | ||
171 | break; | 204 | break; |
172 | case SWAY_VIEW_TYPES: | 205 | default: |
173 | break; | 206 | break; |
174 | } | 207 | } |
175 | } | 208 | } |
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) { | |||
77 | listener, server, wl_shell_surface); | 77 | listener, server, wl_shell_surface); |
78 | struct wlr_wl_shell_surface *shell_surface = data; | 78 | struct wlr_wl_shell_surface *shell_surface = data; |
79 | 79 | ||
80 | if (shell_surface->state != WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) { | 80 | if (shell_surface->state == WLR_WL_SHELL_SURFACE_STATE_POPUP) { |
81 | // TODO: transient and popups should be floating | 81 | // popups don't get views |
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | 84 | ||
85 | // TODO make transient windows floating | ||
86 | |||
85 | wlr_log(L_DEBUG, "New wl_shell toplevel title='%s' app_id='%s'", | 87 | wlr_log(L_DEBUG, "New wl_shell toplevel title='%s' app_id='%s'", |
86 | shell_surface->title, shell_surface->class); | 88 | shell_surface->title, shell_surface->class); |
87 | wlr_wl_shell_surface_ping(shell_surface); | 89 | wlr_wl_shell_surface_ping(shell_surface); |