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
Handle class for MirWindowId - provides automatic reference counting.
Definition: window_id.h:33
WindowId(MirWindow *window)
Definition: window_id.h:37
auto c_str() const -> char const *
Definition: window_id.h:39
WindowId(MirWindowId *id)
Definition: window_id.h:35
char const * mir_window_id_as_string(MirWindowId *id)
Get a string representation of a MirSurfaceId.
struct MirPersistentId MirWindowId
Definition: client_types.h:48
struct MirSurface MirWindow
Definition: client_types.h:42
MirWindowId * mir_window_request_window_id_sync(MirWindow *window)
Request a persistent ID for a window and wait for the result.
void mir_window_id_release(MirWindowId *id)
Free a MirWindowId.
Definition: splash_session.h:24

Copyright © 2012-2021 Canonical Ltd.
Generated on Sat Aug 7 00:05:17 UTC 2021
This documentation is licensed under the GPL version 2 or 3.