Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwcomposer: wp_cursor_shape_manager_v1 implements #58

Open
wants to merge 1 commit into
base: lineage-18.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions hwcomposer/wayland-hwc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include "relative-pointer-unstable-v1-client-protocol.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
#include "fractional-scale-v1-client-protocol.h"
#include "cursor-shape-v1-client-protocol.h"

using ::android::hardware::hidl_string;

Expand Down Expand Up @@ -807,9 +808,17 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
{
struct display *display = (struct display *)data;
display->pointer_surface = surface;
if (display->cursor_surface)
wl_pointer_set_cursor(pointer, serial,
display->cursor_surface, 0, 0);
if (display->cursor_shape_manager != NULL) {
struct wp_cursor_shape_device_v1 *device =
wp_cursor_shape_manager_v1_get_pointer(display->cursor_shape_manager, pointer);
wp_cursor_shape_device_v1_set_shape(device, serial,
WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
wp_cursor_shape_device_v1_destroy(device);
} else {
if (display->cursor_surface)
wl_pointer_set_cursor(pointer, serial,
display->cursor_surface, 0, 0); // FIXME: cursor hotspot with scale
}
}

static void
Expand Down Expand Up @@ -1817,6 +1826,9 @@ registry_handle_global(void *data, struct wl_registry *registry,
&wl_output_interface, std::min(version, 3U));
wl_output_add_listener(d->output, &output_listener, d);
wl_display_roundtrip(d->display);
} else if (strcmp(interface, "wp_cursor_shape_manager_v1") == 0) {
d->cursor_shape_manager = (struct wp_cursor_shape_manager_v1*)wl_registry_bind(registry, id,
&wp_cursor_shape_manager_v1_interface, 1);
} else if (strcmp(interface, "wp_presentation") == 0) {
bool no_presentation = property_get_bool("persist.waydroid.no_presentation", false);
if (!no_presentation) {
Expand Down
1 change: 1 addition & 0 deletions hwcomposer/wayland-hwc.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ struct display {
struct zwp_relative_pointer_v1 *relative_pointer;
struct zwp_idle_inhibit_manager_v1 *idle_manager;
struct wp_fractional_scale_manager_v1 *fractional_scale_manager;
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
int gtype;
double scale;

Expand Down