diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-01-13 15:45:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-13 15:45:08 -0500 |
commit | 10a2c4edec5e4f0877ff4afc83178c3f08b4f063 (patch) | |
tree | 8a67242c39b2086bf6c31891e5a1996770ea872c | |
parent | 8134d5b1e0b8c65f7c8b2e7ae626c1f2e5cbc9e1 (diff) | |
parent | 776b6ce39512c00d756b994528b4fb300c0d5610 (diff) |
Merge pull request #1462 from alexbakker/fix-soft-cursors
Fix software cursor rendering for tinywl and some examples
-rw-r--r-- | examples/multi-pointer.c | 1 | ||||
-rw-r--r-- | examples/pointer.c | 1 | ||||
-rw-r--r-- | tinywl/tinywl.c | 8 |
3 files changed, 10 insertions, 0 deletions
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index 49670c39..a007f712 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -100,6 +100,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) { sample->clear_color[2], sample->clear_color[3]); glClear(GL_COLOR_BUFFER_BIT); + wlr_output_render_software_cursors(wlr_output, NULL); wlr_output_swap_buffers(wlr_output, NULL, NULL); } diff --git a/examples/pointer.c b/examples/pointer.c index cc58c223..c7140d97 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -101,6 +101,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) { wlr_output_make_current(wlr_output, NULL); wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); wlr_renderer_clear(renderer, state->clear_color); + wlr_output_render_software_cursors(wlr_output, NULL); wlr_output_swap_buffers(wlr_output, NULL, NULL); wlr_renderer_end(renderer); } diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 49bce1f3..14a1d08b 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -610,6 +610,14 @@ static void output_frame(struct wl_listener *listener, void *data) { 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 * on-screen. */ wlr_renderer_end(renderer); |