aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-11-02 23:17:39 -0400
committerDrew DeVault <sir@cmpwn.com>2017-11-02 23:17:39 -0400
commitca8cf7d48dc8de94494e23292c1687c1dad766f2 (patch)
tree24926b5062da15c1ac27d83d47cce93ab82d3fb4
parented74f473d60bb577aca9c7309664ae07d3ccf09b (diff)
Rethink HiDPI output layouts, fixes everything
Except for subsurfaces not rendering at the right scale. But that part is (somewhat) easy.
-rw-r--r--rootston/desktop.c9
-rw-r--r--rootston/output.c2
-rw-r--r--types/wlr_output.c5
3 files changed, 10 insertions, 6 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index a724a40c..f87be11e 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -167,15 +167,14 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
continue;
}
- int scale = view->wlr_surface->current->scale;
- double view_sx = (lx - view->x) / (double)scale;
- double view_sy = (ly - view->y) / (double)scale;
+ double view_sx = lx - view->x;
+ double view_sy = ly - view->y;
struct wlr_box box = {
.x = 0,
.y = 0,
- .width = view->wlr_surface->current->buffer_width * scale,
- .height = view->wlr_surface->current->buffer_height * scale,
+ .width = view->wlr_surface->current->buffer_width,
+ .height = view->wlr_surface->current->buffer_height,
};
if (view->rotation != 0.0) {
// Coordinates relative to the center of the view
diff --git a/rootston/output.c b/rootston/output.c
index 37af1e2d..c21c6781 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -25,6 +25,8 @@ static void render_surface(struct wlr_surface *surface,
int height = surface->current->buffer_height * scale_factor;
double ox = lx, oy = ly;
wlr_output_layout_output_coords(desktop->layout, wlr_output, &ox, &oy);
+ ox *= wlr_output->scale;
+ oy *= wlr_output->scale;
if (wlr_output_layout_intersects(desktop->layout, wlr_output,
lx, ly, lx + width, ly + height)) {
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 44d24ae3..82e805b4 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -227,7 +227,6 @@ void wlr_output_destroy(struct wlr_output *output) {
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height) {
- // TODO: Scale factor
if (output->transform % 2 == 1) {
*width = output->height;
*height = output->width;
@@ -235,6 +234,8 @@ void wlr_output_effective_resolution(struct wlr_output *output,
*width = output->width;
*height = output->height;
}
+ *width /= output->scale;
+ *height /= output->scale;
}
void wlr_output_make_current(struct wlr_output *output) {
@@ -450,6 +451,8 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
}
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
+ x *= cursor->output->scale;
+ y *= cursor->output->scale;
cursor->x = x;
cursor->y = y;