aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-03-02 13:42:35 +0100
committerDrew DeVault <sir@cmpwn.com>2019-03-02 09:37:05 -0700
commit6a60dafe596e3eed680f6176466d7855222d1395 (patch)
tree0b1215f63e7134bec2516def572592804239c4d3 /rootston
parentc2178d51a8af8bc70e4cf468ee4796ff2a9224fc (diff)
rootston: fix input events for rotated views
Diffstat (limited to 'rootston')
-rw-r--r--rootston/desktop.c18
-rw-r--r--rootston/output.c8
2 files changed, 6 insertions, 20 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 147cc084..9a14395d 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -51,22 +51,8 @@ static bool view_at(struct roots_view *view, double lx, double ly,
double view_sx = lx - view->box.x;
double view_sy = ly - view->box.y;
-
- struct wlr_surface_state *state = &view->wlr_surface->current;
- struct wlr_box box = {
- .x = 0, .y = 0,
- .width = state->width, .height = state->height,
- };
- if (view->rotation != 0.0) {
- // Coordinates relative to the center of the view
- 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;
- view_sx = rx + (double)box.width/2;
- view_sy = ry + (double)box.height/2;
- }
+ rotate_child_position(&view_sx, &view_sy, 0, 0,
+ view->box.width, view->box.height, -view->rotation);
double _sx, _sy;
struct wlr_surface *_surface = NULL;
diff --git a/rootston/output.c b/rootston/output.c
index a6cdc25d..bc2f4d6c 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -30,11 +30,11 @@ void rotate_child_position(double *sx, double *sy, double sw, double sh,
}
// Coordinates relative to the center of the subsurface
- double ox = *sx - pw/2 + sw/2,
- oy = *sy - ph/2 + sh/2;
+ double cx = *sx - pw/2 + sw/2,
+ cy = *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)*cx - sin(rotation)*cy,
+ ry = cos(rotation)*cy + sin(rotation)*cx;
*sx = rx + pw/2 - sw/2;
*sy = ry + ph/2 - sh/2;
}