diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-15 16:42:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-15 16:42:01 -0500 |
commit | ac78c6642a1c742c896f08282ee31c4f0d3acd51 (patch) | |
tree | 87a5bc837c4fe2b01628665501c0ac016e14f0a7 | |
parent | 0fe51b66e40e7016d42f00d539cbd3d382c2820c (diff) | |
parent | bf1f461eba320cdeded1d5d8ae80caaa9d4cef98 (diff) |
Merge pull request #420 from emersion/output-done
Call wl_output_send_done when current mode is updated
-rw-r--r-- | types/wlr_output.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/types/wlr_output.c b/types/wlr_output.c index df02afec..411dd404 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -29,8 +29,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) { if (version >= WL_OUTPUT_MODE_SINCE_VERSION) { struct wlr_output_mode *mode; wl_list_for_each(mode, &output->modes, link) { - // TODO: mode->flags should just be preferred - uint32_t flags = mode->flags; + uint32_t flags = mode->flags & WL_OUTPUT_MODE_PREFERRED; if (output->current_mode == mode) { flags |= WL_OUTPUT_MODE_CURRENT; } @@ -62,13 +61,17 @@ static void wlr_output_send_current_mode_to_resource( } if (output->current_mode != NULL) { struct wlr_output_mode *mode = output->current_mode; - wl_output_send_mode(resource, mode->flags | WL_OUTPUT_MODE_CURRENT, + uint32_t flags = mode->flags & WL_OUTPUT_MODE_PREFERRED; + wl_output_send_mode(resource, flags | WL_OUTPUT_MODE_CURRENT, mode->width, mode->height, mode->refresh); } else { // Output has no mode, send the current width/height wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT, output->width, output->height, 0); } + if (version >= WL_OUTPUT_DONE_SINCE_VERSION) { + wl_output_send_done(resource); + } } static void wl_output_destroy(struct wl_resource *resource) { @@ -163,6 +166,9 @@ bool wlr_output_set_mode(struct wlr_output *output, void wlr_output_update_size(struct wlr_output *output, int32_t width, int32_t height) { + if (output->width == width && output->height == height) { + return; + } output->width = width; output->height = height; wlr_output_update_matrix(output); |