mirror of
https://codeberg.org/vyivel/dulcepan/
synced 2025-03-12 18:59:15 +02:00
seat: make cursor-shape-v1 support optional
This commit is contained in:
parent
6158dd112b
commit
bdf8308c4e
@ -173,6 +173,8 @@ struct dp_state {
|
|||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
struct zwlr_screencopy_manager_v1 *screencopy_manager;
|
struct zwlr_screencopy_manager_v1 *screencopy_manager;
|
||||||
|
|
||||||
|
// Optional
|
||||||
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||||
|
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
@ -89,8 +89,6 @@ static void run(struct dp_state *state) {
|
|||||||
dp_log_fatal("The compositor has no zwlr_layer_shell_v1");
|
dp_log_fatal("The compositor has no zwlr_layer_shell_v1");
|
||||||
} else if (state->screencopy_manager == NULL) {
|
} else if (state->screencopy_manager == NULL) {
|
||||||
dp_log_fatal("The compositor has no zwlr_screencopy_manager_v1");
|
dp_log_fatal("The compositor has no zwlr_screencopy_manager_v1");
|
||||||
} else if (state->cursor_shape_manager == NULL) {
|
|
||||||
dp_log_fatal("The compositor has no wp_cursor_shape_manager_v1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_list_empty(&state->outputs)) {
|
if (wl_list_empty(&state->outputs)) {
|
||||||
@ -150,7 +148,10 @@ static void run(struct dp_state *state) {
|
|||||||
wl_shm_destroy(state->shm);
|
wl_shm_destroy(state->shm);
|
||||||
zwlr_layer_shell_v1_destroy(state->layer_shell);
|
zwlr_layer_shell_v1_destroy(state->layer_shell);
|
||||||
zwlr_screencopy_manager_v1_destroy(state->screencopy_manager);
|
zwlr_screencopy_manager_v1_destroy(state->screencopy_manager);
|
||||||
|
|
||||||
|
if (state->cursor_shape_manager) {
|
||||||
wp_cursor_shape_manager_v1_destroy(state->cursor_shape_manager);
|
wp_cursor_shape_manager_v1_destroy(state->cursor_shape_manager);
|
||||||
|
}
|
||||||
|
|
||||||
wl_registry_destroy(registry);
|
wl_registry_destroy(registry);
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,11 @@ static enum wp_cursor_shape_device_v1_shape get_cursor_shape(struct dp_selection
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void update_cursor(struct dp_seat *seat) {
|
static void update_cursor(struct dp_seat *seat) {
|
||||||
|
if (seat->cursor_shape_device != NULL) {
|
||||||
wp_cursor_shape_device_v1_set_shape(seat->cursor_shape_device, seat->pointer_serial,
|
wp_cursor_shape_device_v1_set_shape(seat->cursor_shape_device, seat->pointer_serial,
|
||||||
get_cursor_shape(&seat->state->selection));
|
get_cursor_shape(&seat->state->selection));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void process_position(struct dp_seat *seat, wl_fixed_t x, wl_fixed_t y) {
|
static void process_position(struct dp_seat *seat, wl_fixed_t x, wl_fixed_t y) {
|
||||||
struct dp_output *output = seat->ptr_output;
|
struct dp_output *output = seat->ptr_output;
|
||||||
@ -224,10 +226,13 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, uint32
|
|||||||
if ((caps & WL_SEAT_CAPABILITY_POINTER) != 0 && seat->pointer == NULL) {
|
if ((caps & WL_SEAT_CAPABILITY_POINTER) != 0 && seat->pointer == NULL) {
|
||||||
seat->pointer = wl_seat_get_pointer(wl_seat);
|
seat->pointer = wl_seat_get_pointer(wl_seat);
|
||||||
wl_pointer_add_listener(seat->pointer, &pointer_listener, seat);
|
wl_pointer_add_listener(seat->pointer, &pointer_listener, seat);
|
||||||
|
|
||||||
|
if (seat->state->cursor_shape_manager != NULL) {
|
||||||
seat->cursor_shape_device = wp_cursor_shape_manager_v1_get_pointer(
|
seat->cursor_shape_device = wp_cursor_shape_manager_v1_get_pointer(
|
||||||
seat->state->cursor_shape_manager, seat->pointer);
|
seat->state->cursor_shape_manager, seat->pointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) {
|
static void seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) {
|
||||||
// Ignored
|
// Ignored
|
||||||
@ -260,6 +265,8 @@ void dp_seat_destroy(struct dp_seat *seat) {
|
|||||||
}
|
}
|
||||||
if (seat->pointer != NULL) {
|
if (seat->pointer != NULL) {
|
||||||
wl_pointer_release(seat->pointer);
|
wl_pointer_release(seat->pointer);
|
||||||
|
}
|
||||||
|
if (seat->cursor_shape_device != NULL) {
|
||||||
wp_cursor_shape_device_v1_destroy(seat->cursor_shape_device);
|
wp_cursor_shape_device_v1_destroy(seat->cursor_shape_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user