From 3a02bbdb21764d3e77961d70666b8e162885e380 Mon Sep 17 00:00:00 2001 From: Swift Kim Date: Fri, 13 Jan 2023 17:50:48 +0900 Subject: [PATCH 1/2] Set rotations properly for landscape default devices --- .../tizen/channels/platform_channel.cc | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/flutter/shell/platform/tizen/channels/platform_channel.cc b/flutter/shell/platform/tizen/channels/platform_channel.cc index 8ab196c..f9ce966 100644 --- a/flutter/shell/platform/tizen/channels/platform_channel.cc +++ b/flutter/shell/platform/tizen/channels/platform_channel.cc @@ -326,12 +326,23 @@ void PlatformChannel::SetEnabledSystemUiOverlays( void PlatformChannel::SetPreferredOrientations( const std::vector& orientations) { if (auto* window = dynamic_cast(view_)) { - static const std::map orientation_mapping = { - {kPortraitUp, 0}, - {kLandscapeLeft, 90}, - {kPortraitDown, 180}, - {kLandscapeRight, 270}, - }; + std::map orientation_mapping; + TizenGeometry geometry = window->GetGeometry(); + if (geometry.width > geometry.height) { + orientation_mapping = { + {kLandscapeLeft, 0}, + {kPortraitDown, 90}, + {kLandscapeRight, 180}, + {kPortraitUp, 270}, + }; + } else { + orientation_mapping = { + {kPortraitUp, 0}, + {kLandscapeLeft, 90}, + {kPortraitDown, 180}, + {kLandscapeRight, 270}, + }; + } std::vector rotations; for (const auto& orientation : orientations) { rotations.push_back(orientation_mapping.at(orientation)); From 69c47641cf057596e433bb9a87a0c5cb03ad24f6 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Thu, 13 Feb 2025 15:37:42 +0900 Subject: [PATCH 2/2] Set only landscape as default for TV profile --- flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc b/flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc index 77c7458..2b2ec27 100644 --- a/flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc +++ b/flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc @@ -142,7 +142,11 @@ void TizenWindowEcoreWl2::SetWindowOptions() { ecore_wl2_indicator_visible_type_set(ecore_wl2_window_, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN); +#ifdef TV_PROFILE + int rotations[1] = {0}; // Default is only landscape. +#else int rotations[4] = {0, 90, 180, 270}; +#endif ecore_wl2_window_available_rotations_set(ecore_wl2_window_, rotations, sizeof(rotations) / sizeof(int));