blob: ccbcf6ea1749fe8ad9cbdb86ff1bde2628c6e6fa (
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
45
46
47
48
49
50
|
#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(Hyprutils::OS::CFileDescriptor fd, uint32_t mask);
void die();
struct {
CSignal ready;
} events;
wl_client* xwaylandClient = nullptr;
private:
bool tryOpenSockets();
void runXWayland(Hyprutils::OS::CFileDescriptor& notifyFD);
pid_t serverPID = 0;
std::string displayName;
int display = -1;
std::array<Hyprutils::OS::CFileDescriptor, 2> xFDs;
std::array<wl_event_source*, 2> xFDReadEvents = {nullptr, nullptr};
wl_event_source* idleSource = nullptr;
wl_event_source* pipeSource = nullptr;
Hyprutils::OS::CFileDescriptor pipeFd;
std::array<Hyprutils::OS::CFileDescriptor, 2> xwmFDs;
std::array<Hyprutils::OS::CFileDescriptor, 2> waylandFDs;
friend class CXWM;
};
|