mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
bring edges into wlr
This commit is contained in:
parent
f469784bbc
commit
d74ac69f7b
9 changed files with 53 additions and 47 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#endif
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/util/edges.h>
|
||||
#include "rootston/xcursor.h"
|
||||
#include "rootston/cursor.h"
|
||||
|
||||
|
|
@ -75,22 +76,22 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
|
|||
double y = view->y;
|
||||
int width = cursor->view_width;
|
||||
int height = cursor->view_height;
|
||||
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
|
||||
if (cursor->resize_edges & WLR_EDGE_TOP) {
|
||||
y = cursor->view_y + dy;
|
||||
height -= dy;
|
||||
if (height < 1) {
|
||||
y += height;
|
||||
}
|
||||
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
|
||||
} else if (cursor->resize_edges & WLR_EDGE_BOTTOM) {
|
||||
height += dy;
|
||||
}
|
||||
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
||||
if (cursor->resize_edges & WLR_EDGE_LEFT) {
|
||||
x = cursor->view_x + dx;
|
||||
width -= dx;
|
||||
if (width < 1) {
|
||||
x += width;
|
||||
}
|
||||
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
||||
} else if (cursor->resize_edges & WLR_EDGE_RIGHT) {
|
||||
width += dx;
|
||||
}
|
||||
|
||||
|
|
@ -147,14 +148,14 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
|
|||
case BTN_RIGHT:
|
||||
edges = 0;
|
||||
if (sx < view->wlr_surface->current->width/2) {
|
||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_LEFT;
|
||||
edges |= WLR_EDGE_LEFT;
|
||||
} else {
|
||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_RIGHT;
|
||||
edges |= WLR_EDGE_RIGHT;
|
||||
}
|
||||
if (sy < view->wlr_surface->current->height/2) {
|
||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_TOP;
|
||||
edges |= WLR_EDGE_TOP;
|
||||
} else {
|
||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_BOTTOM;
|
||||
edges |= WLR_EDGE_BOTTOM;
|
||||
}
|
||||
roots_seat_begin_resize(seat, view, edges);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue