diff options
Diffstat (limited to 'rootston/cursor.c')
| -rw-r--r-- | rootston/cursor.c | 46 | 
1 files changed, 37 insertions, 9 deletions
| diff --git a/rootston/cursor.c b/rootston/cursor.c index b153e8c8..cbd03af1 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -42,8 +42,15 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,  	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); @@ -57,13 +64,22 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,  	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,6 +94,8 @@ void view_begin_rotate(struct roots_input *input, struct wlr_cursor *cursor,  	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); @@ -102,7 +120,8 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {  			set_compositor_cursor = view_client != input->cursor_client;  		}  		if (set_compositor_cursor) { -			struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme); +			struct wlr_xcursor *xcursor = +				get_default_xcursor(input->xcursor_theme);  			cursor_set_xcursor_image(input, xcursor->images[0]);  			input->cursor_client = NULL;  		} @@ -383,11 +402,20 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {  static void handle_tool_axis(struct wl_listener *listener, void *data) {  	struct roots_input *input = wl_container_of(listener, input, cursor_tool_axis);  	struct wlr_event_tablet_tool_axis *event = data; +  	if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) &&  			(event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) {  		wlr_cursor_warp_absolute(input->cursor, event->device,  			event->x_mm / event->width_mm, event->y_mm / event->height_mm);  		cursor_update_position(input, event->time_msec); +	} else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { +		wlr_cursor_warp_absolute(input->cursor, event->device, +			event->x_mm / event->width_mm, -1); +		cursor_update_position(input, event->time_msec); +	} else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) { +		wlr_cursor_warp_absolute(input->cursor, event->device, +			-1, event->y_mm / event->height_mm); +		cursor_update_position(input, event->time_msec);  	}  } | 
