Merge lp:~dandrader/unity-mir/osk_rotation_lp1236489 into lp:unity-mir

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Gerry Boland
Approved revision: 123
Merged at revision: 131
Proposed branch: lp:~dandrader/unity-mir/osk_rotation_lp1236489
Merge into: lp:unity-mir
Diff against target: 136 lines (+26/-49)
3 files modified
src/modules/Unity/Application/OSKController.qml (+5/-49)
src/modules/Unity/Application/ubuntukeyboardinfo.cpp (+11/-0)
src/modules/Unity/Application/ubuntukeyboardinfo.h (+10/-0)
To merge this branch: bzr merge lp:~dandrader/unity-mir/osk_rotation_lp1236489
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+190947@code.launchpad.net

Commit message

UbuntuKeyboardInfo now provides the opaque keybard area in scene coordinates

So all that's left for OSKController is setting its InputArea to match it.
No more guesswork anymore.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
123. By Daniel d'Andrada

UbuntuKeyboardInfo now provides the opaque keybard area in scene coordinates

So all that's left for OSKController is setting its InputArea to match it.
No more guesswork anymore!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :
review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

Dependent approved, approving this too

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/OSKController.qml'
2--- src/modules/Unity/Application/OSKController.qml 2013-10-09 21:03:57 +0000
3+++ src/modules/Unity/Application/OSKController.qml 2013-10-14 18:42:48 +0000
4@@ -48,61 +48,17 @@
5 anchors.fill: oskInputArea
6 }
7
8- /* Need to position InputArea of oskSurface to cover the keyboard. But as shell
9- currently has no idea the shape of the OSK (since OSK draws inside a fullscreen
10- surface) we have to do guesswork so that the InputArea is correctly placed */
11+ /* Need to position InputArea of oskSurface to cover the keyboard. */
12 InputArea {
13 id: oskInputArea
14
15- readonly property int orientationAngle: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
16+ x: ubuntuKeyboardInfo.x
17+ y: ubuntuKeyboardInfo.y
18+ width: ubuntuKeyboardInfo.width
19+ height: ubuntuKeyboardInfo.height
20
21 surface: __oskSurface
22 enabled: false
23-
24- state: orientationAngle.toString()
25-
26- states: [
27- State {
28- name: "0"
29- PropertyChanges { target: oskInputArea; height: ubuntuKeyboardInfo.height; width: undefined }
30- AnchorChanges { target: oskInputArea; anchors {
31- top: undefined
32- bottom: parent.bottom
33- left: parent.left
34- right: parent.right
35- }}
36- },
37- State {
38- name: "180"
39- PropertyChanges { target: oskInputArea; height: ubuntuKeyboardInfo.height; width: undefined }
40- AnchorChanges { target: oskInputArea; anchors {
41- top: parent.top
42- bottom: undefined
43- left: parent.left
44- right: parent.right
45- }}
46- },
47- State {
48- name: "270"
49- PropertyChanges { target: oskInputArea; height: undefined; width: ubuntuKeyboardInfo.height }
50- AnchorChanges { target: oskInputArea; anchors {
51- top: parent.top
52- bottom: parent.bottom
53- left: undefined
54- right: parent.right
55- }}
56- },
57- State {
58- name: "90"
59- PropertyChanges { target: oskInputArea; height: undefined; width: ubuntuKeyboardInfo.height }
60- AnchorChanges { target: oskInputArea; anchors {
61- top: parent.top
62- bottom: parent.bottom
63- left: parent.left
64- right: undefined
65- }}
66- }
67- ]
68 }
69
70 Connections {
71
72=== modified file 'src/modules/Unity/Application/ubuntukeyboardinfo.cpp'
73--- src/modules/Unity/Application/ubuntukeyboardinfo.cpp 2013-10-14 10:30:36 +0000
74+++ src/modules/Unity/Application/ubuntukeyboardinfo.cpp 2013-10-14 18:42:48 +0000
75@@ -117,6 +117,17 @@
76
77 {
78 struct SharedInfo *sharedInfo = reinterpret_cast<struct SharedInfo*>(bytes.data());
79+
80+ if (m_lastX != sharedInfo->keyboardX) {
81+ m_lastX = sharedInfo->keyboardX;
82+ Q_EMIT xChanged(m_lastX);
83+ }
84+
85+ if (m_lastY != sharedInfo->keyboardY) {
86+ m_lastY = sharedInfo->keyboardY;
87+ Q_EMIT yChanged(m_lastY);
88+ }
89+
90 if (m_lastWidth != sharedInfo->keyboardWidth) {
91 m_lastWidth = sharedInfo->keyboardWidth;
92 Q_EMIT widthChanged(m_lastWidth);
93
94=== modified file 'src/modules/Unity/Application/ubuntukeyboardinfo.h'
95--- src/modules/Unity/Application/ubuntukeyboardinfo.h 2013-10-11 15:34:58 +0000
96+++ src/modules/Unity/Application/ubuntukeyboardinfo.h 2013-10-14 18:42:48 +0000
97@@ -25,15 +25,21 @@
98 // instead of a fullscreen one.
99 class UbuntuKeyboardInfo : public QObject {
100 Q_OBJECT
101+ Q_PROPERTY(qreal x READ x NOTIFY xChanged)
102+ Q_PROPERTY(qreal y READ y NOTIFY yChanged)
103 Q_PROPERTY(qreal width READ width NOTIFY widthChanged)
104 Q_PROPERTY(qreal height READ height NOTIFY heightChanged)
105 public:
106 UbuntuKeyboardInfo(QObject *parent = 0);
107 virtual ~UbuntuKeyboardInfo();
108+ qreal x() const { return m_lastX; }
109+ qreal y() const { return m_lastY; }
110 qreal width() const { return m_lastWidth; }
111 qreal height() const { return m_lastHeight; }
112
113 Q_SIGNALS:
114+ void xChanged(qreal x);
115+ void yChanged(qreal y);
116 void widthChanged(qreal width);
117 void heightChanged(qreal height);
118
119@@ -47,6 +53,8 @@
120 // NB! Must match the definition in ubuntu-keyboard. Not worth creating a shared header
121 // just for that.
122 struct SharedInfo {
123+ qint32 keyboardX;
124+ qint32 keyboardY;
125 qint32 keyboardWidth;
126 qint32 keyboardHeight;
127 };
128@@ -57,6 +65,8 @@
129 int m_consecutiveAttempts;
130
131 QLocalSocket m_socket;
132+ qint32 m_lastX;
133+ qint32 m_lastY;
134 qint32 m_lastWidth;
135 qint32 m_lastHeight;
136 QTimer m_connectionRetryTimer;

Subscribers

People subscribed via source and target branches