Merge ~santoshbit2007/oxide:oxide1.16_nativeOrientation into oxide:1.16

Proposed by Santosh
Status: Merged
Merged at revision: 0a98ec8a6474bde096465555477a4c1418fc760f
Proposed branch: ~santoshbit2007/oxide:oxide1.16_nativeOrientation
Merge into: oxide:1.16
Diff against target: 115 lines (+37/-3)
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)
qt/core/core.gyp (+5/-0)
shared/browser/oxide_hybris_utils.h (+2/-1)
Reviewer Review Type Date Requested Status
Olivier Tilloy Pending
Review via email: mp+303036@code.launchpad.net

Description of the change

Backporting native orientation fix from master

To post a comment you must log in.

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/qt/core/core.gyp b/qt/core/core.gyp
84index 7ab0528..3269ceb 100644
85--- a/qt/core/core.gyp
86+++ b/qt/core/core.gyp
87@@ -370,6 +370,11 @@
88 ],
89 },
90 }],
91+ ['enable_hybris==1', {
92+ 'defines': [
93+ 'ENABLE_HYBRIS=1',
94+ ]
95+ }],
96 ],
97 },
98 {
99diff --git a/shared/browser/oxide_hybris_utils.h b/shared/browser/oxide_hybris_utils.h
100index a47f5b7..c07f93d 100644
101--- a/shared/browser/oxide_hybris_utils.h
102+++ b/shared/browser/oxide_hybris_utils.h
103@@ -21,10 +21,11 @@
104 #include <string>
105
106 #include "base/macros.h"
107+#include "shared/common/oxide_shared_export.h"
108
109 namespace oxide {
110
111-class HybrisUtils {
112+class OXIDE_SHARED_EXPORT HybrisUtils {
113 public:
114
115 struct DeviceProperties {

Subscribers

People subscribed via source and target branches

to all changes: