summaryrefslogtreecommitdiff
path: root/swaybar/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/input.c')
-rw-r--r--swaybar/input.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/swaybar/input.c b/swaybar/input.c
index 8eccf542..ada4bc86 100644
--- a/swaybar/input.c
+++ b/swaybar/input.c
@@ -81,8 +81,16 @@ void update_cursor(struct swaybar_seat *seat) {
int scale = pointer->current ? pointer->current->scale : 1;
pointer->cursor_theme = wl_cursor_theme_load(
cursor_theme, cursor_size * scale, seat->bar->shm);
+ if (!pointer->cursor_theme) {
+ sway_log(SWAY_ERROR, "Failed to load cursor theme");
+ return;
+ }
struct wl_cursor *cursor;
- cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");
+ cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "default");
+ if (!cursor) {
+ sway_log(SWAY_ERROR, "Failed to get default cursor from theme");
+ return;
+ }
pointer->cursor_image = cursor->images[0];
wl_surface_set_buffer_scale(pointer->cursor_surface, scale);
wl_surface_attach(pointer->cursor_surface,
@@ -103,7 +111,7 @@ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
struct swaybar_pointer *pointer = &seat->pointer;
seat->pointer.x = wl_fixed_to_double(surface_x);
seat->pointer.y = wl_fixed_to_double(surface_y);
- pointer->serial = serial;
+
struct swaybar_output *output;
wl_list_for_each(output, &seat->bar->outputs, link) {
if (output->surface == surface) {
@@ -111,7 +119,18 @@ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
break;
}
}
- update_cursor(seat);
+
+ if (seat->bar->cursor_shape_manager) {
+ struct wp_cursor_shape_device_v1 *device =
+ wp_cursor_shape_manager_v1_get_pointer(
+ seat->bar->cursor_shape_manager, wl_pointer);
+ wp_cursor_shape_device_v1_set_shape(device, serial,
+ WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
+ wp_cursor_shape_device_v1_destroy(device);
+ } else {
+ pointer->serial = serial;
+ update_cursor(seat);
+ }
}
static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
@@ -207,7 +226,7 @@ static void workspace_next(struct swaybar *bar, struct swaybar_output *output,
}
}
- if (new) {
+ if (new && new != active) {
ipc_send_workspace_command(bar, new->name);
// Since we're asking Sway to switch to 'new', it should become visible.