Remove outdated TODOs, use wlr_surface_has_buffer

This commit is contained in:
emersion 2017-10-31 10:54:05 +01:00
parent 6a74a3586f
commit ae9a46fc9b
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
4 changed files with 5 additions and 9 deletions

View file

@ -84,8 +84,6 @@ static void handle_output_add(struct output_state *ostate) {
example_config_configure_cursor(sample->config, cursor->cursor,
sample->compositor);
// TODO the cursor must be set depending on which surface it is
// displayed over which should happen in the compositor.
struct wlr_xcursor_image *image = sample->xcursor->images[0];
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
image->width, image->height, image->hotspot_x, image->hotspot_y);

View file

@ -108,8 +108,6 @@ static void handle_output_add(struct output_state *ostate) {
example_config_configure_cursor(sample->config, sample->cursor,
sample->compositor);
// TODO the cursor must be set depending on which surface it is displayed
// over which should happen in the compositor.
struct wlr_xcursor_image *image = sample->xcursor->images[0];
wlr_cursor_set_image(sample->cursor, image->buffer, image->width,
image->width, image->height, image->hotspot_x, image->hotspot_y);

View file

@ -223,8 +223,6 @@ void output_add_notify(struct wl_listener *listener, void *data) {
cursor_load_config(config, input->cursor, input, desktop);
// TODO the cursor must be set depending on which surface it is displayed
// over which should happen in the compositor.
struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme);
struct wlr_xcursor_image *image = xcursor->images[0];
wlr_cursor_set_image(input->cursor, image->buffer, image->width,

View file

@ -241,13 +241,15 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
struct wlr_texture *texture = cursor->texture;
struct wlr_renderer *renderer = cursor->renderer;
if (cursor->surface != NULL) {
// Some clients commit a cursor surface with a NULL buffer to hide it.
if (!wlr_surface_has_buffer(cursor->surface)) {
return;
}
texture = cursor->surface->texture;
renderer = cursor->surface->renderer;
}
// We check texture->valid because some clients set a cursor surface
// with a NULL buffer to hide it
if (renderer && texture && texture->valid) {
if (texture != NULL && renderer != NULL) {
glViewport(0, 0, cursor->output->width, cursor->output->height);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);