Skip to content

Commit a73994f

Browse files
wayland: fix screen rotation issue on Wayland (#411)
Signed-off-by: Makoto Sato <[email protected]>
1 parent 185d73a commit a73994f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ const wl_output_listener ELinuxWindowWayland::kWlOutputListener = {
628628
const char* model,
629629
int32_t output_transform) -> void {
630630
ELINUX_LOG(TRACE) << "wl_output_listener.geometry";
631+
auto self = reinterpret_cast<ELinuxWindowWayland*>(data);
632+
self->transform_ = output_transform;
631633
},
632634
.mode = [](void* data,
633635
wl_output* wl_output,
@@ -639,7 +641,11 @@ const wl_output_listener ELinuxWindowWayland::kWlOutputListener = {
639641

640642
auto self = reinterpret_cast<ELinuxWindowWayland*>(data);
641643
if (flags & WL_OUTPUT_MODE_CURRENT) {
642-
if (self->current_rotation_ == 90 || self->current_rotation_ == 270) {
644+
if (self->current_rotation_ == 90 || self->current_rotation_ == 270 ||
645+
self->transform_ == WL_OUTPUT_TRANSFORM_90 ||
646+
self->transform_ == WL_OUTPUT_TRANSFORM_270 ||
647+
self->transform_ == WL_OUTPUT_TRANSFORM_FLIPPED_90 ||
648+
self->transform_ == WL_OUTPUT_TRANSFORM_FLIPPED_270) {
643649
std::swap(width, height);
644650
}
645651

src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class ELinuxWindowWayland : public ELinuxWindow, public WindowBindingHandler {
153153
bool maximised_;
154154
uint32_t last_frame_time_;
155155
bool enable_impeller_ = false;
156+
int32_t transform_ = WL_OUTPUT_TRANSFORM_NORMAL;
156157

157158
// Indicates that exists a keyboard show request from Flutter Engine.
158159
bool is_requested_show_virtual_keyboard_;

0 commit comments

Comments
 (0)