Navigation Menu

Skip to content

Commit

Permalink
Add a request to lipstick_recorder to trigger a repaint
Browse files Browse the repository at this point in the history
  • Loading branch information
giucam committed Dec 16, 2014
1 parent 8894c56 commit 8419b75
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
13 changes: 13 additions & 0 deletions protocol/lipstick-recorder.xml
Expand Up @@ -57,6 +57,19 @@
<arg name="buffer" type="object" interface="wl_buffer"/>
</request>

<request name="repaint">
<description summary="request the compositor to repaint asap">
Calling record_frame will not cause the compositor to
repaint, but it will wait instead for the first frame
the compositor draws due to some other external event
or internal change.
Calling this request after calling record_frame will
ask the compositor to redraw as soon at possible even
if it wouldn't otherwise.
If no frame was requested this request has no effect.
</description>
</request>

<enum name="result">
<entry name="bad_buffer" value="2"/>
</enum>
Expand Down
10 changes: 9 additions & 1 deletion src/compositor/lipstickrecorder.cpp
Expand Up @@ -116,7 +116,7 @@ void LipstickRecorderManager::lipstick_recorder_manager_create_recorder(Resource
}


LipstickRecorder::LipstickRecorder(LipstickRecorderManager *manager, wl_client *client, quint32 id, QWindow *window)
LipstickRecorder::LipstickRecorder(LipstickRecorderManager *manager, wl_client *client, quint32 id, QQuickWindow *window)
: QtWaylandServer::lipstick_recorder(client, id, 1)
, m_manager(manager)
, m_bufferResource(Q_NULLPTR)
Expand Down Expand Up @@ -157,6 +157,14 @@ void LipstickRecorder::lipstick_recorder_record_frame(Resource *resource, ::wl_r
}
}

void LipstickRecorder::lipstick_recorder_repaint(Resource *resource)
{
Q_UNUSED(resource)
if (m_bufferResource) {
m_window->update();
}
}

bool LipstickRecorder::event(QEvent *e)
{
if (e->type() == FrameEventType) {
Expand Down
6 changes: 4 additions & 2 deletions src/compositor/lipstickrecorder.h
Expand Up @@ -27,6 +27,7 @@ struct wl_shm_buffer;
struct wl_client;

class QWindow;
class QQuickWindow;
class QEvent;
class LipstickRecorder;

Expand All @@ -53,7 +54,7 @@ class LipstickRecorderManager : public QWaylandGlobalInterface, public QtWayland
class LipstickRecorder : public QObject, public QtWaylandServer::lipstick_recorder
{
public:
LipstickRecorder(LipstickRecorderManager *manager, wl_client *client, quint32 id, QWindow *window);
LipstickRecorder(LipstickRecorderManager *manager, wl_client *client, quint32 id, QQuickWindow *window);
~LipstickRecorder();

wl_shm_buffer *buffer() const { return m_buffer; }
Expand All @@ -64,13 +65,14 @@ class LipstickRecorder : public QObject, public QtWaylandServer::lipstick_record
void lipstick_recorder_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
void lipstick_recorder_destroy(Resource *resource) Q_DECL_OVERRIDE;
void lipstick_recorder_record_frame(Resource *resource, ::wl_resource *buffer) Q_DECL_OVERRIDE;
void lipstick_recorder_repaint(Resource *resource) Q_DECL_OVERRIDE;

private:
LipstickRecorderManager *m_manager;
wl_resource *m_bufferResource;
wl_shm_buffer *m_buffer;
wl_client *m_client;
QWindow *m_window;
QQuickWindow *m_window;
};

#endif

0 comments on commit 8419b75

Please sign in to comment.