Mir
window_id.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 2 or 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_CLIENT_WINDOW_ID_H
20 #define MIR_CLIENT_WINDOW_ID_H
21 
22 #include <mir_toolkit/mir_window.h>
24 
25 #include <memory>
26 
27 namespace mir
28 {
29 namespace client
30 {
32 class WindowId
33 {
34 public:
35  explicit WindowId(MirWindowId* id) : self{id, deleter} {}
36 
38 
39  auto c_str() const -> char const* { return mir_window_id_as_string(self.get()); }
40 
41 private:
42  static void deleter(MirWindowId* id) { mir_window_id_release(id); }
43  std::shared_ptr<MirWindowId> self;
44 };
45 }
46 }
47 
48 #endif //MIR_CLIENT_WINDOW_ID_H
Definition: splash_session.h:24
struct MirSurface MirWindow
Definition: client_types.h:43
Handle class for MirWindowId - provides automatic reference counting.
Definition: window_id.h:32
struct MirPersistentId MirWindowId
Definition: client_types.h:51
auto c_str() const -> char const *
Definition: window_id.h:39
WindowId(MirWindow *window)
Definition: window_id.h:37
void mir_window_id_release(MirWindowId *id)
Free a MirWindowId.
MirWindowId * mir_window_request_window_id_sync(MirWindow *window)
WindowId(MirWindowId *id)
Definition: window_id.h:35
char const * mir_window_id_as_string(MirWindowId *id)
Get a string representation of a MirSurfaceId.

Copyright © 2012-2018 Canonical Ltd.
Generated on Sat Sep 1 14:12:02 UTC 2018