Merge ~santoshbit2007/oxide:nativeOrientationFix_oxide1.17 into oxide:1.17

Proposed by Santosh
Status: Merged
Merge reported by: Chris Coulson
Merged at revision: not available
Proposed branch: ~santoshbit2007/oxide:nativeOrientationFix_oxide1.17
Merge into: oxide:1.17
Diff against target: 123 lines (+37/-4)
5 files modified
qt/core/browser/oxide_qt_screen_client.cc (+1/-1)
qt/core/browser/oxide_qt_screen_utils.cc (+27/-1)
qt/core/browser/oxide_qt_screen_utils.h (+2/-0)
shared/BUILD.gn (+5/-1)
shared/browser/oxide_hybris_utils.h (+2/-1)
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+303523@code.launchpad.net

Description of the change

Back Porting native Orientation fix.

To post a comment you must log in.
1cc8c31... by Santosh

Backporting native orientation fix for M10(cooler and frieza)

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks, it looks ok although I've left one small comment. Feel free to push this with that fixed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/qt/core/browser/oxide_qt_screen_client.cc b/qt/core/browser/oxide_qt_screen_client.cc
2index 3d3e5e3..3d70709 100644
3--- a/qt/core/browser/oxide_qt_screen_client.cc
4+++ b/qt/core/browser/oxide_qt_screen_client.cc
5@@ -70,7 +70,7 @@ void ScreenClient::UpdatePrimaryDisplay() {
6 screen));
7
8 primary_display_.SetRotationAsDegree(
9- screen->angleBetween(screen->nativeOrientation(),
10+ screen->angleBetween(GetNativeOrientation(screen),
11 screen->orientation()));
12 }
13
14diff --git a/qt/core/browser/oxide_qt_screen_utils.cc b/qt/core/browser/oxide_qt_screen_utils.cc
15index 4f95c9c..890f49e 100644
16--- a/qt/core/browser/oxide_qt_screen_utils.cc
17+++ b/qt/core/browser/oxide_qt_screen_utils.cc
18@@ -26,6 +26,10 @@
19 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h"
20 #include "third_party/WebKit/public/platform/WebRect.h"
21
22+#if defined(ENABLE_HYBRIS)
23+#include "shared/browser/oxide_hybris_utils.h"
24+#endif
25+
26 #include "oxide_qt_dpi_utils.h"
27 #include "oxide_qt_type_conversions.h"
28
29@@ -83,10 +87,32 @@ blink::WebScreenInfo GetWebScreenInfoFromQScreen(QScreen* screen) {
30
31 result.orientationAngle =
32 screen->angleBetween(screen->orientation(),
33- screen->nativeOrientation());
34+ GetNativeOrientation(screen));
35
36 return result;
37 }
38
39+Qt::ScreenOrientation GetNativeOrientation(QScreen* screen) {
40+ Qt::ScreenOrientation native_orientation = screen->nativeOrientation();
41+
42+#if defined(ENABLE_HYBRIS)
43+ // FIXME : Remove below hack once #1612659 is fixed
44+ std::string device_name;
45+ if (oxide::HybrisUtils::HasDeviceProperties()) {
46+ device_name = oxide::HybrisUtils::GetDeviceProperties().device;
47+ }
48+
49+ if ((device_name == "cooler" || device_name == "frieza") &&
50+ screen == QGuiApplication::primaryScreen()) {
51+ // The native orientation returned by qt for M10 devices
52+ // is portrait which is wrong. It should be landscape.
53+ // See https://launchpad.net/bugs/1601887
54+ native_orientation = Qt::LandscapeOrientation;
55+ }
56+#endif
57+
58+ return native_orientation;
59+}
60+
61 } // namespace qt
62 } // namespace oxide
63diff --git a/qt/core/browser/oxide_qt_screen_utils.h b/qt/core/browser/oxide_qt_screen_utils.h
64index ff9186e..4daece0 100644
65--- a/qt/core/browser/oxide_qt_screen_utils.h
66+++ b/qt/core/browser/oxide_qt_screen_utils.h
67@@ -19,6 +19,7 @@
68 #define _OXIDE_QT_CORE_BROWSER_SCREEN_UTILS_H_
69
70 #include <QtGlobal>
71+#include <QScreen>
72
73 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
74
75@@ -30,6 +31,7 @@ namespace oxide {
76 namespace qt {
77
78 blink::WebScreenInfo GetWebScreenInfoFromQScreen(QScreen* screen);
79+Qt::ScreenOrientation GetNativeOrientation(QScreen* screen);
80
81 } // namespace qt
82 } // namespace oxide
83diff --git a/shared/BUILD.gn b/shared/BUILD.gn
84index 4fa21f0..b7c2bfd 100644
85--- a/shared/BUILD.gn
86+++ b/shared/BUILD.gn
87@@ -36,6 +36,10 @@ config("shared_include_dirs") {
88 ]
89 }
90
91+config("hybris_defines") {
92+ defines = [ "ENABLE_HYBRIS" ]
93+}
94+
95 grit("shared_resources") {
96 source = "oxide_resources.grd"
97 outputs = [
98@@ -587,7 +591,7 @@ component("shared") {
99
100 if (enable_hybris) {
101 assert(is_linux)
102- defines += [ "ENABLE_HYBRIS" ]
103+ public_configs += [ ":hybris_defines" ]
104
105 configs += [
106 "//oxide/build/config/linux:android_properties"
107diff --git a/shared/browser/oxide_hybris_utils.h b/shared/browser/oxide_hybris_utils.h
108index a47f5b7..c07f93d 100644
109--- a/shared/browser/oxide_hybris_utils.h
110+++ b/shared/browser/oxide_hybris_utils.h
111@@ -21,10 +21,11 @@
112 #include <string>
113
114 #include "base/macros.h"
115+#include "shared/common/oxide_shared_export.h"
116
117 namespace oxide {
118
119-class HybrisUtils {
120+class OXIDE_SHARED_EXPORT HybrisUtils {
121 public:
122
123 struct DeviceProperties {

Subscribers

People subscribed via source and target branches

to all changes: