~nemo-mobile-team/nemo-mobile/lipstick

« back to all changes in this revision

Viewing changes to src/compositor/lipstickrecorder.h

  • Committer: David Greaves
  • Author(s): David Greaves
  • Date: 2015-10-19 20:20:12 UTC
  • Revision ID: git-v1:3c17eedd5fcde9880c844fd860bc7ca8cfd7587e
Migration to git.merproject.org

Signed-off-by: David Greaves <david.greaves@jolla.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
**
3
 
** Copyright (C) 2014 Jolla Ltd.
4
 
** Contact: Giulio Camuffo <giulio.camuffo@jollamobile.com>
5
 
**
6
 
** This file is part of lipstick.
7
 
**
8
 
** This library is free software; you can redistribute it and/or
9
 
** modify it under the terms of the GNU Lesser General Public
10
 
** License version 2.1 as published by the Free Software Foundation
11
 
** and appearing in the file LICENSE.LGPL included in the packaging
12
 
** of this file.
13
 
**
14
 
****************************************************************************/
15
 
 
16
 
#ifndef LIPSTICKCOMPOSITORRECORDER_H
17
 
#define LIPSTICKCOMPOSITORRECORDER_H
18
 
 
19
 
#include <QObject>
20
 
#include <QMultiHash>
21
 
#include <QMutex>
22
 
#include <QWaylandGlobalInterface>
23
 
 
24
 
#include "qwayland-server-lipstick-recorder.h"
25
 
 
26
 
struct wl_shm_buffer;
27
 
struct wl_client;
28
 
 
29
 
class QWindow;
30
 
class QQuickWindow;
31
 
class QEvent;
32
 
class LipstickRecorder;
33
 
 
34
 
class LipstickRecorderManager : public QWaylandGlobalInterface, public QtWaylandServer::lipstick_recorder_manager
35
 
{
36
 
public:
37
 
    LipstickRecorderManager();
38
 
 
39
 
    const wl_interface* interface() const Q_DECL_OVERRIDE;
40
 
 
41
 
    void recordFrame(QWindow *window);
42
 
    void requestFrame(QWindow *window, LipstickRecorder *recorder);
43
 
    void remove(QWindow *window, LipstickRecorder *recorder);
44
 
 
45
 
protected:
46
 
    void bind(wl_client *client, quint32 version, quint32 id) Q_DECL_OVERRIDE;
47
 
    void lipstick_recorder_manager_create_recorder(Resource *resource, uint32_t id, ::wl_resource *output) Q_DECL_OVERRIDE;
48
 
 
49
 
private:
50
 
    QMultiHash<QWindow *, LipstickRecorder *> m_requests;
51
 
    QMutex m_mutex;
52
 
};
53
 
 
54
 
class LipstickRecorder : public QObject, public QtWaylandServer::lipstick_recorder
55
 
{
56
 
public:
57
 
    LipstickRecorder(LipstickRecorderManager *manager, wl_client *client, quint32 id, QQuickWindow *window);
58
 
    ~LipstickRecorder();
59
 
 
60
 
    wl_shm_buffer *buffer() const { return m_buffer; }
61
 
    wl_client *client() const { return m_client; }
62
 
 
63
 
protected:
64
 
    bool event(QEvent *e) Q_DECL_OVERRIDE;
65
 
    void lipstick_recorder_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
66
 
    void lipstick_recorder_destroy(Resource *resource) Q_DECL_OVERRIDE;
67
 
    void lipstick_recorder_record_frame(Resource *resource, ::wl_resource *buffer) Q_DECL_OVERRIDE;
68
 
    void lipstick_recorder_repaint(Resource *resource) Q_DECL_OVERRIDE;
69
 
 
70
 
private:
71
 
    LipstickRecorderManager *m_manager;
72
 
    wl_resource *m_bufferResource;
73
 
    wl_shm_buffer *m_buffer;
74
 
    wl_client *m_client;
75
 
    QQuickWindow *m_window;
76
 
};
77
 
 
78
 
#endif