git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

scenefx/types/output/output.c (863B)

 1 #include <stdlib.h>
 2 
 3 #include "types/wlr_output.h"
 4 
 5 void output_pending_resolution(struct wlr_output *output,
 6 		const struct wlr_output_state *state, int *width, int *height) {
 7 	if (state->committed & WLR_OUTPUT_STATE_MODE) {
 8 		switch (state->mode_type) {
 9 		case WLR_OUTPUT_STATE_MODE_FIXED:
10 			*width = state->mode->width;
11 			*height = state->mode->height;
12 			return;
13 		case WLR_OUTPUT_STATE_MODE_CUSTOM:
14 			*width = state->custom_mode.width;
15 			*height = state->custom_mode.height;
16 			return;
17 		}
18 		abort();
19 	} else {
20 		*width = output->width;
21 		*height = output->height;
22 	}
23 }
24 
25 const struct wlr_output_image_description *output_pending_image_description(
26 		struct wlr_output *output, const struct wlr_output_state *state) {
27 	if (state->committed & WLR_OUTPUT_STATE_IMAGE_DESCRIPTION) {
28 		return state->image_description;
29 	}
30 	return output->image_description;
31 }