~ubuntu-branches/ubuntu/wily/kwin/wily-proposed

« back to all changes in this revision

Viewing changes to backends/hwcomposer/hwcomposer_backend.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-08-10 23:16:37 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20150810231637-5zb2tstjkez93hml
Tags: 4:5.3.95-0ubuntu1
new upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 KWin - the KDE window manager
 
3
 This file is part of the KDE project.
 
4
 
 
5
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
 
6
 
 
7
This program is free software; you can redistribute it and/or modify
 
8
it under the terms of the GNU General Public License as published by
 
9
the Free Software Foundation; either version 3 of the License, or
 
10
(at your option) any later version.
 
11
 
 
12
This program is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*********************************************************************/
 
20
#ifndef KWIN_HWCOMPOSER_BACKEND_H
 
21
#define KWIN_HWCOMPOSER_BACKEND_H
 
22
#include "abstract_backend.h"
 
23
 
 
24
// libhybris
 
25
#include <hwcomposer_window.h>
 
26
// needed as hwcomposer_window.h includes EGL which on non-arm includes Xlib
 
27
#include <fixx11h.h>
 
28
 
 
29
typedef struct hwc_display_contents_1 hwc_display_contents_1_t;
 
30
typedef struct hwc_layer_1 hwc_layer_1_t;
 
31
typedef struct hwc_composer_device_1 hwc_composer_device_1_t;
 
32
struct Event;
 
33
struct AndroidEventListener;
 
34
 
 
35
namespace KWin
 
36
{
 
37
 
 
38
class HwcomposerWindow;
 
39
 
 
40
class HwcomposerBackend : public AbstractBackend
 
41
{
 
42
    Q_OBJECT
 
43
    Q_INTERFACES(KWin::AbstractBackend)
 
44
    Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "hwcomposer.json")
 
45
public:
 
46
    explicit HwcomposerBackend(QObject *parent = nullptr);
 
47
    virtual ~HwcomposerBackend();
 
48
 
 
49
    void init() override;
 
50
    Screens *createScreens(QObject *parent = nullptr) override;
 
51
    OpenGLBackend *createOpenGLBackend() override;
 
52
 
 
53
    HwcomposerWindow *createSurface();
 
54
 
 
55
    QSize size() const {
 
56
        return m_displaySize;
 
57
    }
 
58
 
 
59
    hwc_composer_device_1_t *device() const {
 
60
        return m_device;
 
61
    }
 
62
    int refreshRate() const {
 
63
        return m_refreshRate;
 
64
    }
 
65
 
 
66
private Q_SLOTS:
 
67
    void toggleBlankOutput();
 
68
 
 
69
private:
 
70
    static void inputEvent(Event *event, void *context);
 
71
    void initInput();
 
72
    QSize m_displaySize;
 
73
    hwc_composer_device_1_t *m_device = nullptr;
 
74
    AndroidEventListener *m_inputListener = nullptr;
 
75
    bool m_outputBlank = true;
 
76
    int m_refreshRate = 60000;
 
77
};
 
78
 
 
79
class HwcomposerWindow : public HWComposerNativeWindow
 
80
{
 
81
public:
 
82
    virtual ~HwcomposerWindow();
 
83
 
 
84
    void present();
 
85
 
 
86
private:
 
87
    friend HwcomposerBackend;
 
88
    HwcomposerWindow(HwcomposerBackend *backend);
 
89
    HwcomposerBackend *m_backend;
 
90
    hwc_display_contents_1_t **m_list;
 
91
};
 
92
 
 
93
}
 
94
 
 
95
#endif