aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index ad843b31..3b87c2e7 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -12,6 +12,8 @@
12#include "sway/output.h" 12#include "sway/output.h"
13#include "sway/server.h" 13#include "sway/server.h"
14#include "sway/view.h" 14#include "sway/view.h"
15#include "sway/input/input-manager.h"
16#include "sway/input/seat.h"
15 17
16static void output_frame_view(swayc_t *view, void *data) { 18static void output_frame_view(swayc_t *view, void *data) {
17 struct sway_output *output = data; 19 struct sway_output *output = data;
@@ -23,8 +25,8 @@ static void output_frame_view(swayc_t *view, void *data) {
23 } 25 }
24 // TODO 26 // TODO
25 // - Deal with wlr_output_layout 27 // - Deal with wlr_output_layout
26 int width = sway_view->width; 28 int width = sway_view->surface->current->width;
27 int height = sway_view->height; 29 int height = sway_view->surface->current->height;
28 int render_width = width * wlr_output->scale; 30 int render_width = width * wlr_output->scale;
29 int render_height = height * wlr_output->scale; 31 int render_height = height * wlr_output->scale;
30 double ox = view->x, oy = view->y; 32 double ox = view->x, oy = view->y;
@@ -38,19 +40,33 @@ static void output_frame_view(swayc_t *view, void *data) {
38 // return; 40 // return;
39 //} 41 //}
40 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
41 // TODO 54 // TODO
42 double rotation = 0; 55 double rotation = 0;
43 float matrix[16]; 56 float matrix[16];
44 57
45 float translate_origin[16]; 58 float translate_origin[16];
46 wlr_matrix_translate(&translate_origin, 59 wlr_matrix_translate(&translate_origin,
47 (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);
48 63
49 float rotate[16]; 64 float rotate[16];
50 wlr_matrix_rotate(&rotate, rotation); 65 wlr_matrix_rotate(&rotate, rotation);
51 66
52 float translate_center[16]; 67 float translate_center[16];
53 wlr_matrix_translate(&translate_center, -render_width / 2, 68 wlr_matrix_translate(&translate_center,
69 -render_width / 2,
54 -render_height / 2, 0); 70 -render_height / 2, 0);
55 71
56 float scale[16]; 72 float scale[16];
@@ -115,6 +131,8 @@ void output_add_notify(struct wl_listener *listener, void *data) {
115 return; 131 return;
116 } 132 }
117 133
134 sway_input_manager_configure_xcursor(input_manager);
135
118 output->frame.notify = output_frame_notify; 136 output->frame.notify = output_frame_notify;
119 wl_signal_add(&wlr_output->events.frame, &output->frame); 137 wl_signal_add(&wlr_output->events.frame, &output->frame);
120} 138}