Merge lp:~michael-sheldon/ubuntu/utopic/maliit-framework/fix-input-method-size-updates into lp:ubuntu/utopic/maliit-framework

Proposed by Michael Sheldon
Status: Merged
Merge reported by: Ricardo Salveti
Merged at revision: not available
Proposed branch: lp:~michael-sheldon/ubuntu/utopic/maliit-framework/fix-input-method-size-updates
Merge into: lp:ubuntu/utopic/maliit-framework
Diff against target: 483 lines (+416/-3)
8 files modified
.pc/0009-update-input-region-when-hiding.patch/src/windowgroup.cpp (+176/-0)
.pc/0010-fix-building-with-g++-4.9.patch/src/src.pro (+193/-0)
.pc/applied-patches (+2/-0)
debian/changelog (+10/-0)
debian/patches/0009-update-input-region-when-hiding.patch (+25/-0)
debian/patches/series (+2/-0)
src/src.pro (+4/-0)
src/windowgroup.cpp (+4/-3)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu/utopic/maliit-framework/fix-input-method-size-updates
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+228860@code.launchpad.net

Commit message

Ensure that input method area sizes are always updated when sent from the keyboard plugin regardless of whether the keyboard is currently active. This allows for hiding animations to correctly set the input method area whilst the keyboard is otherwise inactive.

Description of the change

Ensures that input method area sizes are always updated when sent from the keyboard plugin regardless of whether the keyboard is currently active. This allows for hiding animations to correctly set the input method area whilst the keyboard is otherwise inactive.

To post a comment you must log in.
18. By Michael Sheldon

Fix building against g++ 4.9

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/0009-update-input-region-when-hiding.patch'
2=== added directory '.pc/0009-update-input-region-when-hiding.patch/src'
3=== added file '.pc/0009-update-input-region-when-hiding.patch/src/windowgroup.cpp'
4--- .pc/0009-update-input-region-when-hiding.patch/src/windowgroup.cpp 1970-01-01 00:00:00 +0000
5+++ .pc/0009-update-input-region-when-hiding.patch/src/windowgroup.cpp 2014-08-04 15:52:39 +0000
6@@ -0,0 +1,176 @@
7+/* * This file is part of Maliit framework *
8+ *
9+ * Copyright (C) 2013 Openismus GmbH
10+ *
11+ * Contact: maliit-discuss@lists.maliit.org
12+ *
13+ * This library is free software; you can redistribute it and/or
14+ * modify it under the terms of the GNU Lesser General Public
15+ * License version 2.1 as published by the Free Software Foundation
16+ * and appearing in the file LICENSE.LGPL included in the packaging
17+ * of this file.
18+ */
19+
20+#include <QDebug>
21+
22+#include "abstractplatform.h"
23+#include "windowgroup.h"
24+
25+namespace Maliit
26+{
27+
28+WindowGroup::WindowGroup(const QSharedPointer<AbstractPlatform> &platform)
29+ : m_platform(platform),
30+ m_active(false)
31+{
32+ m_hideTimer.setSingleShot(true);
33+ m_hideTimer.setInterval(2000);
34+ connect(&m_hideTimer, SIGNAL(timeout()), this, SLOT(hideWindows()));
35+}
36+
37+WindowGroup::~WindowGroup()
38+{}
39+
40+void WindowGroup::activate()
41+{
42+ m_active = true;
43+ m_hideTimer.stop();
44+}
45+
46+void WindowGroup::deactivate(HideMode mode)
47+{
48+ if (m_active) {
49+ m_active = false;
50+
51+ if (mode == HideImmediate) {
52+ hideWindows();
53+ } else {
54+ m_hideTimer.start();
55+ }
56+ }
57+}
58+
59+void WindowGroup::setupWindow(QWindow *window, Maliit::Position position)
60+{
61+ if (window) {
62+ if (not containsWindow(window)) {
63+ QWindow *parent = window->parent ();
64+
65+ if (parent and not containsWindow(parent)) {
66+ qWarning () << "Plugin is misbehaving - tried to register a window with yet-unregistered parent!";
67+ return;
68+ }
69+ m_window_list.append (WindowData(window, position));
70+
71+ window->setFlags (Qt::FramelessWindowHint |
72+ Qt::WindowStaysOnTopHint |
73+ Qt::WindowDoesNotAcceptFocus);
74+
75+ connect (window, SIGNAL (visibleChanged(bool)),
76+ this, SLOT (onVisibleChanged(bool)));
77+ connect (window, SIGNAL (heightChanged(int)),
78+ this, SLOT (updateInputMethodArea()));
79+ connect (window, SIGNAL (widthChanged(int)),
80+ this, SLOT (updateInputMethodArea()));
81+ connect (window, SIGNAL (xChanged(int)),
82+ this, SLOT (updateInputMethodArea()));
83+ connect (window, SIGNAL (yChanged(int)),
84+ this, SLOT (updateInputMethodArea()));
85+ m_platform->setupInputPanel(window, position);
86+ updateInputMethodArea();
87+ }
88+ }
89+}
90+
91+void WindowGroup::setScreenRegion(const QRegion &region, QWindow *window)
92+{
93+ if (window == 0 && m_window_list.size() > 0) {
94+ window = m_window_list.at(0).m_window.data();
95+ }
96+ m_platform->setInputRegion(window, region);
97+}
98+
99+void WindowGroup::setInputMethodArea(const QRegion &region, QWindow *window)
100+{
101+ if (window == 0 && m_window_list.size() > 0) {
102+ window = m_window_list.at(0).m_window.data();
103+ }
104+
105+ for (int i = 0; i < m_window_list.size(); ++i) {
106+ WindowData &data = m_window_list[i];
107+ if (data.m_window == window) {
108+ data.m_inputMethodArea = region;
109+ break;
110+ }
111+ }
112+
113+ if (m_active) {
114+ updateInputMethodArea();
115+ }
116+}
117+
118+void WindowGroup::setApplicationWindow(WId id)
119+{
120+ Q_FOREACH (const WindowData &data, m_window_list) {
121+ if (data.m_window and not data.m_window->parent()) {
122+ m_platform->setApplicationWindow(data.m_window, id);
123+ }
124+ }
125+}
126+
127+void WindowGroup::onVisibleChanged(bool visible)
128+{
129+ if (m_active) {
130+ updateInputMethodArea();
131+ } else if (visible) {
132+ QWindow *window = qobject_cast<QWindow*>(sender());
133+
134+ if (window) {
135+ qWarning () << "An inactive plugin is misbehaving - tried to show a window!";
136+ window->setVisible (false);
137+ }
138+ }
139+}
140+
141+void WindowGroup::updateInputMethodArea()
142+{
143+ QRegion new_area;
144+
145+ Q_FOREACH (const WindowData &data, m_window_list) {
146+ if (data.m_window and not data.m_window->parent() and
147+ data.m_window->isVisible() and
148+ not data.m_inputMethodArea.isEmpty()) {
149+ new_area |= data.m_inputMethodArea.translated(data.m_window->position());
150+ }
151+ }
152+
153+ if (new_area != m_last_im_area) {
154+ m_last_im_area = new_area;
155+ Q_EMIT inputMethodAreaChanged(m_last_im_area);
156+ }
157+}
158+
159+bool WindowGroup::containsWindow(QWindow *window)
160+{
161+ Q_FOREACH (const WindowData &data, m_window_list) {
162+ if (data.m_window == window) {
163+ return true;
164+ }
165+ }
166+
167+ return false;
168+}
169+
170+void WindowGroup::hideWindows()
171+{
172+ m_hideTimer.stop();
173+
174+ Q_FOREACH (const WindowData &data, m_window_list) {
175+ if (data.m_window) {
176+ data.m_window->setVisible (false);
177+ }
178+ }
179+ updateInputMethodArea();
180+}
181+
182+} // namespace Maliit
183
184=== added directory '.pc/0010-fix-building-with-g++-4.9.patch'
185=== added directory '.pc/0010-fix-building-with-g++-4.9.patch/src'
186=== added file '.pc/0010-fix-building-with-g++-4.9.patch/src/src.pro'
187--- .pc/0010-fix-building-with-g++-4.9.patch/src/src.pro 1970-01-01 00:00:00 +0000
188+++ .pc/0010-fix-building-with-g++-4.9.patch/src/src.pro 2014-08-04 15:52:39 +0000
189@@ -0,0 +1,193 @@
190+include(../config.pri)
191+
192+TOP_DIR = ..
193+
194+VERSION = $$MALIIT_ABI_VERSION
195+TEMPLATE = lib
196+TARGET = $$TOP_DIR/lib/$$MALIIT_PLUGINS_LIB
197+
198+# Input
199+PLUGIN_HEADERS_PUBLIC = \
200+ maliit/plugins/inputmethodplugin.h \
201+ maliit/plugins/abstractinputmethod.h \
202+ maliit/plugins/abstractinputmethodhost.h \
203+ maliit/plugins/keyoverride.h \
204+ maliit/plugins/keyoverridedata.h \
205+ maliit/plugins/attributeextension.h \
206+ maliit/plugins/extensionevent.h \
207+ maliit/plugins/updateevent.h \
208+ maliit/plugins/updatereceiver.h \
209+ maliit/plugins/plugindescription.h \
210+ maliit/plugins/subviewdescription.h \
211+ maliit/plugins/abstractpluginsetting.h \
212+
213+PLUGIN_SOURCES += \
214+ maliit/plugins/abstractinputmethod.cpp \
215+ maliit/plugins/abstractinputmethodhost.cpp \
216+ maliit/plugins/keyoverride.cpp \
217+ maliit/plugins/keyoverridedata.cpp \
218+ maliit/plugins/attributeextension.cpp \
219+ maliit/plugins/extensionevent.cpp \
220+ maliit/plugins/updateevent.cpp \
221+ maliit/plugins/updatereceiver.cpp \
222+ maliit/plugins/plugindescription.cpp \
223+ maliit/plugins/subviewdescription.cpp \
224+
225+PLUGIN_HEADERS_PRIVATE += \
226+ maliit/plugins/keyoverride_p.h \
227+ maliit/plugins/attributeextension_p.h \
228+ maliit/plugins/extensionevent_p.h \
229+ maliit/plugins/updateevent_p.h \
230+
231+SERVER_HEADERS_PUBLIC += \
232+ mimserver.h \
233+
234+SERVER_SOURCES += \
235+ mimserver.cpp \
236+
237+SERVER_HEADERS_PRIVATE += \
238+ mimpluginmanager.h \
239+ mimpluginmanager_p.h \
240+ minputmethodhost.h \
241+ mattributeextensionid.h \
242+ mattributeextensionmanager.h \
243+ msharedattributeextensionmanager.h \
244+ mimhwkeyboardtracker.h \
245+ mimonscreenplugins.h \
246+ mimsubviewoverride.h \
247+ mimserveroptions.h \
248+ windowgroup.h \
249+ windowdata.h \
250+ abstractplatform.h \
251+ unknownplatform.h \
252+
253+SERVER_SOURCES += \
254+ mimpluginmanager.cpp \
255+ minputmethodhost.cpp \
256+ mattributeextensionid.cpp \
257+ mattributeextensionmanager.cpp \
258+ msharedattributeextensionmanager.cpp \
259+ mimonscreenplugins.cpp \
260+ mimsubviewoverride.cpp \
261+ mimserveroptions.cpp \
262+ windowgroup.cpp \
263+ windowdata.cpp \
264+ abstractplatform.cpp \
265+ unknownplatform.cpp \
266+
267+!noxcb {
268+ SERVER_HEADERS_PRIVATE += xcbplatform.h
269+ SERVER_SOURCES += xcbplatform.cpp
270+ PKGCONFIG += xcb xcb-xfixes
271+}
272+
273+wayland {
274+ SERVER_HEADERS_PRIVATE += waylandplatform.h
275+ SERVER_SOURCES += waylandplatform.cpp
276+}
277+
278+SETTINGS_HEADERS_PRIVATE += \
279+ mimsettingsqsettings.h \
280+ mimsettings.h \
281+
282+SETTINGS_SOURCES += \
283+ mimsettings.cpp \
284+ mimsettingsqsettings.cpp \
285+
286+QUICK_HEADERS_PRIVATE += \
287+ quick/maliitquick.h \
288+ quick/inputmethodquick.h \
289+ quick/inputmethodquickplugin.h \
290+ quick/keyoverridequick.h \
291+ quick/keyoverridequick_p.h \
292+
293+QUICK_SOURCES += \
294+ quick/inputmethodquick.cpp \
295+ quick/inputmethodquickplugin.cpp \
296+ quick/keyoverridequick.cpp \
297+
298+!nohwkeyboard {
299+ SERVER_HEADERS_PRIVATE += mimhwkeyboardtracker_p.h
300+ SERVER_SOURCES += mimhwkeyboardtracker.cpp
301+
302+ enable-contextkit {
303+ PKGCONFIG += contextsubscriber-1.0
304+ DEFINES += HAVE_CONTEXTSUBSCRIBER
305+ } else {
306+ # libudev needed by non-contextkit MImHwKeyboardTracker
307+ PKGCONFIG += libudev
308+ }
309+} else {
310+ SERVER_SOURCES += mimhwkeyboardtracker_stub.cpp
311+}
312+
313+HEADERS += \
314+ $$PLUGIN_HEADERS_PUBLIC \
315+ $$PLUGIN_HEADERS_PRIVATE \
316+ $$SERVER_HEADERS_PUBLIC \
317+ $$SERVER_HEADERS_PRIVATE \
318+ $$SETTINGS_HEADERS_PRIVATE \
319+ $$QUICK_HEADERS_PRIVATE
320+
321+SOURCES += \
322+ $$PLUGIN_SOURCES \
323+ $$SERVER_SOURCES \
324+ $$SETTINGS_SOURCES \
325+ $$QUICK_SOURCES
326+
327+CONFIG += link_pkgconfig
328+QT = core gui gui-private dbus qml quick
329+
330+
331+# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
332+for(OPTION,$$list($$lower($$COV_OPTION))){
333+ isEqual(OPTION, on){
334+ QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs -fno-elide-constructors
335+ LIBS += -lgcov
336+ }
337+}
338+
339+OBJECTS_DIR = .obj
340+MOC_DIR = .moc
341+
342+QMAKE_CLEAN += $$OBJECTS_DIR/*.gcno $$OBJECTS_DIR/*.gcda
343+
344+target.path += $$LIBDIR
345+
346+plugins_headers.path += $$INCLUDEDIR/$$MALIIT_PLUGINS_HEADER/maliit/plugins
347+plugins_headers.files += $$PLUGIN_HEADERS_PUBLIC
348+
349+server_headers.path += $$INCLUDEDIR/$$MALIIT_SERVER_HEADER
350+server_headers.files += $$SERVER_HEADERS_PUBLIC
351+
352+OTHER_FILES += \
353+ maliit-server.pc.in \
354+ maliit-plugins.pc.in \
355+ libmaliit-plugins.pri
356+
357+OTHER_FILES += \
358+ config.h.in \
359+ maliit-plugins.prf.in \
360+ maliit-defines.prf.in \
361+
362+outputFiles(config.h maliit-defines.prf maliit-plugins.prf maliit-plugins.pc maliit-server.pc)
363+
364+install_pkgconfig.path = $${LIBDIR}/pkgconfig
365+install_pkgconfig.files = \
366+ $$OUT_PWD/MeegoImFramework.pc \
367+ $$OUT_PWD/maliit-plugins.pc \
368+ $$OUT_PWD/maliit-server.pc \
369+
370+install_prf.path = $$MALIIT_INSTALL_PRF
371+install_prf.files = $$OUT_PWD/maliit-plugins.prf $$OUT_PWD/maliit-defines.prf
372+
373+INSTALLS += \
374+ target \
375+ plugins_headers \
376+ server_headers \
377+ install_prf \
378+ install_pkgconfig \
379+
380+include($$TOP_DIR/weston-protocols/libmaliit-weston-protocols.pri)
381+include($$TOP_DIR/connection/libmaliit-connection.pri)
382+include($$TOP_DIR/common/libmaliit-common.pri)
383
384=== modified file '.pc/applied-patches'
385--- .pc/applied-patches 2014-06-02 15:26:38 +0000
386+++ .pc/applied-patches 2014-08-04 15:52:39 +0000
387@@ -6,3 +6,5 @@
388 0006-fix_orientation_to_angle_mapping.patch
389 0007-use_host_prefix_for_mkspecs.patch
390 0008-qt5.3-fix.patch
391+0009-update-input-region-when-hiding.patch
392+0010-fix-building-with-g++-4.9.patch
393
394=== modified file 'debian/changelog'
395--- debian/changelog 2014-06-02 15:26:38 +0000
396+++ debian/changelog 2014-08-04 15:52:39 +0000
397@@ -1,3 +1,13 @@
398+maliit-framework (0.99.0+git20130615+97e8335-0ubuntu10) utopic; urgency=medium
399+
400+ * Ensure that input method area sizes are always updated when sent from the
401+ keyboard plugin regardless of whether the keyboard is currently active.
402+ This allows for hiding animations to correctly set the input method area
403+ whilst the keyboard is otherwise inactive.
404+ * Fix building with g++ 4.9
405+
406+ -- Michael Sheldon <michael.sheldon@canonical.com> Mon, 04 Aug 2014 16:34:14 +0100
407+
408 maliit-framework (0.99.0+git20130615+97e8335-0ubuntu9) utopic; urgency=medium
409
410 [ Timo Jyrinki ]
411
412=== added file 'debian/patches/0009-update-input-region-when-hiding.patch'
413--- debian/patches/0009-update-input-region-when-hiding.patch 1970-01-01 00:00:00 +0000
414+++ debian/patches/0009-update-input-region-when-hiding.patch 2014-08-04 15:52:39 +0000
415@@ -0,0 +1,25 @@
416+Author: Michael Sheldon <michael.sheldon@canonical.com>
417+Forwarded: no
418+Description: Update input method area when hiding the keyboard
419+ This patch ensures that maliit continues to update the input method area after the
420+ keyboard has been dismissed. This allows keyboard hiding animations to provide a
421+ smooth transition between the showing and hiding states.
422+
423+Index: maliit-framework-0.99+git20130702+97e8335/src/windowgroup.cpp
424+===================================================================
425+--- maliit-framework-0.99.0+git20130615+97e8335.orig/src/windowgroup.cpp
426++++ maliit-framework-0.99.0+git20130615+97e8335/src/windowgroup.cpp
427+@@ -104,9 +104,10 @@ void WindowGroup::setInputMethodArea(con
428+ }
429+ }
430+
431+- if (m_active) {
432+- updateInputMethodArea();
433+- }
434++ // We should update the input method area regardless of whether we're still
435++ // active or not, as keyboard hiding animations could be changing this
436++ // region after we've deactivated
437++ updateInputMethodArea();
438+ }
439+
440+ void WindowGroup::setApplicationWindow(WId id)
441
442=== modified file 'debian/patches/series'
443--- debian/patches/series 2014-06-02 15:26:38 +0000
444+++ debian/patches/series 2014-08-04 15:52:39 +0000
445@@ -6,3 +6,5 @@
446 0006-fix_orientation_to_angle_mapping.patch
447 0007-use_host_prefix_for_mkspecs.patch
448 0008-qt5.3-fix.patch
449+0009-update-input-region-when-hiding.patch
450+0010-fix-building-with-g++-4.9.patch
451
452=== modified file 'src/src.pro'
453--- src/src.pro 2013-07-23 19:47:04 +0000
454+++ src/src.pro 2014-08-04 15:52:39 +0000
455@@ -147,6 +147,10 @@
456 }
457 }
458
459+# g++ 4.9 introduces a new check for unused functions that we wish to ignore
460+# to avoid removing upstream code
461+QMAKE_CXXFLAGS += -Wno-unused-function
462+
463 OBJECTS_DIR = .obj
464 MOC_DIR = .moc
465
466
467=== modified file 'src/windowgroup.cpp'
468--- src/windowgroup.cpp 2013-07-23 19:47:04 +0000
469+++ src/windowgroup.cpp 2014-08-04 15:52:39 +0000
470@@ -104,9 +104,10 @@
471 }
472 }
473
474- if (m_active) {
475- updateInputMethodArea();
476- }
477+ // We should update the input method area regardless of whether we're still
478+ // active or not, as keyboard hiding animations could be changing this
479+ // region after we've deactivated
480+ updateInputMethodArea();
481 }
482
483 void WindowGroup::setApplicationWindow(WId id)

Subscribers

People subscribed via source and target branches