Linux + iPhone Continuity / iMessage / SMS
initial commit
Zack Barteld9eb484d529c
diff --git a/.gitignore b/.gitignorenew file mode 100644index 0000000..d606522--- /dev/null+++ b/.gitignore@@ -0,0 +1,8 @@+build+.cache+compile_commands.json+**/*.o+_CPack_Packages+*.deb+*.rpm+*.tar.gzdiff --git a/CMakeLists.txt b/CMakeLists.txtnew file mode 100644index 0000000..20e0da2--- /dev/null+++ b/CMakeLists.txt@@ -0,0 +1,20 @@+cmake_minimum_required(VERSION 3.19)+project(tether CXX C)++set(CMAKE_CXX_STANDARD 20)+set(CMAKE_CXX_STANDARD_REQUIRED ON)++find_package(PkgConfig REQUIRED)+pkg_check_modules(WAYLAND REQUIRED IMPORTED_TARGET wayland-client)++include(FetchContent)++FetchContent_Declare(+ json+ GIT_REPOSITORY https://github.com/nlohmann/json.git+ GIT_TAG v3.11.3+)+FetchContent_MakeAvailable(json)++# We will use subdirectories for the targets+add_subdirectory(src)diff --git a/CMakePresets.json b/CMakePresets.jsonnew file mode 100644index 0000000..1b9431f--- /dev/null+++ b/CMakePresets.json@@ -0,0 +1,41 @@+{+ "version": 3,+ "cmakeMinimumRequired": {+ "major": 3,+ "minor": 19+ },+ "configurePresets": [+ {+ "name": "debug",+ "displayName": "Debug Build (Ninja)",+ "description": "Ninja Debug build inside build/debug",+ "generator": "Ninja",+ "binaryDir": "${sourceDir}/build/debug",+ "cacheVariables": {+ "CMAKE_BUILD_TYPE": "Debug",+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"+ }+ },+ {+ "name": "release",+ "displayName": "Release Build (Ninja)",+ "description": "Ninja Release build inside build/release",+ "generator": "Ninja",+ "binaryDir": "${sourceDir}/build/release",+ "cacheVariables": {+ "CMAKE_BUILD_TYPE": "Release",+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"+ }+ }+ ],+ "buildPresets": [+ {+ "name": "debug",+ "configurePreset": "debug"+ },+ {+ "name": "release",+ "configurePreset": "release"+ }+ ]+}diff --git a/DESIGN.md b/DESIGN.mdnew file mode 100644index 0000000..316a4d4--- /dev/null+++ b/DESIGN.md@@ -0,0 +1,172 @@+# Tether++**Cross-Device Companion Integration for iPhone + Linux**+*Design Document · Draft 0.1*++---++## 1. Overview++Tether is an open-source companion device integration tool for iPhone and Linux, targeting Wayland compositors — initially Hyprland, but designed to run on any Wayland desktop. It is the missing equivalent of Apple's Continuity and AirDrop for people who have left the Apple ecosystem on the desktop but retained an iPhone.++The name captures the relationship well: a tether connects two things without merging them. It works as a verb ("tether your phone"), reads cleanly as a CLI tool (`tetherd`), and is not tied to any specific desktop environment.++**Scope of v1.0:**++- Shared clipboard between iPhone and Linux desktop+- TOTP/OTP vault with autofill in the browser via extension+- File transfer over local network+- Email OTP code detection and forwarding to browser++---++## 2. Problem Statement++macOS users enjoy a tightly integrated device ecosystem: Universal Clipboard syncs seamlessly between Mac and iPhone, SMS and email OTP codes appear automatically above the keyboard and autofill in Safari, and AirDrop makes file transfer invisible. None of this survives a migration to Linux.++The closest existing solution is KDE Connect, which runs on Hyprland but has persistent theming issues with qt6ct — specifically its QtQuick/QML interface bypasses the platform theme and queries KColorScheme directly. GSConnect, the GNOME Shell equivalent, is tied to the GNOME Shell process and does not run on Hyprland. Neither solution adequately addresses TOTP autofill or email OTP forwarding to the browser.++Apple's iOS SDK also severely limits what third-party apps can do. SMS inbox access is a private entitlement not granted to third-party developers. Background execution is constrained by `BGTaskScheduler`, which provides only periodic wake windows rather than real-time sync. Clipboard access via `UIPasteboard` works, but since iOS 14 every read triggers a user-visible banner. These constraints shape what Tether can and cannot promise on the iOS side.++---++## 3. Architecture++Tether has three components that communicate over an encrypted local network channel with an optional relay for out-of-network use.++| Component | Technology | Responsibility |+|---|---|---|+| `tetherd` | Rust or Go daemon | Linux-side coordinator; Wayland clipboard, file sync endpoint, local HTTP/Unix socket API |+| Browser Extension | WebExtension (FF + Chrome) | TOTP autofill, OTP detection, native messaging host bridge to tetherd |+| iPhone App | Swift / SwiftUI | Clipboard sync, TOTP vault, file sharing, `ASCredentialProviderExtension` |++All three components communicate via an encrypted local network channel. The daemon advertises itself via mDNS/Bonjour so the iPhone app can discover it without manual IP configuration. An optional relay server (self-hostable) allows sync when devices are on different networks.++```+iPhone App (Swift)+ ├── UIPasteboard sync →──────────────────────────────┐+ ├── TOTP vault + ASCredentialProviderExtension │+ └── File sharing (Bonjour/mDNS + TCP) │+ ↕ E2E encrypted · local network / relay │+tetherd (Linux daemon) │+ ├── Wayland clipboard (wl-clipboard / compositor IPC) ┘+ ├── File sync endpoint+ ├── TOTP vault sync+ └── Unix socket / local HTTP API+ ↕ native messaging+Browser Extension (WebExtension)+ ├── Native messaging host → tetherd+ ├── TOTP autofill+ └── Email OTP detection → clipboard → autofill+```++---++## 4. Components++### 4.1 tetherd — Linux Daemon++The daemon is the hub. It runs as a user-space process, started via `exec-once` in Hyprland config or a systemd user unit, and exposes a Unix socket for local IPC and a TCP endpoint for the iPhone app.++#### Wayland Clipboard++Wayland intentionally restricts clipboard access to the focused window. The daemon works around this by running with compositor-level privileges or by using Hyprland's IPC socket directly. On other compositors, it falls back to `wl-clipboard` (`wl-copy` / `wl-paste`) polled on a short interval.++- Watches clipboard for changes and pushes to iPhone app+- Receives clipboard content from iPhone app and writes via `wl-copy`+- Exposes clipboard state to browser extension via Unix socket++#### File Sync++- Serves a simple authenticated HTTP endpoint for file push/pull+- mDNS advertisement so iPhone app discovers it automatically+- Configurable receive directory++#### TOTP Vault++- Stores encrypted TOTP secrets, synced from iPhone app+- Generates current codes on request from browser extension+- Never stores secrets in plaintext; vault key derived from user passphrase++---++### 4.2 Browser Extension++A standard WebExtension compatible with Firefox and Chromium-based browsers. Communicates with `tetherd` via a native messaging host — a small binary installed alongside tetherd that the browser can launch and talk to over stdin/stdout.++#### TOTP Autofill++- Detects OTP input fields on page load+- Requests current TOTP code from tetherd via native messaging host+- Injects code into field; user can also trigger via keyboard shortcut or extension popup++#### Email OTP Detection++Rather than requiring a specific email client, the extension monitors the active tab if it is a webmail client, or listens for signals from the email client daemon integration.++- **Terminal clients (aerc, neomutt):** a filter/hook script detects OTP patterns in incoming mail and writes the code to a named pipe or tetherd's socket+- **Webmail:** extension content script scans new email notifications for OTP patterns+- Detected code is surfaced as an autofill suggestion on the matching domain++> ⚠ SMS-based OTP forwarding from iPhone is not possible. Apple's SMS inbox is inaccessible to third-party apps — this is a hard platform restriction, not a missing feature.++---++### 4.3 iPhone App++A native SwiftUI app targeting iOS 16+. Apple's sandbox and background execution restrictions shape what is possible, but the core features are achievable.++#### Clipboard Sync++The app reads from `UIPasteboard` and sends to tetherd when foregrounded. Since iOS 14 every clipboard read triggers a user-visible "Tether pasted from [app]" banner — this is unavoidable. Background sync uses `BGTaskScheduler` for periodic wake windows (roughly every 15 minutes), so clipboard sync is not real-time when backgrounded. Foregrounded sync is instant.++#### TOTP Vault + ASCredentialProviderExtension++This is the most valuable feature on the iOS side. iOS 18 introduced a public credential provider API (`ASCredentialProviderExtension`) that allows third-party apps to surface TOTP codes in the system autofill menu — the same one that appears above the keyboard when a code field is focused. Tether implements this extension to provide:++- One-tap OTP autofill in Safari and other iOS browsers+- Sync of TOTP secrets with tetherd so the same vault is available on both devices+- No dependency on iCloud or any Apple account for vault storage++The vault is encrypted with a user passphrase. Sync between the iPhone app and tetherd uses the same E2E encrypted channel as clipboard sync.++> ⚠ This is distinct from SMS OTP autofill. Tether's TOTP vault handles authenticator-app-style codes (TOTP). SMS codes remain unforwardable from iPhone to Linux.++#### File Sharing++- Discovers tetherd via mDNS/Bonjour on the local network+- Share sheet integration: share any file to Tether from any app+- Browse and pull files from the Linux machine++---++## 5. Explicit Non-Goals (v1.0)++- **SMS forwarding from iPhone** — not possible without private Apple entitlements+- **Notification mirroring from iPhone** — iOS 14+ blocks third-party apps from reading other apps' notifications+- **Screen mirroring or remote control**+- **Android support** — out of scope; KDE Connect already covers this well+- **Cloud relay in the default build** — self-host only for v1.0++---++## 6. Naming & Packaging++| | |+|---|---|+| Name | Tether |+| Daemon binary | `tetherd` |+| CLI | `tether` |+| Config | `~/.config/tether/tether.toml` |+| Primary packaging | AUR (Arch), daemon works on any Wayland Linux |+| iOS distribution | App Store (required for `ASCredentialProviderExtension`) |++---++## 7. Open Questions++- **Daemon language:** Rust gives a better AUR packaging story and aligns with the Hyprland ecosystem; Go is simpler for the network/IPC layer. Decision pending.+- **Relay design:** whether to build a minimal relay server or recommend users run their own ClipCascade instance for cross-network sync.+- **Email OTP detection scope:** aerc hook integration is clean and well-defined; webmail content script scanning is messier. May ship aerc-only first.+- **Vault sync conflict resolution:** if codes are added on both devices while offline, last-write-wins is simplest but could lose data.+- **Name conflict check:** verify `tether` is clear in the AUR before committing.diff --git a/Makefile b/Makefilenew file mode 100644index 0000000..c3810f7--- /dev/null+++ b/Makefile@@ -0,0 +1,33 @@+default: debug++debug:+ cmake --preset debug+ cmake --build --preset debug+ ln -sf build/debug/compile_commands.json++release:+ cmake --preset release+ cmake --build --preset release+ ln -sf build/release/compile_commands.json++install: release+ cmake --install build/release++run-daemon: debug+ ./build/debug/tetherd++run-cli: debug+ ./build/debug/tether++run-gtk: debug+ ./build/debug/tether-gtk++.PHONY: fmt+fmt:+ @echo "Formatting code with clang-format..."+ @find ./src -name "*.cpp" -o -name "*.hpp" -print0 | xargs -0 -n 1 clang-format -i+ @echo "Done."++clean:+ rm -rf build+ rm -f compile_commands.jsondiff --git a/src/CMakeLists.txt b/src/CMakeLists.txtnew file mode 100644index 0000000..a32232e--- /dev/null+++ b/src/CMakeLists.txt@@ -0,0 +1,4 @@+add_subdirectory(core)+add_subdirectory(daemon)+add_subdirectory(cli)+add_subdirectory(gtk)diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txtnew file mode 100644index 0000000..6f08fbd--- /dev/null+++ b/src/cli/CMakeLists.txt@@ -0,0 +1,8 @@+add_executable(tether+ main.cpp+)++target_link_libraries(tether PRIVATE tether_core)++# Output into root build dir instead of nested build/src/cli+set_target_properties(tether PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")diff --git a/src/cli/main.cpp b/src/cli/main.cppnew file mode 100644index 0000000..064ccff--- /dev/null+++ b/src/cli/main.cpp@@ -0,0 +1,7 @@+#include <iostream>+#include <tether/core.hpp>++int main(int argc, char** argv) {+ std::cout << "tether cli version " << tether::get_version() << "\n";+ return 0;+}diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtnew file mode 100644index 0000000..2618538--- /dev/null+++ b/src/core/CMakeLists.txt@@ -0,0 +1,18 @@+add_library(tether_core STATIC+ src/core.cpp+ src/event_loop.cpp+ src/net.cpp+ src/clipboard.cpp+ src/wayland.cpp+ src/wayland_protocols/wayland.cpp+ src/wayland_protocols/wlr-data-control-unstable-v1.cpp+)++target_include_directories(tether_core PUBLIC+ include+)++target_link_libraries(tether_core PUBLIC+ nlohmann_json::nlohmann_json+ PkgConfig::WAYLAND+)diff --git a/src/core/include/tether/clipboard.hpp b/src/core/include/tether/clipboard.hppnew file mode 100644index 0000000..6739fc1--- /dev/null+++ b/src/core/include/tether/clipboard.hpp@@ -0,0 +1,34 @@+#pragma once++#include <string>+#include <functional>+#include <memory>++class CCZwlrDataControlManagerV1;+class CCWlSeat;+class CCZwlrDataControlDeviceV1;+class CCZwlrDataControlOfferV1;++namespace tether {++class ClipboardManager {+public:+ ClipboardManager(CCZwlrDataControlManagerV1* manager, CCWlSeat* seat);+ ~ClipboardManager();++ // Set callback to receive native Wayland clipboard updates+ void set_update_callback(std::function<void(const std::string&)> cb);++ // Push text from Tether network to native Wayland clipboard+ void copy(const std::string& text);++private:+ CCZwlrDataControlManagerV1* manager_;+ CCWlSeat* seat_;+ std::unique_ptr<CCZwlrDataControlDeviceV1> device_;++ std::function<void(const std::string&)> cb_;+ std::unique_ptr<CCZwlrDataControlOfferV1> current_offer_;+};++} // namespace tetherdiff --git a/src/core/include/tether/core.hpp b/src/core/include/tether/core.hppnew file mode 100644index 0000000..b20c87b--- /dev/null+++ b/src/core/include/tether/core.hpp@@ -0,0 +1,9 @@+#pragma once++#include <string>++namespace tether {++std::string get_version();++} // namespace tetherdiff --git a/src/core/include/tether/event_loop.hpp b/src/core/include/tether/event_loop.hppnew file mode 100644index 0000000..c9dad18--- /dev/null+++ b/src/core/include/tether/event_loop.hpp@@ -0,0 +1,37 @@+#pragma once++#include <functional>+#include <map>++namespace tether {++class EpollEventLoop {+public:+ EpollEventLoop();+ ~EpollEventLoop();++ // Disable copy/move+ EpollEventLoop(const EpollEventLoop&) = delete;+ EpollEventLoop& operator=(const EpollEventLoop&) = delete;++ using Callback = std::function<void(int fd)>;++ // Add a file descriptor to be watched for EPOLLIN+ bool addFd(int fd, Callback cb);++ // Remove a file descriptor from being watched+ bool removeFd(int fd);++ // Run the event loop (blocks forever until stopped)+ void run();++ // Signal the event loop to stop+ void stop();++private:+ int epoll_fd_;+ bool running_;+ std::map<int, Callback> callbacks_;+};++} // namespace tetherdiff --git a/src/core/include/tether/net.hpp b/src/core/include/tether/net.hppnew file mode 100644index 0000000..543b90c--- /dev/null+++ b/src/core/include/tether/net.hpp@@ -0,0 +1,55 @@+#pragma once++#include "tether/event_loop.hpp"+#include <string>++namespace tether {++// Check if tetherd is already running. Exits if another instance holds the lock.+void ensure_single_instance();+std::string get_runtime_dir();++class TcpServer;+class UnixServer;++// Simple registry for active clients to support broadcasting+void register_client_fd(int fd);+void unregister_client_fd(int fd);+void broadcast_message(const std::string& msg);++class UnixServer {+public:+ UnixServer(EpollEventLoop& loop);+ ~UnixServer();++ bool start();+ void stop();++private:+ void handle_accept(int fd);+ void handle_client(int client_fd);++ EpollEventLoop& loop_;+ int server_fd_ = -1;+ std::string socket_path_;+};++class TcpServer {+public:+ // bind_port = 0 binds to any available port+ TcpServer(EpollEventLoop& loop, int bind_port = 5134);+ ~TcpServer();++ bool start();+ void stop();++private:+ void handle_accept(int fd);+ void handle_client(int client_fd);++ EpollEventLoop& loop_;+ int server_fd_ = -1;+ int bind_port_;+};++} // namespace tetherdiff --git a/src/core/include/tether/wayland.hpp b/src/core/include/tether/wayland.hppnew file mode 100644index 0000000..bb9615f--- /dev/null+++ b/src/core/include/tether/wayland.hpp@@ -0,0 +1,39 @@+#pragma once++#include "tether/event_loop.hpp"+#include "tether/clipboard.hpp"+#include <memory>+#include <functional>+#include <string>++class CCWlDisplay;+class CCWlRegistry;+class CCWlSeat;+class CCZwlrDataControlManagerV1;+struct wl_display;++namespace tether {++class WaylandContext {+public:+ WaylandContext(EpollEventLoop& loop);+ ~WaylandContext();++ bool init();+ void set_clipboard_callback(std::function<void(const std::string&)> cb);+ void copy_to_clipboard(const std::string& text);++private:+ EpollEventLoop& loop_;+ wl_display* raw_display_ = nullptr;+ std::unique_ptr<CCWlDisplay> display_;+ std::unique_ptr<CCWlRegistry> registry_;++ std::unique_ptr<CCWlSeat> seat_;+ std::unique_ptr<CCZwlrDataControlManagerV1> data_control_manager_;+ std::unique_ptr<ClipboardManager> clipboard_;++ std::function<void(const std::string&)> clipboard_cb_;+};++} // namespace tetherdiff --git a/src/core/src/clipboard.cpp b/src/core/src/clipboard.cppnew file mode 100644index 0000000..0cc0485--- /dev/null+++ b/src/core/src/clipboard.cpp@@ -0,0 +1,91 @@+#include "tether/clipboard.hpp"+#include "wayland_protocols/wlr-data-control-unstable-v1.hpp"+#include "wayland_protocols/wayland.hpp"+#include <iostream>+#include <thread>+#include <unistd.h>+#include <fcntl.h>+#include <cstring>++namespace tether {++ClipboardManager::ClipboardManager(CCZwlrDataControlManagerV1* manager, CCWlSeat* seat)+ : manager_(manager), seat_(seat) {++ auto proxy = manager_->sendGetDataDevice((wl_proxy*)seat_->resource());+ device_ = std::make_unique<CCZwlrDataControlDeviceV1>(proxy);++ device_->setDataOffer([this](CCZwlrDataControlDeviceV1*, wl_proxy* offer_proxy) {+ // We received a new offer+ current_offer_ = std::make_unique<CCZwlrDataControlOfferV1>(offer_proxy);++ current_offer_->setOffer([](CCZwlrDataControlOfferV1* offer, const char* mime_type) {+ // we ignore the reported mime types for now and just blindly try text/plain+ });+ });++ device_->setSelection([this](CCZwlrDataControlDeviceV1*, wl_proxy* offer_proxy) {+ if (!offer_proxy) {+ return;+ }++ // The selection has changed. It's time to read it!+ int pipefs[2];+ if (pipe(pipefs) < 0) return;++ // Ask the offer to send the data into our pipe.+ current_offer_->sendReceive("text/plain", pipefs[1]);+ close(pipefs[1]); // Close our write end, wayland compositor has it now.++ // Read in a detached thread so we don't block the event loop+ std::thread([this, fd = pipefs[0]]() {+ std::string result;+ char buf[1024];+ while (true) {+ ssize_t n = read(fd, buf, sizeof(buf));+ if (n <= 0) break;+ result.append(buf, n);+ }+ close(fd);++ if (!result.empty() && cb_) {+ cb_(result);+ }+ }).detach();+ });+}++ClipboardManager::~ClipboardManager() {+ if (device_) {+ device_->sendDestroy();+ }+}++void ClipboardManager::set_update_callback(std::function<void(const std::string&)> cb) {+ cb_ = std::move(cb);+}++void ClipboardManager::copy(const std::string& text) {+ auto proxy = manager_->sendCreateDataSource();+ auto source = std::make_unique<CCZwlrDataControlSourceV1>(proxy);++ source->sendOffer("text/plain");+ source->sendOffer("UTF8_STRING");++ // Wayland uses detached thread approach nicely too for offering data+ std::string text_copy = text;+ source->setSend([text_copy](CCZwlrDataControlSourceV1* s, const char* mime_type, int32_t fd) {+ std::thread([text_copy, fd]() {+ write(fd, text_copy.c_str(), text_copy.size());+ close(fd);+ }).detach();+ });++ source->setCancelled([](CCZwlrDataControlSourceV1* s) {+ s->sendDestroy();+ });++ device_->sendSetSelection(source.release()); // Leak to compositor until cancelled+}++} // namespace tetherdiff --git a/src/core/src/core.cpp b/src/core/src/core.cppnew file mode 100644index 0000000..4b542fe--- /dev/null+++ b/src/core/src/core.cpp@@ -0,0 +1,9 @@+#include "tether/core.hpp"++namespace tether {++std::string get_version() {+ return "0.1.0";+}++} // namespace tetherdiff --git a/src/core/src/event_loop.cpp b/src/core/src/event_loop.cppnew file mode 100644index 0000000..ebb514e--- /dev/null+++ b/src/core/src/event_loop.cpp@@ -0,0 +1,72 @@+#include "tether/event_loop.hpp"+#include <sys/epoll.h>+#include <unistd.h>+#include <stdexcept>+#include <iostream>++namespace tether {++EpollEventLoop::EpollEventLoop() : running_(false) {+ epoll_fd_ = epoll_create1(0);+ if (epoll_fd_ < 0) {+ throw std::runtime_error("Failed to create epoll file descriptor");+ }+}++EpollEventLoop::~EpollEventLoop() {+ stop();+ if (epoll_fd_ >= 0) {+ close(epoll_fd_);+ }+}++bool EpollEventLoop::addFd(int fd, Callback cb) {+ struct epoll_event ev;+ ev.events = EPOLLIN;+ ev.data.fd = fd;++ if (epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, fd, &ev) < 0) {+ std::cerr << "Failed to add fd to epoll: " << fd << std::endl;+ return false;+ }+ callbacks_[fd] = std::move(cb);+ return true;+}++bool EpollEventLoop::removeFd(int fd) {+ if (epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, fd, nullptr) < 0) {+ return false;+ }+ callbacks_.erase(fd);+ return true;+}++void EpollEventLoop::run() {+ running_ = true;+ const int MAX_EVENTS = 10;+ struct epoll_event events[MAX_EVENTS];++ while (running_) {+ int n = epoll_wait(epoll_fd_, events, MAX_EVENTS, -1);+ if (n == -1) {+ if (errno == EINTR) continue;+ std::cerr << "epoll_wait failed" << std::endl;+ break;+ }++ for (int i = 0; i < n; ++i) {+ int fd = events[i].data.fd;+ auto it = callbacks_.find(fd);+ if (it != callbacks_.end()) {+ // Execute callback for readable fd+ it->second(fd);+ }+ }+ }+}++void EpollEventLoop::stop() {+ running_ = false;+}++} // namespace tetherdiff --git a/src/core/src/net.cpp b/src/core/src/net.cppnew file mode 100644index 0000000..a29d2be--- /dev/null+++ b/src/core/src/net.cpp@@ -0,0 +1,292 @@+#include "tether/net.hpp"++#include <sys/socket.h>+#include <sys/un.h>+#include <sys/file.h>+#include <sys/stat.h>+#include <arpa/inet.h>+#include <unistd.h>+#include <fcntl.h>+#include <errno.h>++#include <iostream>+#include <cstring>+#include <filesystem>+#include <set>+#include <nlohmann/json.hpp>+#include "tether/wayland.hpp"++namespace tether {++// Global list of active connected clients+static std::set<int> active_clients;++void register_client_fd(int fd) {+ active_clients.insert(fd);+}++void unregister_client_fd(int fd) {+ active_clients.erase(fd);+}++void broadcast_message(const std::string& msg) {+ std::string packet = msg;+ if (packet.back() != '\n') packet += '\n';++ for(int fd : active_clients) {+ write(fd, packet.c_str(), packet.size());+ }+}++std::string get_runtime_dir() {+ const char* xdg_runtime = std::getenv("XDG_RUNTIME_DIR");+ if (!xdg_runtime) {+ throw std::runtime_error("XDG_RUNTIME_DIR is not set");+ }+ std::filesystem::path tether_dir = std::filesystem::path(xdg_runtime) / "tether";+ if (!std::filesystem::exists(tether_dir)) {+ std::filesystem::create_directories(tether_dir);+ std::filesystem::permissions(tether_dir,+ std::filesystem::perms::owner_all,+ std::filesystem::perm_options::replace);+ }+ return tether_dir.string();+}++void ensure_single_instance() {+ std::string lock_file = get_runtime_dir() + "/tetherd.lock";+ int fd = open(lock_file.c_str(), O_RDWR | O_CREAT, 0600);+ if (fd < 0) {+ throw std::system_error(errno, std::system_category(), "Failed to open lock file");+ }++ if (flock(fd, LOCK_EX | LOCK_NB) < 0) {+ if (errno == EWOULDBLOCK) {+ std::cerr << "tetherd is already running." << std::endl;+ exit(1);+ } else {+ throw std::system_error(errno, std::system_category(), "Failed to lock file");+ }+ }+ // We intentionally leak the fd so the lock is held for the lifetime of the process.+ // lock is automatically released by OS on exit.+}+++// --- UnixServer ---++UnixServer::UnixServer(EpollEventLoop& loop) : loop_(loop) {+ socket_path_ = get_runtime_dir() + "/tetherd.sock";+}++UnixServer::~UnixServer() {+ stop();+}++bool UnixServer::start() {+ server_fd_ = socket(AF_UNIX, SOCK_STREAM, 0);+ if (server_fd_ < 0) {+ std::cerr << "Failed to create unix socket" << std::endl;+ return false;+ }++ // Set non-blocking+ int flags = fcntl(server_fd_, F_GETFL, 0);+ fcntl(server_fd_, F_SETFL, flags | O_NONBLOCK);++ unlink(socket_path_.c_str());++ sockaddr_un addr{};+ addr.sun_family = AF_UNIX;+ std::strncpy(addr.sun_path, socket_path_.c_str(), sizeof(addr.sun_path) - 1);++ if (bind(server_fd_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) < 0) {+ std::cerr << "Failed to bind unix socket: " << std::strerror(errno) << std::endl;+ return false;+ }++ if (listen(server_fd_, SOMAXCONN) < 0) {+ std::cerr << "Failed to listen on unix socket" << std::endl;+ return false;+ }++ loop_.addFd(server_fd_, [this](int fd) { handle_accept(fd); });+ std::cout << "UnixServer listening on " << socket_path_ << std::endl;+ return true;+}++void UnixServer::stop() {+ if (server_fd_ >= 0) {+ loop_.removeFd(server_fd_);+ close(server_fd_);+ server_fd_ = -1;+ unlink(socket_path_.c_str());+ }+}++void UnixServer::handle_accept(int fd) {+ int client_fd = accept(fd, nullptr, nullptr);+ if (client_fd < 0) {+ if (errno != EAGAIN && errno != EWOULDBLOCK) {+ std::cerr << "UnixServer accept error: " << std::strerror(errno) << std::endl;+ }+ return;+ }++ // Set non-blocking+ int flags = fcntl(client_fd, F_GETFL, 0);+ fcntl(client_fd, F_SETFL, flags | O_NONBLOCK);++ // Register client+ loop_.addFd(client_fd, [this](int cfd) { handle_client(cfd); });+ std::cout << "UnixServer: New connection (fd: " << client_fd << ")" << std::endl;+}++void UnixServer::handle_client(int client_fd) {+ char buf[1024];+ ssize_t n = read(client_fd, buf, sizeof(buf) - 1);+ if (n > 0) {+ buf[n] = '\0';+ std::string msg(buf);+ std::cout << "UnixServer received: " << msg << std::endl;++ // Try to parse json just to show we can+ try {+ nlohmann::json j = nlohmann::json::parse(msg);+ std::cout << " (Parsed JSON: " << j.dump() << ")" << std::endl;++ if (j.contains("command") && j["command"] == "clipboard_set" && j.contains("content")) {+ std::string content = j["content"];+ // Externally hooked up in main+ extern WaylandContext* g_wayland;+ if (g_wayland) {+ g_wayland->copy_to_clipboard(content);+ }+ }+ } catch (...) {+ // Ignore parse errors for raw text protocol+ }++ std::string response = "OK\n";+ write(client_fd, response.c_str(), response.size());+ } else if (n == 0 || (n < 0 && errno != EAGAIN && errno != EWOULDBLOCK)) {+ // Disconnected+ std::cout << "UnixServer: Client disconnected (fd: " << client_fd << ")" << std::endl;+ unregister_client_fd(client_fd);+ loop_.removeFd(client_fd);+ close(client_fd);+ }+}++// --- TcpServer ---++TcpServer::TcpServer(EpollEventLoop& loop, int bind_port)+ : loop_(loop), bind_port_(bind_port) {}++TcpServer::~TcpServer() {+ stop();+}++bool TcpServer::start() {+ server_fd_ = socket(AF_INET, SOCK_STREAM, 0);+ if (server_fd_ < 0) {+ std::cerr << "Failed to create tcp socket" << std::endl;+ return false;+ }++ int opt = 1;+ if (setsockopt(server_fd_, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)) < 0) {+ std::cerr << "TcpServer setsockopt reuse failed" << std::endl;+ }++ // Set non-blocking+ int flags = fcntl(server_fd_, F_GETFL, 0);+ fcntl(server_fd_, F_SETFL, flags | O_NONBLOCK);++ sockaddr_in addr{};+ addr.sin_family = AF_INET;+ addr.sin_addr.s_addr = INADDR_ANY;+ addr.sin_port = htons(bind_port_);++ if (bind(server_fd_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) < 0) {+ std::cerr << "Failed to bind tcp socket on port " << bind_port_ << ": " << std::strerror(errno) << std::endl;+ return false;+ }++ if (listen(server_fd_, SOMAXCONN) < 0) {+ std::cerr << "Failed to listen on tcp socket" << std::endl;+ return false;+ }++ loop_.addFd(server_fd_, [this](int fd) { handle_accept(fd); });+ std::cout << "TcpServer listening on 0.0.0.0:" << bind_port_ << std::endl;+ return true;+}++void TcpServer::stop() {+ if (server_fd_ >= 0) {+ loop_.removeFd(server_fd_);+ close(server_fd_);+ server_fd_ = -1;+ }+}++void TcpServer::handle_accept(int fd) {+ sockaddr_in client_addr{};+ socklen_t addrlen = sizeof(client_addr);+ int client_fd = accept(fd, reinterpret_cast<sockaddr*>(&client_addr), &addrlen);+ if (client_fd < 0) {+ if (errno != EAGAIN && errno != EWOULDBLOCK) {+ std::cerr << "TcpServer accept error: " << std::strerror(errno) << std::endl;+ }+ return;+ }++ // Set non-blocking+ int flags = fcntl(client_fd, F_GETFL, 0);+ fcntl(client_fd, F_SETFL, flags | O_NONBLOCK);++ register_client_fd(client_fd);+ loop_.addFd(client_fd, [this](int cfd) { handle_client(cfd); });++ char ip[INET_ADDRSTRLEN];+ inet_ntop(AF_INET, &(client_addr.sin_addr), ip, INET_ADDRSTRLEN);+ std::cout << "TcpServer: New connection from " << ip << " (fd: " << client_fd << ")" << std::endl;+}++void TcpServer::handle_client(int client_fd) {+ char buf[1024];+ ssize_t n = read(client_fd, buf, sizeof(buf) - 1);+ if (n > 0) {+ buf[n] = '\0';+ std::string msg(buf);+ std::cout << "TcpServer received: " << msg << std::endl;++ // Try to parse json just to show we can+ try {+ nlohmann::json j = nlohmann::json::parse(msg);+ std::cout << " (Parsed JSON: " << j.dump() << ")" << std::endl;++ if (j.contains("command") && j["command"] == "clipboard_set" && j.contains("content")) {+ std::string content = j["content"];+ extern WaylandContext* g_wayland;+ if (g_wayland) {+ g_wayland->copy_to_clipboard(content);+ }+ }+ } catch (...) {+ // Ignore parse errors for raw text protocol+ }++ std::string response = "OK\n";+ write(client_fd, response.c_str(), response.size());+ } else if (n == 0 || (n < 0 && errno != EAGAIN && errno != EWOULDBLOCK)) {+ // Disconnected+ std::cout << "TcpServer: Client disconnected (fd: " << client_fd << ")" << std::endl;+ unregister_client_fd(client_fd);+ loop_.removeFd(client_fd);+ close(client_fd);+ }+}++} // namespace tetherdiff --git a/src/core/src/wayland.cpp b/src/core/src/wayland.cppnew file mode 100644index 0000000..a37dc20--- /dev/null+++ b/src/core/src/wayland.cpp@@ -0,0 +1,87 @@+#include "tether/wayland.hpp"+#include "wayland_protocols/wayland.hpp"+#include "wayland_protocols/wlr-data-control-unstable-v1.hpp"++#include <wayland-client.h>+#include <iostream>+#include <cstring>++namespace tether {++WaylandContext::WaylandContext(EpollEventLoop& loop) : loop_(loop) {}++WaylandContext::~WaylandContext() {+ if (raw_display_) {+ // remove from poll+ loop_.removeFd(wl_display_get_fd(raw_display_));+ wl_display_disconnect(raw_display_);+ }+}++bool WaylandContext::init() {+ raw_display_ = wl_display_connect(nullptr);+ if (!raw_display_) {+ std::cerr << "WaylandContext: Failed to connect to Wayland display" << std::endl;+ return false;+ }++ display_ = std::make_unique<CCWlDisplay>((wl_proxy*)raw_display_);++ auto proxy = display_->sendGetRegistry();+ registry_ = std::make_unique<CCWlRegistry>(proxy);++ registry_->setGlobal([this](CCWlRegistry* r, uint32_t name, const char* interface, uint32_t version) {+ if (std::strcmp(interface, "wl_seat") == 0) {+ auto p = wl_registry_bind((wl_registry*)r->resource(), name, &wl_seat_interface, 1);+ seat_ = std::make_unique<CCWlSeat>((wl_proxy*)p);+ } else if (std::strcmp(interface, "zwlr_data_control_manager_v1") == 0) {+ auto p = wl_registry_bind((wl_registry*)r->resource(), name, &zwlr_data_control_manager_v1_interface, 1);+ data_control_manager_ = std::make_unique<CCZwlrDataControlManagerV1>((wl_proxy*)p);+ }+ });++ // synchronous roundtrips to populate globals+ wl_display_roundtrip(raw_display_);+ wl_display_roundtrip(raw_display_);++ if (!seat_ || !data_control_manager_) {+ std::cerr << "WaylandContext: Failed to obtain necessary globals." << std::endl;+ return false;+ }++ clipboard_ = std::make_unique<ClipboardManager>(data_control_manager_.get(), seat_.get());++ if (clipboard_cb_) {+ clipboard_->set_update_callback(clipboard_cb_);+ }++ // Attach to event loop!+ int fd = wl_display_get_fd(raw_display_);+ loop_.addFd(fd, [this](int) {+ if (wl_display_dispatch(raw_display_) < 0) {+ std::cerr << "WaylandContext: Display disconnected." << std::endl;+ }+ });++ // Flush any pending requests+ wl_display_flush(raw_display_);++ std::cout << "WaylandContext initialized successfully." << std::endl;+ return true;+}++void WaylandContext::set_clipboard_callback(std::function<void(const std::string&)> cb) {+ clipboard_cb_ = std::move(cb);+ if (clipboard_) {+ clipboard_->set_update_callback(clipboard_cb_);+ }+}++void WaylandContext::copy_to_clipboard(const std::string& text) {+ if (clipboard_) {+ clipboard_->copy(text);+ wl_display_flush(raw_display_);+ }+}++} // namespace tetherdiff --git a/src/core/src/wayland_protocols/wayland.cpp b/src/core/src/wayland_protocols/wayland.cppnew file mode 100644index 0000000..7cb8d37--- /dev/null+++ b/src/core/src/wayland_protocols/wayland.cpp@@ -0,0 +1,2476 @@+// Generated with hyprwayland-scanner 0.4.5. Made with vaxry's keyboard and ❤️.+// wayland++/*+ This protocol's authors' copyright notice is:+++ Copyright © 2008-2011 Kristian Høgsberg+ Copyright © 2010-2011 Intel Corporation+ Copyright © 2012-2013 Collabora, Ltd.++ Permission is hereby granted, free of charge, to any person+ obtaining a copy of this software and associated documentation files+ (the "Software"), to deal in the Software without restriction,+ including without limitation the rights to use, copy, modify, merge,+ publish, distribute, sublicense, and/or sell copies of the Software,+ and to permit persons to whom the Software is furnished to do so,+ subject to the following conditions:++ The above copyright notice and this permission notice (including the+ next paragraph) shall be included in all copies or substantial+ portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.++*/++#define private public+#define HYPRWAYLAND_SCANNER_NO_INTERFACES+#include "wayland.hpp"+#undef private+#define F std::function++static const wl_interface* wayland_dummyTypes[] = { nullptr };++// Reference all other interfaces.+// The reason why this is in snake is to+// be able to cooperate with existing+// wayland_scanner interfaces (they are interop)+extern const wl_interface wl_display_interface;+extern const wl_interface wl_registry_interface;+extern const wl_interface wl_callback_interface;+extern const wl_interface wl_compositor_interface;+extern const wl_interface wl_shm_pool_interface;+extern const wl_interface wl_shm_interface;+extern const wl_interface wl_buffer_interface;+extern const wl_interface wl_data_offer_interface;+extern const wl_interface wl_data_source_interface;+extern const wl_interface wl_data_device_interface;+extern const wl_interface wl_data_device_manager_interface;+extern const wl_interface wl_shell_interface;+extern const wl_interface wl_shell_surface_interface;+extern const wl_interface wl_surface_interface;+extern const wl_interface wl_seat_interface;+extern const wl_interface wl_pointer_interface;+extern const wl_interface wl_keyboard_interface;+extern const wl_interface wl_touch_interface;+extern const wl_interface wl_output_interface;+extern const wl_interface wl_region_interface;+extern const wl_interface wl_subcompositor_interface;+extern const wl_interface wl_subsurface_interface;+extern const wl_interface wl_fixes_interface;++static void _CWlDisplayError(void* data, void* resource, wl_proxy* object_id, uint32_t code, const char* message) {+ const auto PO = (CCWlDisplay*)data;+ if (PO && PO->requests.error)+ PO->requests.error(PO, object_id, code, message);+}++static void _CWlDisplayDeleteId(void* data, void* resource, uint32_t id) {+ const auto PO = (CCWlDisplay*)data;+ if (PO && PO->requests.deleteId)+ PO->requests.deleteId(PO, id);+}++static const void* _CCWlDisplayVTable[] = {+ (void*)_CWlDisplayError,+ (void*)_CWlDisplayDeleteId,+};++wl_proxy* CCWlDisplay::sendSync() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_callback_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCWlDisplay::sendGetRegistry() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &wl_registry_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}+static const wl_interface* _CWlDisplaySyncTypes[] = {+ &wl_callback_interface,+};+static const wl_interface* _CWlDisplayGetRegistryTypes[] = {+ &wl_registry_interface,+};+static const wl_interface* _CWlDisplayErrorTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDisplayDeleteIdTypes[] = {+ nullptr,+};++static const wl_message _CWlDisplayRequests[] = {+ { .name = "sync", .signature = "n", .types = _CWlDisplaySyncTypes + 0},+ { .name = "get_registry", .signature = "n", .types = _CWlDisplayGetRegistryTypes + 0},+};++static const wl_message _CWlDisplayEvents[] = {+ { .name = "error", .signature = "ous", .types = _CWlDisplayErrorTypes + 0},+ { .name = "delete_id", .signature = "u", .types = _CWlDisplayDeleteIdTypes + 0},+};++const wl_interface wl_display_interface = {+ .name = "wl_display", .version = 1,+ .method_count = 2, .methods = _CWlDisplayRequests,+ .event_count = 2, .events = _CWlDisplayEvents,+};++CCWlDisplay::CCWlDisplay(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlDisplayVTable, this);+}++CCWlDisplay::~CCWlDisplay() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++void CCWlDisplay::setError(F<void(CCWlDisplay*, wl_proxy*, uint32_t, const char*)> handler) {+ requests.error = handler;+}++void CCWlDisplay::setDeleteId(F<void(CCWlDisplay*, uint32_t)> handler) {+ requests.deleteId = handler;+}++static void _CWlRegistryGlobal(void* data, void* resource, uint32_t name, const char* interface, uint32_t version) {+ const auto PO = (CCWlRegistry*)data;+ if (PO && PO->requests.global)+ PO->requests.global(PO, name, interface, version);+}++static void _CWlRegistryGlobalRemove(void* data, void* resource, uint32_t name) {+ const auto PO = (CCWlRegistry*)data;+ if (PO && PO->requests.globalRemove)+ PO->requests.globalRemove(PO, name);+}++static const void* _CCWlRegistryVTable[] = {+ (void*)_CWlRegistryGlobal,+ (void*)_CWlRegistryGlobalRemove,+};++void CCWlRegistry::sendBind(uint32_t name) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, name, nullptr);+ proxy;+}+static const wl_interface* _CWlRegistryBindTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlRegistryGlobalTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlRegistryGlobalRemoveTypes[] = {+ nullptr,+};++static const wl_message _CWlRegistryRequests[] = {+ { .name = "bind", .signature = "usun", .types = _CWlRegistryBindTypes + 0},+};++static const wl_message _CWlRegistryEvents[] = {+ { .name = "global", .signature = "usu", .types = _CWlRegistryGlobalTypes + 0},+ { .name = "global_remove", .signature = "u", .types = _CWlRegistryGlobalRemoveTypes + 0},+};++const wl_interface wl_registry_interface = {+ .name = "wl_registry", .version = 1,+ .method_count = 1, .methods = _CWlRegistryRequests,+ .event_count = 2, .events = _CWlRegistryEvents,+};++CCWlRegistry::CCWlRegistry(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlRegistryVTable, this);+}++CCWlRegistry::~CCWlRegistry() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++void CCWlRegistry::setGlobal(F<void(CCWlRegistry*, uint32_t, const char*, uint32_t)> handler) {+ requests.global = handler;+}++void CCWlRegistry::setGlobalRemove(F<void(CCWlRegistry*, uint32_t)> handler) {+ requests.globalRemove = handler;+}++static void _CWlCallbackDone(void* data, void* resource, uint32_t callback_data) {+ const auto PO = (CCWlCallback*)data;+ if (PO && PO->requests.done)+ PO->requests.done(PO, callback_data);+}++static const void* _CCWlCallbackVTable[] = {+ (void*)_CWlCallbackDone,+};+static const wl_interface* _CWlCallbackDoneTypes[] = {+ nullptr,+};++static const wl_message _CWlCallbackEvents[] = {+ { .name = "done", .signature = "u", .types = _CWlCallbackDoneTypes + 0},+};++const wl_interface wl_callback_interface = {+ .name = "wl_callback", .version = 1,+ .method_count = 0, .methods = nullptr,+ .event_count = 1, .events = _CWlCallbackEvents,+};++CCWlCallback::CCWlCallback(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlCallbackVTable, this);+}++CCWlCallback::~CCWlCallback() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++void CCWlCallback::setDone(F<void(CCWlCallback*, uint32_t)> handler) {+ requests.done = handler;+}++static const void* _CCWlCompositorVTable[] = {+ nullptr,+};++wl_proxy* CCWlCompositor::sendCreateSurface() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_surface_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCWlCompositor::sendCreateRegion() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &wl_region_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}+static const wl_interface* _CWlCompositorCreateSurfaceTypes[] = {+ &wl_surface_interface,+};+static const wl_interface* _CWlCompositorCreateRegionTypes[] = {+ &wl_region_interface,+};++static const wl_message _CWlCompositorRequests[] = {+ { .name = "create_surface", .signature = "n", .types = _CWlCompositorCreateSurfaceTypes + 0},+ { .name = "create_region", .signature = "n", .types = _CWlCompositorCreateRegionTypes + 0},+};++const wl_interface wl_compositor_interface = {+ .name = "wl_compositor", .version = 6,+ .method_count = 2, .methods = _CWlCompositorRequests,+ .event_count = 0, .events = nullptr,+};++CCWlCompositor::CCWlCompositor(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlCompositorVTable, this);+}++CCWlCompositor::~CCWlCompositor() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++static const void* _CCWlShmPoolVTable[] = {+ nullptr,+};++wl_proxy* CCWlShmPool::sendCreateBuffer(int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_buffer_interface, wl_proxy_get_version(pResource), 0, nullptr, offset, width, height, stride, format);++ return proxy;+}++void CCWlShmPool::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlShmPool::sendResize(int32_t size) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, size);+ proxy;+}+static const wl_interface* _CWlShmPoolCreateBufferTypes[] = {+ &wl_buffer_interface,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlShmPoolResizeTypes[] = {+ nullptr,+};++static const wl_message _CWlShmPoolRequests[] = {+ { .name = "create_buffer", .signature = "niiiiu", .types = _CWlShmPoolCreateBufferTypes + 0},+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "resize", .signature = "i", .types = _CWlShmPoolResizeTypes + 0},+};++const wl_interface wl_shm_pool_interface = {+ .name = "wl_shm_pool", .version = 2,+ .method_count = 3, .methods = _CWlShmPoolRequests,+ .event_count = 0, .events = nullptr,+};++CCWlShmPool::CCWlShmPool(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlShmPoolVTable, this);+}++CCWlShmPool::~CCWlShmPool() {+ if (!destroyed)+ sendDestroy();+}++static void _CWlShmFormat(void* data, void* resource, enum wl_shm_format format) {+ const auto PO = (CCWlShm*)data;+ if (PO && PO->requests.format)+ PO->requests.format(PO, format);+}++static const void* _CCWlShmVTable[] = {+ (void*)_CWlShmFormat,+};++wl_proxy* CCWlShm::sendCreatePool(int32_t fd, int32_t size) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_shm_pool_interface, wl_proxy_get_version(pResource), 0, nullptr, fd, size);++ return proxy;+}++void CCWlShm::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlShmCreatePoolTypes[] = {+ &wl_shm_pool_interface,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlShmFormatTypes[] = {+ nullptr,+};++static const wl_message _CWlShmRequests[] = {+ { .name = "create_pool", .signature = "nhi", .types = _CWlShmCreatePoolTypes + 0},+ { .name = "release", .signature = "2", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlShmEvents[] = {+ { .name = "format", .signature = "u", .types = _CWlShmFormatTypes + 0},+};++const wl_interface wl_shm_interface = {+ .name = "wl_shm", .version = 2,+ .method_count = 2, .methods = _CWlShmRequests,+ .event_count = 1, .events = _CWlShmEvents,+};++CCWlShm::CCWlShm(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlShmVTable, this);+}++CCWlShm::~CCWlShm() {+ if (!destroyed)+ sendRelease();+}++void CCWlShm::setFormat(F<void(CCWlShm*, enum wl_shm_format)> handler) {+ requests.format = handler;+}++static void _CWlBufferRelease(void* data, void* resource) {+ const auto PO = (CCWlBuffer*)data;+ if (PO && PO->requests.release)+ PO->requests.release(PO);+}++static const void* _CCWlBufferVTable[] = {+ (void*)_CWlBufferRelease,+};++void CCWlBuffer::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++static const wl_message _CWlBufferRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlBufferEvents[] = {+ { .name = "release", .signature = "", .types = wayland_dummyTypes + 0},+};++const wl_interface wl_buffer_interface = {+ .name = "wl_buffer", .version = 1,+ .method_count = 1, .methods = _CWlBufferRequests,+ .event_count = 1, .events = _CWlBufferEvents,+};++CCWlBuffer::CCWlBuffer(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlBufferVTable, this);+}++CCWlBuffer::~CCWlBuffer() {+ if (!destroyed)+ sendDestroy();+}++void CCWlBuffer::setRelease(F<void(CCWlBuffer*)> handler) {+ requests.release = handler;+}++static void _CWlDataOfferOffer(void* data, void* resource, const char* mime_type) {+ const auto PO = (CCWlDataOffer*)data;+ if (PO && PO->requests.offer)+ PO->requests.offer(PO, mime_type);+}++static void _CWlDataOfferSourceActions(void* data, void* resource, uint32_t source_actions) {+ const auto PO = (CCWlDataOffer*)data;+ if (PO && PO->requests.sourceActions)+ PO->requests.sourceActions(PO, source_actions);+}++static void _CWlDataOfferAction(void* data, void* resource, uint32_t dnd_action) {+ const auto PO = (CCWlDataOffer*)data;+ if (PO && PO->requests.action)+ PO->requests.action(PO, dnd_action);+}++static const void* _CCWlDataOfferVTable[] = {+ (void*)_CWlDataOfferOffer,+ (void*)_CWlDataOfferSourceActions,+ (void*)_CWlDataOfferAction,+};++void CCWlDataOffer::sendAccept(uint32_t serial, const char* mime_type) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, serial, mime_type);+ proxy;+}++void CCWlDataOffer::sendReceive(const char* mime_type, int32_t fd) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, mime_type, fd);+ proxy;+}++void CCWlDataOffer::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlDataOffer::sendFinish() {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 3, nullptr, wl_proxy_get_version(pResource), 0);+ proxy;+}++void CCWlDataOffer::sendSetActions(uint32_t dnd_actions, uint32_t preferred_action) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 4, nullptr, wl_proxy_get_version(pResource), 0, dnd_actions, preferred_action);+ proxy;+}+static const wl_interface* _CWlDataOfferAcceptTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDataOfferReceiveTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDataOfferSetActionsTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDataOfferOfferTypes[] = {+ nullptr,+};+static const wl_interface* _CWlDataOfferSourceActionsTypes[] = {+ nullptr,+};+static const wl_interface* _CWlDataOfferActionTypes[] = {+ nullptr,+};++static const wl_message _CWlDataOfferRequests[] = {+ { .name = "accept", .signature = "u?s", .types = _CWlDataOfferAcceptTypes + 0},+ { .name = "receive", .signature = "sh", .types = _CWlDataOfferReceiveTypes + 0},+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "finish", .signature = "3", .types = wayland_dummyTypes + 0},+ { .name = "set_actions", .signature = "3uu", .types = _CWlDataOfferSetActionsTypes + 0},+};++static const wl_message _CWlDataOfferEvents[] = {+ { .name = "offer", .signature = "s", .types = _CWlDataOfferOfferTypes + 0},+ { .name = "source_actions", .signature = "3u", .types = _CWlDataOfferSourceActionsTypes + 0},+ { .name = "action", .signature = "3u", .types = _CWlDataOfferActionTypes + 0},+};++const wl_interface wl_data_offer_interface = {+ .name = "wl_data_offer", .version = 3,+ .method_count = 5, .methods = _CWlDataOfferRequests,+ .event_count = 3, .events = _CWlDataOfferEvents,+};++CCWlDataOffer::CCWlDataOffer(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlDataOfferVTable, this);+}++CCWlDataOffer::~CCWlDataOffer() {+ if (!destroyed)+ sendDestroy();+}++void CCWlDataOffer::setOffer(F<void(CCWlDataOffer*, const char*)> handler) {+ requests.offer = handler;+}++void CCWlDataOffer::setSourceActions(F<void(CCWlDataOffer*, uint32_t)> handler) {+ requests.sourceActions = handler;+}++void CCWlDataOffer::setAction(F<void(CCWlDataOffer*, uint32_t)> handler) {+ requests.action = handler;+}++static void _CWlDataSourceTarget(void* data, void* resource, const char* mime_type) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.target)+ PO->requests.target(PO, mime_type);+}++static void _CWlDataSourceSend(void* data, void* resource, const char* mime_type, int32_t fd) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.send)+ PO->requests.send(PO, mime_type, fd);+}++static void _CWlDataSourceCancelled(void* data, void* resource) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.cancelled)+ PO->requests.cancelled(PO);+}++static void _CWlDataSourceDndDropPerformed(void* data, void* resource) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.dndDropPerformed)+ PO->requests.dndDropPerformed(PO);+}++static void _CWlDataSourceDndFinished(void* data, void* resource) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.dndFinished)+ PO->requests.dndFinished(PO);+}++static void _CWlDataSourceAction(void* data, void* resource, uint32_t dnd_action) {+ const auto PO = (CCWlDataSource*)data;+ if (PO && PO->requests.action)+ PO->requests.action(PO, dnd_action);+}++static const void* _CCWlDataSourceVTable[] = {+ (void*)_CWlDataSourceTarget,+ (void*)_CWlDataSourceSend,+ (void*)_CWlDataSourceCancelled,+ (void*)_CWlDataSourceDndDropPerformed,+ (void*)_CWlDataSourceDndFinished,+ (void*)_CWlDataSourceAction,+};++void CCWlDataSource::sendOffer(const char* mime_type) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, mime_type);+ proxy;+}++void CCWlDataSource::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlDataSource::sendSetActions(uint32_t dnd_actions) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, dnd_actions);+ proxy;+}+static const wl_interface* _CWlDataSourceOfferTypes[] = {+ nullptr,+};+static const wl_interface* _CWlDataSourceSetActionsTypes[] = {+ nullptr,+};+static const wl_interface* _CWlDataSourceTargetTypes[] = {+ nullptr,+};+static const wl_interface* _CWlDataSourceSendTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDataSourceActionTypes[] = {+ nullptr,+};++static const wl_message _CWlDataSourceRequests[] = {+ { .name = "offer", .signature = "s", .types = _CWlDataSourceOfferTypes + 0},+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "set_actions", .signature = "3u", .types = _CWlDataSourceSetActionsTypes + 0},+};++static const wl_message _CWlDataSourceEvents[] = {+ { .name = "target", .signature = "?s", .types = _CWlDataSourceTargetTypes + 0},+ { .name = "send", .signature = "sh", .types = _CWlDataSourceSendTypes + 0},+ { .name = "cancelled", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "dnd_drop_performed", .signature = "3", .types = wayland_dummyTypes + 0},+ { .name = "dnd_finished", .signature = "3", .types = wayland_dummyTypes + 0},+ { .name = "action", .signature = "3u", .types = _CWlDataSourceActionTypes + 0},+};++const wl_interface wl_data_source_interface = {+ .name = "wl_data_source", .version = 3,+ .method_count = 3, .methods = _CWlDataSourceRequests,+ .event_count = 6, .events = _CWlDataSourceEvents,+};++CCWlDataSource::CCWlDataSource(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlDataSourceVTable, this);+}++CCWlDataSource::~CCWlDataSource() {+ if (!destroyed)+ sendDestroy();+}++void CCWlDataSource::setTarget(F<void(CCWlDataSource*, const char*)> handler) {+ requests.target = handler;+}++void CCWlDataSource::setSend(F<void(CCWlDataSource*, const char*, int32_t)> handler) {+ requests.send = handler;+}++void CCWlDataSource::setCancelled(F<void(CCWlDataSource*)> handler) {+ requests.cancelled = handler;+}++void CCWlDataSource::setDndDropPerformed(F<void(CCWlDataSource*)> handler) {+ requests.dndDropPerformed = handler;+}++void CCWlDataSource::setDndFinished(F<void(CCWlDataSource*)> handler) {+ requests.dndFinished = handler;+}++void CCWlDataSource::setAction(F<void(CCWlDataSource*, uint32_t)> handler) {+ requests.action = handler;+}++static void _CWlDataDeviceDataOffer(void* data, void* resource, wl_proxy* id) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.dataOffer)+ PO->requests.dataOffer(PO, id);+}++static void _CWlDataDeviceEnter(void* data, void* resource, uint32_t serial, wl_proxy* surface, wl_fixed_t x, wl_fixed_t y, wl_proxy* id) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.enter)+ PO->requests.enter(PO, serial, surface, x, y, id);+}++static void _CWlDataDeviceLeave(void* data, void* resource) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.leave)+ PO->requests.leave(PO);+}++static void _CWlDataDeviceMotion(void* data, void* resource, uint32_t time, wl_fixed_t x, wl_fixed_t y) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.motion)+ PO->requests.motion(PO, time, x, y);+}++static void _CWlDataDeviceDrop(void* data, void* resource) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.drop)+ PO->requests.drop(PO);+}++static void _CWlDataDeviceSelection(void* data, void* resource, wl_proxy* id) {+ const auto PO = (CCWlDataDevice*)data;+ if (PO && PO->requests.selection)+ PO->requests.selection(PO, id);+}++static const void* _CCWlDataDeviceVTable[] = {+ (void*)_CWlDataDeviceDataOffer,+ (void*)_CWlDataDeviceEnter,+ (void*)_CWlDataDeviceLeave,+ (void*)_CWlDataDeviceMotion,+ (void*)_CWlDataDeviceDrop,+ (void*)_CWlDataDeviceSelection,+};++void CCWlDataDevice::sendStartDrag(CCWlDataSource* source, CCWlSurface* origin, CCWlSurface* icon, uint32_t serial) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, source ? source->pResource : nullptr, origin ? origin->pResource : nullptr, icon ? icon->pResource : nullptr, serial);+ proxy;+}++void CCWlDataDevice::sendSetSelection(CCWlDataSource* source, uint32_t serial) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, source ? source->pResource : nullptr, serial);+ proxy;+}++void CCWlDataDevice::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlDataDeviceStartDragTypes[] = {+ &wl_data_source_interface,+ &wl_surface_interface,+ &wl_surface_interface,+ nullptr,+};+static const wl_interface* _CWlDataDeviceSetSelectionTypes[] = {+ &wl_data_source_interface,+ nullptr,+};+static const wl_interface* _CWlDataDeviceDataOfferTypes[] = {+ &wl_data_offer_interface,+};+static const wl_interface* _CWlDataDeviceEnterTypes[] = {+ nullptr,+ &wl_surface_interface,+ nullptr,+ nullptr,+ &wl_data_offer_interface,+};+static const wl_interface* _CWlDataDeviceMotionTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlDataDeviceSelectionTypes[] = {+ &wl_data_offer_interface,+};++static const wl_message _CWlDataDeviceRequests[] = {+ { .name = "start_drag", .signature = "?oo?ou", .types = _CWlDataDeviceStartDragTypes + 0},+ { .name = "set_selection", .signature = "?ou", .types = _CWlDataDeviceSetSelectionTypes + 0},+ { .name = "release", .signature = "2", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlDataDeviceEvents[] = {+ { .name = "data_offer", .signature = "n", .types = _CWlDataDeviceDataOfferTypes + 0},+ { .name = "enter", .signature = "uoff?o", .types = _CWlDataDeviceEnterTypes + 0},+ { .name = "leave", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "motion", .signature = "uff", .types = _CWlDataDeviceMotionTypes + 0},+ { .name = "drop", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "selection", .signature = "?o", .types = _CWlDataDeviceSelectionTypes + 0},+};++const wl_interface wl_data_device_interface = {+ .name = "wl_data_device", .version = 3,+ .method_count = 3, .methods = _CWlDataDeviceRequests,+ .event_count = 6, .events = _CWlDataDeviceEvents,+};++CCWlDataDevice::CCWlDataDevice(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlDataDeviceVTable, this);+}++CCWlDataDevice::~CCWlDataDevice() {+ if (!destroyed)+ sendRelease();+}++void CCWlDataDevice::setDataOffer(F<void(CCWlDataDevice*, wl_proxy*)> handler) {+ requests.dataOffer = handler;+}++void CCWlDataDevice::setEnter(F<void(CCWlDataDevice*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t, wl_proxy*)> handler) {+ requests.enter = handler;+}++void CCWlDataDevice::setLeave(F<void(CCWlDataDevice*)> handler) {+ requests.leave = handler;+}++void CCWlDataDevice::setMotion(F<void(CCWlDataDevice*, uint32_t, wl_fixed_t, wl_fixed_t)> handler) {+ requests.motion = handler;+}++void CCWlDataDevice::setDrop(F<void(CCWlDataDevice*)> handler) {+ requests.drop = handler;+}++void CCWlDataDevice::setSelection(F<void(CCWlDataDevice*, wl_proxy*)> handler) {+ requests.selection = handler;+}++static const void* _CCWlDataDeviceManagerVTable[] = {+ nullptr,+};++wl_proxy* CCWlDataDeviceManager::sendCreateDataSource() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_data_source_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCWlDataDeviceManager::sendGetDataDevice(CCWlSeat* seat) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &wl_data_device_interface, wl_proxy_get_version(pResource), 0, nullptr, seat ? seat->pResource : nullptr);++ return proxy;+}+static const wl_interface* _CWlDataDeviceManagerCreateDataSourceTypes[] = {+ &wl_data_source_interface,+};+static const wl_interface* _CWlDataDeviceManagerGetDataDeviceTypes[] = {+ &wl_data_device_interface,+ &wl_seat_interface,+};++static const wl_message _CWlDataDeviceManagerRequests[] = {+ { .name = "create_data_source", .signature = "n", .types = _CWlDataDeviceManagerCreateDataSourceTypes + 0},+ { .name = "get_data_device", .signature = "no", .types = _CWlDataDeviceManagerGetDataDeviceTypes + 0},+};++const wl_interface wl_data_device_manager_interface = {+ .name = "wl_data_device_manager", .version = 3,+ .method_count = 2, .methods = _CWlDataDeviceManagerRequests,+ .event_count = 0, .events = nullptr,+};++CCWlDataDeviceManager::CCWlDataDeviceManager(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlDataDeviceManagerVTable, this);+}++CCWlDataDeviceManager::~CCWlDataDeviceManager() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++static const void* _CCWlShellVTable[] = {+ nullptr,+};++wl_proxy* CCWlShell::sendGetShellSurface(CCWlSurface* surface) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_shell_surface_interface, wl_proxy_get_version(pResource), 0, nullptr, surface ? surface->pResource : nullptr);++ return proxy;+}+static const wl_interface* _CWlShellGetShellSurfaceTypes[] = {+ &wl_shell_surface_interface,+ &wl_surface_interface,+};++static const wl_message _CWlShellRequests[] = {+ { .name = "get_shell_surface", .signature = "no", .types = _CWlShellGetShellSurfaceTypes + 0},+};++const wl_interface wl_shell_interface = {+ .name = "wl_shell", .version = 1,+ .method_count = 1, .methods = _CWlShellRequests,+ .event_count = 0, .events = nullptr,+};++CCWlShell::CCWlShell(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlShellVTable, this);+}++CCWlShell::~CCWlShell() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++static void _CWlShellSurfacePing(void* data, void* resource, uint32_t serial) {+ const auto PO = (CCWlShellSurface*)data;+ if (PO && PO->requests.ping)+ PO->requests.ping(PO, serial);+}++static void _CWlShellSurfaceConfigure(void* data, void* resource, enum wl_shell_surface_resize edges, int32_t width, int32_t height) {+ const auto PO = (CCWlShellSurface*)data;+ if (PO && PO->requests.configure)+ PO->requests.configure(PO, edges, width, height);+}++static void _CWlShellSurfacePopupDone(void* data, void* resource) {+ const auto PO = (CCWlShellSurface*)data;+ if (PO && PO->requests.popupDone)+ PO->requests.popupDone(PO);+}++static const void* _CCWlShellSurfaceVTable[] = {+ (void*)_CWlShellSurfacePing,+ (void*)_CWlShellSurfaceConfigure,+ (void*)_CWlShellSurfacePopupDone,+};++void CCWlShellSurface::sendPong(uint32_t serial) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, serial);+ proxy;+}++void CCWlShellSurface::sendMove(CCWlSeat* seat, uint32_t serial) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, seat ? seat->pResource : nullptr, serial);+ proxy;+}++void CCWlShellSurface::sendResize(CCWlSeat* seat, uint32_t serial, enum wl_shell_surface_resize edges) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, seat ? seat->pResource : nullptr, serial, edges);+ proxy;+}++void CCWlShellSurface::sendSetToplevel() {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 3, nullptr, wl_proxy_get_version(pResource), 0);+ proxy;+}++void CCWlShellSurface::sendSetTransient(CCWlSurface* parent, int32_t x, int32_t y, enum wl_shell_surface_transient flags) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 4, nullptr, wl_proxy_get_version(pResource), 0, parent ? parent->pResource : nullptr, x, y, flags);+ proxy;+}++void CCWlShellSurface::sendSetFullscreen(enum wl_shell_surface_fullscreen_method method, uint32_t framerate, CCWlOutput* output) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 5, nullptr, wl_proxy_get_version(pResource), 0, method, framerate, output ? output->pResource : nullptr);+ proxy;+}++void CCWlShellSurface::sendSetPopup(CCWlSeat* seat, uint32_t serial, CCWlSurface* parent, int32_t x, int32_t y, enum wl_shell_surface_transient flags) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 6, nullptr, wl_proxy_get_version(pResource), 0, seat ? seat->pResource : nullptr, serial, parent ? parent->pResource : nullptr, x, y, flags);+ proxy;+}++void CCWlShellSurface::sendSetMaximized(CCWlOutput* output) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 7, nullptr, wl_proxy_get_version(pResource), 0, output ? output->pResource : nullptr);+ proxy;+}++void CCWlShellSurface::sendSetTitle(const char* title) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 8, nullptr, wl_proxy_get_version(pResource), 0, title);+ proxy;+}++void CCWlShellSurface::sendSetClass(const char* class_) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 9, nullptr, wl_proxy_get_version(pResource), 0, class_);+ proxy;+}+static const wl_interface* _CWlShellSurfacePongTypes[] = {+ nullptr,+};+static const wl_interface* _CWlShellSurfaceMoveTypes[] = {+ &wl_seat_interface,+ nullptr,+};+static const wl_interface* _CWlShellSurfaceResizeTypes[] = {+ &wl_seat_interface,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlShellSurfaceSetTransientTypes[] = {+ &wl_surface_interface,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlShellSurfaceSetFullscreenTypes[] = {+ nullptr,+ nullptr,+ &wl_output_interface,+};+static const wl_interface* _CWlShellSurfaceSetPopupTypes[] = {+ &wl_seat_interface,+ nullptr,+ &wl_surface_interface,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlShellSurfaceSetMaximizedTypes[] = {+ &wl_output_interface,+};+static const wl_interface* _CWlShellSurfaceSetTitleTypes[] = {+ nullptr,+};+static const wl_interface* _CWlShellSurfaceSetClassTypes[] = {+ nullptr,+};+static const wl_interface* _CWlShellSurfacePingTypes[] = {+ nullptr,+};+static const wl_interface* _CWlShellSurfaceConfigureTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};++static const wl_message _CWlShellSurfaceRequests[] = {+ { .name = "pong", .signature = "u", .types = _CWlShellSurfacePongTypes + 0},+ { .name = "move", .signature = "ou", .types = _CWlShellSurfaceMoveTypes + 0},+ { .name = "resize", .signature = "ouu", .types = _CWlShellSurfaceResizeTypes + 0},+ { .name = "set_toplevel", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "set_transient", .signature = "oiiu", .types = _CWlShellSurfaceSetTransientTypes + 0},+ { .name = "set_fullscreen", .signature = "uu?o", .types = _CWlShellSurfaceSetFullscreenTypes + 0},+ { .name = "set_popup", .signature = "ouoiiu", .types = _CWlShellSurfaceSetPopupTypes + 0},+ { .name = "set_maximized", .signature = "?o", .types = _CWlShellSurfaceSetMaximizedTypes + 0},+ { .name = "set_title", .signature = "s", .types = _CWlShellSurfaceSetTitleTypes + 0},+ { .name = "set_class", .signature = "s", .types = _CWlShellSurfaceSetClassTypes + 0},+};++static const wl_message _CWlShellSurfaceEvents[] = {+ { .name = "ping", .signature = "u", .types = _CWlShellSurfacePingTypes + 0},+ { .name = "configure", .signature = "uii", .types = _CWlShellSurfaceConfigureTypes + 0},+ { .name = "popup_done", .signature = "", .types = wayland_dummyTypes + 0},+};++const wl_interface wl_shell_surface_interface = {+ .name = "wl_shell_surface", .version = 1,+ .method_count = 10, .methods = _CWlShellSurfaceRequests,+ .event_count = 3, .events = _CWlShellSurfaceEvents,+};++CCWlShellSurface::CCWlShellSurface(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlShellSurfaceVTable, this);+}++CCWlShellSurface::~CCWlShellSurface() {+ if (!destroyed)+ wl_proxy_destroy(pResource);+}++void CCWlShellSurface::setPing(F<void(CCWlShellSurface*, uint32_t)> handler) {+ requests.ping = handler;+}++void CCWlShellSurface::setConfigure(F<void(CCWlShellSurface*, enum wl_shell_surface_resize, int32_t, int32_t)> handler) {+ requests.configure = handler;+}++void CCWlShellSurface::setPopupDone(F<void(CCWlShellSurface*)> handler) {+ requests.popupDone = handler;+}++static void _CWlSurfaceEnter(void* data, void* resource, wl_proxy* output) {+ const auto PO = (CCWlSurface*)data;+ if (PO && PO->requests.enter)+ PO->requests.enter(PO, output);+}++static void _CWlSurfaceLeave(void* data, void* resource, wl_proxy* output) {+ const auto PO = (CCWlSurface*)data;+ if (PO && PO->requests.leave)+ PO->requests.leave(PO, output);+}++static void _CWlSurfacePreferredBufferScale(void* data, void* resource, int32_t factor) {+ const auto PO = (CCWlSurface*)data;+ if (PO && PO->requests.preferredBufferScale)+ PO->requests.preferredBufferScale(PO, factor);+}++static void _CWlSurfacePreferredBufferTransform(void* data, void* resource, uint32_t transform) {+ const auto PO = (CCWlSurface*)data;+ if (PO && PO->requests.preferredBufferTransform)+ PO->requests.preferredBufferTransform(PO, transform);+}++static const void* _CCWlSurfaceVTable[] = {+ (void*)_CWlSurfaceEnter,+ (void*)_CWlSurfaceLeave,+ (void*)_CWlSurfacePreferredBufferScale,+ (void*)_CWlSurfacePreferredBufferTransform,+};++void CCWlSurface::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlSurface::sendAttach(CCWlBuffer* buffer, int32_t x, int32_t y) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, buffer ? buffer->pResource : nullptr, x, y);+ proxy;+}++void CCWlSurface::sendDamage(int32_t x, int32_t y, int32_t width, int32_t height) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, x, y, width, height);+ proxy;+}++wl_proxy* CCWlSurface::sendFrame() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 3, &wl_callback_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++void CCWlSurface::sendSetOpaqueRegion(CCWlRegion* region) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 4, nullptr, wl_proxy_get_version(pResource), 0, region ? region->pResource : nullptr);+ proxy;+}++void CCWlSurface::sendSetInputRegion(CCWlRegion* region) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 5, nullptr, wl_proxy_get_version(pResource), 0, region ? region->pResource : nullptr);+ proxy;+}++void CCWlSurface::sendCommit() {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 6, nullptr, wl_proxy_get_version(pResource), 0);+ proxy;+}++void CCWlSurface::sendSetBufferTransform(int32_t transform) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 7, nullptr, wl_proxy_get_version(pResource), 0, transform);+ proxy;+}++void CCWlSurface::sendSetBufferScale(int32_t scale) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 8, nullptr, wl_proxy_get_version(pResource), 0, scale);+ proxy;+}++void CCWlSurface::sendDamageBuffer(int32_t x, int32_t y, int32_t width, int32_t height) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 9, nullptr, wl_proxy_get_version(pResource), 0, x, y, width, height);+ proxy;+}++void CCWlSurface::sendOffset(int32_t x, int32_t y) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 10, nullptr, wl_proxy_get_version(pResource), 0, x, y);+ proxy;+}+static const wl_interface* _CWlSurfaceAttachTypes[] = {+ &wl_buffer_interface,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlSurfaceDamageTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlSurfaceFrameTypes[] = {+ &wl_callback_interface,+};+static const wl_interface* _CWlSurfaceSetOpaqueRegionTypes[] = {+ &wl_region_interface,+};+static const wl_interface* _CWlSurfaceSetInputRegionTypes[] = {+ &wl_region_interface,+};+static const wl_interface* _CWlSurfaceSetBufferTransformTypes[] = {+ nullptr,+};+static const wl_interface* _CWlSurfaceSetBufferScaleTypes[] = {+ nullptr,+};+static const wl_interface* _CWlSurfaceDamageBufferTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlSurfaceOffsetTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlSurfaceEnterTypes[] = {+ &wl_output_interface,+};+static const wl_interface* _CWlSurfaceLeaveTypes[] = {+ &wl_output_interface,+};+static const wl_interface* _CWlSurfacePreferredBufferScaleTypes[] = {+ nullptr,+};+static const wl_interface* _CWlSurfacePreferredBufferTransformTypes[] = {+ nullptr,+};++static const wl_message _CWlSurfaceRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "attach", .signature = "?oii", .types = _CWlSurfaceAttachTypes + 0},+ { .name = "damage", .signature = "iiii", .types = _CWlSurfaceDamageTypes + 0},+ { .name = "frame", .signature = "n", .types = _CWlSurfaceFrameTypes + 0},+ { .name = "set_opaque_region", .signature = "?o", .types = _CWlSurfaceSetOpaqueRegionTypes + 0},+ { .name = "set_input_region", .signature = "?o", .types = _CWlSurfaceSetInputRegionTypes + 0},+ { .name = "commit", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "set_buffer_transform", .signature = "2i", .types = _CWlSurfaceSetBufferTransformTypes + 0},+ { .name = "set_buffer_scale", .signature = "3i", .types = _CWlSurfaceSetBufferScaleTypes + 0},+ { .name = "damage_buffer", .signature = "4iiii", .types = _CWlSurfaceDamageBufferTypes + 0},+ { .name = "offset", .signature = "5ii", .types = _CWlSurfaceOffsetTypes + 0},+};++static const wl_message _CWlSurfaceEvents[] = {+ { .name = "enter", .signature = "o", .types = _CWlSurfaceEnterTypes + 0},+ { .name = "leave", .signature = "o", .types = _CWlSurfaceLeaveTypes + 0},+ { .name = "preferred_buffer_scale", .signature = "6i", .types = _CWlSurfacePreferredBufferScaleTypes + 0},+ { .name = "preferred_buffer_transform", .signature = "6u", .types = _CWlSurfacePreferredBufferTransformTypes + 0},+};++const wl_interface wl_surface_interface = {+ .name = "wl_surface", .version = 6,+ .method_count = 11, .methods = _CWlSurfaceRequests,+ .event_count = 4, .events = _CWlSurfaceEvents,+};++CCWlSurface::CCWlSurface(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlSurfaceVTable, this);+}++CCWlSurface::~CCWlSurface() {+ if (!destroyed)+ sendDestroy();+}++void CCWlSurface::setEnter(F<void(CCWlSurface*, wl_proxy*)> handler) {+ requests.enter = handler;+}++void CCWlSurface::setLeave(F<void(CCWlSurface*, wl_proxy*)> handler) {+ requests.leave = handler;+}++void CCWlSurface::setPreferredBufferScale(F<void(CCWlSurface*, int32_t)> handler) {+ requests.preferredBufferScale = handler;+}++void CCWlSurface::setPreferredBufferTransform(F<void(CCWlSurface*, uint32_t)> handler) {+ requests.preferredBufferTransform = handler;+}++static void _CWlSeatCapabilities(void* data, void* resource, enum wl_seat_capability capabilities) {+ const auto PO = (CCWlSeat*)data;+ if (PO && PO->requests.capabilities)+ PO->requests.capabilities(PO, capabilities);+}++static void _CWlSeatName(void* data, void* resource, const char* name) {+ const auto PO = (CCWlSeat*)data;+ if (PO && PO->requests.name)+ PO->requests.name(PO, name);+}++static const void* _CCWlSeatVTable[] = {+ (void*)_CWlSeatCapabilities,+ (void*)_CWlSeatName,+};++wl_proxy* CCWlSeat::sendGetPointer() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &wl_pointer_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCWlSeat::sendGetKeyboard() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &wl_keyboard_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCWlSeat::sendGetTouch() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, &wl_touch_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++void CCWlSeat::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 3, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlSeatGetPointerTypes[] = {+ &wl_pointer_interface,+};+static const wl_interface* _CWlSeatGetKeyboardTypes[] = {+ &wl_keyboard_interface,+};+static const wl_interface* _CWlSeatGetTouchTypes[] = {+ &wl_touch_interface,+};+static const wl_interface* _CWlSeatCapabilitiesTypes[] = {+ nullptr,+};+static const wl_interface* _CWlSeatNameTypes[] = {+ nullptr,+};++static const wl_message _CWlSeatRequests[] = {+ { .name = "get_pointer", .signature = "n", .types = _CWlSeatGetPointerTypes + 0},+ { .name = "get_keyboard", .signature = "n", .types = _CWlSeatGetKeyboardTypes + 0},+ { .name = "get_touch", .signature = "n", .types = _CWlSeatGetTouchTypes + 0},+ { .name = "release", .signature = "5", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlSeatEvents[] = {+ { .name = "capabilities", .signature = "u", .types = _CWlSeatCapabilitiesTypes + 0},+ { .name = "name", .signature = "2s", .types = _CWlSeatNameTypes + 0},+};++const wl_interface wl_seat_interface = {+ .name = "wl_seat", .version = 10,+ .method_count = 4, .methods = _CWlSeatRequests,+ .event_count = 2, .events = _CWlSeatEvents,+};++CCWlSeat::CCWlSeat(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlSeatVTable, this);+}++CCWlSeat::~CCWlSeat() {+ if (!destroyed)+ sendRelease();+}++void CCWlSeat::setCapabilities(F<void(CCWlSeat*, enum wl_seat_capability)> handler) {+ requests.capabilities = handler;+}++void CCWlSeat::setName(F<void(CCWlSeat*, const char*)> handler) {+ requests.name = handler;+}++static void _CWlPointerEnter(void* data, void* resource, uint32_t serial, wl_proxy* surface, wl_fixed_t surface_x, wl_fixed_t surface_y) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.enter)+ PO->requests.enter(PO, serial, surface, surface_x, surface_y);+}++static void _CWlPointerLeave(void* data, void* resource, uint32_t serial, wl_proxy* surface) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.leave)+ PO->requests.leave(PO, serial, surface);+}++static void _CWlPointerMotion(void* data, void* resource, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.motion)+ PO->requests.motion(PO, time, surface_x, surface_y);+}++static void _CWlPointerButton(void* data, void* resource, uint32_t serial, uint32_t time, uint32_t button, enum wl_pointer_button_state state) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.button)+ PO->requests.button(PO, serial, time, button, state);+}++static void _CWlPointerAxis(void* data, void* resource, uint32_t time, enum wl_pointer_axis axis, wl_fixed_t value) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axis)+ PO->requests.axis(PO, time, axis, value);+}++static void _CWlPointerFrame(void* data, void* resource) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.frame)+ PO->requests.frame(PO);+}++static void _CWlPointerAxisSource(void* data, void* resource, enum wl_pointer_axis_source axis_source) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axisSource)+ PO->requests.axisSource(PO, axis_source);+}++static void _CWlPointerAxisStop(void* data, void* resource, uint32_t time, enum wl_pointer_axis axis) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axisStop)+ PO->requests.axisStop(PO, time, axis);+}++static void _CWlPointerAxisDiscrete(void* data, void* resource, enum wl_pointer_axis axis, int32_t discrete) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axisDiscrete)+ PO->requests.axisDiscrete(PO, axis, discrete);+}++static void _CWlPointerAxisValue120(void* data, void* resource, enum wl_pointer_axis axis, int32_t value120) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axisValue120)+ PO->requests.axisValue120(PO, axis, value120);+}++static void _CWlPointerAxisRelativeDirection(void* data, void* resource, enum wl_pointer_axis axis, enum wl_pointer_axis_relative_direction direction) {+ const auto PO = (CCWlPointer*)data;+ if (PO && PO->requests.axisRelativeDirection)+ PO->requests.axisRelativeDirection(PO, axis, direction);+}++static const void* _CCWlPointerVTable[] = {+ (void*)_CWlPointerEnter,+ (void*)_CWlPointerLeave,+ (void*)_CWlPointerMotion,+ (void*)_CWlPointerButton,+ (void*)_CWlPointerAxis,+ (void*)_CWlPointerFrame,+ (void*)_CWlPointerAxisSource,+ (void*)_CWlPointerAxisStop,+ (void*)_CWlPointerAxisDiscrete,+ (void*)_CWlPointerAxisValue120,+ (void*)_CWlPointerAxisRelativeDirection,+};++void CCWlPointer::sendSetCursor(uint32_t serial, CCWlSurface* surface, int32_t hotspot_x, int32_t hotspot_y) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, serial, surface ? surface->pResource : nullptr, hotspot_x, hotspot_y);+ proxy;+}++void CCWlPointer::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlPointerSetCursorTypes[] = {+ nullptr,+ &wl_surface_interface,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerEnterTypes[] = {+ nullptr,+ &wl_surface_interface,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerLeaveTypes[] = {+ nullptr,+ &wl_surface_interface,+};+static const wl_interface* _CWlPointerMotionTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerButtonTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerAxisTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerAxisSourceTypes[] = {+ nullptr,+};+static const wl_interface* _CWlPointerAxisStopTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerAxisDiscreteTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerAxisValue120Types[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlPointerAxisRelativeDirectionTypes[] = {+ nullptr,+ nullptr,+};++static const wl_message _CWlPointerRequests[] = {+ { .name = "set_cursor", .signature = "u?oii", .types = _CWlPointerSetCursorTypes + 0},+ { .name = "release", .signature = "3", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlPointerEvents[] = {+ { .name = "enter", .signature = "uoff", .types = _CWlPointerEnterTypes + 0},+ { .name = "leave", .signature = "uo", .types = _CWlPointerLeaveTypes + 0},+ { .name = "motion", .signature = "uff", .types = _CWlPointerMotionTypes + 0},+ { .name = "button", .signature = "uuuu", .types = _CWlPointerButtonTypes + 0},+ { .name = "axis", .signature = "uuf", .types = _CWlPointerAxisTypes + 0},+ { .name = "frame", .signature = "5", .types = wayland_dummyTypes + 0},+ { .name = "axis_source", .signature = "5u", .types = _CWlPointerAxisSourceTypes + 0},+ { .name = "axis_stop", .signature = "5uu", .types = _CWlPointerAxisStopTypes + 0},+ { .name = "axis_discrete", .signature = "5ui", .types = _CWlPointerAxisDiscreteTypes + 0},+ { .name = "axis_value120", .signature = "8ui", .types = _CWlPointerAxisValue120Types + 0},+ { .name = "axis_relative_direction", .signature = "9uu", .types = _CWlPointerAxisRelativeDirectionTypes + 0},+};++const wl_interface wl_pointer_interface = {+ .name = "wl_pointer", .version = 10,+ .method_count = 2, .methods = _CWlPointerRequests,+ .event_count = 11, .events = _CWlPointerEvents,+};++CCWlPointer::CCWlPointer(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlPointerVTable, this);+}++CCWlPointer::~CCWlPointer() {+ if (!destroyed)+ sendRelease();+}++void CCWlPointer::setEnter(F<void(CCWlPointer*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t)> handler) {+ requests.enter = handler;+}++void CCWlPointer::setLeave(F<void(CCWlPointer*, uint32_t, wl_proxy*)> handler) {+ requests.leave = handler;+}++void CCWlPointer::setMotion(F<void(CCWlPointer*, uint32_t, wl_fixed_t, wl_fixed_t)> handler) {+ requests.motion = handler;+}++void CCWlPointer::setButton(F<void(CCWlPointer*, uint32_t, uint32_t, uint32_t, enum wl_pointer_button_state)> handler) {+ requests.button = handler;+}++void CCWlPointer::setAxis(F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis, wl_fixed_t)> handler) {+ requests.axis = handler;+}++void CCWlPointer::setFrame(F<void(CCWlPointer*)> handler) {+ requests.frame = handler;+}++void CCWlPointer::setAxisSource(F<void(CCWlPointer*, enum wl_pointer_axis_source)> handler) {+ requests.axisSource = handler;+}++void CCWlPointer::setAxisStop(F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis)> handler) {+ requests.axisStop = handler;+}++void CCWlPointer::setAxisDiscrete(F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> handler) {+ requests.axisDiscrete = handler;+}++void CCWlPointer::setAxisValue120(F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> handler) {+ requests.axisValue120 = handler;+}++void CCWlPointer::setAxisRelativeDirection(F<void(CCWlPointer*, enum wl_pointer_axis, enum wl_pointer_axis_relative_direction)> handler) {+ requests.axisRelativeDirection = handler;+}++static void _CWlKeyboardKeymap(void* data, void* resource, enum wl_keyboard_keymap_format format, int32_t fd, uint32_t size) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.keymap)+ PO->requests.keymap(PO, format, fd, size);+}++static void _CWlKeyboardEnter(void* data, void* resource, uint32_t serial, wl_proxy* surface, wl_array* keys) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.enter)+ PO->requests.enter(PO, serial, surface, keys);+}++static void _CWlKeyboardLeave(void* data, void* resource, uint32_t serial, wl_proxy* surface) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.leave)+ PO->requests.leave(PO, serial, surface);+}++static void _CWlKeyboardKey(void* data, void* resource, uint32_t serial, uint32_t time, uint32_t key, enum wl_keyboard_key_state state) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.key)+ PO->requests.key(PO, serial, time, key, state);+}++static void _CWlKeyboardModifiers(void* data, void* resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.modifiers)+ PO->requests.modifiers(PO, serial, mods_depressed, mods_latched, mods_locked, group);+}++static void _CWlKeyboardRepeatInfo(void* data, void* resource, int32_t rate, int32_t delay) {+ const auto PO = (CCWlKeyboard*)data;+ if (PO && PO->requests.repeatInfo)+ PO->requests.repeatInfo(PO, rate, delay);+}++static const void* _CCWlKeyboardVTable[] = {+ (void*)_CWlKeyboardKeymap,+ (void*)_CWlKeyboardEnter,+ (void*)_CWlKeyboardLeave,+ (void*)_CWlKeyboardKey,+ (void*)_CWlKeyboardModifiers,+ (void*)_CWlKeyboardRepeatInfo,+};++void CCWlKeyboard::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlKeyboardKeymapTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlKeyboardEnterTypes[] = {+ nullptr,+ &wl_surface_interface,+ nullptr,+};+static const wl_interface* _CWlKeyboardLeaveTypes[] = {+ nullptr,+ &wl_surface_interface,+};+static const wl_interface* _CWlKeyboardKeyTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlKeyboardModifiersTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlKeyboardRepeatInfoTypes[] = {+ nullptr,+ nullptr,+};++static const wl_message _CWlKeyboardRequests[] = {+ { .name = "release", .signature = "3", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlKeyboardEvents[] = {+ { .name = "keymap", .signature = "uhu", .types = _CWlKeyboardKeymapTypes + 0},+ { .name = "enter", .signature = "uoa", .types = _CWlKeyboardEnterTypes + 0},+ { .name = "leave", .signature = "uo", .types = _CWlKeyboardLeaveTypes + 0},+ { .name = "key", .signature = "uuuu", .types = _CWlKeyboardKeyTypes + 0},+ { .name = "modifiers", .signature = "uuuuu", .types = _CWlKeyboardModifiersTypes + 0},+ { .name = "repeat_info", .signature = "4ii", .types = _CWlKeyboardRepeatInfoTypes + 0},+};++const wl_interface wl_keyboard_interface = {+ .name = "wl_keyboard", .version = 10,+ .method_count = 1, .methods = _CWlKeyboardRequests,+ .event_count = 6, .events = _CWlKeyboardEvents,+};++CCWlKeyboard::CCWlKeyboard(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlKeyboardVTable, this);+}++CCWlKeyboard::~CCWlKeyboard() {+ if (!destroyed)+ sendRelease();+}++void CCWlKeyboard::setKeymap(F<void(CCWlKeyboard*, enum wl_keyboard_keymap_format, int32_t, uint32_t)> handler) {+ requests.keymap = handler;+}++void CCWlKeyboard::setEnter(F<void(CCWlKeyboard*, uint32_t, wl_proxy*, wl_array*)> handler) {+ requests.enter = handler;+}++void CCWlKeyboard::setLeave(F<void(CCWlKeyboard*, uint32_t, wl_proxy*)> handler) {+ requests.leave = handler;+}++void CCWlKeyboard::setKey(F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, enum wl_keyboard_key_state)> handler) {+ requests.key = handler;+}++void CCWlKeyboard::setModifiers(F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> handler) {+ requests.modifiers = handler;+}++void CCWlKeyboard::setRepeatInfo(F<void(CCWlKeyboard*, int32_t, int32_t)> handler) {+ requests.repeatInfo = handler;+}++static void _CWlTouchDown(void* data, void* resource, uint32_t serial, uint32_t time, wl_proxy* surface, int32_t id, wl_fixed_t x, wl_fixed_t y) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.down)+ PO->requests.down(PO, serial, time, surface, id, x, y);+}++static void _CWlTouchUp(void* data, void* resource, uint32_t serial, uint32_t time, int32_t id) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.up)+ PO->requests.up(PO, serial, time, id);+}++static void _CWlTouchMotion(void* data, void* resource, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.motion)+ PO->requests.motion(PO, time, id, x, y);+}++static void _CWlTouchFrame(void* data, void* resource) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.frame)+ PO->requests.frame(PO);+}++static void _CWlTouchCancel(void* data, void* resource) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.cancel)+ PO->requests.cancel(PO);+}++static void _CWlTouchShape(void* data, void* resource, int32_t id, wl_fixed_t major, wl_fixed_t minor) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.shape)+ PO->requests.shape(PO, id, major, minor);+}++static void _CWlTouchOrientation(void* data, void* resource, int32_t id, wl_fixed_t orientation) {+ const auto PO = (CCWlTouch*)data;+ if (PO && PO->requests.orientation)+ PO->requests.orientation(PO, id, orientation);+}++static const void* _CCWlTouchVTable[] = {+ (void*)_CWlTouchDown,+ (void*)_CWlTouchUp,+ (void*)_CWlTouchMotion,+ (void*)_CWlTouchFrame,+ (void*)_CWlTouchCancel,+ (void*)_CWlTouchShape,+ (void*)_CWlTouchOrientation,+};++void CCWlTouch::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlTouchDownTypes[] = {+ nullptr,+ nullptr,+ &wl_surface_interface,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlTouchUpTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlTouchMotionTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlTouchShapeTypes[] = {+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlTouchOrientationTypes[] = {+ nullptr,+ nullptr,+};++static const wl_message _CWlTouchRequests[] = {+ { .name = "release", .signature = "3", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlTouchEvents[] = {+ { .name = "down", .signature = "uuoiff", .types = _CWlTouchDownTypes + 0},+ { .name = "up", .signature = "uui", .types = _CWlTouchUpTypes + 0},+ { .name = "motion", .signature = "uiff", .types = _CWlTouchMotionTypes + 0},+ { .name = "frame", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "cancel", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "shape", .signature = "6iff", .types = _CWlTouchShapeTypes + 0},+ { .name = "orientation", .signature = "6if", .types = _CWlTouchOrientationTypes + 0},+};++const wl_interface wl_touch_interface = {+ .name = "wl_touch", .version = 10,+ .method_count = 1, .methods = _CWlTouchRequests,+ .event_count = 7, .events = _CWlTouchEvents,+};++CCWlTouch::CCWlTouch(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlTouchVTable, this);+}++CCWlTouch::~CCWlTouch() {+ if (!destroyed)+ sendRelease();+}++void CCWlTouch::setDown(F<void(CCWlTouch*, uint32_t, uint32_t, wl_proxy*, int32_t, wl_fixed_t, wl_fixed_t)> handler) {+ requests.down = handler;+}++void CCWlTouch::setUp(F<void(CCWlTouch*, uint32_t, uint32_t, int32_t)> handler) {+ requests.up = handler;+}++void CCWlTouch::setMotion(F<void(CCWlTouch*, uint32_t, int32_t, wl_fixed_t, wl_fixed_t)> handler) {+ requests.motion = handler;+}++void CCWlTouch::setFrame(F<void(CCWlTouch*)> handler) {+ requests.frame = handler;+}++void CCWlTouch::setCancel(F<void(CCWlTouch*)> handler) {+ requests.cancel = handler;+}++void CCWlTouch::setShape(F<void(CCWlTouch*, int32_t, wl_fixed_t, wl_fixed_t)> handler) {+ requests.shape = handler;+}++void CCWlTouch::setOrientation(F<void(CCWlTouch*, int32_t, wl_fixed_t)> handler) {+ requests.orientation = handler;+}++static void _CWlOutputGeometry(void* data, void* resource, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char* make, const char* model, int32_t transform) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.geometry)+ PO->requests.geometry(PO, x, y, physical_width, physical_height, subpixel, make, model, transform);+}++static void _CWlOutputMode(void* data, void* resource, enum wl_output_mode flags, int32_t width, int32_t height, int32_t refresh) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.mode)+ PO->requests.mode(PO, flags, width, height, refresh);+}++static void _CWlOutputDone(void* data, void* resource) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.done)+ PO->requests.done(PO);+}++static void _CWlOutputScale(void* data, void* resource, int32_t factor) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.scale)+ PO->requests.scale(PO, factor);+}++static void _CWlOutputName(void* data, void* resource, const char* name) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.name)+ PO->requests.name(PO, name);+}++static void _CWlOutputDescription(void* data, void* resource, const char* description) {+ const auto PO = (CCWlOutput*)data;+ if (PO && PO->requests.description)+ PO->requests.description(PO, description);+}++static const void* _CCWlOutputVTable[] = {+ (void*)_CWlOutputGeometry,+ (void*)_CWlOutputMode,+ (void*)_CWlOutputDone,+ (void*)_CWlOutputScale,+ (void*)_CWlOutputName,+ (void*)_CWlOutputDescription,+};++void CCWlOutput::sendRelease() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CWlOutputGeometryTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlOutputModeTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlOutputScaleTypes[] = {+ nullptr,+};+static const wl_interface* _CWlOutputNameTypes[] = {+ nullptr,+};+static const wl_interface* _CWlOutputDescriptionTypes[] = {+ nullptr,+};++static const wl_message _CWlOutputRequests[] = {+ { .name = "release", .signature = "3", .types = wayland_dummyTypes + 0},+};++static const wl_message _CWlOutputEvents[] = {+ { .name = "geometry", .signature = "iiiiissi", .types = _CWlOutputGeometryTypes + 0},+ { .name = "mode", .signature = "uiii", .types = _CWlOutputModeTypes + 0},+ { .name = "done", .signature = "2", .types = wayland_dummyTypes + 0},+ { .name = "scale", .signature = "2i", .types = _CWlOutputScaleTypes + 0},+ { .name = "name", .signature = "4s", .types = _CWlOutputNameTypes + 0},+ { .name = "description", .signature = "4s", .types = _CWlOutputDescriptionTypes + 0},+};++const wl_interface wl_output_interface = {+ .name = "wl_output", .version = 4,+ .method_count = 1, .methods = _CWlOutputRequests,+ .event_count = 6, .events = _CWlOutputEvents,+};++CCWlOutput::CCWlOutput(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlOutputVTable, this);+}++CCWlOutput::~CCWlOutput() {+ if (!destroyed)+ sendRelease();+}++void CCWlOutput::setGeometry(F<void(CCWlOutput*, int32_t, int32_t, int32_t, int32_t, int32_t, const char*, const char*, int32_t)> handler) {+ requests.geometry = handler;+}++void CCWlOutput::setMode(F<void(CCWlOutput*, enum wl_output_mode, int32_t, int32_t, int32_t)> handler) {+ requests.mode = handler;+}++void CCWlOutput::setDone(F<void(CCWlOutput*)> handler) {+ requests.done = handler;+}++void CCWlOutput::setScale(F<void(CCWlOutput*, int32_t)> handler) {+ requests.scale = handler;+}++void CCWlOutput::setName(F<void(CCWlOutput*, const char*)> handler) {+ requests.name = handler;+}++void CCWlOutput::setDescription(F<void(CCWlOutput*, const char*)> handler) {+ requests.description = handler;+}++static const void* _CCWlRegionVTable[] = {+ nullptr,+};++void CCWlRegion::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlRegion::sendAdd(int32_t x, int32_t y, int32_t width, int32_t height) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, x, y, width, height);+ proxy;+}++void CCWlRegion::sendSubtract(int32_t x, int32_t y, int32_t width, int32_t height) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, x, y, width, height);+ proxy;+}+static const wl_interface* _CWlRegionAddTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};+static const wl_interface* _CWlRegionSubtractTypes[] = {+ nullptr,+ nullptr,+ nullptr,+ nullptr,+};++static const wl_message _CWlRegionRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "add", .signature = "iiii", .types = _CWlRegionAddTypes + 0},+ { .name = "subtract", .signature = "iiii", .types = _CWlRegionSubtractTypes + 0},+};++const wl_interface wl_region_interface = {+ .name = "wl_region", .version = 1,+ .method_count = 3, .methods = _CWlRegionRequests,+ .event_count = 0, .events = nullptr,+};++CCWlRegion::CCWlRegion(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlRegionVTable, this);+}++CCWlRegion::~CCWlRegion() {+ if (!destroyed)+ sendDestroy();+}++static const void* _CCWlSubcompositorVTable[] = {+ nullptr,+};++void CCWlSubcompositor::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++wl_proxy* CCWlSubcompositor::sendGetSubsurface(CCWlSurface* surface, CCWlSurface* parent) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &wl_subsurface_interface, wl_proxy_get_version(pResource), 0, nullptr, surface ? surface->pResource : nullptr, parent ? parent->pResource : nullptr);++ return proxy;+}+static const wl_interface* _CWlSubcompositorGetSubsurfaceTypes[] = {+ &wl_subsurface_interface,+ &wl_surface_interface,+ &wl_surface_interface,+};++static const wl_message _CWlSubcompositorRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "get_subsurface", .signature = "noo", .types = _CWlSubcompositorGetSubsurfaceTypes + 0},+};++const wl_interface wl_subcompositor_interface = {+ .name = "wl_subcompositor", .version = 1,+ .method_count = 2, .methods = _CWlSubcompositorRequests,+ .event_count = 0, .events = nullptr,+};++CCWlSubcompositor::CCWlSubcompositor(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlSubcompositorVTable, this);+}++CCWlSubcompositor::~CCWlSubcompositor() {+ if (!destroyed)+ sendDestroy();+}++static const void* _CCWlSubsurfaceVTable[] = {+ nullptr,+};++void CCWlSubsurface::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlSubsurface::sendSetPosition(int32_t x, int32_t y) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, x, y);+ proxy;+}++void CCWlSubsurface::sendPlaceAbove(CCWlSurface* sibling) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, sibling ? sibling->pResource : nullptr);+ proxy;+}++void CCWlSubsurface::sendPlaceBelow(CCWlSurface* sibling) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 3, nullptr, wl_proxy_get_version(pResource), 0, sibling ? sibling->pResource : nullptr);+ proxy;+}++void CCWlSubsurface::sendSetSync() {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 4, nullptr, wl_proxy_get_version(pResource), 0);+ proxy;+}++void CCWlSubsurface::sendSetDesync() {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 5, nullptr, wl_proxy_get_version(pResource), 0);+ proxy;+}+static const wl_interface* _CWlSubsurfaceSetPositionTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CWlSubsurfacePlaceAboveTypes[] = {+ &wl_surface_interface,+};+static const wl_interface* _CWlSubsurfacePlaceBelowTypes[] = {+ &wl_surface_interface,+};++static const wl_message _CWlSubsurfaceRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "set_position", .signature = "ii", .types = _CWlSubsurfaceSetPositionTypes + 0},+ { .name = "place_above", .signature = "o", .types = _CWlSubsurfacePlaceAboveTypes + 0},+ { .name = "place_below", .signature = "o", .types = _CWlSubsurfacePlaceBelowTypes + 0},+ { .name = "set_sync", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "set_desync", .signature = "", .types = wayland_dummyTypes + 0},+};++const wl_interface wl_subsurface_interface = {+ .name = "wl_subsurface", .version = 1,+ .method_count = 6, .methods = _CWlSubsurfaceRequests,+ .event_count = 0, .events = nullptr,+};++CCWlSubsurface::CCWlSubsurface(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlSubsurfaceVTable, this);+}++CCWlSubsurface::~CCWlSubsurface() {+ if (!destroyed)+ sendDestroy();+}++static const void* _CCWlFixesVTable[] = {+ nullptr,+};++void CCWlFixes::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCWlFixes::sendDestroyRegistry(CCWlRegistry* registry) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 0, registry ? registry->pResource : nullptr);+ proxy;+}+static const wl_interface* _CWlFixesDestroyRegistryTypes[] = {+ &wl_registry_interface,+};++static const wl_message _CWlFixesRequests[] = {+ { .name = "destroy", .signature = "", .types = wayland_dummyTypes + 0},+ { .name = "destroy_registry", .signature = "o", .types = _CWlFixesDestroyRegistryTypes + 0},+};++const wl_interface wl_fixes_interface = {+ .name = "wl_fixes", .version = 1,+ .method_count = 2, .methods = _CWlFixesRequests,+ .event_count = 0, .events = nullptr,+};++CCWlFixes::CCWlFixes(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCWlFixesVTable, this);+}++CCWlFixes::~CCWlFixes() {+ if (!destroyed)+ sendDestroy();+}++#undef Fdiff --git a/src/core/src/wayland_protocols/wayland.hpp b/src/core/src/wayland_protocols/wayland.hppnew file mode 100644index 0000000..2aac0fc--- /dev/null+++ b/src/core/src/wayland_protocols/wayland.hpp@@ -0,0 +1,1486 @@+// Generated with hyprwayland-scanner 0.4.5. Made with vaxry's keyboard and ❤️.+// wayland++/*+ This protocol's authors' copyright notice is:+++ Copyright © 2008-2011 Kristian Høgsberg+ Copyright © 2010-2011 Intel Corporation+ Copyright © 2012-2013 Collabora, Ltd.++ Permission is hereby granted, free of charge, to any person+ obtaining a copy of this software and associated documentation files+ (the "Software"), to deal in the Software without restriction,+ including without limitation the rights to use, copy, modify, merge,+ publish, distribute, sublicense, and/or sell copies of the Software,+ and to permit persons to whom the Software is furnished to do so,+ subject to the following conditions:++ The above copyright notice and this permission notice (including the+ next paragraph) shall be included in all copies or substantial+ portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.++*/++#pragma once++#include <functional>+#include <cstdint>+#include <string>+#include <wayland-client.h>++#define F std::function++struct wl_proxy;+++class CCWlDisplay;+class CCWlCallback;+class CCWlRegistry;+class CCWlRegistry;+class CCWlCallback;+class CCWlCompositor;+class CCWlSurface;+class CCWlRegion;+class CCWlShmPool;+class CCWlBuffer;+class CCWlShm;+class CCWlShmPool;+class CCWlBuffer;+class CCWlDataOffer;+class CCWlDataSource;+class CCWlDataDevice;+class CCWlDataSource;+class CCWlSurface;+class CCWlSurface;+class CCWlDataSource;+class CCWlDataOffer;+class CCWlSurface;+class CCWlDataOffer;+class CCWlDataOffer;+class CCWlDataDeviceManager;+class CCWlDataSource;+class CCWlDataDevice;+class CCWlSeat;+class CCWlShell;+class CCWlShellSurface;+class CCWlSurface;+class CCWlShellSurface;+class CCWlSeat;+class CCWlSeat;+class CCWlSurface;+class CCWlOutput;+class CCWlSeat;+class CCWlSurface;+class CCWlOutput;+class CCWlSurface;+class CCWlBuffer;+class CCWlCallback;+class CCWlRegion;+class CCWlRegion;+class CCWlOutput;+class CCWlOutput;+class CCWlSeat;+class CCWlPointer;+class CCWlKeyboard;+class CCWlTouch;+class CCWlPointer;+class CCWlSurface;+class CCWlSurface;+class CCWlSurface;+class CCWlKeyboard;+class CCWlSurface;+class CCWlSurface;+class CCWlTouch;+class CCWlSurface;+class CCWlOutput;+class CCWlRegion;+class CCWlSubcompositor;+class CCWlSubsurface;+class CCWlSurface;+class CCWlSurface;+class CCWlSubsurface;+class CCWlSurface;+class CCWlSurface;+class CCWlFixes;+class CCWlRegistry;++#ifndef HYPRWAYLAND_SCANNER_NO_INTERFACES+extern const wl_interface wl_display_interface;+extern const wl_interface wl_registry_interface;+extern const wl_interface wl_callback_interface;+extern const wl_interface wl_compositor_interface;+extern const wl_interface wl_shm_pool_interface;+extern const wl_interface wl_shm_interface;+extern const wl_interface wl_buffer_interface;+extern const wl_interface wl_data_offer_interface;+extern const wl_interface wl_data_source_interface;+extern const wl_interface wl_data_device_interface;+extern const wl_interface wl_data_device_manager_interface;+extern const wl_interface wl_shell_interface;+extern const wl_interface wl_shell_surface_interface;+extern const wl_interface wl_surface_interface;+extern const wl_interface wl_seat_interface;+extern const wl_interface wl_pointer_interface;+extern const wl_interface wl_keyboard_interface;+extern const wl_interface wl_touch_interface;+extern const wl_interface wl_output_interface;+extern const wl_interface wl_region_interface;+extern const wl_interface wl_subcompositor_interface;+extern const wl_interface wl_subsurface_interface;+extern const wl_interface wl_fixes_interface;++#endif+++class CCWlDisplay {+ public:+ CCWlDisplay(wl_proxy*);+ ~CCWlDisplay();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setError(F<void(CCWlDisplay*, wl_proxy*, uint32_t, const char*)> handler);+ void setDeleteId(F<void(CCWlDisplay*, uint32_t)> handler);++ // --------------- Events --------------- //++ wl_proxy* sendSync();+ wl_proxy* sendGetRegistry();++ private:+ struct {+ F<void(CCWlDisplay*, wl_proxy*, uint32_t, const char*)> error;+ F<void(CCWlDisplay*, uint32_t)> deleteId;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlRegistry {+ public:+ CCWlRegistry(wl_proxy*);+ ~CCWlRegistry();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setGlobal(F<void(CCWlRegistry*, uint32_t, const char*, uint32_t)> handler);+ void setGlobalRemove(F<void(CCWlRegistry*, uint32_t)> handler);++ // --------------- Events --------------- //++ void sendBind(uint32_t);++ private:+ struct {+ F<void(CCWlRegistry*, uint32_t, const char*, uint32_t)> global;+ F<void(CCWlRegistry*, uint32_t)> globalRemove;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlCallback {+ public:+ CCWlCallback(wl_proxy*);+ ~CCWlCallback();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setDone(F<void(CCWlCallback*, uint32_t)> handler);++ // --------------- Events --------------- //+++ private:+ struct {+ F<void(CCWlCallback*, uint32_t)> done;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlCompositor {+ public:+ CCWlCompositor(wl_proxy*);+ ~CCWlCompositor();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ wl_proxy* sendCreateSurface();+ wl_proxy* sendCreateRegion();++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlShmPool {+ public:+ CCWlShmPool(wl_proxy*);+ ~CCWlShmPool();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ wl_proxy* sendCreateBuffer(int32_t, int32_t, int32_t, int32_t, uint32_t);+ void sendDestroy();+ void sendResize(int32_t);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlShm {+ public:+ CCWlShm(wl_proxy*);+ ~CCWlShm();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setFormat(F<void(CCWlShm*, enum wl_shm_format)> handler);++ // --------------- Events --------------- //++ wl_proxy* sendCreatePool(int32_t, int32_t);+ void sendRelease();++ private:+ struct {+ F<void(CCWlShm*, enum wl_shm_format)> format;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlBuffer {+ public:+ CCWlBuffer(wl_proxy*);+ ~CCWlBuffer();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setRelease(F<void(CCWlBuffer*)> handler);++ // --------------- Events --------------- //++ void sendDestroy();++ private:+ struct {+ F<void(CCWlBuffer*)> release;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlDataOffer {+ public:+ CCWlDataOffer(wl_proxy*);+ ~CCWlDataOffer();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setOffer(F<void(CCWlDataOffer*, const char*)> handler);+ void setSourceActions(F<void(CCWlDataOffer*, uint32_t)> handler);+ void setAction(F<void(CCWlDataOffer*, uint32_t)> handler);++ // --------------- Events --------------- //++ void sendAccept(uint32_t, const char*);+ void sendReceive(const char*, int32_t);+ void sendDestroy();+ void sendFinish();+ void sendSetActions(uint32_t, uint32_t);++ private:+ struct {+ F<void(CCWlDataOffer*, const char*)> offer;+ F<void(CCWlDataOffer*, uint32_t)> sourceActions;+ F<void(CCWlDataOffer*, uint32_t)> action;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlDataSource {+ public:+ CCWlDataSource(wl_proxy*);+ ~CCWlDataSource();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setTarget(F<void(CCWlDataSource*, const char*)> handler);+ void setSend(F<void(CCWlDataSource*, const char*, int32_t)> handler);+ void setCancelled(F<void(CCWlDataSource*)> handler);+ void setDndDropPerformed(F<void(CCWlDataSource*)> handler);+ void setDndFinished(F<void(CCWlDataSource*)> handler);+ void setAction(F<void(CCWlDataSource*, uint32_t)> handler);++ // --------------- Events --------------- //++ void sendOffer(const char*);+ void sendDestroy();+ void sendSetActions(uint32_t);++ private:+ struct {+ F<void(CCWlDataSource*, const char*)> target;+ F<void(CCWlDataSource*, const char*, int32_t)> send;+ F<void(CCWlDataSource*)> cancelled;+ F<void(CCWlDataSource*)> dndDropPerformed;+ F<void(CCWlDataSource*)> dndFinished;+ F<void(CCWlDataSource*, uint32_t)> action;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlDataDevice {+ public:+ CCWlDataDevice(wl_proxy*);+ ~CCWlDataDevice();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setDataOffer(F<void(CCWlDataDevice*, wl_proxy*)> handler);+ void setEnter(F<void(CCWlDataDevice*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t, wl_proxy*)> handler);+ void setLeave(F<void(CCWlDataDevice*)> handler);+ void setMotion(F<void(CCWlDataDevice*, uint32_t, wl_fixed_t, wl_fixed_t)> handler);+ void setDrop(F<void(CCWlDataDevice*)> handler);+ void setSelection(F<void(CCWlDataDevice*, wl_proxy*)> handler);++ // --------------- Events --------------- //++ void sendStartDrag(CCWlDataSource*, CCWlSurface*, CCWlSurface*, uint32_t);+ void sendSetSelection(CCWlDataSource*, uint32_t);+ void sendRelease();++ private:+ struct {+ F<void(CCWlDataDevice*, wl_proxy*)> dataOffer;+ F<void(CCWlDataDevice*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t, wl_proxy*)> enter;+ F<void(CCWlDataDevice*)> leave;+ F<void(CCWlDataDevice*, uint32_t, wl_fixed_t, wl_fixed_t)> motion;+ F<void(CCWlDataDevice*)> drop;+ F<void(CCWlDataDevice*, wl_proxy*)> selection;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlDataDeviceManager {+ public:+ CCWlDataDeviceManager(wl_proxy*);+ ~CCWlDataDeviceManager();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ wl_proxy* sendCreateDataSource();+ wl_proxy* sendGetDataDevice(CCWlSeat*);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlShell {+ public:+ CCWlShell(wl_proxy*);+ ~CCWlShell();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ wl_proxy* sendGetShellSurface(CCWlSurface*);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlShellSurface {+ public:+ CCWlShellSurface(wl_proxy*);+ ~CCWlShellSurface();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setPing(F<void(CCWlShellSurface*, uint32_t)> handler);+ void setConfigure(F<void(CCWlShellSurface*, enum wl_shell_surface_resize, int32_t, int32_t)> handler);+ void setPopupDone(F<void(CCWlShellSurface*)> handler);++ // --------------- Events --------------- //++ void sendPong(uint32_t);+ void sendMove(CCWlSeat*, uint32_t);+ void sendResize(CCWlSeat*, uint32_t, enum wl_shell_surface_resize);+ void sendSetToplevel();+ void sendSetTransient(CCWlSurface*, int32_t, int32_t, enum wl_shell_surface_transient);+ void sendSetFullscreen(enum wl_shell_surface_fullscreen_method, uint32_t, CCWlOutput*);+ void sendSetPopup(CCWlSeat*, uint32_t, CCWlSurface*, int32_t, int32_t, enum wl_shell_surface_transient);+ void sendSetMaximized(CCWlOutput*);+ void sendSetTitle(const char*);+ void sendSetClass(const char*);++ private:+ struct {+ F<void(CCWlShellSurface*, uint32_t)> ping;+ F<void(CCWlShellSurface*, enum wl_shell_surface_resize, int32_t, int32_t)> configure;+ F<void(CCWlShellSurface*)> popupDone;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlSurface {+ public:+ CCWlSurface(wl_proxy*);+ ~CCWlSurface();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setEnter(F<void(CCWlSurface*, wl_proxy*)> handler);+ void setLeave(F<void(CCWlSurface*, wl_proxy*)> handler);+ void setPreferredBufferScale(F<void(CCWlSurface*, int32_t)> handler);+ void setPreferredBufferTransform(F<void(CCWlSurface*, uint32_t)> handler);++ // --------------- Events --------------- //++ void sendDestroy();+ void sendAttach(CCWlBuffer*, int32_t, int32_t);+ void sendDamage(int32_t, int32_t, int32_t, int32_t);+ wl_proxy* sendFrame();+ void sendSetOpaqueRegion(CCWlRegion*);+ void sendSetInputRegion(CCWlRegion*);+ void sendCommit();+ void sendSetBufferTransform(int32_t);+ void sendSetBufferScale(int32_t);+ void sendDamageBuffer(int32_t, int32_t, int32_t, int32_t);+ void sendOffset(int32_t, int32_t);++ private:+ struct {+ F<void(CCWlSurface*, wl_proxy*)> enter;+ F<void(CCWlSurface*, wl_proxy*)> leave;+ F<void(CCWlSurface*, int32_t)> preferredBufferScale;+ F<void(CCWlSurface*, uint32_t)> preferredBufferTransform;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlSeat {+ public:+ CCWlSeat(wl_proxy*);+ ~CCWlSeat();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setCapabilities(F<void(CCWlSeat*, enum wl_seat_capability)> handler);+ void setName(F<void(CCWlSeat*, const char*)> handler);++ // --------------- Events --------------- //++ wl_proxy* sendGetPointer();+ wl_proxy* sendGetKeyboard();+ wl_proxy* sendGetTouch();+ void sendRelease();++ private:+ struct {+ F<void(CCWlSeat*, enum wl_seat_capability)> capabilities;+ F<void(CCWlSeat*, const char*)> name;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlPointer {+ public:+ CCWlPointer(wl_proxy*);+ ~CCWlPointer();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setEnter(F<void(CCWlPointer*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t)> handler);+ void setLeave(F<void(CCWlPointer*, uint32_t, wl_proxy*)> handler);+ void setMotion(F<void(CCWlPointer*, uint32_t, wl_fixed_t, wl_fixed_t)> handler);+ void setButton(F<void(CCWlPointer*, uint32_t, uint32_t, uint32_t, enum wl_pointer_button_state)> handler);+ void setAxis(F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis, wl_fixed_t)> handler);+ void setFrame(F<void(CCWlPointer*)> handler);+ void setAxisSource(F<void(CCWlPointer*, enum wl_pointer_axis_source)> handler);+ void setAxisStop(F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis)> handler);+ void setAxisDiscrete(F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> handler);+ void setAxisValue120(F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> handler);+ void setAxisRelativeDirection(F<void(CCWlPointer*, enum wl_pointer_axis, enum wl_pointer_axis_relative_direction)> handler);++ // --------------- Events --------------- //++ void sendSetCursor(uint32_t, CCWlSurface*, int32_t, int32_t);+ void sendRelease();++ private:+ struct {+ F<void(CCWlPointer*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t)> enter;+ F<void(CCWlPointer*, uint32_t, wl_proxy*)> leave;+ F<void(CCWlPointer*, uint32_t, wl_fixed_t, wl_fixed_t)> motion;+ F<void(CCWlPointer*, uint32_t, uint32_t, uint32_t, enum wl_pointer_button_state)> button;+ F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis, wl_fixed_t)> axis;+ F<void(CCWlPointer*)> frame;+ F<void(CCWlPointer*, enum wl_pointer_axis_source)> axisSource;+ F<void(CCWlPointer*, uint32_t, enum wl_pointer_axis)> axisStop;+ F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> axisDiscrete;+ F<void(CCWlPointer*, enum wl_pointer_axis, int32_t)> axisValue120;+ F<void(CCWlPointer*, enum wl_pointer_axis, enum wl_pointer_axis_relative_direction)> axisRelativeDirection;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlKeyboard {+ public:+ CCWlKeyboard(wl_proxy*);+ ~CCWlKeyboard();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setKeymap(F<void(CCWlKeyboard*, enum wl_keyboard_keymap_format, int32_t, uint32_t)> handler);+ void setEnter(F<void(CCWlKeyboard*, uint32_t, wl_proxy*, wl_array*)> handler);+ void setLeave(F<void(CCWlKeyboard*, uint32_t, wl_proxy*)> handler);+ void setKey(F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, enum wl_keyboard_key_state)> handler);+ void setModifiers(F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> handler);+ void setRepeatInfo(F<void(CCWlKeyboard*, int32_t, int32_t)> handler);++ // --------------- Events --------------- //++ void sendRelease();++ private:+ struct {+ F<void(CCWlKeyboard*, enum wl_keyboard_keymap_format, int32_t, uint32_t)> keymap;+ F<void(CCWlKeyboard*, uint32_t, wl_proxy*, wl_array*)> enter;+ F<void(CCWlKeyboard*, uint32_t, wl_proxy*)> leave;+ F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, enum wl_keyboard_key_state)> key;+ F<void(CCWlKeyboard*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> modifiers;+ F<void(CCWlKeyboard*, int32_t, int32_t)> repeatInfo;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlTouch {+ public:+ CCWlTouch(wl_proxy*);+ ~CCWlTouch();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setDown(F<void(CCWlTouch*, uint32_t, uint32_t, wl_proxy*, int32_t, wl_fixed_t, wl_fixed_t)> handler);+ void setUp(F<void(CCWlTouch*, uint32_t, uint32_t, int32_t)> handler);+ void setMotion(F<void(CCWlTouch*, uint32_t, int32_t, wl_fixed_t, wl_fixed_t)> handler);+ void setFrame(F<void(CCWlTouch*)> handler);+ void setCancel(F<void(CCWlTouch*)> handler);+ void setShape(F<void(CCWlTouch*, int32_t, wl_fixed_t, wl_fixed_t)> handler);+ void setOrientation(F<void(CCWlTouch*, int32_t, wl_fixed_t)> handler);++ // --------------- Events --------------- //++ void sendRelease();++ private:+ struct {+ F<void(CCWlTouch*, uint32_t, uint32_t, wl_proxy*, int32_t, wl_fixed_t, wl_fixed_t)> down;+ F<void(CCWlTouch*, uint32_t, uint32_t, int32_t)> up;+ F<void(CCWlTouch*, uint32_t, int32_t, wl_fixed_t, wl_fixed_t)> motion;+ F<void(CCWlTouch*)> frame;+ F<void(CCWlTouch*)> cancel;+ F<void(CCWlTouch*, int32_t, wl_fixed_t, wl_fixed_t)> shape;+ F<void(CCWlTouch*, int32_t, wl_fixed_t)> orientation;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlOutput {+ public:+ CCWlOutput(wl_proxy*);+ ~CCWlOutput();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setGeometry(F<void(CCWlOutput*, int32_t, int32_t, int32_t, int32_t, int32_t, const char*, const char*, int32_t)> handler);+ void setMode(F<void(CCWlOutput*, enum wl_output_mode, int32_t, int32_t, int32_t)> handler);+ void setDone(F<void(CCWlOutput*)> handler);+ void setScale(F<void(CCWlOutput*, int32_t)> handler);+ void setName(F<void(CCWlOutput*, const char*)> handler);+ void setDescription(F<void(CCWlOutput*, const char*)> handler);++ // --------------- Events --------------- //++ void sendRelease();++ private:+ struct {+ F<void(CCWlOutput*, int32_t, int32_t, int32_t, int32_t, int32_t, const char*, const char*, int32_t)> geometry;+ F<void(CCWlOutput*, enum wl_output_mode, int32_t, int32_t, int32_t)> mode;+ F<void(CCWlOutput*)> done;+ F<void(CCWlOutput*, int32_t)> scale;+ F<void(CCWlOutput*, const char*)> name;+ F<void(CCWlOutput*, const char*)> description;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlRegion {+ public:+ CCWlRegion(wl_proxy*);+ ~CCWlRegion();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ void sendDestroy();+ void sendAdd(int32_t, int32_t, int32_t, int32_t);+ void sendSubtract(int32_t, int32_t, int32_t, int32_t);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlSubcompositor {+ public:+ CCWlSubcompositor(wl_proxy*);+ ~CCWlSubcompositor();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ void sendDestroy();+ wl_proxy* sendGetSubsurface(CCWlSurface*, CCWlSurface*);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlSubsurface {+ public:+ CCWlSubsurface(wl_proxy*);+ ~CCWlSubsurface();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ void sendDestroy();+ void sendSetPosition(int32_t, int32_t);+ void sendPlaceAbove(CCWlSurface*);+ void sendPlaceBelow(CCWlSurface*);+ void sendSetSync();+ void sendSetDesync();++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCWlFixes {+ public:+ CCWlFixes(wl_proxy*);+ ~CCWlFixes();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ void sendDestroy();+ void sendDestroyRegistry(CCWlRegistry*);++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++#undef Fdiff --git a/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.cpp b/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.cppnew file mode 100644index 0000000..b37236a--- /dev/null+++ b/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.cpp@@ -0,0 +1,378 @@+// Generated with hyprwayland-scanner 0.4.5. Made with vaxry's keyboard and ❤️.+// wlr_data_control_unstable_v1++/*+ This protocol's authors' copyright notice is:+++ Copyright © 2018 Simon Ser+ Copyright © 2019 Ivan Molodetskikh++ Permission to use, copy, modify, distribute, and sell this+ software and its documentation for any purpose is hereby granted+ without fee, provided that the above copyright notice appear in+ all copies and that both that copyright notice and this permission+ notice appear in supporting documentation, and that the name of+ the copyright holders not be used in advertising or publicity+ pertaining to distribution of the software without specific,+ written prior permission. The copyright holders make no+ representations about the suitability of this software for any+ purpose. It is provided "as is" without express or implied+ warranty.++ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF+ THIS SOFTWARE.++*/++#define private public+#define HYPRWAYLAND_SCANNER_NO_INTERFACES+#include "wlr-data-control-unstable-v1.hpp"+#undef private+#define F std::function++static const wl_interface* wlrDataControlUnstableV1_dummyTypes[] = { nullptr };++// Reference all other interfaces.+// The reason why this is in snake is to+// be able to cooperate with existing+// wayland_scanner interfaces (they are interop)+extern const wl_interface zwlr_data_control_manager_v1_interface;+extern const wl_interface zwlr_data_control_device_v1_interface;+extern const wl_interface zwlr_data_control_source_v1_interface;+extern const wl_interface zwlr_data_control_offer_v1_interface;+extern const wl_interface wl_seat_interface;++static const void* _CCZwlrDataControlManagerV1VTable[] = {+ nullptr,+};++wl_proxy* CCZwlrDataControlManagerV1::sendCreateDataSource() {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, &zwlr_data_control_source_v1_interface, wl_proxy_get_version(pResource), 0, nullptr);++ return proxy;+}++wl_proxy* CCZwlrDataControlManagerV1::sendGetDataDevice(wl_proxy* seat) {+ if (!pResource)+ return nullptr;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, &zwlr_data_control_device_v1_interface, wl_proxy_get_version(pResource), 0, nullptr, seat);++ return proxy;+}++void CCZwlrDataControlManagerV1::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CZwlrDataControlManagerV1CreateDataSourceTypes[] = {+ &zwlr_data_control_source_v1_interface,+};+static const wl_interface* _CZwlrDataControlManagerV1GetDataDeviceTypes[] = {+ &zwlr_data_control_device_v1_interface,+ &wl_seat_interface,+};++static const wl_message _CZwlrDataControlManagerV1Requests[] = {+ { .name = "create_data_source", .signature = "n", .types = _CZwlrDataControlManagerV1CreateDataSourceTypes + 0},+ { .name = "get_data_device", .signature = "no", .types = _CZwlrDataControlManagerV1GetDataDeviceTypes + 0},+ { .name = "destroy", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+};++const wl_interface zwlr_data_control_manager_v1_interface = {+ .name = "zwlr_data_control_manager_v1", .version = 2,+ .method_count = 3, .methods = _CZwlrDataControlManagerV1Requests,+ .event_count = 0, .events = nullptr,+};++CCZwlrDataControlManagerV1::CCZwlrDataControlManagerV1(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCZwlrDataControlManagerV1VTable, this);+}++CCZwlrDataControlManagerV1::~CCZwlrDataControlManagerV1() {+ if (!destroyed)+ sendDestroy();+}++static void _CZwlrDataControlDeviceV1DataOffer(void* data, void* resource, wl_proxy* id) {+ const auto PO = (CCZwlrDataControlDeviceV1*)data;+ if (PO && PO->requests.dataOffer)+ PO->requests.dataOffer(PO, id);+}++static void _CZwlrDataControlDeviceV1Selection(void* data, void* resource, wl_proxy* id) {+ const auto PO = (CCZwlrDataControlDeviceV1*)data;+ if (PO && PO->requests.selection)+ PO->requests.selection(PO, id);+}++static void _CZwlrDataControlDeviceV1Finished(void* data, void* resource) {+ const auto PO = (CCZwlrDataControlDeviceV1*)data;+ if (PO && PO->requests.finished)+ PO->requests.finished(PO);+}++static void _CZwlrDataControlDeviceV1PrimarySelection(void* data, void* resource, wl_proxy* id) {+ const auto PO = (CCZwlrDataControlDeviceV1*)data;+ if (PO && PO->requests.primarySelection)+ PO->requests.primarySelection(PO, id);+}++static const void* _CCZwlrDataControlDeviceV1VTable[] = {+ (void*)_CZwlrDataControlDeviceV1DataOffer,+ (void*)_CZwlrDataControlDeviceV1Selection,+ (void*)_CZwlrDataControlDeviceV1Finished,+ (void*)_CZwlrDataControlDeviceV1PrimarySelection,+};++void CCZwlrDataControlDeviceV1::sendSetSelection(CCZwlrDataControlSourceV1* source) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, source ? source->pResource : nullptr);+ proxy;+}++void CCZwlrDataControlDeviceV1::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}++void CCZwlrDataControlDeviceV1::sendSetPrimarySelection(CCZwlrDataControlSourceV1* source) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 2, nullptr, wl_proxy_get_version(pResource), 0, source ? source->pResource : nullptr);+ proxy;+}+static const wl_interface* _CZwlrDataControlDeviceV1SetSelectionTypes[] = {+ &zwlr_data_control_source_v1_interface,+};+static const wl_interface* _CZwlrDataControlDeviceV1SetPrimarySelectionTypes[] = {+ &zwlr_data_control_source_v1_interface,+};+static const wl_interface* _CZwlrDataControlDeviceV1DataOfferTypes[] = {+ &zwlr_data_control_offer_v1_interface,+};+static const wl_interface* _CZwlrDataControlDeviceV1SelectionTypes[] = {+ &zwlr_data_control_offer_v1_interface,+};+static const wl_interface* _CZwlrDataControlDeviceV1PrimarySelectionTypes[] = {+ &zwlr_data_control_offer_v1_interface,+};++static const wl_message _CZwlrDataControlDeviceV1Requests[] = {+ { .name = "set_selection", .signature = "?o", .types = _CZwlrDataControlDeviceV1SetSelectionTypes + 0},+ { .name = "destroy", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+ { .name = "set_primary_selection", .signature = "2?o", .types = _CZwlrDataControlDeviceV1SetPrimarySelectionTypes + 0},+};++static const wl_message _CZwlrDataControlDeviceV1Events[] = {+ { .name = "data_offer", .signature = "n", .types = _CZwlrDataControlDeviceV1DataOfferTypes + 0},+ { .name = "selection", .signature = "?o", .types = _CZwlrDataControlDeviceV1SelectionTypes + 0},+ { .name = "finished", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+ { .name = "primary_selection", .signature = "2?o", .types = _CZwlrDataControlDeviceV1PrimarySelectionTypes + 0},+};++const wl_interface zwlr_data_control_device_v1_interface = {+ .name = "zwlr_data_control_device_v1", .version = 2,+ .method_count = 3, .methods = _CZwlrDataControlDeviceV1Requests,+ .event_count = 4, .events = _CZwlrDataControlDeviceV1Events,+};++CCZwlrDataControlDeviceV1::CCZwlrDataControlDeviceV1(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCZwlrDataControlDeviceV1VTable, this);+}++CCZwlrDataControlDeviceV1::~CCZwlrDataControlDeviceV1() {+ if (!destroyed)+ sendDestroy();+}++void CCZwlrDataControlDeviceV1::setDataOffer(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler) {+ requests.dataOffer = handler;+}++void CCZwlrDataControlDeviceV1::setSelection(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler) {+ requests.selection = handler;+}++void CCZwlrDataControlDeviceV1::setFinished(F<void(CCZwlrDataControlDeviceV1*)> handler) {+ requests.finished = handler;+}++void CCZwlrDataControlDeviceV1::setPrimarySelection(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler) {+ requests.primarySelection = handler;+}++static void _CZwlrDataControlSourceV1Send(void* data, void* resource, const char* mime_type, int32_t fd) {+ const auto PO = (CCZwlrDataControlSourceV1*)data;+ if (PO && PO->requests.send)+ PO->requests.send(PO, mime_type, fd);+}++static void _CZwlrDataControlSourceV1Cancelled(void* data, void* resource) {+ const auto PO = (CCZwlrDataControlSourceV1*)data;+ if (PO && PO->requests.cancelled)+ PO->requests.cancelled(PO);+}++static const void* _CCZwlrDataControlSourceV1VTable[] = {+ (void*)_CZwlrDataControlSourceV1Send,+ (void*)_CZwlrDataControlSourceV1Cancelled,+};++void CCZwlrDataControlSourceV1::sendOffer(const char* mime_type) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, mime_type);+ proxy;+}++void CCZwlrDataControlSourceV1::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CZwlrDataControlSourceV1OfferTypes[] = {+ nullptr,+};+static const wl_interface* _CZwlrDataControlSourceV1SendTypes[] = {+ nullptr,+ nullptr,+};++static const wl_message _CZwlrDataControlSourceV1Requests[] = {+ { .name = "offer", .signature = "s", .types = _CZwlrDataControlSourceV1OfferTypes + 0},+ { .name = "destroy", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+};++static const wl_message _CZwlrDataControlSourceV1Events[] = {+ { .name = "send", .signature = "sh", .types = _CZwlrDataControlSourceV1SendTypes + 0},+ { .name = "cancelled", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+};++const wl_interface zwlr_data_control_source_v1_interface = {+ .name = "zwlr_data_control_source_v1", .version = 1,+ .method_count = 2, .methods = _CZwlrDataControlSourceV1Requests,+ .event_count = 2, .events = _CZwlrDataControlSourceV1Events,+};++CCZwlrDataControlSourceV1::CCZwlrDataControlSourceV1(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCZwlrDataControlSourceV1VTable, this);+}++CCZwlrDataControlSourceV1::~CCZwlrDataControlSourceV1() {+ if (!destroyed)+ sendDestroy();+}++void CCZwlrDataControlSourceV1::setSend(F<void(CCZwlrDataControlSourceV1*, const char*, int32_t)> handler) {+ requests.send = handler;+}++void CCZwlrDataControlSourceV1::setCancelled(F<void(CCZwlrDataControlSourceV1*)> handler) {+ requests.cancelled = handler;+}++static void _CZwlrDataControlOfferV1Offer(void* data, void* resource, const char* mime_type) {+ const auto PO = (CCZwlrDataControlOfferV1*)data;+ if (PO && PO->requests.offer)+ PO->requests.offer(PO, mime_type);+}++static const void* _CCZwlrDataControlOfferV1VTable[] = {+ (void*)_CZwlrDataControlOfferV1Offer,+};++void CCZwlrDataControlOfferV1::sendReceive(const char* mime_type, int32_t fd) {+ if (!pResource)+ return;++ auto proxy = wl_proxy_marshal_flags(pResource, 0, nullptr, wl_proxy_get_version(pResource), 0, mime_type, fd);+ proxy;+}++void CCZwlrDataControlOfferV1::sendDestroy() {+ if (!pResource)+ return;+ destroyed = true;++ auto proxy = wl_proxy_marshal_flags(pResource, 1, nullptr, wl_proxy_get_version(pResource), 1);+ proxy;+}+static const wl_interface* _CZwlrDataControlOfferV1ReceiveTypes[] = {+ nullptr,+ nullptr,+};+static const wl_interface* _CZwlrDataControlOfferV1OfferTypes[] = {+ nullptr,+};++static const wl_message _CZwlrDataControlOfferV1Requests[] = {+ { .name = "receive", .signature = "sh", .types = _CZwlrDataControlOfferV1ReceiveTypes + 0},+ { .name = "destroy", .signature = "", .types = wlrDataControlUnstableV1_dummyTypes + 0},+};++static const wl_message _CZwlrDataControlOfferV1Events[] = {+ { .name = "offer", .signature = "s", .types = _CZwlrDataControlOfferV1OfferTypes + 0},+};++const wl_interface zwlr_data_control_offer_v1_interface = {+ .name = "zwlr_data_control_offer_v1", .version = 1,+ .method_count = 2, .methods = _CZwlrDataControlOfferV1Requests,+ .event_count = 1, .events = _CZwlrDataControlOfferV1Events,+};++CCZwlrDataControlOfferV1::CCZwlrDataControlOfferV1(wl_proxy* resource) : pResource(resource) {++ if (!pResource)+ return;++ wl_proxy_add_listener(pResource, (void (**)(void))&_CCZwlrDataControlOfferV1VTable, this);+}++CCZwlrDataControlOfferV1::~CCZwlrDataControlOfferV1() {+ if (!destroyed)+ sendDestroy();+}++void CCZwlrDataControlOfferV1::setOffer(F<void(CCZwlrDataControlOfferV1*, const char*)> handler) {+ requests.offer = handler;+}++#undef Fdiff --git a/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.hpp b/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.hppnew file mode 100644index 0000000..68c305a--- /dev/null+++ b/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.hpp@@ -0,0 +1,292 @@+// Generated with hyprwayland-scanner 0.4.5. Made with vaxry's keyboard and ❤️.+// wlr_data_control_unstable_v1++/*+ This protocol's authors' copyright notice is:+++ Copyright © 2018 Simon Ser+ Copyright © 2019 Ivan Molodetskikh++ Permission to use, copy, modify, distribute, and sell this+ software and its documentation for any purpose is hereby granted+ without fee, provided that the above copyright notice appear in+ all copies and that both that copyright notice and this permission+ notice appear in supporting documentation, and that the name of+ the copyright holders not be used in advertising or publicity+ pertaining to distribution of the software without specific,+ written prior permission. The copyright holders make no+ representations about the suitability of this software for any+ purpose. It is provided "as is" without express or implied+ warranty.++ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF+ THIS SOFTWARE.++*/++#pragma once++#include <functional>+#include <cstdint>+#include <string>+#include <wayland-client.h>++#define F std::function++struct wl_proxy;+++class CCZwlrDataControlManagerV1;+class CCZwlrDataControlSourceV1;+class CCZwlrDataControlDeviceV1;+class CCWlSeat;+class CCZwlrDataControlDeviceV1;+class CCZwlrDataControlSourceV1;+class CCZwlrDataControlSourceV1;+class CCZwlrDataControlOfferV1;+class CCZwlrDataControlOfferV1;+class CCZwlrDataControlOfferV1;+class CCZwlrDataControlSourceV1;+class CCZwlrDataControlOfferV1;++#ifndef HYPRWAYLAND_SCANNER_NO_INTERFACES+extern const wl_interface zwlr_data_control_manager_v1_interface;+extern const wl_interface zwlr_data_control_device_v1_interface;+extern const wl_interface zwlr_data_control_source_v1_interface;+extern const wl_interface zwlr_data_control_offer_v1_interface;++#endif+++class CCZwlrDataControlManagerV1 {+ public:+ CCZwlrDataControlManagerV1(wl_proxy*);+ ~CCZwlrDataControlManagerV1();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //+++ // --------------- Events --------------- //++ wl_proxy* sendCreateDataSource();+ wl_proxy* sendGetDataDevice(wl_proxy*);+ void sendDestroy();++ private:+ struct {+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCZwlrDataControlDeviceV1 {+ public:+ CCZwlrDataControlDeviceV1(wl_proxy*);+ ~CCZwlrDataControlDeviceV1();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setDataOffer(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler);+ void setSelection(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler);+ void setFinished(F<void(CCZwlrDataControlDeviceV1*)> handler);+ void setPrimarySelection(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler);++ // --------------- Events --------------- //++ void sendSetSelection(CCZwlrDataControlSourceV1*);+ void sendDestroy();+ void sendSetPrimarySelection(CCZwlrDataControlSourceV1*);++ private:+ struct {+ F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> dataOffer;+ F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> selection;+ F<void(CCZwlrDataControlDeviceV1*)> finished;+ F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> primarySelection;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCZwlrDataControlSourceV1 {+ public:+ CCZwlrDataControlSourceV1(wl_proxy*);+ ~CCZwlrDataControlSourceV1();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setSend(F<void(CCZwlrDataControlSourceV1*, const char*, int32_t)> handler);+ void setCancelled(F<void(CCZwlrDataControlSourceV1*)> handler);++ // --------------- Events --------------- //++ void sendOffer(const char*);+ void sendDestroy();++ private:+ struct {+ F<void(CCZwlrDataControlSourceV1*, const char*, int32_t)> send;+ F<void(CCZwlrDataControlSourceV1*)> cancelled;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++class CCZwlrDataControlOfferV1 {+ public:+ CCZwlrDataControlOfferV1(wl_proxy*);+ ~CCZwlrDataControlOfferV1();+++ // set the data for this resource+ void setData(void* data) {{+ pData = data;+ }}++ // get the data for this resource+ void* data() {{+ return pData;+ }}++ // get the raw wl_resource (wl_proxy) ptr+ wl_proxy* resource() {{+ return pResource;+ }}++ // get the raw wl_proxy ptr+ wl_proxy* proxy() {{+ return pResource;+ }}++ // get the resource version+ int version() {{+ return wl_proxy_get_version(pResource);+ }}++ // --------------- Requests --------------- //++ void setOffer(F<void(CCZwlrDataControlOfferV1*, const char*)> handler);++ // --------------- Events --------------- //++ void sendReceive(const char*, int32_t);+ void sendDestroy();++ private:+ struct {+ F<void(CCZwlrDataControlOfferV1*, const char*)> offer;+ } requests;++ wl_proxy* pResource = nullptr;++ bool destroyed = false;++ void* pData = nullptr;+};++++#undef Fdiff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txtnew file mode 100644index 0000000..73b804b--- /dev/null+++ b/src/daemon/CMakeLists.txt@@ -0,0 +1,8 @@+add_executable(tetherd+ main.cpp+)++target_link_libraries(tetherd PRIVATE tether_core)++# Output into root build dir instead of nested build/src/daemon+set_target_properties(tetherd PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")diff --git a/src/daemon/main.cpp b/src/daemon/main.cppnew file mode 100644index 0000000..2f52cd6--- /dev/null+++ b/src/daemon/main.cpp@@ -0,0 +1,67 @@+#include <iostream>+#include <tether/core.hpp>+#include <tether/net.hpp>+#include <tether/event_loop.hpp>+#include <tether/wayland.hpp>+#include <nlohmann/json.hpp>+#include <csignal>++tether::EpollEventLoop* g_loop = nullptr;++namespace tether {+ WaylandContext* g_wayland = nullptr;+}++void signal_handler(int) {+ if (g_loop) {+ std::cout << "\nStopping tetherd..." << std::endl;+ g_loop->stop();+ }+}++int main(int argc, char** argv) {+ std::cout << "tetherd version " << tether::get_version() << "\n";++ try {+ tether::ensure_single_instance();+ } catch(const std::exception& e) {+ std::cerr << "Initialization error: " << e.what() << std::endl;+ return 1;+ }++ // Capture Ctrl-C gracefully and stop the event loop+ std::signal(SIGINT, signal_handler);+ std::signal(SIGTERM, signal_handler);++ tether::EpollEventLoop loop;+ g_loop = &loop;++ tether::UnixServer unix_srv(loop);+ if (!unix_srv.start()) {+ std::cerr << "Failed to start Unix server" << std::endl;+ return 1;+ }++ tether::TcpServer tcp_srv(loop, 5134);+ if (!tcp_srv.start()) {+ std::cerr << "Failed to start TCP server" << std::endl;+ return 1;+ }++ tether::WaylandContext wayland_srv(loop);+ tether::g_wayland = &wayland_srv;+ if (wayland_srv.init()) {+ wayland_srv.set_clipboard_callback([](const std::string& text) {+ nlohmann::json j;+ j["command"] = "clipboard_updated";+ j["content"] = text;+ tether::broadcast_message(j.dump());+ });+ }++ std::cout << "tetherd is running. Press Ctrl-C to stop." << std::endl;+ loop.run();++ std::cout << "tetherd shutdown complete." << std::endl;+ return 0;+}diff --git a/src/gtk/CMakeLists.txt b/src/gtk/CMakeLists.txtnew file mode 100644index 0000000..437f2b2--- /dev/null+++ b/src/gtk/CMakeLists.txt@@ -0,0 +1,8 @@+add_executable(tether-gtk+ main.cpp+)++target_link_libraries(tether-gtk PRIVATE tether_core)++# Output into root build dir instead of nested build/src/gtk+set_target_properties(tether-gtk PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")diff --git a/src/gtk/main.cpp b/src/gtk/main.cppnew file mode 100644index 0000000..a01e258--- /dev/null+++ b/src/gtk/main.cpp@@ -0,0 +1,8 @@+#include <iostream>+#include <tether/core.hpp>++int main(int argc, char** argv) {+ std::cout << "tether-gtk version " << tether::get_version() << "\n";+ std::cout << "Starting GTK UI stub...\n";+ return 0;+}