Partially fix resize offset
This commit is contained in:
parent
28d4b475dc
commit
77d28183b5
|
@ -78,7 +78,7 @@ struct roots_input {
|
||||||
enum roots_cursor_mode mode;
|
enum roots_cursor_mode mode;
|
||||||
struct roots_view *active_view;
|
struct roots_view *active_view;
|
||||||
int offs_x, offs_y;
|
int offs_x, offs_y;
|
||||||
int view_width, view_height;
|
int view_x, view_y, view_width, view_height;
|
||||||
uint32_t resize_edges;
|
uint32_t resize_edges;
|
||||||
|
|
||||||
// Ring buffer of input events that could trigger move/resize/rotate
|
// Ring buffer of input events that could trigger move/resize/rotate
|
||||||
|
|
|
@ -33,8 +33,10 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
|
||||||
struct roots_view *view, uint32_t edges) {
|
struct roots_view *view, uint32_t edges) {
|
||||||
input->mode = ROOTS_CURSOR_RESIZE;
|
input->mode = ROOTS_CURSOR_RESIZE;
|
||||||
wlr_log(L_DEBUG, "begin resize");
|
wlr_log(L_DEBUG, "begin resize");
|
||||||
input->offs_x = cursor->x - view->x;
|
input->offs_x = cursor->x;
|
||||||
input->offs_y = cursor->y - view->y;
|
input->offs_y = cursor->y;
|
||||||
|
input->view_x = view->x;
|
||||||
|
input->view_y = view->y;
|
||||||
input->view_width = view->wlr_surface->current.width;
|
input->view_width = view->wlr_surface->current.width;
|
||||||
input->view_height = view->wlr_surface->current.height;
|
input->view_height = view->wlr_surface->current.height;
|
||||||
input->resize_edges = edges;
|
input->resize_edges = edges;
|
||||||
|
@ -71,14 +73,14 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
|
||||||
int width = input->view_width;
|
int width = input->view_width;
|
||||||
int height = input->view_height;
|
int height = input->view_height;
|
||||||
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
|
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
|
||||||
input->active_view->y = dy;
|
input->active_view->y = input->view_y + dy;
|
||||||
height -= dy;
|
height -= dy;
|
||||||
}
|
}
|
||||||
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
|
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
|
||||||
height += dy;
|
height += dy;
|
||||||
}
|
}
|
||||||
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
||||||
input->active_view->x = dx;
|
input->active_view->x = input->view_x + dx;
|
||||||
width -= dx;
|
width -= dx;
|
||||||
}
|
}
|
||||||
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
||||||
|
|
Loading…
Reference in New Issue