Merge pull request #1462 from alexbakker/fix-soft-cursors

Fix software cursor rendering for tinywl and some examples
This commit is contained in:
Drew DeVault 2019-01-13 15:45:08 -05:00 committed by GitHub
commit 10a2c4edec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -100,6 +100,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
sample->clear_color[2], sample->clear_color[3]); sample->clear_color[2], sample->clear_color[3]);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
wlr_output_render_software_cursors(wlr_output, NULL);
wlr_output_swap_buffers(wlr_output, NULL, NULL); wlr_output_swap_buffers(wlr_output, NULL, NULL);
} }

View File

@ -101,6 +101,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) {
wlr_output_make_current(wlr_output, NULL); wlr_output_make_current(wlr_output, NULL);
wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);
wlr_renderer_clear(renderer, state->clear_color); wlr_renderer_clear(renderer, state->clear_color);
wlr_output_render_software_cursors(wlr_output, NULL);
wlr_output_swap_buffers(wlr_output, NULL, NULL); wlr_output_swap_buffers(wlr_output, NULL, NULL);
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
} }

View File

@ -610,6 +610,14 @@ static void output_frame(struct wl_listener *listener, void *data) {
render_surface, &rdata); render_surface, &rdata);
} }
/* Hardware cursors are rendered by the GPU on a separate plane, and can be
* moved around without re-rendering what's beneath them - which is more
* efficient. However, not all hardware supports hardware cursors. For this
* reason, wlroots provides a software fallback, which we ask it to render
* here. wlr_cursor handles configuring hardware vs software cursors for you,
* and this function is a no-op when hardware cursors are in use. */
wlr_output_render_software_cursors(output->wlr_output, NULL);
/* Conclude rendering and swap the buffers, showing the final frame /* Conclude rendering and swap the buffers, showing the final frame
* on-screen. */ * on-screen. */
wlr_renderer_end(renderer); wlr_renderer_end(renderer);