mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 04:54:14 +01:00
Set xwayland cursor
This commit is contained in:
parent
212b503992
commit
b237fa0b22
@ -33,6 +33,7 @@ struct sway_server {
|
|||||||
struct wl_listener xdg_shell_v6_surface;
|
struct wl_listener xdg_shell_v6_surface;
|
||||||
|
|
||||||
struct wlr_xwayland *xwayland;
|
struct wlr_xwayland *xwayland;
|
||||||
|
struct wlr_xcursor_manager *xcursor_manager;
|
||||||
struct wl_listener xwayland_surface;
|
struct wl_listener xwayland_surface;
|
||||||
struct wl_listener xwayland_ready;
|
struct wl_listener xwayland_ready;
|
||||||
|
|
||||||
|
@ -259,11 +259,11 @@ void sway_seat_remove_device(struct sway_seat *seat,
|
|||||||
|
|
||||||
void sway_seat_configure_xcursor(struct sway_seat *seat) {
|
void sway_seat_configure_xcursor(struct sway_seat *seat) {
|
||||||
// TODO configure theme and size
|
// TODO configure theme and size
|
||||||
const char *cursor_theme = "default";
|
const char *cursor_theme = NULL;
|
||||||
|
|
||||||
if (!seat->cursor->xcursor_manager) {
|
if (!seat->cursor->xcursor_manager) {
|
||||||
seat->cursor->xcursor_manager =
|
seat->cursor->xcursor_manager =
|
||||||
wlr_xcursor_manager_create("default", 24);
|
wlr_xcursor_manager_create(cursor_theme, 24);
|
||||||
if (sway_assert(seat->cursor->xcursor_manager,
|
if (sway_assert(seat->cursor->xcursor_manager,
|
||||||
"Cannot create XCursor manager for theme %s",
|
"Cannot create XCursor manager for theme %s",
|
||||||
cursor_theme)) {
|
cursor_theme)) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <wlr/types/wlr_layer_shell.h>
|
#include <wlr/types/wlr_layer_shell.h>
|
||||||
#include <wlr/types/wlr_screenshooter.h>
|
#include <wlr/types/wlr_screenshooter.h>
|
||||||
#include <wlr/types/wlr_wl_shell.h>
|
#include <wlr/types/wlr_wl_shell.h>
|
||||||
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
// TODO WLR: make Xwayland optional
|
// TODO WLR: make Xwayland optional
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
@ -78,6 +79,18 @@ bool server_init(struct sway_server *server) {
|
|||||||
// TODO: call server_ready now if xwayland is not enabled
|
// TODO: call server_ready now if xwayland is not enabled
|
||||||
server->xwayland_ready.notify = server_ready;
|
server->xwayland_ready.notify = server_ready;
|
||||||
|
|
||||||
|
// TODO: configurable cursor theme and size
|
||||||
|
server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24);
|
||||||
|
wlr_xcursor_manager_load(server->xcursor_manager, 1);
|
||||||
|
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
||||||
|
server->xcursor_manager, "left_ptr", 1);
|
||||||
|
if (xcursor != NULL) {
|
||||||
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
|
wlr_xwayland_set_cursor(server->xwayland, image->buffer,
|
||||||
|
image->width * 4, image->width, image->height, image->hotspot_x,
|
||||||
|
image->hotspot_y);
|
||||||
|
}
|
||||||
|
|
||||||
server->wl_shell = wlr_wl_shell_create(server->wl_display);
|
server->wl_shell = wlr_wl_shell_create(server->wl_display);
|
||||||
wl_signal_add(&server->wl_shell->events.new_surface,
|
wl_signal_add(&server->wl_shell->events.new_surface,
|
||||||
&server->wl_shell_surface);
|
&server->wl_shell_surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user