Mir

Merge lp:~raof/mir/add-mirclientcpp-event into lp:mir

Proposed by Chris Halse Rogers
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 4267
Proposed branch: lp:~raof/mir/add-mirclientcpp-event
Merge into: lp:mir
Diff against target: 70 lines (+55/-0)
2 files modified
include/client/mir/client/event.h (+54/-0)
src/client/CMakeLists.txt (+1/-0)
To merge this branch: bzr merge lp:~raof/mir/add-mirclientcpp-event
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+331278@code.launchpad.net

Commit message

Add a smart-pointer-ish wrapper for MirEvent to mirclientcpp.

Useful for the obvious reasons.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4265
https://mir-jenkins.ubuntu.com/job/mir-ci/3684/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/5051/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5287
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5275
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/5095/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/5095/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/5095/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/5095/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/5095/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/5095/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/5095/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5095
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/5095/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3684/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'include/client/mir/client/event.h'
2--- include/client/mir/client/event.h 1970-01-01 00:00:00 +0000
3+++ include/client/mir/client/event.h 2017-09-25 18:10:00 +0000
4@@ -0,0 +1,54 @@
5+/*
6+ * Copyright © 2017 Canonical Ltd.
7+ *
8+ * This program is free software: you can redistribute it and/or modify
9+ * it under the terms of the GNU Lesser General Public License version 2 or 3 as
10+ * published by the Free Software Foundation.
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+ * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
21+ */
22+
23+#ifndef MIR_CLIENT_EVENT_H_
24+#define MIR_CLIENT_EVENT_H_
25+
26+#include "mir_toolkit/events/event.h"
27+
28+#include <memory>
29+
30+namespace mir
31+{
32+namespace client
33+{
34+/// Handle class for MirEvent - provides automatic reference counting.
35+class Event
36+{
37+public:
38+ Event() = default;
39+ explicit Event(MirEvent const* event) : self{mir_event_ref(event), deleter}
40+ {
41+ }
42+
43+ operator MirEvent const*() const { return self.get(); }
44+
45+ void reset() { self.reset(); }
46+
47+private:
48+ static void deleter(MirEvent const* event) { mir_event_unref(event); }
49+ std::shared_ptr<MirEvent const> self;
50+};
51+
52+// Provide a deleted overload to avoid double release "accidents".
53+void mir_event_unref(Event const& event) = delete;
54+}
55+}
56+
57+#endif //MIR_CLIENT_EVENT_H_
58+
59
60=== modified file 'src/client/CMakeLists.txt'
61--- src/client/CMakeLists.txt 2017-08-29 14:23:50 +0000
62+++ src/client/CMakeLists.txt 2017-09-25 18:10:00 +0000
63@@ -118,6 +118,7 @@
64 ${CMAKE_SOURCE_DIR}/include/client/mir/client/connection.h
65 ${CMAKE_SOURCE_DIR}/include/client/mir/client/display_config.h
66 ${CMAKE_SOURCE_DIR}/include/client/mir/client/window.h
67+ ${CMAKE_SOURCE_DIR}/include/client/mir/client/event.h
68 )
69
70 # Ensure protobuf C++ headers have been produced before

Subscribers

People subscribed via source and target branches