aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-27 19:09:38 +0200
committeremersion <contact@emersion.fr>2017-10-27 19:09:38 +0200
commitec5beeb8b8eec615f74f640f84e8fa8e451ba3bb (patch)
tree9a401030cf9102554d711b0a0535d586ce420a02 /rootston/cursor.c
parentad27cc3bffd459a0162db74eee60deb3ec46dbb0 (diff)
Move xcursor stuff into its own file
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r--rootston/cursor.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 8b269a11..e8e40aed 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -62,36 +62,12 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
input->view_y = view->y;
wlr_seat_pointer_clear_focus(input->wl_seat);
- struct wlr_xcursor *xcursor = wlr_xcursor_theme_get_cursor(input->theme,
- "grabbing");
+ struct wlr_xcursor *xcursor = get_move_xcursor(input->xcursor_theme);
if (xcursor != NULL) {
cursor_set_xcursor_image(input, xcursor->images[0]);
}
}
-static const char *get_resize_cursor_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
-}
-
void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view, uint32_t edges) {
input->mode = ROOTS_CURSOR_RESIZE;
@@ -106,8 +82,7 @@ void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
input->resize_edges = edges;
wlr_seat_pointer_clear_focus(input->wl_seat);
- struct wlr_xcursor *xcursor = wlr_xcursor_theme_get_cursor(input->theme,
- get_resize_cursor_name(edges));
+ struct wlr_xcursor *xcursor = get_resize_xcursor(input->xcursor_theme, edges);
if (xcursor != NULL) {
cursor_set_xcursor_image(input, xcursor->images[0]);
}
@@ -121,8 +96,7 @@ void view_begin_rotate(struct roots_input *input, struct wlr_cursor *cursor,
input->view_rotation = view->rotation;
wlr_seat_pointer_clear_focus(input->wl_seat);
- struct wlr_xcursor *xcursor = wlr_xcursor_theme_get_cursor(input->theme,
- "grabbing");
+ struct wlr_xcursor *xcursor = get_rotate_xcursor(input->xcursor_theme);
if (xcursor != NULL) {
cursor_set_xcursor_image(input, xcursor->images[0]);
}
@@ -144,7 +118,8 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
set_compositor_cursor = view_client != input->cursor_client;
}
if (set_compositor_cursor) {
- cursor_set_xcursor_image(input, input->xcursor->images[0]);
+ struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme);
+ cursor_set_xcursor_image(input, xcursor->images[0]);
input->cursor_client = NULL;
}
if (view) {