diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index d2003834..0e7f7060 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -25,8 +25,8 @@ static void output_frame_view(swayc_t *view, void *data) { | |||
25 | } | 25 | } |
26 | // TODO | 26 | // TODO |
27 | // - Deal with wlr_output_layout | 27 | // - Deal with wlr_output_layout |
28 | int width = sway_view->width; | 28 | int width = sway_view->surface->current->width; |
29 | int height = sway_view->height; | 29 | int height = sway_view->surface->current->height; |
30 | int render_width = width * wlr_output->scale; | 30 | int render_width = width * wlr_output->scale; |
31 | int render_height = height * wlr_output->scale; | 31 | int render_height = height * wlr_output->scale; |
32 | double ox = view->x, oy = view->y; | 32 | double ox = view->x, oy = view->y; |
@@ -40,19 +40,33 @@ static void output_frame_view(swayc_t *view, void *data) { | |||
40 | // return; | 40 | // return; |
41 | //} | 41 | //} |
42 | 42 | ||
43 | // if the shell specifies window geometry, make the top left corner of the | ||
44 | // window in the top left corner of the container to avoid arbitrarily | ||
45 | // sized gaps based on the attached buffer size | ||
46 | int window_offset_x = 0; | ||
47 | int window_offset_y = 0; | ||
48 | |||
49 | if (view->sway_view->type == SWAY_XDG_SHELL_V6_VIEW) { | ||
50 | window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry->x; | ||
51 | window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry->y; | ||
52 | } | ||
53 | |||
43 | // TODO | 54 | // TODO |
44 | double rotation = 0; | 55 | double rotation = 0; |
45 | float matrix[16]; | 56 | float matrix[16]; |
46 | 57 | ||
47 | float translate_origin[16]; | 58 | float translate_origin[16]; |
48 | wlr_matrix_translate(&translate_origin, | 59 | wlr_matrix_translate(&translate_origin, |
49 | (int)ox + render_width / 2, (int)oy + render_height / 2, 0); | 60 | (int)ox + render_width / 2 - window_offset_x, |
61 | (int)oy + render_height / 2 - window_offset_y, | ||
62 | 0); | ||
50 | 63 | ||
51 | float rotate[16]; | 64 | float rotate[16]; |
52 | wlr_matrix_rotate(&rotate, rotation); | 65 | wlr_matrix_rotate(&rotate, rotation); |
53 | 66 | ||
54 | float translate_center[16]; | 67 | float translate_center[16]; |
55 | wlr_matrix_translate(&translate_center, -render_width / 2, | 68 | wlr_matrix_translate(&translate_center, |
69 | -render_width / 2, | ||
56 | -render_height / 2, 0); | 70 | -render_height / 2, 0); |
57 | 71 | ||
58 | float scale[16]; | 72 | float scale[16]; |
@@ -122,10 +136,10 @@ void output_add_notify(struct wl_listener *listener, void *data) { | |||
122 | output->resolution.notify = output_resolution_notify; | 136 | output->resolution.notify = output_resolution_notify; |
123 | wl_signal_add(&wlr_output->events.resolution, &output->resolution); | 137 | wl_signal_add(&wlr_output->events.resolution, &output->resolution); |
124 | 138 | ||
125 | for (int i = 0; i < server->input->seats->length; ++i) { | 139 | for (int i = 0; i < server->input->seats->length; ++i) { |
126 | struct sway_seat *seat = server->input->seats->items[i]; | 140 | struct sway_seat *seat = server->input->seats->items[i]; |
127 | sway_seat_configure_xcursor(seat); | 141 | sway_seat_configure_xcursor(seat); |
128 | } | 142 | } |
129 | 143 | ||
130 | arrange_windows(output->swayc, -1, -1); | 144 | arrange_windows(output->swayc, -1, -1); |
131 | } | 145 | } |