Skip to content

Commit 3b5d236

Browse files
JSUYAswift-kim
andauthored
Set rotations properly for landscape default devices (#80)
Co-authored-by: Swift Kim <[email protected]>
1 parent 183a0d6 commit 3b5d236

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

flutter/shell/platform/tizen/channels/platform_channel.cc

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,23 @@ void PlatformChannel::SetEnabledSystemUiOverlays(
326326
void PlatformChannel::SetPreferredOrientations(
327327
const std::vector<std::string>& orientations) {
328328
if (auto* window = dynamic_cast<TizenWindow*>(view_)) {
329-
static const std::map<std::string, int> orientation_mapping = {
330-
{kPortraitUp, 0},
331-
{kLandscapeLeft, 90},
332-
{kPortraitDown, 180},
333-
{kLandscapeRight, 270},
334-
};
329+
std::map<std::string, int> orientation_mapping;
330+
TizenGeometry geometry = window->GetGeometry();
331+
if (geometry.width > geometry.height) {
332+
orientation_mapping = {
333+
{kLandscapeLeft, 0},
334+
{kPortraitDown, 90},
335+
{kLandscapeRight, 180},
336+
{kPortraitUp, 270},
337+
};
338+
} else {
339+
orientation_mapping = {
340+
{kPortraitUp, 0},
341+
{kLandscapeLeft, 90},
342+
{kPortraitDown, 180},
343+
{kLandscapeRight, 270},
344+
};
345+
}
335346
std::vector<int> rotations;
336347
for (const auto& orientation : orientations) {
337348
rotations.push_back(orientation_mapping.at(orientation));

flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ void TizenWindowEcoreWl2::SetWindowOptions() {
142142
ecore_wl2_indicator_visible_type_set(ecore_wl2_window_,
143143
ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN);
144144

145+
#ifdef TV_PROFILE
146+
int rotations[1] = {0}; // Default is only landscape.
147+
#else
145148
int rotations[4] = {0, 90, 180, 270};
149+
#endif
146150
ecore_wl2_window_available_rotations_set(ecore_wl2_window_, rotations,
147151
sizeof(rotations) / sizeof(int));
148152

0 commit comments

Comments
 (0)