aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/fullscreen-shell.c11
-rw-r--r--examples/multi-pointer.c10
-rw-r--r--examples/output-layout.c9
-rw-r--r--examples/pointer.c9
-rw-r--r--examples/rotation.c9
-rw-r--r--examples/simple.c10
-rw-r--r--examples/tablet.c9
-rw-r--r--examples/touch.c9
8 files changed, 40 insertions, 36 deletions
diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c
index 9a2f7d7d..52776c55 100644
--- a/examples/fullscreen-shell.c
+++ b/examples/fullscreen-shell.c
@@ -146,12 +146,6 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
wl_container_of(listener, server, new_output);
struct wlr_output *wlr_output = data;
- if (!wl_list_empty(&wlr_output->modes)) {
- struct wlr_output_mode *mode =
- wl_container_of(wlr_output->modes.prev, mode, link);
- wlr_output_set_mode(wlr_output, mode);
- }
-
struct fullscreen_output *output =
calloc(1, sizeof(struct fullscreen_output));
output->wlr_output = wlr_output;
@@ -163,6 +157,11 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
wlr_output_layout_add_auto(server->output_layout, wlr_output);
wlr_output_create_global(wlr_output);
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output);
+ if (mode != NULL) {
+ wlr_output_set_mode(wlr_output, mode);
+ }
+
wlr_output_commit(wlr_output);
}
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c
index 2445e2ff..b24ac458 100644
--- a/examples/multi-pointer.c
+++ b/examples/multi-pointer.c
@@ -145,10 +145,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
@@ -158,7 +154,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wlr_output_layout_add_auto(sample->layout, output);
-
struct sample_cursor *cursor;
wl_list_for_each(cursor, &sample->cursors, link) {
configure_cursor(cursor->cursor, cursor->device, sample);
@@ -172,6 +167,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
}
wl_list_insert(&sample->outputs, &sample_output->link);
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}
diff --git a/examples/output-layout.c b/examples/output-layout.c
index cacee014..d8643168 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -159,10 +159,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
wlr_output_layout_add_auto(sample->layout, output);
sample_output->output = output;
sample_output->sample = sample;
@@ -171,6 +167,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}
diff --git a/examples/pointer.c b/examples/pointer.c
index 64815804..e446d81e 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -252,10 +252,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
sample_output->output = output;
sample_output->state = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
@@ -268,6 +264,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wlr_xcursor_manager_set_cursor_image(sample->xcursor_manager, "left_ptr",
sample->cursor);
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}
diff --git a/examples/rotation.c b/examples/rotation.c
index 84daa822..7be443f2 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -109,10 +109,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
sample_output->x_offs = sample_output->y_offs = 0;
sample_output->x_vel = sample_output->y_vel = 128;
@@ -125,6 +121,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->destroy.notify = output_remove_notify;
wl_list_insert(&sample->outputs, &sample_output->link);
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}
diff --git a/examples/simple.c b/examples/simple.c
index 34ca46c7..20d80096 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -86,11 +86,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_container_of(listener, sample, new_output);
struct sample_output *sample_output =
calloc(1, sizeof(struct sample_output));
-
- struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
- if (mode != NULL) {
- wlr_output_set_mode(output, mode);
- }
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
@@ -98,6 +93,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(sample_output->output);
}
diff --git a/examples/tablet.c b/examples/tablet.c
index af21ad2e..f526c689 100644
--- a/examples/tablet.c
+++ b/examples/tablet.c
@@ -239,10 +239,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
@@ -250,6 +246,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}
diff --git a/examples/touch.c b/examples/touch.c
index 3184d8be..f53b7bb8 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -151,10 +151,6 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct wlr_output *output = data;
struct sample_state *sample = wl_container_of(listener, sample, new_output);
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
- if (!wl_list_empty(&output->modes)) {
- struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link);
- wlr_output_set_mode(output, mode);
- }
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
@@ -162,6 +158,11 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;
+ struct wlr_output_mode *mode = wlr_output_preferred_mode(output);
+ if (mode != NULL) {
+ wlr_output_set_mode(output, mode);
+ }
+
wlr_output_commit(output);
}