aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-20 17:51:45 -0400
committerDrew DeVault <sir@cmpwn.com>2017-06-20 17:51:45 -0400
commitb9d36c8149536cff1aa229f59337dcfa2f70a37b (patch)
tree1381f243d1bb9df41691e2b92593a8495bb80f37 /example
parentc9d5a0b2fb5686627344922138c3c603cae364bc (diff)
Add dynamic output resizing for Wayland backend
This allows outputs to: - Not support modesetting - Resize themselves
Diffstat (limited to 'example')
-rw-r--r--example/pointer.c17
-rw-r--r--example/rotation.c13
-rw-r--r--example/shared.c4
3 files changed, 17 insertions, 17 deletions
diff --git a/example/pointer.c b/example/pointer.c
index 1da77b85..8735c61e 100644
--- a/example/pointer.c
+++ b/example/pointer.c
@@ -110,15 +110,14 @@ int main(int argc, char *argv[]) {
.default_color = { 0.25f, 0.25f, 0.25f, 1 },
.clear_color = { 0.25f, 0.25f, 0.25f, 1 }
};
- struct compositor_state compositor = { 0,
- .data = &state,
- .output_add_cb = handle_output_add,
- .output_frame_cb = handle_output_frame,
- .keyboard_key_cb = handle_keyboard_key,
- .pointer_motion_cb = handle_pointer_motion,
- .pointer_button_cb = handle_pointer_button,
- .pointer_axis_cb = handle_pointer_axis,
- };
+ struct compositor_state compositor = { 0 };
+ compositor.data = &state;
+ compositor.output_add_cb = handle_output_add;
+ compositor.output_frame_cb = handle_output_frame;
+ compositor.keyboard_key_cb = handle_keyboard_key;
+ compositor.pointer_motion_cb = handle_pointer_motion;
+ compositor.pointer_button_cb = handle_pointer_button;
+ compositor.pointer_axis_cb = handle_pointer_axis;
compositor_init(&compositor);
state.renderer = wlr_gles3_renderer_init();
diff --git a/example/rotation.c b/example/rotation.c
index a1c77013..d7b6b169 100644
--- a/example/rotation.c
+++ b/example/rotation.c
@@ -197,13 +197,12 @@ int main(int argc, char *argv[]) {
wl_list_init(&state.config);
parse_args(argc, argv, &state.config);
- struct compositor_state compositor = { 0,
- .data = &state,
- .output_add_cb = handle_output_add,
- .output_remove_cb = handle_output_remove,
- .output_frame_cb = handle_output_frame,
- .keyboard_key_cb = handle_keyboard_key,
- };
+ struct compositor_state compositor = { 0 };
+ compositor.data = &state;
+ compositor.output_add_cb = handle_output_add;
+ compositor.output_remove_cb = handle_output_remove;
+ compositor.output_frame_cb = handle_output_frame;
+ compositor.keyboard_key_cb = handle_keyboard_key;
compositor_init(&compositor);
state.renderer = wlr_gles3_renderer_init();
diff --git a/example/shared.c b/example/shared.c
index 0fe7270f..6af3042b 100644
--- a/example/shared.c
+++ b/example/shared.c
@@ -383,7 +383,9 @@ static void output_add_notify(struct wl_listener *listener, void *data) {
fprintf(stderr, "Output '%s' added\n", output->name);
fprintf(stderr, "%s %s %"PRId32"mm x %"PRId32"mm\n", output->make, output->model,
output->phys_width, output->phys_height);
- wlr_output_set_mode(output, output->modes->items[0]);
+ if (output->modes->length > 0) {
+ wlr_output_set_mode(output, output->modes->items[0]);
+ }
struct output_state *ostate = calloc(1, sizeof(struct output_state));
clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame);
ostate->output = output;