aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-19 18:15:11 +0100
committeremersion <contact@emersion.fr>2017-11-19 18:15:11 +0100
commita8b31da52c32a65793d6e941b869d5f2d6736775 (patch)
tree13085dcfbf1c8d0001bc03cc8ed59afe001e27bc /rootston/cursor.c
parent76e8e1a6ad8ac3947b568bec32b7ed0acd69bef1 (diff)
Remove roots_seat_{add,remove}_view
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r--rootston/cursor.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 7bb46692..046fd4f4 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -58,19 +58,21 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
}
break;
case ROOTS_CURSOR_MOVE:
- if (seat->focus) {
+ view = roots_seat_get_focused_view(seat);
+ if (view != NULL) {
double dx = cursor->cursor->x - cursor->offs_x;
double dy = cursor->cursor->y - cursor->offs_y;
- view_move(seat->focus->view, cursor->view_x + dx,
+ view_move(view, cursor->view_x + dx,
cursor->view_y + dy);
}
break;
case ROOTS_CURSOR_RESIZE:
- if (seat->focus) {
+ view = roots_seat_get_focused_view(seat);
+ if (view != NULL) {
double dx = cursor->cursor->x - cursor->offs_x;
double dy = cursor->cursor->y - cursor->offs_y;
- double active_x = seat->focus->view->x;
- double active_y = seat->focus->view->y;
+ double active_x = view->x;
+ double active_y = view->y;
int width = cursor->view_width;
int height = cursor->view_height;
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
@@ -99,18 +101,18 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
height = 0;
}
- if (active_x != seat->focus->view->x ||
- active_y != seat->focus->view->y) {
- view_move_resize(seat->focus->view, active_x, active_y,
+ if (active_x != view->x ||
+ active_y != view->y) {
+ view_move_resize(view, active_x, active_y,
width, height);
} else {
- view_resize(seat->focus->view, width, height);
+ view_resize(view, width, height);
}
}
break;
case ROOTS_CURSOR_ROTATE:
- if (seat->focus) {
- struct roots_view *view = seat->focus->view;
+ view = roots_seat_get_focused_view(seat);
+ if (view != NULL) {
int ox = view->x + view->wlr_surface->current->width/2,
oy = view->y + view->wlr_surface->current->height/2;
int ux = cursor->offs_x - ox,
@@ -124,7 +126,6 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
}
break;
}
-
}
static void roots_cursor_press_button(struct roots_cursor *cursor,