aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-08 22:25:06 +0100
committeremersion <contact@emersion.fr>2017-11-08 22:25:06 +0100
commit4df8be1a8f32ea59f88a179104885c0452a89d6e (patch)
treef391f60de99ee67bc11d18681ade2876ac6a44ea
parent03d3fdc15879c6fbdd24d5fe1d60f9a77402220d (diff)
Better UX when moving/resizing/rotating maximized views
-rw-r--r--rootston/cursor.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index d97d518e..80836ccd 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -39,13 +39,18 @@ static void cursor_set_xcursor_image(struct roots_input *input,
void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view) {
- view_maximize(view, false);
-
input->mode = ROOTS_CURSOR_MOVE;
input->offs_x = cursor->x;
input->offs_y = cursor->y;
- input->view_x = view->x;
- input->view_y = view->y;
+ if (view->maximized) {
+ input->view_x = view->saved.x;
+ input->view_y = view->saved.y;
+ } else {
+ input->view_x = view->x;
+ input->view_y = view->y;
+ }
+
+ view_maximize(view, false);
wlr_seat_pointer_clear_focus(input->wl_seat);
struct wlr_xcursor *xcursor = get_move_xcursor(input->xcursor_theme);
@@ -56,18 +61,25 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view, uint32_t edges) {
- view_maximize(view, false);
-
input->mode = ROOTS_CURSOR_RESIZE;
input->offs_x = cursor->x;
input->offs_y = cursor->y;
- input->view_x = view->x;
- input->view_y = view->y;
- struct wlr_box size;
- view_get_size(view, &size);
- input->view_width = size.width;
- input->view_height = size.height;
+ if (view->maximized) {
+ input->view_x = view->saved.x;
+ input->view_y = view->saved.y;
+ input->view_width = view->saved.width;
+ input->view_height = view->saved.height;
+ } else {
+ input->view_x = view->x;
+ input->view_y = view->y;
+ struct wlr_box size;
+ view_get_size(view, &size);
+ input->view_width = size.width;
+ input->view_height = size.height;
+ }
input->resize_edges = edges;
+
+ view_maximize(view, false);
wlr_seat_pointer_clear_focus(input->wl_seat);
struct wlr_xcursor *xcursor = get_resize_xcursor(input->xcursor_theme, edges);
@@ -78,12 +90,12 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
void view_begin_rotate(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view) {
- view_maximize(view, false);
-
input->mode = ROOTS_CURSOR_ROTATE;
input->offs_x = cursor->x;
input->offs_y = cursor->y;
input->view_rotation = view->rotation;
+
+ view_maximize(view, false);
wlr_seat_pointer_clear_focus(input->wl_seat);
struct wlr_xcursor *xcursor = get_rotate_xcursor(input->xcursor_theme);