mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
Remove outdated TODOs, use wlr_surface_has_buffer
This commit is contained in:
parent
6a74a3586f
commit
ae9a46fc9b
4 changed files with 5 additions and 9 deletions
|
@ -84,8 +84,6 @@ static void handle_output_add(struct output_state *ostate) {
|
||||||
example_config_configure_cursor(sample->config, cursor->cursor,
|
example_config_configure_cursor(sample->config, cursor->cursor,
|
||||||
sample->compositor);
|
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];
|
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
||||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||||
|
|
|
@ -108,8 +108,6 @@ static void handle_output_add(struct output_state *ostate) {
|
||||||
example_config_configure_cursor(sample->config, sample->cursor,
|
example_config_configure_cursor(sample->config, sample->cursor,
|
||||||
sample->compositor);
|
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];
|
struct wlr_xcursor_image *image = sample->xcursor->images[0];
|
||||||
wlr_cursor_set_image(sample->cursor, image->buffer, image->width,
|
wlr_cursor_set_image(sample->cursor, image->buffer, image->width,
|
||||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||||
|
|
|
@ -223,8 +223,6 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
cursor_load_config(config, input->cursor, input, desktop);
|
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 *xcursor = get_default_xcursor(input->xcursor_theme);
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_cursor_set_image(input->cursor, image->buffer, image->width,
|
wlr_cursor_set_image(input->cursor, image->buffer, image->width,
|
||||||
|
|
|
@ -241,13 +241,15 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
|
||||||
struct wlr_texture *texture = cursor->texture;
|
struct wlr_texture *texture = cursor->texture;
|
||||||
struct wlr_renderer *renderer = cursor->renderer;
|
struct wlr_renderer *renderer = cursor->renderer;
|
||||||
if (cursor->surface != NULL) {
|
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;
|
texture = cursor->surface->texture;
|
||||||
renderer = cursor->surface->renderer;
|
renderer = cursor->surface->renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We check texture->valid because some clients set a cursor surface
|
if (texture != NULL && renderer != NULL) {
|
||||||
// with a NULL buffer to hide it
|
|
||||||
if (renderer && texture && texture->valid) {
|
|
||||||
glViewport(0, 0, cursor->output->width, cursor->output->height);
|
glViewport(0, 0, cursor->output->width, cursor->output->height);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
Loading…
Reference in a new issue