mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
Fix software cursors
This commit is contained in:
parent
de6f32c84e
commit
2facf1df65
4 changed files with 19 additions and 11 deletions
|
@ -245,10 +245,12 @@ static struct wlr_renderer_impl wlr_renderer_impl = {
|
||||||
|
|
||||||
struct wlr_renderer *wlr_gles2_renderer_init(struct wlr_backend *backend) {
|
struct wlr_renderer *wlr_gles2_renderer_init(struct wlr_backend *backend) {
|
||||||
init_globals();
|
init_globals();
|
||||||
struct wlr_egl *egl = wlr_backend_get_egl(backend);
|
|
||||||
struct wlr_gles2_renderer *renderer =
|
struct wlr_gles2_renderer *renderer =
|
||||||
calloc(1, sizeof(struct wlr_gles2_renderer));
|
calloc(1, sizeof(struct wlr_gles2_renderer));
|
||||||
wlr_renderer_init(&renderer->wlr_renderer, &wlr_renderer_impl);
|
wlr_renderer_init(&renderer->wlr_renderer, &wlr_renderer_impl);
|
||||||
|
if (backend) {
|
||||||
|
struct wlr_egl *egl = wlr_backend_get_egl(backend);
|
||||||
renderer->egl = egl;
|
renderer->egl = egl;
|
||||||
|
}
|
||||||
return &renderer->wlr_renderer;
|
return &renderer->wlr_renderer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_renderer_destroy(struct wlr_renderer *r) {
|
void wlr_renderer_destroy(struct wlr_renderer *r) {
|
||||||
if (r->impl->destroy) {
|
if (r && r->impl->destroy) {
|
||||||
r->impl->destroy(r);
|
r->impl->destroy(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ void wlr_texture_init(struct wlr_texture *texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_texture_destroy(struct wlr_texture *texture) {
|
void wlr_texture_destroy(struct wlr_texture *texture) {
|
||||||
if (texture->impl->destroy) {
|
if (texture && texture->impl->destroy) {
|
||||||
texture->impl->destroy(texture);
|
texture->impl->destroy(texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,6 @@ bool wlr_output_set_cursor(struct wlr_output *output,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
wlr_log(L_INFO, "Falling back to software cursor");
|
wlr_log(L_INFO, "Falling back to software cursor");
|
||||||
|
|
||||||
output->cursor.is_sw = true;
|
output->cursor.is_sw = true;
|
||||||
|
@ -138,18 +137,22 @@ bool wlr_output_set_cursor(struct wlr_output *output,
|
||||||
output->cursor.height = height;
|
output->cursor.height = height;
|
||||||
|
|
||||||
if (!output->cursor.renderer) {
|
if (!output->cursor.renderer) {
|
||||||
output->cursor.renderer = wlr_gles2_renderer_init();
|
/* NULL egl is okay given that we are only using pixel buffers */
|
||||||
|
output->cursor.renderer = wlr_gles2_renderer_init(NULL);
|
||||||
|
if (!output->cursor.renderer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!output->cursor.texture) {
|
if (!output->cursor.texture) {
|
||||||
output->cursor.texture = wlr_render_texture_init(output->cursor.renderer);
|
output->cursor.texture = wlr_render_texture_init(output->cursor.renderer);
|
||||||
|
if (!output->cursor.texture) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_texture_upload_pixels(output->cursor.texture, WL_SHM_FORMAT_ARGB8888,
|
return wlr_texture_upload_pixels(output->cursor.texture,
|
||||||
stride, width, height, buf);
|
WL_SHM_FORMAT_ARGB8888, stride, width, height, buf);
|
||||||
*/
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) {
|
bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) {
|
||||||
|
@ -172,6 +175,9 @@ void wlr_output_destroy(struct wlr_output *output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_texture_destroy(output->cursor.texture);
|
||||||
|
wlr_renderer_destroy(output->cursor.renderer);
|
||||||
|
|
||||||
output->impl->destroy(output);
|
output->impl->destroy(output);
|
||||||
for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
|
for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
|
||||||
struct wlr_output_mode *mode = output->modes->items[i];
|
struct wlr_output_mode *mode = output->modes->items[i];
|
||||||
|
|
Loading…
Reference in a new issue