aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-09-27 10:42:35 +0200
committeremersion <contact@emersion.fr>2018-09-27 10:42:35 +0200
commit792b1f5cbf98fab1ba1080b0bf7c5c592d6f0301 (patch)
tree32316f2a8554b916dafdc3b806c80fbff72442e3
parentdac4f8e19ffd19dfeee2c65270476a52c13d0f8f (diff)
rootston: remove broken rotated pointer constraint handling
-rw-r--r--rootston/cursor.c43
1 files changed, 8 insertions, 35 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 08a71ec4..9a163c63 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -314,19 +314,14 @@ void roots_cursor_handle_motion(struct roots_cursor *cursor,
struct roots_view *view = cursor->pointer_view->view;
assert(view);
- double center_x = view->x + view->width / 2.;
- double center_y = view->y + view->height / 2.;
-
- double lx1 = cursor->cursor->x;
- double ly1 = cursor->cursor->y;
+ // TODO: handle rotated views
+ if (view->rotation == 0.0) {
+ double lx1 = cursor->cursor->x;
+ double ly1 = cursor->cursor->y;
- double lx2 = lx1 + dx;
- double ly2 = ly1 + dy;
+ double lx2 = lx1 + dx;
+ double ly2 = ly1 + dy;
- // Optimization for most common case.
- // This also makes sure that we don't encounter
- // precision bugs in the most common case.
- if (view->rotation == 0.0) {
double sx1 = lx1 - view->x;
double sy1 = ly1 - view->y;
@@ -334,35 +329,13 @@ void roots_cursor_handle_motion(struct roots_cursor *cursor,
double sy2 = ly2 - view->y;
double sx2_confined, sy2_confined;
- if (!wlr_region_confine(&cursor->confine, sx1, sy1, sx2, sy2, &sx2_confined, &sy2_confined)) {
+ if (!wlr_region_confine(&cursor->confine, sx1, sy1, sx2, sy2,
+ &sx2_confined, &sy2_confined)) {
return;
}
dx = sx2_confined - sx1;
dy = sy2_confined - sy1;
- } else {
- assert(false);
- double c = cos(view->rotation);
- double s = sin(view->rotation);
-
- double sx1 = c * (lx1 - center_x) - s * (ly1 - center_y) + view->width / 2.;
- double sy1 = s * (lx1 - center_x) + c * (ly1 - center_y) + view->height / 2.;
-
- double sx2 = c * (lx2 - center_x) - s * (ly2 - center_y) + view->width / 2.;
- double sy2 = s * (lx2 - center_x) + c * (ly2 - center_y) + view->height / 2.;
-
- double sx2_confined, sy2_confined;
- if (!wlr_region_confine(&cursor->confine, sx1, sy1, sx2, sy2, &sx2_confined, &sy2_confined)) {
- return;
- }
-
- // avoid NaNs
- double fraction = (sx2 - sx1) > (sy2 - sy1) ?
- (sx2_confined - sx1) / (sx2 - sx1) :
- (sy2_confined - sy1) / (sy2 - sy1);
-
- dx *= fraction;
- dy *= fraction;
}
}