aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-24 07:28:04 -0400
committerTony Crisci <tony@dubstepdish.com>2017-10-24 07:57:36 -0400
commit1dbe31493708790f6fafb4c9da8d24cbb3fa07b9 (patch)
tree42e7dbbe8b77403aa00983befc256f7b7a7742ca /examples
parent6fcac087fe1d7b7fa3cd0628a6b7818d26222678 (diff)
parent1b7918f50e8b22cbaba978c695b7cc5921125c55 (diff)
Merge branch 'master' into feature/data-device-selection
Diffstat (limited to 'examples')
-rw-r--r--examples/pointer.c9
-rw-r--r--examples/screenshot.c4
-rw-r--r--examples/shared.c6
-rw-r--r--examples/touch.c10
4 files changed, 14 insertions, 15 deletions
diff --git a/examples/pointer.c b/examples/pointer.c
index 92faaf0c..66598ad4 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -21,6 +21,7 @@
#include <wlr/xcursor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/util/log.h>
+#include <wlr/types/wlr_list.h>
#include "shared.h"
#include "config.h"
#include "cat.h"
@@ -45,7 +46,7 @@ struct sample_state {
struct wl_listener touch_up;
struct wl_listener touch_down;
struct wl_listener touch_cancel;
- list_t *touch_points;
+ struct wlr_list *touch_points;
struct wl_listener tablet_tool_axis;
struct wl_listener tablet_tool_proxmity;
@@ -212,7 +213,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) {
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *point = sample->touch_points->items[i];
if (point->slot == event->slot) {
- list_del(sample->touch_points, i);
+ wlr_list_del(sample->touch_points, i);
break;
}
}
@@ -227,7 +228,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
point->slot = event->slot;
point->x = event->x_mm / event->width_mm;
point->y = event->y_mm / event->height_mm;
- if (list_add(sample->touch_points, point) == -1) {
+ if (wlr_list_add(sample->touch_points, point) == -1) {
free(point);
}
@@ -269,7 +270,7 @@ int main(int argc, char *argv[]) {
struct sample_state state = {
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
.clear_color = { 0.25f, 0.25f, 0.25f, 1 },
- .touch_points = list_create(),
+ .touch_points = wlr_list_create(),
};
state.config = parse_args(argc, argv);
diff --git a/examples/screenshot.c b/examples/screenshot.c
index 95af49ca..2a3b74aa 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -267,10 +267,6 @@ int main(int argc, char *argv[]) {
struct screenshooter_output *output;
wl_list_for_each(output, &output_list, link) {
- if (output->width == 0 || output->height == 0) {
- continue;
- }
-
output->buffer = create_shm_buffer(output->width, output->height, &output->data);
if (output->buffer == NULL) {
return -1;
diff --git a/examples/shared.c b/examples/shared.c
index 1fdd5775..1a1f4be4 100644
--- a/examples/shared.c
+++ b/examples/shared.c
@@ -413,8 +413,10 @@ static void output_add_notify(struct wl_listener *listener, void *data) {
wlr_log(L_DEBUG, "Output '%s' added", output->name);
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model,
output->phys_width, output->phys_height);
- if (output->modes->length > 0) {
- wlr_output_set_mode(output, output->modes->items[0]);
+ if (wl_list_length(&output->modes) > 0) {
+ struct wlr_output_mode *mode;
+ mode = wl_container_of((&output->modes)->prev, mode, link);
+ wlr_output_set_mode(output, mode);
}
struct output_state *ostate = calloc(1, sizeof(struct output_state));
clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame);
diff --git a/examples/touch.c b/examples/touch.c
index db025942..3f0c4867 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -16,7 +16,7 @@
#include <wlr/render.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
-#include <wlr/util/list.h>
+#include <wlr/types/wlr_list.h>
#include <wlr/util/log.h>
#include "shared.h"
#include "cat.h"
@@ -24,7 +24,7 @@
struct sample_state {
struct wlr_renderer *renderer;
struct wlr_texture *cat_texture;
- list_t *touch_points;
+ struct wlr_list *touch_points;
};
struct touch_point {
@@ -65,7 +65,7 @@ static void handle_touch_down(struct touch_state *tstate, int32_t slot,
point->slot = slot;
point->x = x / width;
point->y = y / height;
- if (list_add(sample->touch_points, point) == -1) {
+ if (wlr_list_add(sample->touch_points, point) == -1) {
free(point);
}
}
@@ -75,7 +75,7 @@ static void handle_touch_up(struct touch_state *tstate, int32_t slot) {
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *point = sample->touch_points->items[i];
if (point->slot == slot) {
- list_del(sample->touch_points, i);
+ wlr_list_del(sample->touch_points, i);
break;
}
}
@@ -96,7 +96,7 @@ static void handle_touch_motion(struct touch_state *tstate, int32_t slot,
int main(int argc, char *argv[]) {
struct sample_state state = {
- .touch_points = list_create()
+ .touch_points = wlr_list_create()
};
struct compositor_state compositor = { 0,
.data = &state,