diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-08-17 11:21:54 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-08-17 21:05:13 -0400 |
commit | d9ebf0615a2f548a66abc590dbca9ae395cdfd0e (patch) | |
tree | c39aec086f9ffaebc92bf677cafa40b9743af8c7 /examples | |
parent | 5a9baf487e0161cfbf9481c31eb6f72be0ec2fbe (diff) |
add output resolution notify to example shared
Diffstat (limited to 'examples')
-rw-r--r-- | examples/shared.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/shared.c b/examples/shared.c index 58aef21a..1474f8a2 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -428,6 +428,15 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { compositor->last_frame = now; } +static void output_resolution_notify(struct wl_listener *listener, void *data) { + struct output_state *output = wl_container_of(listener, output, resolution); + struct compositor_state *compositor = output->compositor; + + if (compositor->output_resolution_cb) { + compositor->output_resolution_cb(output); + } +} + static void output_add_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct compositor_state *state = wl_container_of(listener, state, output_add); @@ -442,8 +451,10 @@ static void output_add_notify(struct wl_listener *listener, void *data) { ostate->output = output; ostate->compositor = state; ostate->frame.notify = output_frame_notify; + ostate->resolution.notify = output_resolution_notify; wl_list_init(&ostate->frame.link); wl_signal_add(&output->events.frame, &ostate->frame); + wl_signal_add(&output->events.resolution, &ostate->resolution); wl_list_insert(&state->outputs, &ostate->link); if (state->output_add_cb) { state->output_add_cb(ostate); @@ -468,6 +479,7 @@ static void output_remove_notify(struct wl_listener *listener, void *data) { } wl_list_remove(&ostate->link); wl_list_remove(&ostate->frame.link); + wl_list_remove(&ostate->resolution.link); free(ostate); } |