diff options
author | emersion <contact@emersion.fr> | 2017-11-20 14:35:31 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-11-20 14:35:31 +0100 |
commit | 1d08d317096a80f96d03cd67303381bdedaaac2a (patch) | |
tree | 0c2115f562fe6b5f6a609b561a05dbb9dddda10c /rootston/cursor.c | |
parent | 272e0858e49bf341b363fdbe59a5f669ba678ce2 (diff) | |
parent | c3e0fbdb8f0cb16d99e70d14bb5cef6bd48d4591 (diff) |
Merge branch 'master' into laggy-move-resize
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r-- | rootston/cursor.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c index 93ee03d4..3cd5da40 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_focus(seat); + if (view != NULL) { double dx = cursor->cursor->x - cursor->offs_x; double dy = cursor->cursor->y - cursor->offs_y; - view_move(seat->focus, 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_focus(seat); + if (view != NULL) { double dx = cursor->cursor->x - cursor->offs_x; double dy = cursor->cursor->y - cursor->offs_y; - double x = seat->focus->x; - double y = seat->focus->y; + double x = view->x; + double y = view->y; int width = cursor->view_width; int height = cursor->view_height; if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) { @@ -99,12 +101,12 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, height = 1; } - view_move_resize(seat->focus, x, y, width, height); + view_move_resize(view, x, y, width, height); } break; case ROOTS_CURSOR_ROTATE: - if (seat->focus) { - struct roots_view *view = seat->focus; + view = roots_seat_get_focus(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, @@ -118,7 +120,6 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, } break; } - } static void roots_cursor_press_button(struct roots_cursor *cursor, @@ -135,7 +136,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, if (state == WLR_BUTTON_PRESSED && view && roots_seat_has_meta_pressed(seat)) { - roots_seat_focus_view(seat, view); + roots_seat_set_focus(seat, view); uint32_t edges; switch (button) { @@ -186,7 +187,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, cursor->input_events[i].device = device; cursor->input_events_idx = (i + 1) % (sizeof(cursor->input_events) / sizeof(cursor->input_events[0])); - roots_seat_focus_view(seat, view); + roots_seat_set_focus(seat, view); break; } } |