blob: 7266a9b0cd73dadd2354f6b05621c5bbf49803ea (
plain)
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
|
#pragma once
#include <array>
#include <hyprutils/os/FileDescriptor.hpp>
#include "../helpers/signal/Signal.hpp"
struct wl_event_source;
struct wl_client;
// TODO: add lazy mode
class CXWaylandServer {
public:
CXWaylandServer();
~CXWaylandServer();
// create the server.
bool create();
// starts the server, meant to be called by CXWaylandServer.
bool start();
// called on ready
int ready(int fd, uint32_t mask);
void die();
wl_client* m_xwaylandClient = nullptr;
private:
bool tryOpenSockets();
void runXWayland(Hyprutils::OS::CFileDescriptor& notifyFD);
std::string m_displayName;
int m_display = -1;
std::array<Hyprutils::OS::CFileDescriptor, 2> m_xFDs;
std::array<wl_event_source*, 2> m_xFDReadEvents = {nullptr, nullptr};
wl_event_source* m_idleSource = nullptr;
wl_event_source* m_pipeSource = nullptr;
Hyprutils::OS::CFileDescriptor m_pipeFd;
std::array<Hyprutils::OS::CFileDescriptor, 2> m_xwmFDs;
std::array<Hyprutils::OS::CFileDescriptor, 2> m_waylandFDs;
friend class CXWM;
};
|