Commit 1805383d authored by Roman Gilg's avatar Roman Gilg Committed by Olivier Fourdan
Browse files

xwayland: simplify output_get_new_size function

We can just read out the xdg_output field of the provided xwl_output to check
if a rotation is necessary or not.

This makes the function easier to understand. Additionally some documentation
is added.
Signed-off-by: Roman Gilg's avatarRoman Gilg <>
parent 919f1f46
......@@ -125,14 +125,19 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
xwl_output->refresh = refresh;
* Decides on the maximum expanse of an output in logical space (i.e. in the
* Wayland compositor plane) respective to some fix width and height values. The
* function sets the provided values to these maxima on return.
static inline void
output_get_new_size(struct xwl_output *xwl_output,
Bool need_rotate,
int *height, int *width)
output_get_new_size(struct xwl_output *xwl_output, int *height, int *width)
int output_width, output_height;
if (!need_rotate || (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
/* When we have xdg-output support the stored size is already rotated. */
if (xwl_output->xdg_output
|| (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
output_width = xwl_output->width;
output_height = xwl_output->height;
} else {
......@@ -535,14 +540,14 @@ apply_output_change(struct xwl_output *xwl_output)
if (it == xwl_output)
has_this_output = 1;
output_get_new_size(it, need_rotate, &height, &width);
output_get_new_size(it, &height, &width);
if (!has_this_output) {
xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
/* we did not check this output for new screen size, do it now */
output_get_new_size(xwl_output, need_rotate, &height, &width);
output_get_new_size(xwl_output, &height, &width);
......@@ -704,12 +709,11 @@ xwl_output_remove(struct xwl_output *xwl_output)
struct xwl_output *it;
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
int width = 0, height = 0;
Bool need_rotate = (xwl_output->xdg_output == NULL);
xorg_list_for_each_entry(it, &xwl_screen->output_list, link)
output_get_new_size(it, need_rotate, &height, &width);
output_get_new_size(it, &height, &width);
update_screen_size(xwl_output, width, height);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment