diff options
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 47c89a39..53e798bc 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -196,6 +196,10 @@ static void output_scale(void *data, struct wl_output *wl_output, | |||
196 | int32_t factor) { | 196 | int32_t factor) { |
197 | struct swaybar_output *output = data; | 197 | struct swaybar_output *output = data; |
198 | output->scale = factor; | 198 | output->scale = factor; |
199 | if (output == output->bar->pointer.current) { | ||
200 | update_cursor(output->bar); | ||
201 | render_frame(output); | ||
202 | } | ||
199 | } | 203 | } |
200 | 204 | ||
201 | struct wl_output_listener output_listener = { | 205 | struct wl_output_listener output_listener = { |
@@ -273,7 +277,7 @@ static void handle_global(void *data, struct wl_registry *registry, | |||
273 | struct swaybar *bar = data; | 277 | struct swaybar *bar = data; |
274 | if (strcmp(interface, wl_compositor_interface.name) == 0) { | 278 | if (strcmp(interface, wl_compositor_interface.name) == 0) { |
275 | bar->compositor = wl_registry_bind(registry, name, | 279 | bar->compositor = wl_registry_bind(registry, name, |
276 | &wl_compositor_interface, 3); | 280 | &wl_compositor_interface, 4); |
277 | } else if (strcmp(interface, wl_seat_interface.name) == 0) { | 281 | } else if (strcmp(interface, wl_seat_interface.name) == 0) { |
278 | bar->seat = wl_registry_bind(registry, name, | 282 | bar->seat = wl_registry_bind(registry, name, |
279 | &wl_seat_interface, 3); | 283 | &wl_seat_interface, 3); |
@@ -355,22 +359,6 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { | |||
355 | wl_display_roundtrip(bar->display); | 359 | wl_display_roundtrip(bar->display); |
356 | 360 | ||
357 | struct swaybar_pointer *pointer = &bar->pointer; | 361 | struct swaybar_pointer *pointer = &bar->pointer; |
358 | |||
359 | int max_scale = 1; | ||
360 | struct swaybar_output *output; | ||
361 | wl_list_for_each(output, &bar->outputs, link) { | ||
362 | if (output->scale > max_scale) { | ||
363 | max_scale = output->scale; | ||
364 | } | ||
365 | } | ||
366 | |||
367 | pointer->cursor_theme = | ||
368 | wl_cursor_theme_load(NULL, 24 * max_scale, bar->shm); | ||
369 | assert(pointer->cursor_theme); | ||
370 | struct wl_cursor *cursor; | ||
371 | cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); | ||
372 | assert(cursor); | ||
373 | pointer->cursor_image = cursor->images[0]; | ||
374 | pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); | 362 | pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); |
375 | assert(pointer->cursor_surface); | 363 | assert(pointer->cursor_surface); |
376 | 364 | ||