aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-08-29 12:08:49 -0400
committerTony Crisci <tony@dubstepdish.com>2017-08-29 12:36:39 -0400
commit9b65d0b3f0030bf2103cd7d65448f727c62de468 (patch)
tree2ba88f72b4ae0310dcc40aa27fa4d41be536d4c9 /examples
parenta51b76083e589214320f30c8792d6b2666ef21d2 (diff)
refactor and rename wlr_geometry to wlr_box
Diffstat (limited to 'examples')
-rw-r--r--examples/config.c34
-rw-r--r--examples/config.h4
-rw-r--r--examples/pointer.c4
3 files changed, 21 insertions, 21 deletions
diff --git a/examples/config.c b/examples/config.c
index b99f130d..a1ed5d5a 100644
--- a/examples/config.c
+++ b/examples/config.c
@@ -8,7 +8,7 @@
#include <unistd.h>
#include <sys/param.h>
#include <wlr/util/log.h>
-#include <wlr/types/wlr_geometry.h>
+#include <wlr/types/wlr_box.h>
#include "shared.h"
#include "config.h"
#include "ini.h"
@@ -25,7 +25,7 @@ static void usage(const char *name, int ret) {
exit(ret);
}
-static struct wlr_geometry *parse_geometry(const char *str) {
+static struct wlr_box *parse_geometry(const char *str) {
// format: {width}x{height}+{x}+{y}
if (strlen(str) > 255) {
wlr_log(L_ERROR, "cannot parse geometry string, too long");
@@ -33,7 +33,7 @@ static struct wlr_geometry *parse_geometry(const char *str) {
}
char *buf = strdup(str);
- struct wlr_geometry *geo = calloc(1, sizeof(struct wlr_geometry));
+ struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
bool has_width = false;
bool has_height = false;
@@ -56,16 +56,16 @@ static struct wlr_geometry *parse_geometry(const char *str) {
}
if (!has_width) {
- geo->width = val;
+ box->width = val;
has_width = true;
} else if (!has_height) {
- geo->height = val;
+ box->height = val;
has_height = true;
} else if (!has_x) {
- geo->x = val;
+ box->x = val;
has_x = true;
} else if (!has_y) {
- geo->y = val;
+ box->y = val;
has_y = true;
} else {
break;
@@ -78,12 +78,12 @@ static struct wlr_geometry *parse_geometry(const char *str) {
}
free(buf);
- return geo;
+ return box;
invalid_input:
wlr_log(L_ERROR, "could not parse geometry string: %s", str);
free(buf);
- free(geo);
+ free(box);
return NULL;
}
@@ -140,8 +140,8 @@ static int config_ini_handler(void *user, const char *section, const char *name,
free(config->cursor.mapped_output);
config->cursor.mapped_output = strdup(value);
} else if (strcmp(name, "geometry") == 0) {
- free(config->cursor.mapped_geo);
- config->cursor.mapped_geo = parse_geometry(value);
+ free(config->cursor.mapped_box);
+ config->cursor.mapped_box = parse_geometry(value);
} else {
wlr_log(L_ERROR, "got unknown cursor config: %s", name);
}
@@ -167,8 +167,8 @@ static int config_ini_handler(void *user, const char *section, const char *name,
free(dc->mapped_output);
dc->mapped_output = strdup(value);
} else if (strcmp(name, "geometry") == 0) {
- free(dc->mapped_geo);
- dc->mapped_geo = parse_geometry(value);
+ free(dc->mapped_box);
+ dc->mapped_box = parse_geometry(value);
} else {
wlr_log(L_ERROR, "got unknown device config: %s", name);
}
@@ -239,8 +239,8 @@ void example_config_destroy(struct example_config *config) {
if (dc->mapped_output) {
free(dc->mapped_output);
}
- if (dc->mapped_geo) {
- free(dc->mapped_geo);
+ if (dc->mapped_box) {
+ free(dc->mapped_box);
}
free(dc);
}
@@ -251,8 +251,8 @@ void example_config_destroy(struct example_config *config) {
if (config->cursor.mapped_output) {
free(config->cursor.mapped_output);
}
- if (config->cursor.mapped_geo) {
- free(config->cursor.mapped_geo);
+ if (config->cursor.mapped_box) {
+ free(config->cursor.mapped_box);
}
free(config);
}
diff --git a/examples/config.h b/examples/config.h
index cd19dc5e..2a69c4f4 100644
--- a/examples/config.h
+++ b/examples/config.h
@@ -15,14 +15,14 @@ struct output_config {
struct device_config {
char *name;
char *mapped_output;
- struct wlr_geometry *mapped_geo;
+ struct wlr_box *mapped_box;
struct wl_list link;
};
struct example_config {
struct {
char *mapped_output;
- struct wlr_geometry *mapped_geo;
+ struct wlr_box *mapped_box;
} cursor;
struct wl_list outputs;
diff --git a/examples/pointer.c b/examples/pointer.c
index 5341c72c..d9a06339 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -105,7 +105,7 @@ static void configure_devices(struct sample_state *sample) {
wl_list_for_each(dc, &sample->config->devices, link) {
if (strcmp(dev->device->name, dc->name) == 0) {
wlr_cursor_map_input_to_region(sample->cursor, dev->device,
- dc->mapped_geo);
+ dc->mapped_box);
}
}
}
@@ -341,7 +341,7 @@ int main(int argc, char *argv[]) {
state.config = parse_args(argc, argv);
state.cursor = wlr_cursor_create();
- wlr_cursor_map_to_region(state.cursor, state.config->cursor.mapped_geo);
+ wlr_cursor_map_to_region(state.cursor, state.config->cursor.mapped_box);
wl_list_init(&state.devices);
// pointer events