From 83670fce65edc76127bf9595a2f993eaa80a3d59 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 19 Apr 2021 17:32:07 +0200 Subject: [PATCH] examples: remove dependency on GLES2 for compositor examples Most of the examples had a GLES2 dependency, but weren't using it. Convert multi-pointer to wlr_renderer instead of using directly glClear. --- examples/meson.build | 12 +----------- examples/multi-pointer.c | 11 ++++++----- examples/output-layout.c | 1 - examples/rotation.c | 1 - examples/tablet.c | 1 - examples/touch.c | 1 - 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index 704c5183..0fee7d92 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -23,11 +23,6 @@ if libavutil.found() and not cc.has_header('libavutil/hwcontext_drm.h', dependen libavutil = disabler() endif -wlr_gles2_renderer = [] -if not features['gles2-renderer'] - wlr_gles2_renderer = disabler() -endif - compositors = { 'simple': { 'src': 'simple.c', @@ -37,23 +32,18 @@ compositors = { }, 'touch': { 'src': ['touch.c', 'cat.c'], - 'dep': [wlr_gles2_renderer], }, 'tablet': { 'src': 'tablet.c', - 'dep': [wlr_gles2_renderer], }, 'rotation': { 'src': ['rotation.c', 'cat.c'], - 'dep': [wlr_gles2_renderer], }, 'multi-pointer': { 'src': 'multi-pointer.c', - 'dep': [wlr_gles2_renderer], }, 'output-layout': { 'src': ['output-layout.c', 'cat.c'], - 'dep': [wlr_gles2_renderer], }, 'fullscreen-shell': { 'src': 'fullscreen-shell.c', @@ -203,7 +193,7 @@ foreach name, info : compositors executable( name, [info.get('src'), extra_src], - dependencies: [wlroots, libdrm, info.get('dep', [])], + dependencies: [wlroots, libdrm], include_directories: [wlr_inc, proto_inc], build_by_default: get_option('examples'), ) diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index b24ac458..1da1795b 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -1,6 +1,5 @@ #define _POSIX_C_SOURCE 200112L #include -#include #include #include #include @@ -71,7 +70,7 @@ struct sample_keyboard { static void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device, struct sample_state *sample) { struct sample_output *output; - wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device); + wlr_log(WLR_INFO, "Configuring cursor %p for device %p", cursor, device); // reset mappings wlr_cursor_map_to_output(cursor, NULL); @@ -92,14 +91,16 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_output *output = wl_container_of(listener, output, frame); struct sample_state *sample = output->sample; struct wlr_output *wlr_output = output->output; + struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); wlr_output_attach_render(wlr_output, NULL); - glClearColor(sample->clear_color[0], sample->clear_color[1], - sample->clear_color[2], sample->clear_color[3]); - glClear(GL_COLOR_BUFFER_BIT); + wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); + + wlr_renderer_clear(renderer, sample->clear_color); wlr_output_render_software_cursors(wlr_output, NULL); + wlr_renderer_end(renderer); wlr_output_commit(wlr_output); } diff --git a/examples/output-layout.c b/examples/output-layout.c index d8643168..11774f7e 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -1,6 +1,5 @@ #define _POSIX_C_SOURCE 200112L #include -#include #include #include #include diff --git a/examples/rotation.c b/examples/rotation.c index 7be443f2..0b52f9c7 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -1,6 +1,5 @@ #define _POSIX_C_SOURCE 200112L #include -#include #include #include #include diff --git a/examples/tablet.c b/examples/tablet.c index f526c689..54e5476e 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -1,5 +1,4 @@ #define _XOPEN_SOURCE 600 -#include #include #include #include diff --git a/examples/touch.c b/examples/touch.c index f53b7bb8..6ee15c25 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -1,6 +1,5 @@ #define _POSIX_C_SOURCE 200112L #include -#include #include #include #include