move get_resize_name to xcursor

master
Tony Crisci 7 years ago
parent 31bafc2461
commit 4c60072be5

@ -4,7 +4,6 @@
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/xcursor.h> #include <wlr/xcursor.h>
#include <wlr/util/edges.h>
/** /**
* A scaled XCursor theme. * 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, void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager,
const char *name, struct wlr_cursor *cursor); 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 #endif

@ -32,6 +32,7 @@
#define WLR_XCURSOR_H #define WLR_XCURSOR_H
#include <stdint.h> #include <stdint.h>
#include <wlr/util/edges.h>
struct wlr_xcursor_image { struct wlr_xcursor_image {
uint32_t width; /* actual width */ 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); 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 #endif

@ -661,7 +661,7 @@ void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
view_maximize(view, false); view_maximize(view, false);
wlr_seat_pointer_clear_focus(seat->seat); 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, wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
resize_name, seat->cursor->cursor); resize_name, seat->cursor->cursor);
} }

@ -82,26 +82,3 @@ void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager,
theme->scale); 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
}

@ -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) { int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
return wlr_xcursor_frame_and_duration(_cursor, time, NULL); 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
}

Loading…
Cancel
Save