xcursor-configuration: initial protocol implementation

This commit is contained in:
emersion 2018-10-21 19:18:24 +02:00
parent be6210cf82
commit 57e8d2b125
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
10 changed files with 435 additions and 4 deletions

View file

@ -8,8 +8,8 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
@ -18,13 +18,14 @@
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/types/wlr_wl_shell.h>
#include <wlr/types/wlr_xcursor_configuration_v1.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h>
#include "rootston/layers.h"
#include "rootston/seat.h"
@ -984,6 +985,8 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->presentation =
wlr_presentation_create(server->wl_display, server->backend);
desktop->xcursor_configuration_manager =
wlr_xcursor_configuration_manager_v1_create(server->wl_display);
return desktop;
}

View file

@ -968,6 +968,8 @@ void roots_seat_add_device(struct roots_seat *seat,
}
void roots_seat_configure_xcursor(struct roots_seat *seat) {
struct roots_desktop *desktop = seat->input->server->desktop;
const char *cursor_theme = NULL;
struct roots_cursor_config *cc =
roots_config_get_cursor(seat->input->config, seat->seat->name);
@ -1001,6 +1003,23 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
seat->cursor->default_xcursor, seat->cursor->cursor);
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
seat->cursor->cursor->y);
const struct wlr_xcursor_configuration_v1_attrs xcursor_attrs = {
.theme = {
.name = (char *)(cursor_theme != NULL ? cursor_theme : "default"),
.size = ROOTS_XCURSOR_SIZE,
},
.default_cursor = (char *)(seat->cursor->default_xcursor != NULL ?
seat->cursor->default_xcursor : "left_ptr"),
};
wlr_xcursor_configuration_manager_v1_configure(
desktop->xcursor_configuration_manager, seat->seat,
ZWP_XCURSOR_CONFIGURATION_MANAGER_V1_DEVICE_TYPE_POINTER,
&xcursor_attrs);
wlr_xcursor_configuration_manager_v1_configure(
desktop->xcursor_configuration_manager, seat->seat,
ZWP_XCURSOR_CONFIGURATION_MANAGER_V1_DEVICE_TYPE_TABLET_TOOL,
&xcursor_attrs);
}
bool roots_seat_has_meta_pressed(struct roots_seat *seat) {