move get_resize_name to xcursor

This commit is contained in:
Tony Crisci 2017-12-08 06:08:06 -05:00
parent 31bafc2461
commit 4c60072be5
5 changed files with 30 additions and 31 deletions

View File

@ -4,7 +4,6 @@
#include <wayland-server.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/xcursor.h>
#include <wlr/util/edges.h>
/**
* 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

View File

@ -32,6 +32,7 @@
#define WLR_XCURSOR_H
#include <stdint.h>
#include <wlr/util/edges.h>
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

View File

@ -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);
}

View File

@ -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
}

View File

@ -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
}