mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
Add scale parameter to wlr_cursor_set_image
This commit is contained in:
parent
2bee288090
commit
ac1573b0e7
6 changed files with 35 additions and 18 deletions
|
@ -86,7 +86,7 @@ static void handle_output_add(struct output_state *ostate) {
|
|||
|
||||
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
|
||||
wlr_cursor_warp(cursor->cursor, NULL, cursor->cursor->x,
|
||||
cursor->cursor->y);
|
||||
|
@ -150,7 +150,7 @@ static void handle_input_add(struct compositor_state *state,
|
|||
|
||||
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
|
||||
wl_list_insert(&sample->cursors, &cursor->link);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ static void handle_output_add(struct output_state *ostate) {
|
|||
|
||||
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||
wlr_cursor_set_image(sample->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
|
||||
wlr_cursor_warp(sample->cursor, NULL, sample->cursor->x, sample->cursor->y);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
struct wlr_xcursor_image *image = state.xcursor->images[0];
|
||||
wlr_cursor_set_image(state.cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
|
||||
compositor_init(&compositor);
|
||||
if (!wlr_backend_start(compositor.backend)) {
|
||||
|
|
|
@ -60,9 +60,22 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
|||
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
||||
double delta_x, double delta_y);
|
||||
|
||||
/**
|
||||
* Set the cursor image. stride is given in bytes. If pixels is NULL, hides the
|
||||
* cursor.
|
||||
*
|
||||
* If scale isn't zero, the image is only set on outputs having the provided
|
||||
* scale.
|
||||
*/
|
||||
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
|
||||
int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
|
||||
int32_t hotspot_y);
|
||||
int32_t hotspot_y, uint32_t scale);
|
||||
|
||||
/**
|
||||
* Set the cursor surface. The surface can be committed to update the cursor
|
||||
* image. The surface position is substracted from the hotspot. A NULL surface
|
||||
* commit hides the cursor.
|
||||
*/
|
||||
void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
|
||||
int32_t hotspot_x, int32_t hotspot_y);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ void roots_cursor_destroy(struct roots_cursor *cursor) {
|
|||
static void cursor_set_xcursor_image(struct roots_cursor *cursor,
|
||||
struct wlr_xcursor_image *image) {
|
||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
}
|
||||
|
||||
static void roots_cursor_update_position(struct roots_cursor *cursor, uint32_t time) {
|
||||
|
|
|
@ -176,6 +176,12 @@ void roots_seat_configure_cursor(struct roots_seat *seat) {
|
|||
}
|
||||
}
|
||||
|
||||
static void seat_set_xcursor_image(struct roots_seat *seat, struct
|
||||
wlr_xcursor_image *image) {
|
||||
wlr_cursor_set_image(seat->cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
|
||||
}
|
||||
|
||||
static void roots_seat_init_cursor(struct roots_seat *seat) {
|
||||
seat->cursor = roots_cursor_create(seat);
|
||||
if (!seat->cursor) {
|
||||
|
@ -204,8 +210,7 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
|
|||
}
|
||||
|
||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||
wlr_cursor_set_image(seat->cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
seat_set_xcursor_image(seat, image);
|
||||
|
||||
// XXX: xwayland will always have the theme of the last created seat
|
||||
if (seat->input->server->desktop->xwayland != NULL) {
|
||||
|
@ -471,10 +476,10 @@ void roots_seat_remove_device(struct roots_seat *seat,
|
|||
}
|
||||
|
||||
void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||
struct wlr_xcursor *xcursor = get_default_xcursor(seat->cursor->xcursor_theme);
|
||||
struct wlr_xcursor *xcursor =
|
||||
get_default_xcursor(seat->cursor->xcursor_theme);
|
||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||
wlr_cursor_set_image(seat->cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
seat_set_xcursor_image(seat, image);
|
||||
|
||||
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
||||
seat->cursor->cursor->y);
|
||||
|
@ -537,12 +542,6 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
|
|||
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface);
|
||||
}
|
||||
|
||||
static void seat_set_xcursor_image(struct roots_seat *seat, struct
|
||||
wlr_xcursor_image *image) {
|
||||
wlr_cursor_set_image(seat->cursor->cursor, image->buffer, image->width,
|
||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||
}
|
||||
|
||||
void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
|
||||
struct roots_cursor *cursor = seat->cursor;
|
||||
cursor->mode = ROOTS_CURSOR_MOVE;
|
||||
|
|
|
@ -299,9 +299,14 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
|||
|
||||
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
|
||||
int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
|
||||
int32_t hotspot_y) {
|
||||
int32_t hotspot_y, uint32_t scale) {
|
||||
struct wlr_cursor_output_cursor *output_cursor;
|
||||
wl_list_for_each(output_cursor, &cur->state->output_cursors, link) {
|
||||
if (scale != 0 &&
|
||||
output_cursor->output_cursor->output->scale != scale) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wlr_output_cursor_set_image(output_cursor->output_cursor, pixels,
|
||||
stride, width, height, hotspot_x, hotspot_y);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue