Merge lp:~lukas-kde/qtmir/defaultKeymap into lp:qtmir

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 587
Merged at revision: 586
Proposed branch: lp:~lukas-kde/qtmir/defaultKeymap
Merge into: lp:qtmir
Prerequisite: lp:~lukas-kde/qtmir/cleanups
Diff against target: 565 lines (+284/-36)
17 files modified
CMakeLists.txt (+1/-1)
debian/control (+1/-1)
src/modules/Unity/Application/mirsurface.cpp (+2/-8)
src/platforms/mirserver/CMakeLists.txt (+1/-0)
src/platforms/mirserver/inputdeviceobserver.cpp (+106/-0)
src/platforms/mirserver/inputdeviceobserver.h (+55/-0)
src/platforms/mirserver/logging.cpp (+1/-0)
src/platforms/mirserver/logging.h (+1/-0)
src/platforms/mirserver/mirserverhooks.cpp (+17/-0)
src/platforms/mirserver/mirserverhooks.h (+3/-0)
src/platforms/mirserver/mirsingleton.cpp (+30/-0)
src/platforms/mirserver/mirsingleton.h (+5/-1)
src/platforms/mirserver/qmirserver_p.cpp (+1/-0)
src/platforms/mirserver/qteventfeeder.cpp (+0/-17)
src/platforms/mirserver/surfaceobserver.h (+0/-1)
tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h (+18/-7)
tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp (+42/-0)
To merge this branch: bzr merge lp:~lukas-kde/qtmir/defaultKeymap
Reviewer Review Type Date Requested Status
Unity8 CI Bot (community) continuous-integration Approve
Gerry Boland (community) Approve
Daniel d'Andrada Pending
Review via email: mp+314079@code.launchpad.net

This proposal supersedes a proposal from 2016-09-22.

Commit message

Apply default device keymap

Description of the change

Prereq-archive: ppa:ci-train-ppa-service/2272

Apply default device keymap (thereby fixing lp:1626435 - Keyboard layout not applied on the shell)

Drop unused code from SurfaceObserver

Needs unity-api branch: https://code.launchpad.net/~lukas-kde/unity-api/defaultKeymap/+merge/307309

And a small patch for unity8: https://code.launchpad.net/~lukas-kde/unity8/defaultKeymap/+merge/306761

To post a comment you must log in.
Revision history for this message
Andreas Pokorny (andreas-pokorny) : Posted in a previous version of this proposal
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:565
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/386/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/2965/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2993
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2851/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2851/console
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2851/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2851
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2851/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:566
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/387/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2970
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2998
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2856/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2856
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2856/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal

+++ src/platforms/mirserver/inputdeviceobserver.cpp
+#include <QDebug>
logging.h includes this.

I see lots of namespace qualifiers here. Could you please do
using mi = mir::input
just to mask the worst of the noise.

+MirInputDeviceObserver::~MirInputDeviceObserver()
+{
+ m_devices.clear();
+}
redundant? QVector effectively does this in destruction anyway, no?

+++ src/platforms/mirserver/inputdeviceobserver.h
+class MirInputDeviceObserver
Please stick this into the qtmir namespace.

+ std::shared_ptr<mir::input::InputDeviceHub> m_hub;
I don't see this being used anywhere.

Other cleanups are nice, thanks, but mixing them with a new feature is a possible danger. Say if cleanup breaks something, the whole commit gets reverted/removed from the silo, so we loose the feature.

But overall very nice!

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:567
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/388/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3014/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3042
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2899/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2899
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2899/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

In src/platforms/mirserver/inputdeviceobserver.h:

"""
namespace mi = mir::input;
"""

Not a fan of aliasing namespaces in headers as that will contaminate any cpp file that #includes this header. Theoretically some cpp file might already use "mi" for something else and you would cause a collision, which is exactly what namespaces are there for.

Aliasing namespaces is a decision that only implementation code should make, locally.

Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

In src/platforms/mirserver/mirsingleton.h:

"""
Q_PROPERTY(QString currentKeymap READ currentKeymap WRITE setCurrentKeymap NOTIFY currentKeymapChanged)
"""

This has to go into unity/shell/application/Mir.h interface from unity-api.

review: Needs Fixing
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

> In src/platforms/mirserver/inputdeviceobserver.h:
>
> """
> namespace mi = mir::input;
> """
>
> Not a fan of aliasing namespaces in headers as that will contaminate any cpp
> file that #includes this header. Theoretically some cpp file might already use
> "mi" for something else and you would cause a collision, which is exactly what
> namespaces are there for.
>
> Aliasing namespaces is a decision that only implementation code should make,
> locally.

Although I agree in general, this is what Gerry suggested above :)

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

> In src/platforms/mirserver/mirsingleton.h:
>
> """
> Q_PROPERTY(QString currentKeymap READ currentKeymap WRITE setCurrentKeymap
> NOTIFY currentKeymapChanged)
> """
>
> This has to go into unity/shell/application/Mir.h interface from unity-api.

Yup, I can definitely move it over there if you insist but isn't this too implementation specific?

Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

> > In src/platforms/mirserver/mirsingleton.h:
> >
> > """
> > Q_PROPERTY(QString currentKeymap READ currentKeymap WRITE setCurrentKeymap
> > NOTIFY currentKeymapChanged)
> > """
> >
> > This has to go into unity/shell/application/Mir.h interface from unity-api.
>
> Yup, I can definitely move it over there if you insist but isn't this too
> implementation specific?

If unity8 uses it, it has to be in unity-api. That's the whole point of unity-api: define/expose the API that unity8 uses from qtmir.

Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

> > In src/platforms/mirserver/inputdeviceobserver.h:
> >
> > """
> > namespace mi = mir::input;
> > """
> >
> > Not a fan of aliasing namespaces in headers as that will contaminate any cpp
> > file that #includes this header. Theoretically some cpp file might already
> use
> > "mi" for something else and you would cause a collision, which is exactly
> what
> > namespaces are there for.
> >
> > Aliasing namespaces is a decision that only implementation code should make,
> > locally.
>
> Although I agree in general, this is what Gerry suggested above :)

You do that in src/platforms/mirserver/inputdeviceobserver.cpp, not in its header.

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

> > > In src/platforms/mirserver/inputdeviceobserver.h:
> > >
> > > """
> > > namespace mi = mir::input;
> > > """
> > >
> > > Not a fan of aliasing namespaces in headers as that will contaminate any
> cpp
> > > file that #includes this header. Theoretically some cpp file might already
> > use
> > > "mi" for something else and you would cause a collision, which is exactly
> > what
> > > namespaces are there for.
> > >
> > > Aliasing namespaces is a decision that only implementation code should
> make,
> > > locally.
> >
> > Although I agree in general, this is what Gerry suggested above :)
>
> You do that in src/platforms/mirserver/inputdeviceobserver.cpp, not in its
> header.

Sure, fixed

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

> > > In src/platforms/mirserver/mirsingleton.h:
> > >
> > > """
> > > Q_PROPERTY(QString currentKeymap READ currentKeymap WRITE setCurrentKeymap
> > > NOTIFY currentKeymapChanged)
> > > """
> > >
> > > This has to go into unity/shell/application/Mir.h interface from unity-
> api.
> >
> > Yup, I can definitely move it over there if you insist but isn't this too
> > implementation specific?
>
> If unity8 uses it, it has to be in unity-api. That's the whole point of unity-
> api: define/expose the API that unity8 uses from qtmir.

Yeah done; see also https://code.launchpad.net/~lukas-kde/unity-api/defaultKeymap/+merge/307309

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

+ connect(Mir::instance(), &Mir::currentKeymapChanged, this, &MirInputDeviceObserver::setKeymap, Qt::DirectConnection);
Why specifying direct? Is it that the slot doesn't live in an object belonging to a QThread (which has no event loop, so queued signal/slot fails to work).

+MirInputDeviceObserver::~MirInputDeviceObserver()
+{
+ m_devices.clear();
+}
is this necessary? Surely the deletion of the QVector will achieve this too?

+ const QString layout = stringList.at(0);
could this be a reference and save a string copy? Similar for variant.

I'm a bit concerned about thread safety. The device_{add,chang,remov}ed
methods are called by Mir, and that is usually done on some Mir internal thread. The object itself belongs to that thread too. However the Mir::currentKeymapChanged signal fires on the QtGui thread, so it is possible for those 2 threads to call applyKeymap almost simultaneously.

I think a little locking is necessary for safety.

Also, could you please add comments on each method explaining the thread situation, as this stuff is super easy to forget.

review: Needs Fixing
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> +MirInputDeviceObserver::~MirInputDeviceObserver()
> +{
> + m_devices.clear();
> +}
> is this necessary? Surely the deletion of the QVector will achieve this too?

I think so, QVector imo doesn't do that by itself.

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

> + const QString layout = stringList.at(0);
> could this be a reference and save a string copy? Similar for variant.

Done for layout, variant might be empty so it won't work there

Revision history for this message
Gerry Boland (gerboland) wrote :

Ok, much improved, thank you.

But please add comments explaining the thread situation. We remember it now, but someone else won't have a clue, and could introduce subtle errors if they forget the locking, or remove the DirectConnection specifier thinking it extraneous.

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

> > +MirInputDeviceObserver::~MirInputDeviceObserver()
> > +{
> > + m_devices.clear();
> > +}
> > is this necessary? Surely the deletion of the QVector will achieve this too?
>
> I think so, QVector imo doesn't do that by itself.

/me was curious, looked at the source:

template <typename T>
class QVector
{
    typedef QTypedArrayData<T> Data;
    Data *d;

public:
    inline ~QVector() { if (!d->ref.deref()) freeData(d); }

};

template <typename T>
void QVector<T>::freeData(Data *x)
{
    destruct(x->begin(), x->end());
    Data::deallocate(x);
}

template <typename T>
void QVector<T>::destruct(T *from, T *to)
{
    if (QTypeInfo<T>::isComplex) {
        while (from != to) {
            from++->~T();
        }
    }
}

It does look like ~QVector calls freeData(Data*), which calls destruct() that explicitly calls the destructor of each member of the type T in the container (if T is complex which I think std::shared_ptr is).

How clear() works is less obvious to me, I think we both trust it does.

I'd be surprised that a container would leak its members on destruction, requiring us to explicitly clear() it before letting it go out of scope. Is why I suspect the clear() is unnecessary.

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

Addressed the above comments

Revision history for this message
Gerry Boland (gerboland) wrote :

Perfect, thanks!

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

FAILED: Continuous integration, rev:587
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/444/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3794/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3822
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3665
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3665/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3665
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3665/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3665
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3665/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3665/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3665
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3665/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3665/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:587
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/445/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/3800/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3828
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3671
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3671/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3671
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3671/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3671
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3671/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3671/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3671
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3671/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3671/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:587
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/448/
Executed test runs:

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:587
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/447/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3819
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3847
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3690/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3690
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3690/artifact/output/*zip*/output.zip

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

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

CI good again

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-12-16 08:24:29 +0000
+++ CMakeLists.txt 2017-01-04 17:43:31 +0000
@@ -88,7 +88,7 @@
88pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)88pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
89pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED)89pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED)
90pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED)90pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED)
91pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=23)91pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=25)
92pkg_check_modules(CGMANAGER libcgmanager REQUIRED)92pkg_check_modules(CGMANAGER libcgmanager REQUIRED)
93pkg_check_modules(CONTENT_HUB libcontent-hub>=0.2 REQUIRED)93pkg_check_modules(CONTENT_HUB libcontent-hub>=0.2 REQUIRED)
9494
9595
=== modified file 'debian/control'
--- debian/control 2016-12-13 15:51:14 +0000
+++ debian/control 2017-01-04 17:43:31 +0000
@@ -25,7 +25,7 @@
25 libubuntu-app-launch2-dev (>= 0.9),25 libubuntu-app-launch2-dev (>= 0.9),
26 libubuntu-application-api-dev (>= 2.1.0),26 libubuntu-application-api-dev (>= 2.1.0),
27 libudev-dev,27 libudev-dev,
28 libunity-api-dev (>= 8.0),28 libunity-api-dev (>= 8.1),
29 liburl-dispatcher1-dev,29 liburl-dispatcher1-dev,
30 libxkbcommon-dev,30 libxkbcommon-dev,
31 libxrender-dev,31 libxrender-dev,
3232
=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
--- src/modules/Unity/Application/mirsurface.cpp 2017-01-04 17:43:31 +0000
+++ src/modules/Unity/Application/mirsurface.cpp 2017-01-04 17:43:31 +0000
@@ -89,8 +89,8 @@
89 void cursor_image_set_to(mir::graphics::CursorImage const&) override;89 void cursor_image_set_to(mir::graphics::CursorImage const&) override;
90 void orientation_set_to(MirOrientation) override {}90 void orientation_set_to(MirOrientation) override {}
91 void client_surface_close_requested() override {}91 void client_surface_close_requested() override {}
92 void keymap_changed(MirInputDeviceId, std::string const& model, std::string const& layout,92 void keymap_changed(MirInputDeviceId, std::string const&, std::string const&,
93 std::string const& variant, std::string const& options) override;93 std::string const&, std::string const&) override {}
94 void renamed(char const * name) override;94 void renamed(char const * name) override;
95 void cursor_image_removed() override;95 void cursor_image_removed() override;
9696
@@ -1142,12 +1142,6 @@
1142 Q_EMIT cursorChanged(qcursor);1142 Q_EMIT cursorChanged(qcursor);
1143}1143}
11441144
1145void MirSurface::SurfaceObserverImpl::keymap_changed(MirInputDeviceId, const std::string &, const std::string &layout,
1146 const std::string &variant, const std::string &)
1147{
1148 Q_EMIT keymapChanged(QString::fromStdString(layout), QString::fromStdString(variant));
1149}
1150
1151QCursor MirSurface::SurfaceObserverImpl::createQCursorFromMirCursorImage(const mir::graphics::CursorImage &cursorImage) {1145QCursor MirSurface::SurfaceObserverImpl::createQCursorFromMirCursorImage(const mir::graphics::CursorImage &cursorImage) {
1152 if (cursorImage.as_argb_8888() == nullptr) {1146 if (cursorImage.as_argb_8888() == nullptr) {
1153 // Must be a named cursor1147 // Must be a named cursor
11541148
=== modified file 'src/platforms/mirserver/CMakeLists.txt'
--- src/platforms/mirserver/CMakeLists.txt 2016-11-03 20:17:46 +0000
+++ src/platforms/mirserver/CMakeLists.txt 2017-01-04 17:43:31 +0000
@@ -101,6 +101,7 @@
101 mirserverintegration.cpp101 mirserverintegration.cpp
102 miropenglcontext.cpp102 miropenglcontext.cpp
103 offscreensurface.cpp103 offscreensurface.cpp
104 inputdeviceobserver.cpp
104 promptsessionmanager.cpp promptsessionmanager.h promptsession.h105 promptsessionmanager.cpp promptsessionmanager.h promptsession.h
105# We need to run moc on these headers106# We need to run moc on these headers
106 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirMousePointerInterface.h107 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirMousePointerInterface.h
107108
=== added file 'src/platforms/mirserver/inputdeviceobserver.cpp'
--- src/platforms/mirserver/inputdeviceobserver.cpp 1970-01-01 00:00:00 +0000
+++ src/platforms/mirserver/inputdeviceobserver.cpp 2017-01-04 17:43:31 +0000
@@ -0,0 +1,106 @@
1/*
2 * Copyright (C) 2016-2017 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <mir/input/device.h>
18#include <mir/input/device_capability.h>
19#include <mir/input/keyboard_configuration.h>
20
21#include <Qt>
22#include <QTimer>
23
24#include "inputdeviceobserver.h"
25#include "mirsingleton.h"
26#include "logging.h"
27
28using namespace qtmir;
29namespace mi = mir::input;
30
31// Note: MirInputDeviceObserver has affinity to a Mir thread, but it is expected setKeymap will be called from the Qt GUI thread
32
33MirInputDeviceObserver::MirInputDeviceObserver(QObject *parent):
34 QObject(parent)
35{
36 // NB: have to use a Direct connection here, as it's called from Qt GUI thread
37 connect(Mir::instance(), &Mir::currentKeymapChanged, this, &MirInputDeviceObserver::setKeymap, Qt::DirectConnection);
38}
39
40void MirInputDeviceObserver::setKeymap(const QString &keymap)
41{
42 QMutexLocker locker(&m_mutex); // lock so that Qt and Mir don't apply the keymap at the same time
43
44 if (keymap != m_keymap) {
45 qCDebug(QTMIR_MIR_KEYMAP) << "SET KEYMAP" << keymap;
46 m_keymap = keymap;
47 applyKeymap();
48 }
49}
50
51void MirInputDeviceObserver::applyKeymap()
52{
53 Q_FOREACH(const auto &device, m_devices) {
54 applyKeymap(device);
55 }
56}
57
58void MirInputDeviceObserver::device_added(const std::shared_ptr<mi::Device> &device)
59{
60 QMutexLocker locker(&m_mutex); // lock so that Qt and Mir don't apply the keymap at the same time
61
62 if (mir::contains(device->capabilities(), mi::DeviceCapability::keyboard) &&
63 mir::contains(device->capabilities(), mi::DeviceCapability::alpha_numeric)) {
64 qCDebug(QTMIR_MIR_KEYMAP) << "Device added" << device->id();
65 m_devices.append(device);
66 applyKeymap(device);
67 }
68}
69
70void MirInputDeviceObserver::device_removed(const std::shared_ptr<mi::Device> &device)
71{
72 QMutexLocker locker(&m_mutex); // lock so that Qt and Mir don't apply the keymap at the same time
73
74 if (device && m_devices.contains(device)) {
75 qCDebug(QTMIR_MIR_KEYMAP) << "Device removed" << device->id();
76 m_devices.removeAll(device);
77 }
78}
79
80void MirInputDeviceObserver::applyKeymap(const std::shared_ptr<mi::Device> &device)
81{
82 if (!m_keymap.isEmpty()) {
83 const QStringList stringList = m_keymap.split('+', QString::SkipEmptyParts);
84
85 const QString &layout = stringList.at(0);
86 QString variant;
87
88 if (stringList.count() > 1) {
89 variant = stringList.at(1);
90 }
91
92 qCDebug(QTMIR_MIR_KEYMAP) << "Applying keymap" << layout << variant << "on" << device->id() << QString::fromStdString(device->name());
93 mi::KeyboardConfiguration oldConfig;
94 mi::Keymap keymap;
95 if (device->keyboard_configuration().is_set()) { // preserve the model and options
96 oldConfig = device->keyboard_configuration().value();
97 keymap.model = oldConfig.device_keymap.model;
98 keymap.options = oldConfig.device_keymap.options;
99 }
100 keymap.layout = layout.toStdString();
101 keymap.variant = variant.toStdString();
102
103 device->apply_keyboard_configuration(std::move(keymap));
104 qCDebug(QTMIR_MIR_KEYMAP) << "Keymap applied";
105 }
106}
0107
=== added file 'src/platforms/mirserver/inputdeviceobserver.h'
--- src/platforms/mirserver/inputdeviceobserver.h 1970-01-01 00:00:00 +0000
+++ src/platforms/mirserver/inputdeviceobserver.h 2017-01-04 17:43:31 +0000
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2016-2017 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef INPUTDEVICEOBSERVER_H
18#define INPUTDEVICEOBSERVER_H
19
20#include <mir/input/input_device_observer.h>
21
22#include <QObject>
23#include <QString>
24#include <QVector>
25#include <QMutex>
26
27namespace qtmir {
28
29class MirInputDeviceObserver: public QObject, public mir::input::InputDeviceObserver
30{
31 Q_OBJECT
32public:
33 MirInputDeviceObserver(QObject * parent = nullptr);
34 ~MirInputDeviceObserver() = default;
35
36protected:
37 void device_added(std::shared_ptr<mir::input::Device> const& device) override;
38 void device_changed(std::shared_ptr<mir::input::Device> const& /*device*/) override {}
39 void device_removed(std::shared_ptr<mir::input::Device> const& device) override;
40 void changes_complete() override {}
41
42private Q_SLOTS:
43 void setKeymap(const QString &keymap);
44
45private:
46 void applyKeymap();
47 void applyKeymap(const std::shared_ptr<mir::input::Device> &device);
48 QString m_keymap;
49 QVector<std::shared_ptr<mir::input::Device>> m_devices;
50 QMutex m_mutex;
51};
52
53} // namespace qtmir
54
55#endif
056
=== modified file 'src/platforms/mirserver/logging.cpp'
--- src/platforms/mirserver/logging.cpp 2016-07-01 16:15:54 +0000
+++ src/platforms/mirserver/logging.cpp 2017-01-04 17:43:31 +0000
@@ -21,6 +21,7 @@
21Q_LOGGING_CATEGORY(QTMIR_SURFACES, "qtmir.surfaces")21Q_LOGGING_CATEGORY(QTMIR_SURFACES, "qtmir.surfaces")
22Q_LOGGING_CATEGORY(QTMIR_MIR_INPUT, "qtmir.mir.input", QtWarningMsg)22Q_LOGGING_CATEGORY(QTMIR_MIR_INPUT, "qtmir.mir.input", QtWarningMsg)
23Q_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES, "qtmir.mir")23Q_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES, "qtmir.mir")
24Q_LOGGING_CATEGORY(QTMIR_MIR_KEYMAP, "qtmir.mir.keymap")
24Q_LOGGING_CATEGORY(QTMIR_CLIPBOARD, "qtmir.clipboard")25Q_LOGGING_CATEGORY(QTMIR_CLIPBOARD, "qtmir.clipboard")
25Q_LOGGING_CATEGORY(QTMIR_SENSOR_MESSAGES, "qtmir.sensor")26Q_LOGGING_CATEGORY(QTMIR_SENSOR_MESSAGES, "qtmir.sensor")
26Q_LOGGING_CATEGORY(QTMIR_SCREENS, "qtmir.screens")27Q_LOGGING_CATEGORY(QTMIR_SCREENS, "qtmir.screens")
2728
=== modified file 'src/platforms/mirserver/logging.h'
--- src/platforms/mirserver/logging.h 2016-07-01 16:15:54 +0000
+++ src/platforms/mirserver/logging.h 2017-01-04 17:43:31 +0000
@@ -24,6 +24,7 @@
24Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES)24Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_MESSAGES)
25Q_DECLARE_LOGGING_CATEGORY(QTMIR_SENSOR_MESSAGES)25Q_DECLARE_LOGGING_CATEGORY(QTMIR_SENSOR_MESSAGES)
26Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_INPUT)26Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_INPUT)
27Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_KEYMAP)
27Q_DECLARE_LOGGING_CATEGORY(QTMIR_CLIPBOARD)28Q_DECLARE_LOGGING_CATEGORY(QTMIR_CLIPBOARD)
28Q_DECLARE_LOGGING_CATEGORY(QTMIR_SCREENS)29Q_DECLARE_LOGGING_CATEGORY(QTMIR_SCREENS)
29Q_DECLARE_LOGGING_CATEGORY(QTMIR_DBUS)30Q_DECLARE_LOGGING_CATEGORY(QTMIR_DBUS)
3031
=== modified file 'src/platforms/mirserver/mirserverhooks.cpp'
--- src/platforms/mirserver/mirserverhooks.cpp 2016-11-03 20:17:46 +0000
+++ src/platforms/mirserver/mirserverhooks.cpp 2017-01-04 17:43:31 +0000
@@ -23,11 +23,13 @@
23#include "promptsessionlistener.h"23#include "promptsessionlistener.h"
24#include "screenscontroller.h"24#include "screenscontroller.h"
25#include "logging.h"25#include "logging.h"
26#include "inputdeviceobserver.h"
2627
27// mir28// mir
28#include <mir/server.h>29#include <mir/server.h>
29#include <mir/graphics/cursor.h>30#include <mir/graphics/cursor.h>
30#include <mir/scene/prompt_session_listener.h>31#include <mir/scene/prompt_session_listener.h>
32#include <mir/input/input_device_hub.h>
3133
32namespace mg = mir::graphics;34namespace mg = mir::graphics;
33namespace ms = mir::scene;35namespace ms = mir::scene;
@@ -74,6 +76,7 @@
74 std::weak_ptr<mir::graphics::Display> m_mirDisplay;76 std::weak_ptr<mir::graphics::Display> m_mirDisplay;
75 std::weak_ptr<mir::shell::DisplayConfigurationController> m_mirDisplayConfigurationController;77 std::weak_ptr<mir::shell::DisplayConfigurationController> m_mirDisplayConfigurationController;
76 std::weak_ptr<mir::scene::PromptSessionManager> m_mirPromptSessionManager;78 std::weak_ptr<mir::scene::PromptSessionManager> m_mirPromptSessionManager;
79 std::weak_ptr<mir::input::InputDeviceHub> m_inputDeviceHub;
77};80};
7881
79qtmir::MirServerHooks::MirServerHooks() :82qtmir::MirServerHooks::MirServerHooks() :
@@ -104,6 +107,7 @@
104 self->m_mirDisplay = server.the_display();107 self->m_mirDisplay = server.the_display();
105 self->m_mirDisplayConfigurationController = server.the_display_configuration_controller();108 self->m_mirDisplayConfigurationController = server.the_display_configuration_controller();
106 self->m_mirPromptSessionManager = server.the_prompt_session_manager();109 self->m_mirPromptSessionManager = server.the_prompt_session_manager();
110 self->m_inputDeviceHub = server.the_input_device_hub();
107 });111 });
108}112}
109113
@@ -131,12 +135,25 @@
131 throw std::logic_error("No display available. Server not running?");135 throw std::logic_error("No display available. Server not running?");
132}136}
133137
138std::shared_ptr<mir::input::InputDeviceHub> qtmir::MirServerHooks::theInputDeviceHub() const
139{
140 if (auto result = self->m_inputDeviceHub.lock())
141 return result;
142
143 throw std::logic_error("No input device hub available. Server not running?");
144}
145
134QSharedPointer<ScreensController> qtmir::MirServerHooks::createScreensController(QSharedPointer<ScreensModel> const &screensModel) const146QSharedPointer<ScreensController> qtmir::MirServerHooks::createScreensController(QSharedPointer<ScreensModel> const &screensModel) const
135{147{
136 return QSharedPointer<ScreensController>(148 return QSharedPointer<ScreensController>(
137 new ScreensController(screensModel, theMirDisplay(), self->m_mirDisplayConfigurationController.lock()));149 new ScreensController(screensModel, theMirDisplay(), self->m_mirDisplayConfigurationController.lock()));
138}150}
139151
152void qtmir::MirServerHooks::createInputDeviceObserver()
153{
154 theInputDeviceHub()->add_observer(std::make_shared<qtmir::MirInputDeviceObserver>());
155}
156
140PromptSessionListenerImpl::~PromptSessionListenerImpl() = default;157PromptSessionListenerImpl::~PromptSessionListenerImpl() = default;
141158
142void PromptSessionListenerImpl::starting(std::shared_ptr<ms::PromptSession> const& prompt_session)159void PromptSessionListenerImpl::starting(std::shared_ptr<ms::PromptSession> const& prompt_session)
143160
=== modified file 'src/platforms/mirserver/mirserverhooks.h'
--- src/platforms/mirserver/mirserverhooks.h 2016-11-03 20:17:46 +0000
+++ src/platforms/mirserver/mirserverhooks.h 2017-01-04 17:43:31 +0000
@@ -25,6 +25,7 @@
25namespace mir { class Server; }25namespace mir { class Server; }
26namespace mir { namespace scene { class PromptSessionManager; }}26namespace mir { namespace scene { class PromptSessionManager; }}
27namespace mir { namespace graphics { class Display; }}27namespace mir { namespace graphics { class Display; }}
28namespace mir { namespace input { class InputDeviceHub; } }
2829
29class PromptSessionListener;30class PromptSessionListener;
30class ScreensController;31class ScreensController;
@@ -42,8 +43,10 @@
42 PromptSessionListener *promptSessionListener() const;43 PromptSessionListener *promptSessionListener() const;
43 std::shared_ptr<mir::scene::PromptSessionManager> thePromptSessionManager() const;44 std::shared_ptr<mir::scene::PromptSessionManager> thePromptSessionManager() const;
44 std::shared_ptr<mir::graphics::Display> theMirDisplay() const;45 std::shared_ptr<mir::graphics::Display> theMirDisplay() const;
46 std::shared_ptr<mir::input::InputDeviceHub> theInputDeviceHub() const;
4547
46 QSharedPointer<ScreensController> createScreensController(QSharedPointer<ScreensModel> const &screensModel) const;48 QSharedPointer<ScreensController> createScreensController(QSharedPointer<ScreensModel> const &screensModel) const;
49 void createInputDeviceObserver();
4750
48private:51private:
49 struct Self;52 struct Self;
5053
=== modified file 'src/platforms/mirserver/mirsingleton.cpp'
--- src/platforms/mirserver/mirsingleton.cpp 2016-11-03 20:17:46 +0000
+++ src/platforms/mirserver/mirsingleton.cpp 2017-01-04 17:43:31 +0000
@@ -1,3 +1,19 @@
1/*
2 * Copyright (C) 2015-2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "mirsingleton.h"17#include "mirsingleton.h"
218
3qtmir::Mir *qtmir::Mir::m_instance = nullptr;19qtmir::Mir *qtmir::Mir::m_instance = nullptr;
@@ -32,3 +48,17 @@
32{48{
33 return m_cursorName;49 return m_cursorName;
34}50}
51
52QString qtmir::Mir::currentKeymap() const
53{
54 return m_currentKeymap;
55}
56
57void qtmir::Mir::setCurrentKeymap(const QString &currentKeymap)
58{
59 if (m_currentKeymap == currentKeymap)
60 return;
61
62 m_currentKeymap = currentKeymap;
63 Q_EMIT currentKeymapChanged(m_currentKeymap);
64}
3565
=== modified file 'src/platforms/mirserver/mirsingleton.h'
--- src/platforms/mirserver/mirsingleton.h 2015-09-22 20:22:20 +0000
+++ src/platforms/mirserver/mirsingleton.h 2017-01-04 17:43:31 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2015 Canonical, Ltd.2 * Copyright (C) 2015-2016 Canonical, Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it under4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by5 * the terms of the GNU Lesser General Public License version 3, as published by
@@ -33,11 +33,15 @@
33 void setCursorName(const QString &cursorName) override;33 void setCursorName(const QString &cursorName) override;
34 QString cursorName() const override;34 QString cursorName() const override;
3535
36 QString currentKeymap() const override;
37 void setCurrentKeymap(const QString &currentKeymap) override;
38
36private:39private:
37 Mir();40 Mir();
38 Q_DISABLE_COPY(Mir)41 Q_DISABLE_COPY(Mir)
3942
40 QString m_cursorName;43 QString m_cursorName;
44 QString m_currentKeymap;
41 static qtmir::Mir *m_instance;45 static qtmir::Mir *m_instance;
42};46};
4347
4448
=== modified file 'src/platforms/mirserver/qmirserver_p.cpp'
--- src/platforms/mirserver/qmirserver_p.cpp 2016-11-16 17:39:06 +0000
+++ src/platforms/mirserver/qmirserver_p.cpp 2017-01-04 17:43:31 +0000
@@ -117,6 +117,7 @@
117 {117 {
118 screensModel->update();118 screensModel->update();
119 screensController = m_mirServerHooks.createScreensController(screensModel);119 screensController = m_mirServerHooks.createScreensController(screensModel);
120 m_mirServerHooks.createInputDeviceObserver();
120 });121 });
121122
122 runner.add_start_callback(startCallback);123 runner.add_start_callback(startCallback);
123124
=== modified file 'src/platforms/mirserver/qteventfeeder.cpp'
--- src/platforms/mirserver/qteventfeeder.cpp 2016-11-03 20:17:46 +0000
+++ src/platforms/mirserver/qteventfeeder.cpp 2017-01-04 17:43:31 +0000
@@ -27,7 +27,6 @@
27#include <qpa/qplatformintegration.h>27#include <qpa/qplatformintegration.h>
28#include <qpa/qwindowsysteminterface_p.h>28#include <qpa/qwindowsysteminterface_p.h>
29#include <QGuiApplication>29#include <QGuiApplication>
30#include <private/qguiapplication_p.h>
31#include <QTextCodec>30#include <QTextCodec>
32#include <QDebug>31#include <QDebug>
3332
@@ -677,22 +676,6 @@
677 }676 }
678 int keyCode = translateKeysym(xk_sym, text);677 int keyCode = translateKeysym(xk_sym, text);
679678
680 QPlatformInputContext* context = QGuiApplicationPrivate::platformIntegration()->inputContext();
681 if (context) {
682 // TODO: consider event.repeat_count
683 QKeyEvent qKeyEvent(keyType, keyCode, modifiers,
684 mir_keyboard_event_scan_code(kev),
685 mir_keyboard_event_key_code(kev),
686 mir_keyboard_event_modifiers(kev),
687 text, is_auto_rep);
688 qKeyEvent.setTimestamp(timestamp.count());
689 if (context->filterEvent(&qKeyEvent)) {
690 qCDebug(QTMIR_MIR_INPUT) << "Received" << qPrintable(mirKeyboardEventToString(kev))
691 << "but not dispatching as it was filtered out by input context";
692 return;
693 }
694 }
695
696 qCDebug(QTMIR_MIR_INPUT).nospace() << "Received " << qPrintable(mirKeyboardEventToString(kev))679 qCDebug(QTMIR_MIR_INPUT).nospace() << "Received " << qPrintable(mirKeyboardEventToString(kev))
697 << ". Dispatching to " << mQtWindowSystem->focusedWindow();680 << ". Dispatching to " << mQtWindowSystem->focusedWindow();
698681
699682
=== modified file 'src/platforms/mirserver/surfaceobserver.h'
--- src/platforms/mirserver/surfaceobserver.h 2016-12-13 15:31:26 +0000
+++ src/platforms/mirserver/surfaceobserver.h 2017-01-04 17:43:31 +0000
@@ -50,7 +50,6 @@
50 void attributeChanged(const MirSurfaceAttrib attribute, const int value);50 void attributeChanged(const MirSurfaceAttrib attribute, const int value);
51 void framesPosted();51 void framesPosted();
52 void resized(const QSize &size);52 void resized(const QSize &size);
53 void keymapChanged(const QString &rules, const QString &variant);
54 void nameChanged(const QString &name);53 void nameChanged(const QString &name);
55 void cursorChanged(const QCursor &cursor);54 void cursorChanged(const QCursor &cursor);
5655
5756
=== modified file 'tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h'
--- tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h 2016-06-23 13:22:42 +0000
+++ tests/mirserver/QtEventFeeder/mock_qtwindowsystem.h 2017-01-04 17:43:31 +0000
@@ -28,14 +28,25 @@
28 MOCK_METHOD1(getWindowForTouchPoint, QWindow*(const QPoint &point));28 MOCK_METHOD1(getWindowForTouchPoint, QWindow*(const QPoint &point));
29 MOCK_METHOD0(lastWindow, QWindow*());29 MOCK_METHOD0(lastWindow, QWindow*());
30 MOCK_METHOD0(focusedWindow, QWindow*());30 MOCK_METHOD0(focusedWindow, QWindow*());
31 // ignores the last parameter count, due to parameter limit in gmock
32 MOCK_METHOD10(handleExtendedKeyEvent,
33 void(QWindow *window, ulong timestamp, QEvent::Type type,
34 int key, Qt::KeyboardModifiers modifiers,
35 quint32 nativeScanCode, quint32 nativeVirtualKey,
36 quint32 nativeModifiers, const QString &text,
37 bool autorep));
3138
32 // Wanted to use GMock, but MOCK_METHOD11 not implemented39 void handleExtendedKeyEvent(QWindow *window, ulong timestamp, QEvent::Type type, int key,
33 void handleExtendedKeyEvent(QWindow */*window*/, ulong /*timestamp*/, QEvent::Type /*type*/, int /*key*/,40 Qt::KeyboardModifiers modifiers,
34 Qt::KeyboardModifiers /*modifiers*/,41 quint32 nativeScanCode, quint32 nativeVirtualKey,
35 quint32 /*nativeScanCode*/, quint32 /*nativeVirtualKey*/,42 quint32 nativeModifiers,
36 quint32 /*nativeModifiers*/,43 const QString& text, bool autorep,
37 const QString& /*text*/ = QString(), bool /*autorep*/ = false,44 ushort /*count*/ )
38 ushort /*count*/ = 1) {}45 {
46 handleExtendedKeyEvent(window, timestamp, type, key, modifiers,
47 nativeScanCode, nativeVirtualKey,
48 nativeModifiers, text, autorep);
49 }
3950
40 MOCK_METHOD5(handleTouchEvent, void(QWindow *window, ulong timestamp, QTouchDevice *device,51 MOCK_METHOD5(handleTouchEvent, void(QWindow *window, ulong timestamp, QTouchDevice *device,
41 const QList<struct QWindowSystemInterface::TouchPoint> &points,52 const QList<struct QWindowSystemInterface::TouchPoint> &points,
4253
=== modified file 'tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp'
--- tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp 2016-05-30 10:23:52 +0000
+++ tests/mirserver/QtEventFeeder/qteventfeeder_test.cpp 2017-01-04 17:43:31 +0000
@@ -27,6 +27,9 @@
2727
28#include "mock_qtwindowsystem.h"28#include "mock_qtwindowsystem.h"
2929
30#include <linux/input.h>
31#include <xkbcommon/xkbcommon-keysyms.h>
32
30using ::testing::_;33using ::testing::_;
31using ::testing::AllOf;34using ::testing::AllOf;
32using ::testing::AnyNumber;35using ::testing::AnyNumber;
@@ -280,3 +283,42 @@
280 qtEventFeeder->dispatch(*ev2);283 qtEventFeeder->dispatch(*ev2);
281 ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem));284 ASSERT_TRUE(Mock::VerifyAndClearExpectations(mockWindowSystem));
282}285}
286
287TEST_F(QtEventFeederTest, composeKeysNotFilteredOut)
288{
289 auto down = mir_keyboard_action_down;
290 auto up = mir_keyboard_action_up;
291
292 auto dispatch_key_event = [&](MirKeyboardAction action, int scan_code, xkb_keysym_t key_sym)
293 {
294 qtEventFeeder->dispatch(*mev::make_event(
295 MirInputDeviceId{0}, std::chrono::nanoseconds{0}, std::vector<uint8_t>{},
296 action, key_sym, scan_code, mir_input_event_modifier_none));
297 };
298
299 InSequence seq;
300 EXPECT_CALL(
301 *mockWindowSystem,
302 handleExtendedKeyEvent(_, _, QEvent::KeyPress, _, _, KEY_RIGHTSHIFT,
303 XKB_KEY_Shift_R, _, _, _));
304 EXPECT_CALL(*mockWindowSystem,
305 handleExtendedKeyEvent(_, _, QEvent::KeyPress, _, _,
306 KEY_APOSTROPHE, XKB_KEY_NoSymbol,
307 _, _, _));
308 EXPECT_CALL(*mockWindowSystem,
309 handleExtendedKeyEvent(_, _, QEvent::KeyRelease, _, _,
310 KEY_APOSTROPHE, XKB_KEY_NoSymbol,
311 _, _, _));
312 EXPECT_CALL(
313 *mockWindowSystem,
314 handleExtendedKeyEvent(_, _, QEvent::KeyRelease, _, _, KEY_RIGHTSHIFT,
315 XKB_KEY_Shift_R, _, _, _));
316 EXPECT_CALL(*mockWindowSystem,
317 handleExtendedKeyEvent(_, _, QEvent::KeyPress, _, _, KEY_U,
318 XKB_KEY_udiaeresis, _, _, _));
319 dispatch_key_event(down, KEY_RIGHTSHIFT, XKB_KEY_Shift_R);
320 dispatch_key_event(down, KEY_APOSTROPHE, XKB_KEY_NoSymbol);
321 dispatch_key_event(up, KEY_APOSTROPHE, XKB_KEY_NoSymbol);
322 dispatch_key_event(up, KEY_RIGHTSHIFT, XKB_KEY_Shift_R);
323 dispatch_key_event(down, KEY_U, XKB_KEY_udiaeresis);
324}

Subscribers

People subscribed via source and target branches