~dandrader/qtubuntu/cursor

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/nativeinterface.cpp

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2015-09-14 13:12:16 UTC
  • mfrom: (274.3.1 provideMirConnection)
  • Revision ID: ci-train-bot@canonical.com-20150914131216-vybw4n8nyvwnid26
Add QPlatformNativeInterface::nativeResourceForIntegration("mirConnection")

Allow Qt applications to access the underlying MirConnection.
Approved by: PS Jenkins bot, Gerry Boland

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        insert("eglcontext", UbuntuNativeInterface::EglContext);
35
35
        insert("nativeorientation", UbuntuNativeInterface::NativeOrientation);
36
36
        insert("display", UbuntuNativeInterface::Display);
 
37
        insert("mirConnection", UbuntuNativeInterface::MirConnection);
37
38
    }
38
39
};
39
40
 
42
43
UbuntuNativeInterface::UbuntuNativeInterface()
43
44
    : mGenericEventFilterType(QByteArrayLiteral("Event"))
44
45
    , mNativeOrientation(nullptr)
 
46
    , mMirConnection(nullptr)
45
47
{
46
48
}
47
49
 
51
53
    mNativeOrientation = nullptr;
52
54
}
53
55
 
 
56
void* UbuntuNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString)
 
57
{
 
58
    const QByteArray lowerCaseResource = resourceString.toLower();
 
59
 
 
60
    if (!ubuntuResourceMap()->contains(lowerCaseResource)) {
 
61
        return nullptr;
 
62
    }
 
63
 
 
64
    const ResourceType resourceType = ubuntuResourceMap()->value(lowerCaseResource);
 
65
 
 
66
    if (resourceType == UbuntuNativeInterface::MirConnection) {
 
67
        return mMirConnection;
 
68
    } else {
 
69
        return nullptr;
 
70
    }
 
71
}
 
72
 
54
73
void* UbuntuNativeInterface::nativeResourceForContext(
55
74
    const QByteArray& resourceString, QOpenGLContext* context)
56
75
{