Currently, trying to play any game with a rotated display leads to basically every game trying to run in the wrong orientation. This fixes that by switching the width and height for each display mode when using 90 and 270 degree rotations. When I messed around with trying to report the correct rotation via `dmDisplayOrientation` to the game but not switching the width and height, the game still opened in the wrong orientation. So, I am currently not reporting the proper `dmDisplayOrientation`.
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/winewayland.drv/wayland_output.c | 18 ++++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 1 + 2 files changed, 19 insertions(+)
diff --git a/dlls/winewayland.drv/wayland_output.c b/dlls/winewayland.drv/wayland_output.c index f76881a1770..b9fd3d1e7b5 100644 --- a/dlls/winewayland.drv/wayland_output.c +++ b/dlls/winewayland.drv/wayland_output.c @@ -39,6 +39,7 @@ static uint32_t next_output_id = 0; #define WAYLAND_OUTPUT_CHANGED_NAME 0x02 #define WAYLAND_OUTPUT_CHANGED_LOGICAL_XY 0x04 #define WAYLAND_OUTPUT_CHANGED_LOGICAL_WH 0x08 +#define WAYLAND_OUTPUT_CHANGED_GEOMETRY 0x10
/********************************************************************** * Output handling @@ -135,10 +136,22 @@ static void wayland_output_done(struct wayland_output *output) /* Update current state from pending state. */ pthread_mutex_lock(&process_wayland.output_mutex);
+ if (output->pending_flags & WAYLAND_OUTPUT_CHANGED_GEOMETRY) + { + output->current.transform = output->pending.transform; + } + if (output->pending_flags & WAYLAND_OUTPUT_CHANGED_MODES) { RB_FOR_EACH_ENTRY(mode, &output->pending.modes, struct wayland_output_mode, entry) { + /* mode w,h need to be switched when the output is transformed by 90/270 degrees */ + if (output->current.transform & WL_OUTPUT_TRANSFORM_90) + { + const int32_t temp = mode->width; + mode->width = mode->height; + mode->height = temp; + } wayland_output_state_add_mode(&output->current, mode->width, mode->height, mode->refresh, mode == output->pending.current_mode); @@ -200,6 +213,11 @@ static void output_handle_geometry(void *data, struct wl_output *wl_output, const char *make, const char *model, int32_t output_transform) { + struct wayland_output *output = data; + + output->pending.transform = output_transform; + + output->pending_flags |= WAYLAND_OUTPUT_CHANGED_GEOMETRY; }
static void output_handle_mode(void *data, struct wl_output *wl_output, diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index cb331df789d..face73326b0 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -205,6 +205,7 @@ struct wayland_output_state char *name; int logical_x, logical_y; int logical_w, logical_h; + int32_t transform; };
struct wayland_output