aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_output.h11
-rw-r--r--types/output/cursor.c136
-rw-r--r--types/output/output.c10
3 files changed, 2 insertions, 155 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 88dbffb9..f56bd1eb 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -40,16 +40,9 @@ struct wlr_output_cursor {
bool visible;
uint32_t width, height;
int32_t hotspot_x, hotspot_y;
- struct wl_list link;
-
- // only when using a software cursor without a surface
struct wlr_texture *texture;
bool own_texture;
-
- // only when using a cursor surface
- struct wlr_surface *surface;
- struct wl_listener surface_commit;
- struct wl_listener surface_destroy;
+ struct wl_list link;
};
enum wlr_output_adaptive_sync_status {
@@ -550,8 +543,6 @@ struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
int32_t hotspot_x, int32_t hotspot_y);
-void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
- struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_cursor_set_buffer(struct wlr_output_cursor *cursor,
struct wlr_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
diff --git a/types/output/cursor.c b/types/output/cursor.c
index 6ae4ec10..bea83f83 100644
--- a/types/output/cursor.c
+++ b/types/output/cursor.c
@@ -94,9 +94,6 @@ static void output_cursor_render(struct wlr_output_cursor *cursor,
assert(renderer);
struct wlr_texture *texture = cursor->texture;
- if (cursor->surface != NULL) {
- texture = wlr_surface_get_texture(cursor->surface);
- }
if (texture == NULL) {
return;
}
@@ -176,9 +173,6 @@ void wlr_output_add_software_cursors_to_render_pass(struct wlr_output *output,
}
struct wlr_texture *texture = cursor->texture;
- if (cursor->surface != NULL) {
- texture = wlr_surface_get_texture(cursor->surface);
- }
if (texture == NULL) {
continue;
}
@@ -232,14 +226,6 @@ static void output_cursor_reset(struct wlr_output_cursor *cursor) {
if (cursor->output->hardware_cursor != cursor) {
output_cursor_damage_whole(cursor);
}
- if (cursor->surface != NULL) {
- wl_list_remove(&cursor->surface_commit.link);
- wl_list_remove(&cursor->surface_destroy.link);
- if (cursor->visible) {
- wlr_surface_send_leave(cursor->surface, cursor->output);
- }
- cursor->surface = NULL;
- }
}
static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
@@ -252,19 +238,8 @@ static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
output_cursor_get_box(cursor, &cursor_box);
struct wlr_box intersection;
- bool visible =
+ cursor->visible =
wlr_box_intersection(&intersection, &output_box, &cursor_box);
-
- if (cursor->surface != NULL) {
- if (cursor->visible && !visible) {
- wlr_surface_send_leave(cursor->surface, cursor->output);
- }
- if (!cursor->visible && visible) {
- wlr_surface_send_enter(cursor->surface, cursor->output);
- }
- }
-
- cursor->visible = visible;
}
static struct wlr_drm_format *output_pick_cursor_format(struct wlr_output *output) {
@@ -290,11 +265,6 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
float scale = output->scale;
enum wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
struct wlr_texture *texture = cursor->texture;
- if (cursor->surface != NULL) {
- texture = wlr_surface_get_texture(cursor->surface);
- scale = cursor->surface->current.scale;
- transform = cursor->surface->current.transform;
- }
if (texture == NULL) {
return NULL;
}
@@ -393,10 +363,6 @@ static bool output_cursor_attempt_hardware(struct wlr_output_cursor *cursor) {
}
struct wlr_texture *texture = cursor->texture;
- if (cursor->surface != NULL) {
- // TODO: try using the surface buffer directly
- texture = wlr_surface_get_texture(cursor->surface);
- }
// If the cursor was hidden or was a software cursor, the hardware
// cursor position is outdated
@@ -503,102 +469,6 @@ bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
return true;
}
-static void output_cursor_commit(struct wlr_output_cursor *cursor,
- bool update_hotspot) {
- if (cursor->output->hardware_cursor != cursor) {
- output_cursor_damage_whole(cursor);
- }
-
- struct wlr_surface *surface = cursor->surface;
- assert(surface != NULL);
-
- // Some clients commit a cursor surface with a NULL buffer to hide it.
- cursor->enabled = wlr_surface_has_buffer(surface);
- cursor->width = surface->current.width * cursor->output->scale;
- cursor->height = surface->current.height * cursor->output->scale;
- output_cursor_update_visible(cursor);
- if (update_hotspot) {
- cursor->hotspot_x -= surface->current.dx * cursor->output->scale;
- cursor->hotspot_y -= surface->current.dy * cursor->output->scale;
- }
-
- if (output_cursor_attempt_hardware(cursor)) {
- return;
- }
-
- // Fallback to software cursor
- output_cursor_damage_whole(cursor);
-}
-
-static void output_cursor_handle_commit(struct wl_listener *listener,
- void *data) {
- struct wlr_output_cursor *cursor =
- wl_container_of(listener, cursor, surface_commit);
- output_cursor_commit(cursor, true);
-}
-
-static void output_cursor_handle_destroy(struct wl_listener *listener,
- void *data) {
- struct wlr_output_cursor *cursor = wl_container_of(listener, cursor,
- surface_destroy);
- output_cursor_reset(cursor);
-}
-
-void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
- struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) {
- hotspot_x *= cursor->output->scale;
- hotspot_y *= cursor->output->scale;
-
- if (surface && surface == cursor->surface) {
- // Only update the hotspot: surface hasn't changed
-
- if (cursor->output->hardware_cursor != cursor) {
- output_cursor_damage_whole(cursor);
- }
- cursor->hotspot_x = hotspot_x;
- cursor->hotspot_y = hotspot_y;
- if (cursor->output->hardware_cursor != cursor) {
- output_cursor_damage_whole(cursor);
- } else {
- struct wlr_buffer *buffer = cursor->output->cursor_front_buffer;
-
- struct wlr_box hotspot = {
- .x = cursor->hotspot_x,
- .y = cursor->hotspot_y,
- };
- wlr_box_transform(&hotspot, &hotspot,
- wlr_output_transform_invert(cursor->output->transform),
- buffer ? buffer->width : 0, buffer ? buffer->height : 0);
-
- output_set_hardware_cursor(cursor->output, buffer,
- hotspot.x, hotspot.y);
- }
- return;
- }
-
- output_cursor_reset(cursor);
-
- cursor->surface = surface;
- cursor->hotspot_x = hotspot_x;
- cursor->hotspot_y = hotspot_y;
-
- if (surface != NULL) {
- wl_signal_add(&surface->events.commit, &cursor->surface_commit);
- wl_signal_add(&surface->events.destroy, &cursor->surface_destroy);
-
- cursor->visible = false;
- output_cursor_commit(cursor, false);
- } else {
- cursor->enabled = false;
- cursor->width = 0;
- cursor->height = 0;
-
- if (cursor->output->hardware_cursor == cursor) {
- output_set_hardware_cursor(cursor->output, NULL, 0, 0);
- }
- }
-}
-
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
double x, double y) {
// Scale coordinates for the output
@@ -639,10 +509,6 @@ struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {
return NULL;
}
cursor->output = output;
- wl_list_init(&cursor->surface_commit.link);
- cursor->surface_commit.notify = output_cursor_handle_commit;
- wl_list_init(&cursor->surface_destroy.link);
- cursor->surface_destroy.notify = output_cursor_handle_destroy;
wl_list_insert(&output->cursors, &cursor->link);
cursor->visible = true; // default position is at (0, 0)
return cursor;
diff --git a/types/output/output.c b/types/output/output.c
index b958b3c3..f380f8a2 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -759,16 +759,6 @@ bool wlr_output_commit_state(struct wlr_output *output,
return false;
}
- if (pending.committed & WLR_OUTPUT_STATE_BUFFER) {
- struct wlr_output_cursor *cursor;
- wl_list_for_each(cursor, &output->cursors, link) {
- if (!cursor->enabled || !cursor->visible || cursor->surface == NULL) {
- continue;
- }
- wlr_surface_send_frame_done(cursor->surface, &now);
- }
- }
-
if (pending.committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
output->render_format = pending.render_format;
}