aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-07 11:19:43 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-08 06:03:57 -0500
commitd74ac69f7b932a8833527a41351e3310ad391d7c (patch)
tree76ae32f195053b38d5bad555376701a9ecb7070c /rootston
parentf469784bbc73bf6346430a2caa7dc366ad2d0308 (diff)
bring edges into wlr
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c17
-rw-r--r--rootston/meson.build1
-rw-r--r--rootston/seat.c3
-rw-r--r--rootston/xcursor.c28
4 files changed, 11 insertions, 38 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index f0e3d70d..d38e40a1 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -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;
diff --git a/rootston/meson.build b/rootston/meson.build
index 9c543c4f..36b6241a 100644
--- a/rootston/meson.build
+++ b/rootston/meson.build
@@ -8,7 +8,6 @@ sources = [
'main.c',
'output.c',
'seat.c',
- 'xcursor.c',
'xdg_shell_v6.c',
'wl_shell.c',
]
diff --git a/rootston/seat.c b/rootston/seat.c
index 737bbd67..f6473581 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -661,8 +661,9 @@ void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
view_maximize(view, false);
wlr_seat_pointer_clear_focus(seat->seat);
+ const char *resize_name = wlr_xcursor_manager_get_resize_name(edges);
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
- roots_xcursor_get_resize_name(edges), seat->cursor->cursor);
+ resize_name, seat->cursor->cursor);
}
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
diff --git a/rootston/xcursor.c b/rootston/xcursor.c
deleted file mode 100644
index 74e732c9..00000000
--- a/rootston/xcursor.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdlib.h>
-#include <string.h>
-#include "rootston/xcursor.h"
-#include "rootston/input.h"
-
-const char *roots_xcursor_get_resize_name(uint32_t edges) {
- if (edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
- if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
- return "ne-resize";
- } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
- return "nw-resize";
- }
- return "n-resize";
- } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
- if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
- return "se-resize";
- } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
- return "sw-resize";
- }
- return "s-resize";
- } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
- return "e-resize";
- } else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
- return "w-resize";
- }
- return "se-resize"; // fallback
-}