output: drop wlr_output_mode.flags

AFAIK this was always set to zero. Instead, compute wl_output mode flags on the
fly.

Technically this is a breaking change, but I don't think anybody uses this
field.
This commit is contained in:
Simon Ser 2019-07-19 22:42:37 +03:00 committed by Drew DeVault
parent bb05617414
commit 76ef089f52
2 changed files with 10 additions and 5 deletions

View File

@ -18,7 +18,6 @@
#include <wlr/types/wlr_buffer.h> #include <wlr/types/wlr_buffer.h>
struct wlr_output_mode { struct wlr_output_mode {
uint32_t flags; // enum wl_output_mode
int32_t width, height; int32_t width, height;
int32_t refresh; // mHz int32_t refresh; // mHz
bool preferred; bool preferred;

View File

@ -31,7 +31,10 @@ static void send_all_modes(struct wl_resource *resource) {
struct wlr_output_mode *mode; struct wlr_output_mode *mode;
wl_list_for_each(mode, &output->modes, link) { wl_list_for_each(mode, &output->modes, link) {
uint32_t flags = mode->flags & WL_OUTPUT_MODE_PREFERRED; uint32_t flags = 0;
if (mode->preferred) {
flags |= WL_OUTPUT_MODE_PREFERRED;
}
if (output->current_mode == mode) { if (output->current_mode == mode) {
flags |= WL_OUTPUT_MODE_CURRENT; flags |= WL_OUTPUT_MODE_CURRENT;
} }
@ -50,9 +53,12 @@ static void send_current_mode(struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource); struct wlr_output *output = wlr_output_from_resource(resource);
if (output->current_mode != NULL) { if (output->current_mode != NULL) {
struct wlr_output_mode *mode = output->current_mode; struct wlr_output_mode *mode = output->current_mode;
uint32_t flags = mode->flags & WL_OUTPUT_MODE_PREFERRED; uint32_t flags = WL_OUTPUT_MODE_CURRENT;
wl_output_send_mode(resource, flags | WL_OUTPUT_MODE_CURRENT, if (mode->preferred) {
mode->width, mode->height, mode->refresh); flags |= WL_OUTPUT_MODE_PREFERRED;
}
wl_output_send_mode(resource, flags, mode->width, mode->height,
mode->refresh);
} else { } else {
// Output has no mode // Output has no mode
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT, output->width, wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT, output->width,