aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/multi-pointer.c2
-rw-r--r--examples/output-layout.c6
-rw-r--r--examples/pointer.c4
-rw-r--r--examples/rotation.c6
-rw-r--r--examples/touch.c13
5 files changed, 17 insertions, 14 deletions
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c
index 43ccdb66..1f869f50 100644
--- a/examples/multi-pointer.c
+++ b/examples/multi-pointer.c
@@ -149,7 +149,7 @@ static void handle_input_add(struct compositor_state *state,
sample->compositor);
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 * 4,
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
wl_list_insert(&sample->cursors, &cursor->link);
diff --git a/examples/output-layout.c b/examples/output-layout.c
index 45d896b0..c1392a30 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -197,9 +197,9 @@ int main(int argc, char *argv[]) {
compositor_init(&compositor);
state.renderer = wlr_gles2_renderer_create(compositor.backend);
- state.cat_texture = wlr_render_texture_create(state.renderer);
- wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
- cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
+ state.cat_texture = wlr_texture_from_pixels(state.renderer,
+ WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
+ cat_tex.pixel_data);
if (!wlr_backend_start(compositor.backend)) {
wlr_log(L_ERROR, "Failed to start backend");
diff --git a/examples/pointer.c b/examples/pointer.c
index e8a0e892..9794e6e5 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -112,7 +112,7 @@ static void handle_output_add(struct output_state *ostate) {
sample->compositor);
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 * 4,
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
wlr_cursor_warp(sample->cursor, NULL, sample->cursor->x, sample->cursor->y);
@@ -324,7 +324,7 @@ int main(int argc, char *argv[]) {
}
struct wlr_xcursor_image *image = state.xcursor->images[0];
- wlr_cursor_set_image(state.cursor, image->buffer, image->width,
+ wlr_cursor_set_image(state.cursor, image->buffer, image->width * 4,
image->width, image->height, image->hotspot_x, image->hotspot_y, 0);
compositor_init(&compositor);
diff --git a/examples/rotation.c b/examples/rotation.c
index cbff09a1..dfafeeca 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -142,13 +142,13 @@ int main(int argc, char *argv[]) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
- state.cat_texture = wlr_render_texture_create(state.renderer);
+ state.cat_texture = wlr_texture_from_pixels(state.renderer,
+ WL_SHM_FORMAT_ABGR8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
+ cat_tex.pixel_data);
if (!state.cat_texture) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
- wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ABGR8888,
- cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
if (!wlr_backend_start(compositor.backend)) {
wlr_log(L_ERROR, "Failed to start backend");
diff --git a/examples/touch.c b/examples/touch.c
index f9c496cf..7639165c 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -45,10 +45,13 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
wlr_renderer_begin(sample->renderer, wlr_output->width, wlr_output->height);
wlr_renderer_clear(sample->renderer, (float[]){0.25f, 0.25f, 0.25f, 1});
+ int tex_width, tex_height;
+ wlr_texture_get_size(sample->cat_texture, &tex_width, &tex_height);
+
struct touch_point *p;
wl_list_for_each(p, &sample->touch_points, link) {
- int x = (int)(p->x * width) - sample->cat_texture->width / 2;
- int y = (int)(p->y * height) - sample->cat_texture->height / 2;
+ int x = (int)(p->x * width) - tex_width / 2;
+ int y = (int)(p->y * height) - tex_height / 2;
wlr_render_texture(sample->renderer, sample->cat_texture,
wlr_output->transform_matrix, x, y, 1.0f);
}
@@ -110,13 +113,13 @@ int main(int argc, char *argv[]) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
- state.cat_texture = wlr_render_texture_create(state.renderer);
+ state.cat_texture = wlr_texture_from_pixels(state.renderer,
+ WL_SHM_FORMAT_ARGB8888, cat_tex.width * 4, cat_tex.width, cat_tex.height,
+ cat_tex.pixel_data);
if (!state.cat_texture) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
- wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ARGB8888,
- cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);
if (!wlr_backend_start(compositor.backend)) {
wlr_log(L_ERROR, "Failed to start backend");