aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-18 09:25:33 +0100
committerGitHub <noreply@github.com>2018-03-18 09:25:33 +0100
commitbfc9b13dcd19d89c619281b4a7ad66c08116062c (patch)
tree97ac312c45a90ec9d15870faaafbc674436d407c /rootston
parent1956d3cedb533fb44a7f6a446afe84572838ca39 (diff)
parenta491f780b892b60aa65e17dc5dcb1752a2b78ee7 (diff)
Merge pull request #730 from martinetd/matrix_rotate
Rootston: fix rotation heading (was: wlr_matrix: fix matrix_rotate)
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c2
-rw-r--r--rootston/desktop.c4
-rw-r--r--rootston/output.c16
3 files changed, 11 insertions, 11 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index aa94daeb..52439dff 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -200,7 +200,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
uy = cursor->offs_y - oy;
int vx = cursor->cursor->x - ox,
vy = cursor->cursor->y - oy;
- float angle = atan2(vx*uy - vy*ux, vx*ux + vy*uy);
+ float angle = atan2(ux*vy - uy*vx, vx*ux + vy*uy);
int steps = 12;
angle = round(angle/M_PI*steps) / (steps/M_PI);
view_rotate(view, cursor->view_rotation + angle);
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 9730ca57..65d9a280 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -557,8 +557,8 @@ static bool view_at(struct roots_view *view, double lx, double ly,
double ox = view_sx - (double)box.width/2,
oy = view_sy - (double)box.height/2;
// Rotated coordinates
- double rx = cos(view->rotation)*ox - sin(view->rotation)*oy,
- ry = cos(view->rotation)*oy + sin(view->rotation)*ox;
+ double rx = cos(view->rotation)*ox + sin(view->rotation)*oy,
+ ry = cos(view->rotation)*oy - sin(view->rotation)*ox;
view_sx = rx + (double)box.width/2;
view_sy = ry + (double)box.height/2;
}
diff --git a/rootston/output.c b/rootston/output.c
index b8c73290..4146e3e2 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -29,8 +29,8 @@ static void rotate_child_position(double *sx, double *sy, double sw, double sh,
double ox = *sx - pw/2 + sw/2,
oy = *sy - ph/2 + sh/2;
// Rotated coordinates
- double rx = cos(-rotation)*ox - sin(-rotation)*oy,
- ry = cos(-rotation)*oy + sin(-rotation)*ox;
+ double rx = cos(rotation)*ox - sin(rotation)*oy,
+ ry = cos(rotation)*oy + sin(rotation)*ox;
*sx = rx + pw/2 - sw/2;
*sy = ry + ph/2 - sh/2;
}
@@ -227,7 +227,7 @@ static bool surface_intersect_output(struct wlr_surface *surface,
.x = lx, .y = ly,
.width = surface->current->width, .height = surface->current->height,
};
- wlr_box_rotated_bounds(&layout_box, -rotation, &layout_box);
+ wlr_box_rotated_bounds(&layout_box, rotation, &layout_box);
return wlr_output_layout_intersects(output_layout, wlr_output, &layout_box);
}
@@ -275,7 +275,7 @@ static void render_surface(struct wlr_surface *surface, double lx, double ly,
}
struct wlr_box rotated;
- wlr_box_rotated_bounds(&box, -rotation, &rotated);
+ wlr_box_rotated_bounds(&box, rotation, &rotated);
pixman_region32_t damage;
pixman_region32_init(&damage);
@@ -341,7 +341,7 @@ static void render_decorations(struct roots_view *view,
get_decoration_box(view, output, &box);
struct wlr_box rotated;
- wlr_box_rotated_bounds(&box, -view->rotation, &rotated);
+ wlr_box_rotated_bounds(&box, view->rotation, &rotated);
pixman_region32_t damage;
pixman_region32_init(&damage);
@@ -616,7 +616,7 @@ static void damage_whole_surface(struct wlr_surface *surface,
return;
}
- wlr_box_rotated_bounds(&box, -rotation, &box);
+ wlr_box_rotated_bounds(&box, rotation, &box);
wlr_output_damage_add_box(output->damage, &box);
}
@@ -630,7 +630,7 @@ static void damage_whole_decoration(struct roots_view *view,
struct wlr_box box;
get_decoration_box(view, output, &box);
- wlr_box_rotated_bounds(&box, -view->rotation, &box);
+ wlr_box_rotated_bounds(&box, view->rotation, &box);
wlr_output_damage_add_box(output->damage, &box);
}
@@ -689,7 +689,7 @@ static void damage_from_surface(struct wlr_surface *surface,
.width = (extents->x2 - extents->x1) * wlr_output->scale,
.height = (extents->y2 - extents->y1) * wlr_output->scale,
};
- wlr_box_rotated_bounds(&damage_box, -rotation, &damage_box);
+ wlr_box_rotated_bounds(&damage_box, rotation, &damage_box);
wlr_output_damage_add_box(output->damage, &damage_box);
}
}