Skip to content

Commit c993d3a

Browse files
committed
hwcomposer: wp_cursor_shape_manager_v1 implements
1 parent 6076573 commit c993d3a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

hwcomposer/wayland-hwc.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#include "relative-pointer-unstable-v1-client-protocol.h"
7474
#include "idle-inhibit-unstable-v1-client-protocol.h"
7575
#include "fractional-scale-v1-client-protocol.h"
76+
#include "cursor-shape-v1-client-protocol.h"
7677

7778
using ::android::hardware::hidl_string;
7879

@@ -807,9 +808,17 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
807808
{
808809
struct display *display = (struct display *)data;
809810
display->pointer_surface = surface;
810-
if (display->cursor_surface)
811-
wl_pointer_set_cursor(pointer, serial,
812-
display->cursor_surface, 0, 0);
811+
if (display->cursor_shape_manager != NULL) {
812+
struct wp_cursor_shape_device_v1 *device =
813+
wp_cursor_shape_manager_v1_get_pointer(display->cursor_shape_manager, pointer);
814+
wp_cursor_shape_device_v1_set_shape(device, serial,
815+
WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
816+
wp_cursor_shape_device_v1_destroy(device);
817+
} else {
818+
if (display->cursor_surface)
819+
wl_pointer_set_cursor(pointer, serial,
820+
display->cursor_surface, 0, 0); // FIXME: cursor hotspot with scale
821+
}
813822
}
814823

815824
static void
@@ -1817,6 +1826,9 @@ registry_handle_global(void *data, struct wl_registry *registry,
18171826
&wl_output_interface, std::min(version, 3U));
18181827
wl_output_add_listener(d->output, &output_listener, d);
18191828
wl_display_roundtrip(d->display);
1829+
} else if (strcmp(interface, "wp_cursor_shape_manager_v1") == 0) {
1830+
d->cursor_shape_manager = (struct wp_cursor_shape_manager_v1*)wl_registry_bind(registry, id,
1831+
&wp_cursor_shape_manager_v1_interface, 1);
18201832
} else if (strcmp(interface, "wp_presentation") == 0) {
18211833
bool no_presentation = property_get_bool("persist.waydroid.no_presentation", false);
18221834
if (!no_presentation) {

hwcomposer/wayland-hwc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ struct display {
121121
struct zwp_relative_pointer_v1 *relative_pointer;
122122
struct zwp_idle_inhibit_manager_v1 *idle_manager;
123123
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
124+
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
124125
int gtype;
125126
double scale;
126127

0 commit comments

Comments
 (0)