mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 08:32:30 +00:00
examples: use wlr_output_preferred_mode
This commit is contained in:
parent
3432ab2ba7
commit
fd7e565ce3
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user