|
|
@ -1,8 +1,10 @@
|
|
|
|
#define _XOPEN_SOURCE 700
|
|
|
|
#define _XOPEN_SOURCE 700
|
|
|
|
#include <wlr/types/wlr_cursor.h>
|
|
|
|
#include <wlr/types/wlr_cursor.h>
|
|
|
|
|
|
|
|
#include <wlr/types/wlr_xcursor_manager.h>
|
|
|
|
#include "sway/input/seat.h"
|
|
|
|
#include "sway/input/seat.h"
|
|
|
|
#include "sway/input/cursor.h"
|
|
|
|
#include "sway/input/cursor.h"
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
|
|
|
|
#include "sway/output.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_seat *sway_seat_create(struct wl_display *display,
|
|
|
|
struct sway_seat *sway_seat_create(struct wl_display *display,
|
|
|
@ -29,6 +31,8 @@ struct sway_seat *sway_seat_create(struct wl_display *display,
|
|
|
|
WL_SEAT_CAPABILITY_POINTER |
|
|
|
|
WL_SEAT_CAPABILITY_POINTER |
|
|
|
|
WL_SEAT_CAPABILITY_TOUCH);
|
|
|
|
WL_SEAT_CAPABILITY_TOUCH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sway_seat_configure_xcursor(seat);
|
|
|
|
|
|
|
|
|
|
|
|
return seat;
|
|
|
|
return seat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -74,3 +78,37 @@ void sway_seat_remove_device(struct sway_seat *seat,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sway_seat_configure_xcursor(struct sway_seat *seat) {
|
|
|
|
|
|
|
|
// TODO configure theme and size
|
|
|
|
|
|
|
|
const char *cursor_theme = "default";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (seat->cursor->xcursor_manager) {
|
|
|
|
|
|
|
|
wlr_xcursor_manager_destroy(seat->cursor->xcursor_manager);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seat->cursor->xcursor_manager =
|
|
|
|
|
|
|
|
wlr_xcursor_manager_create(NULL, 24);
|
|
|
|
|
|
|
|
if (sway_assert(seat->cursor->xcursor_manager,
|
|
|
|
|
|
|
|
"Cannot create XCursor manager for theme %s", cursor_theme)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < root_container.children->length; ++i) {
|
|
|
|
|
|
|
|
swayc_t *output_container = root_container.children->items[i];
|
|
|
|
|
|
|
|
struct wlr_output *output =
|
|
|
|
|
|
|
|
output_container->sway_output->wlr_output;
|
|
|
|
|
|
|
|
bool result =
|
|
|
|
|
|
|
|
wlr_xcursor_manager_load(seat->cursor->xcursor_manager,
|
|
|
|
|
|
|
|
output->scale);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sway_assert(result,
|
|
|
|
|
|
|
|
"Cannot load xcursor theme for output '%s' with scale %d",
|
|
|
|
|
|
|
|
output->name, output->scale);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
|
|
|
|
|
|
|
|
"left_ptr", seat->cursor->cursor);
|
|
|
|
|
|
|
|
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
|
|
|
|
|
|
|
seat->cursor->cursor->y);
|
|
|
|
|
|
|
|
}
|
|
|
|