Merge lp:~gerboland/qtubuntu/better-input-method-support into lp:qtubuntu

Proposed by Gerry Boland
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 375
Merged at revision: 375
Proposed branch: lp:~gerboland/qtubuntu/better-input-method-support
Merge into: lp:qtubuntu
Diff against target: 196 lines (+53/-36)
3 files modified
debian/changelog (+7/-0)
src/ubuntumirclient/qmirclientwindow.cpp (+45/-36)
src/ubuntumirclient/qmirclientwindow.h (+1/-0)
To merge this branch: bzr merge lp:~gerboland/qtubuntu/better-input-method-support
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Abstain
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+318163@code.launchpad.net

Commit message

Add support for a custom InputMethod window type, and implement QPlatformWindow::setMask.

These features mean the ubuntu-keyboard can drop its build dependence on mirclient.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:374
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/189/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4198
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4226
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4062/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4062/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4062/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4062/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4062/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4062
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4062/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/189/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:375
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/190/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4199
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4227
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4063/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4063/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4063/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4063/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4063/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4063
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4063/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/190/rebuild

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Worked flawelessly when testing with the other branch in silo 2481 (https://bileto.ubuntu.com/#/ticket/2481).

Code looks reasonable as well, too bad Qt doesn't have a dedicated OSK window type.

review: Approve
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

I'm seeing something odd with the input shaping; it seems to work fine initially, but as soon as the mouse enters the shaped keyboard surface the shaping appears to stop working, meaning you can no longer click on anything outside of the keyboard until you dismiss the keyboard.

review: Needs Fixing
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

It'd appear that the input shaping issue was already present prior to this MR, so shouldn't hold this one up

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-02-15 08:23:34 +0000
3+++ debian/changelog 2017-02-23 23:21:14 +0000
4@@ -1,3 +1,10 @@
5+qtubuntu (0.64) UNRELEASED; urgency=medium
6+
7+ * Implement QPlatformWindow::setMask and add support for special InputMethod
8+ window type
9+
10+ -- Gerry Boland <gerry.boland@canonical.com> Thu, 23 Feb 2017 23:13:34 +0000
11+
12 qtubuntu (0.63+17.04.20170215-0ubuntu1) zesty; urgency=medium
13
14 [ Albert Astals Cid ]
15
16=== modified file 'src/ubuntumirclient/qmirclientwindow.cpp'
17--- src/ubuntumirclient/qmirclientwindow.cpp 2017-02-14 19:30:13 +0000
18+++ src/ubuntumirclient/qmirclientwindow.cpp 2017-02-23 23:21:14 +0000
19@@ -58,29 +58,15 @@
20 #include <QtGui/private/qguiapplication_p.h>
21 #include <QtPlatformSupport/private/qeglconvenience_p.h>
22
23-// Platform API
24-#include <ubuntu/application/instance.h>
25-
26 #include <EGL/egl.h>
27
28 Q_LOGGING_CATEGORY(mirclientBufferSwap, "qt.qpa.mirclient.bufferSwap", QtWarningMsg)
29
30 namespace
31 {
32+const Qt::WindowType InputMethodWindowType = (Qt::WindowType)(0x00000080 | Qt::WindowType::Window); // Qt has no such thing
33 const Qt::WindowType LowChromeWindowHint = (Qt::WindowType)0x00800000;
34
35-// FIXME: this used to be defined by platform-api, but it's been removed in v3. Change ubuntu-keyboard to use
36-// a different enum for window roles.
37-enum UAUiWindowRole {
38- U_MAIN_ROLE = 1,
39- U_DASH_ROLE,
40- U_INDICATOR_ROLE,
41- U_NOTIFICATIONS_ROLE,
42- U_GREETER_ROLE,
43- U_LAUNCHER_ROLE,
44- U_ON_SCREEN_KEYBOARD_ROLE,
45- U_SHUTDOWN_DIALOG_ROLE,
46-};
47
48 struct MirSpecDeleter
49 {
50@@ -194,6 +180,8 @@
51 return mir_window_type_tip;
52 case Qt::SplashScreen:
53 return mir_window_type_freestyle;
54+ case InputMethodWindowType:
55+ return mir_window_type_inputmethod;
56 case Qt::Window:
57 default:
58 return mir_window_type_normal;
59@@ -206,19 +194,6 @@
60 return id++;
61 }
62
63-UAUiWindowRole roleFor(QWindow *window)
64-{
65- QVariant roleVariant = window->property("role");
66- if (!roleVariant.isValid())
67- return U_MAIN_ROLE;
68-
69- uint role = roleVariant.toUInt();
70- if (role < U_MAIN_ROLE || role > U_SHUTDOWN_DIALOG_ROLE)
71- return U_MAIN_ROLE;
72-
73- return static_cast<UAUiWindowRole>(role);
74-}
75-
76 QMirClientWindow *transientParentFor(QWindow *window)
77 {
78 QWindow *parent = window->transientParent();
79@@ -253,10 +228,6 @@
80 const int height = geometry.height() > 0 ? geometry.height() : 1;
81 auto type = qtWindowTypeToMirWindowType(window->type());
82
83- if (U_ON_SCREEN_KEYBOARD_ROLE == roleFor(window)) {
84- type = mir_window_type_inputmethod;
85- }
86-
87 MirRectangle location{geometry.x(), geometry.y(), 0, 0};
88 MirWindow *parent = nullptr;
89 if (parentWindowHandle) {
90@@ -322,6 +293,29 @@
91 }
92 }
93
94+void setMask(MirWindowSpec *spec, const QRegion& mask)
95+{
96+ const int count = mask.rectCount();
97+ if (count == 0) {
98+ mir_window_spec_set_input_shape(spec, nullptr, 0);
99+ return;
100+ }
101+
102+ // Convert the QRegion into a list of MirRectangles
103+ auto rects = new MirRectangle[count];
104+
105+ int i=0;
106+ for (const auto &rect : mask.rects()) {
107+ rects[i].left = rect.x();
108+ rects[i].top = rect.y();
109+ rects[i].width = (unsigned int) rect.width();
110+ rects[i].height = (unsigned int) rect.height();
111+ i++;
112+ }
113+
114+ mir_window_spec_set_input_shape(spec, rects, count);
115+}
116+
117 MirWindow *createMirWindow(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle,
118 MirPixelFormat pixelFormat, MirConnection *connection,
119 MirWindowEventCallback inputCallback, void *inputContext)
120@@ -335,6 +329,7 @@
121 mir_window_spec_set_name(spec.get(), title.constData());
122
123 setSizingConstraints(spec.get(), window->minimumSize(), window->maximumSize(), window->sizeIncrement());
124+ setMask(spec.get(), window->mask());
125
126 if (window->windowState() == Qt::WindowFullScreen) {
127 mir_window_spec_set_fullscreen_on_output(spec.get(), mirOutputId);
128@@ -412,6 +407,7 @@
129 void updateGeometry(const QRect &newGeometry);
130 void updateTitle(const QString& title);
131 void setSizingConstraints(const QSize& minSize, const QSize& maxSize, const QSize& increment);
132+ void setMask(const QRegion &mask);
133
134 void onSwapBuffersDone();
135 void handleSurfaceResized(int width, int height);
136@@ -528,8 +524,7 @@
137 platformWindow->QPlatformWindow::setGeometry(geom);
138 QWindowSystemInterface::handleGeometryChange(mWindow, geom);
139
140- qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title()
141- << "role:" << roleFor(mWindow);
142+ qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title();
143 qCDebug(mirclientGraphics)
144 << "Requested format:" << mWindow->requestedFormat()
145 << "\nActual format:" << mFormat
146@@ -709,6 +704,15 @@
147 mir_window_apply_spec(mMirWindow, spec.get());
148 }
149
150+void UbuntuSurface::setMask(const QRegion &region)
151+{
152+ qCDebug(mirclient, "setMask(window=%p, region=%s)", mWindow, region);
153+
154+ Spec spec{mir_create_window_spec(mConnection)};
155+ ::setMask(spec.get(), region);
156+ mir_window_apply_spec(mMirWindow, spec.get());
157+}
158+
159 QString UbuntuSurface::persistentSurfaceId()
160 {
161 if (mPersistentIdStr.isEmpty()) {
162@@ -737,8 +741,8 @@
163 {
164 mWindowExposed = mSurface->mNeedsExposeCatchup == false;
165
166- qCDebug(mirclient, "QMirClientWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s', role: '%d'",
167- w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()), roleFor(window()));
168+ qCDebug(mirclient, "QMirClientWindow(window=%p, screen=%p, input=%p, surf=%p) with title '%s'",
169+ w, w->screen()->handle(), input, mSurface.get(), qPrintable(window()->title()));
170
171 updatePanelHeightHack(mSurface->state() != mir_window_state_fullscreen);
172
173@@ -955,6 +959,11 @@
174 return mWindowVisible && (mWindowExposed || (mSurface && mSurface->mNeedsExposeCatchup));
175 }
176
177+void QMirClientWindow::setMask(const QRegion &region)
178+{
179+ mSurface->setMask(region);
180+}
181+
182 QSurfaceFormat QMirClientWindow::format() const
183 {
184 return mSurface->format();
185
186=== modified file 'src/ubuntumirclient/qmirclientwindow.h'
187--- src/ubuntumirclient/qmirclientwindow.h 2017-02-07 16:16:54 +0000
188+++ src/ubuntumirclient/qmirclientwindow.h 2017-02-23 23:21:14 +0000
189@@ -79,6 +79,7 @@
190 void setWindowTitle(const QString &title) override;
191 void propagateSizeHints() override;
192 bool isExposed() const override;
193+ void setMask(const QRegion &region) override;
194
195 QPoint mapToGlobal(const QPoint &pos) const override;
196 QSurfaceFormat format() const override;

Subscribers

People subscribed via source and target branches