From 4c60072be584a7ed5b97de325994217a9e96bbd4 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Fri, 8 Dec 2017 06:08:06 -0500 Subject: [PATCH] move get_resize_name to xcursor --- include/wlr/types/wlr_xcursor_manager.h | 7 ------- include/wlr/xcursor.h | 6 ++++++ rootston/seat.c | 2 +- types/wlr_xcursor_manager.c | 23 ----------------------- xcursor/wlr_xcursor.c | 23 +++++++++++++++++++++++ 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h index 63eb5386..c78a6e8d 100644 --- a/include/wlr/types/wlr_xcursor_manager.h +++ b/include/wlr/types/wlr_xcursor_manager.h @@ -4,7 +4,6 @@ #include #include #include -#include /** * A scaled XCursor theme. @@ -51,10 +50,4 @@ struct wlr_xcursor *wlr_xcursor_manager_get_xcursor( void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager, const char *name, struct wlr_cursor *cursor); -/** - * Get the name of the cursor image for the given edges. - */ -const char *wlr_xcursor_manager_get_resize_name(enum wlr_edges edges); - - #endif diff --git a/include/wlr/xcursor.h b/include/wlr/xcursor.h index b6362b06..42fcedb9 100644 --- a/include/wlr/xcursor.h +++ b/include/wlr/xcursor.h @@ -32,6 +32,7 @@ #define WLR_XCURSOR_H #include +#include struct wlr_xcursor_image { uint32_t width; /* actual width */ @@ -65,4 +66,9 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor( int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time); +/** + * Get the name of the resize cursor image for the given edges. + */ +const char *wlr_xcursor_get_resize_name(enum wlr_edges edges); + #endif diff --git a/rootston/seat.c b/rootston/seat.c index f6473581..1fa09ad6 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -661,7 +661,7 @@ 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); + const char *resize_name = wlr_xcursor_get_resize_name(edges); wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager, resize_name, seat->cursor->cursor); } diff --git a/types/wlr_xcursor_manager.c b/types/wlr_xcursor_manager.c index 9350d721..f32a96bc 100644 --- a/types/wlr_xcursor_manager.c +++ b/types/wlr_xcursor_manager.c @@ -82,26 +82,3 @@ void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager, theme->scale); } } - -const char *wlr_xcursor_manager_get_resize_name(enum wlr_edges edges) { - if (edges & WLR_EDGE_TOP) { - if (edges & WLR_EDGE_RIGHT) { - return "ne-resize"; - } else if (edges & WLR_EDGE_LEFT) { - return "nw-resize"; - } - return "n-resize"; - } else if (edges & WLR_EDGE_BOTTOM) { - if (edges & WLR_EDGE_RIGHT) { - return "se-resize"; - } else if (edges & WLR_EDGE_LEFT) { - return "sw-resize"; - } - return "s-resize"; - } else if (edges & WLR_EDGE_RIGHT) { - return "e-resize"; - } else if (edges & WLR_EDGE_LEFT) { - return "w-resize"; - } - return "se-resize"; // fallback -} diff --git a/xcursor/wlr_xcursor.c b/xcursor/wlr_xcursor.c index fdebe1af..b1678223 100644 --- a/xcursor/wlr_xcursor.c +++ b/xcursor/wlr_xcursor.c @@ -326,3 +326,26 @@ static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor, int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) { return wlr_xcursor_frame_and_duration(_cursor, time, NULL); } + +const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) { + if (edges & WLR_EDGE_TOP) { + if (edges & WLR_EDGE_RIGHT) { + return "ne-resize"; + } else if (edges & WLR_EDGE_LEFT) { + return "nw-resize"; + } + return "n-resize"; + } else if (edges & WLR_EDGE_BOTTOM) { + if (edges & WLR_EDGE_RIGHT) { + return "se-resize"; + } else if (edges & WLR_EDGE_LEFT) { + return "sw-resize"; + } + return "s-resize"; + } else if (edges & WLR_EDGE_RIGHT) { + return "e-resize"; + } else if (edges & WLR_EDGE_LEFT) { + return "w-resize"; + } + return "se-resize"; // fallback +}