-
Notifications
You must be signed in to change notification settings - Fork 11
/
eglauncher.h
70 lines (57 loc) · 1.87 KB
/
eglauncher.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright © 2018-2019 Octopull Limited.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Alan Griffiths <[email protected]>
*/
#ifndef EGMDE_LAUNCHER_H
#define EGMDE_LAUNCHER_H
#include <miral/application.h>
#include <miral/external_client.h>
#include <memory>
#include <mutex>
struct wl_display;
namespace egmde
{
class Launcher
{
public:
Launcher(miral::ExternalClientLauncher& external_client_launcher, std::string terminal_cmd);
// These operators are the protocol for an "Internal Client"
void operator()(wl_display* display);
void operator()(std::weak_ptr<mir::scene::Session> const& session)
{
std::lock_guard<decltype(mutex)> lock{mutex};
weak_session = session;
}
void show();
void stop();
enum class Mode { wayland, x11, wayland_debug, x11_debug};
auto run_app(std::string app, Mode mode) const -> pid_t;
auto session() const -> std::shared_ptr<mir::scene::Session>
{
std::lock_guard<decltype(mutex)> lock{mutex};
return weak_session.lock();
}
void autostart_apps() const;
private:
miral::ExternalClientLauncher& external_client_launcher;
std::mutex mutable mutex;
std::weak_ptr<mir::scene::Session> weak_session;
std::string const terminal_cmd;
struct Self;
std::weak_ptr<Self> self;
};
}
#endif //EGMDE_LAUNCHER_H