~nick-dedekind/qtubuntu/occlusion-2.0

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/integration.h

  • Committer: CI Train Bot
  • Author(s): daniel.dandrada at canonical, Daniel d'Andrada, Nick Dedekind, Gerry Boland, Michał Sawicz
  • Date: 2016-04-28 15:36:07 UTC
  • mfrom: (304.2.42 screen-info-without-dpr)
  • Revision ID: ci-train-bot@canonical.com-20160428153607-oovixgesc0ogfeoi
Proper support for multiple screens and dynamic scaling support Fixes: #1534682, #1573532
Approved by: Nick Dedekind, Unity8 CI Bot, Daniel d'Andrada, Gerry Boland

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2014 Canonical, Ltd.
 
2
 * Copyright (C) 2014,2016 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
21
21
#include <QSharedPointer>
22
22
 
23
23
#include "platformservices.h"
 
24
#include "screenobserver.h"
24
25
 
25
26
// platform-api
26
27
#include <ubuntu/application/description.h>
27
28
#include <ubuntu/application/instance.h>
28
29
 
 
30
#include <EGL/egl.h>
 
31
 
29
32
class UbuntuClipboard;
30
33
class UbuntuInput;
31
34
class UbuntuNativeInterface;
32
35
class UbuntuScreen;
33
 
 
34
 
class UbuntuClientIntegration : public QPlatformIntegration {
 
36
class MirConnection;
 
37
 
 
38
class UbuntuClientIntegration : public QObject, public QPlatformIntegration
 
39
{
 
40
    Q_OBJECT
 
41
 
35
42
public:
36
43
    UbuntuClientIntegration();
37
44
    virtual ~UbuntuClientIntegration();
50
57
    QPlatformWindow* createPlatformWindow(QWindow* window) const override;
51
58
    QPlatformInputContext* inputContext() const override { return mInputContext; }
52
59
    QPlatformClipboard* clipboard() const override;
 
60
    void initialize() override;
 
61
    QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
53
62
 
 
63
    // non-const versions of some QPlatformIntegration methods
54
64
    QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context);
55
65
    QPlatformWindow* createPlatformWindow(QWindow* window);
56
 
    UbuntuScreen* screen() const { return mScreen; }
57
 
 
58
 
    QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
 
66
 
 
67
    // New methods.
 
68
    MirConnection *mirConnection() const { return mMirConnection; }
 
69
    QSurfaceFormat surfaceFormat() const { return mSurfaceFormat; }
 
70
    EGLDisplay eglDisplay() const { return mEglDisplay; }
 
71
    EGLConfig eglConfig() const { return mEglConfig; }
 
72
    EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; }
 
73
    UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); }
 
74
 
 
75
private Q_SLOTS:
 
76
    void destroyScreen(UbuntuScreen *screen);
59
77
 
60
78
private:
61
79
    void setupOptions();
66
84
 
67
85
    UbuntuPlatformServices* mServices;
68
86
 
69
 
    UbuntuScreen* mScreen;
70
87
    UbuntuInput* mInput;
71
88
    QPlatformInputContext* mInputContext;
72
89
    QSharedPointer<UbuntuClipboard> mClipboard;
 
90
    QScopedPointer<UbuntuScreenObserver> mScreenObserver;
73
91
    qreal mScaleFactor;
74
92
 
 
93
    MirConnection *mMirConnection;
 
94
 
75
95
    // Platform API stuff
76
96
    UApplicationOptions* mOptions;
77
97
    UApplicationDescription* mDesc;
78
98
    UApplicationInstance* mInstance;
 
99
 
 
100
    // EGL related
 
101
    EGLDisplay mEglDisplay{EGL_NO_DISPLAY};
 
102
    EGLConfig mEglConfig{nullptr};
 
103
    EGLNativeDisplayType mEglNativeDisplay;
 
104
    QSurfaceFormat mSurfaceFormat;
79
105
};
80
106
 
81
107
#endif // UBUNTU_CLIENT_INTEGRATION_H