Linux + iPhone Continuity / iMessage / SMS
fmt
Zack Bartelca9dbcf6f88e
diff --git a/src/core/include/tether/base64.hpp b/src/core/include/tether/base64.hppindex c29c09b..65ee6ba 100644--- a/src/core/include/tether/base64.hpp+++ b/src/core/include/tether/base64.hpp@@ -7,4 +7,4 @@ namespace tether {std::string base64_encode(const std::vector<unsigned char>& data);std::string base64_encode(const unsigned char* data, size_t len);std::vector<unsigned char> base64_decode(const std::string& input);-}+} // namespace tetherdiff --git a/src/core/include/tether/clipboard.hpp b/src/core/include/tether/clipboard.hppindex 6739fc1..d74bc85 100644--- a/src/core/include/tether/clipboard.hpp+++ b/src/core/include/tether/clipboard.hpp@@ -1,8 +1,8 @@#pragma once-#include <string>#include <functional>#include <memory>+#include <string>class CCZwlrDataControlManagerV1;class CCWlSeat;@@ -11,24 +11,24 @@ 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_;-};+ 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.hppindex b20c87b..84d6807 100644--- a/src/core/include/tether/core.hpp+++ b/src/core/include/tether/core.hpp@@ -4,6 +4,6 @@namespace tether {-std::string get_version();+ std::string get_version();} // namespace tetherdiff --git a/src/core/include/tether/event_loop.hpp b/src/core/include/tether/event_loop.hppindex c9dad18..f76e3a3 100644--- a/src/core/include/tether/event_loop.hpp+++ b/src/core/include/tether/event_loop.hpp@@ -5,33 +5,33 @@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_;-};+ 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/file_transfer.hpp b/src/core/include/tether/file_transfer.hppindex 4c6f91a..9f7a80d 100644--- a/src/core/include/tether/file_transfer.hpp+++ b/src/core/include/tether/file_transfer.hpp@@ -1,39 +1,39 @@#pragma once-#include <string>+#include <filesystem>+#include <fstream>#include <map>#include <memory>-#include <fstream>-#include <filesystem>#include <mutex>+#include <string>namespace tether {-class FileReceiveManager {-public:- FileReceiveManager();- ~FileReceiveManager();-- bool handle_start(const std::string& transfer_id, const std::string& filename, size_t size);- bool handle_chunk(const std::string& transfer_id, int chunk_index, const std::string& b64_data);- bool handle_end(const std::string& transfer_id);--private:- std::string get_downloads_dir();- std::filesystem::path resolve_filename(const std::string& raw_name);-- struct Transfer {- std::string transfer_id;- std::filesystem::path filepath;- std::unique_ptr<std::ofstream> stream;- size_t expected_size;- size_t bytes_written = 0;+ class FileReceiveManager {+ public:+ FileReceiveManager();+ ~FileReceiveManager();++ bool handle_start(const std::string& transfer_id, const std::string& filename, size_t size);+ bool handle_chunk(const std::string& transfer_id, int chunk_index, const std::string& b64_data);+ bool handle_end(const std::string& transfer_id);++ private:+ std::string get_downloads_dir();+ std::filesystem::path resolve_filename(const std::string& raw_name);++ struct Transfer {+ std::string transfer_id;+ std::filesystem::path filepath;+ std::unique_ptr<std::ofstream> stream;+ size_t expected_size;+ size_t bytes_written = 0;+ };++ std::mutex mutex_;+ std::map<std::string, std::shared_ptr<Transfer>> transfers_;};- std::mutex mutex_;- std::map<std::string, std::shared_ptr<Transfer>> transfers_;-};--extern FileReceiveManager* g_file_manager;+ extern FileReceiveManager* g_file_manager;-}+} // namespace tetherdiff --git a/src/core/include/tether/net.hpp b/src/core/include/tether/net.hppindex 7e1cb4d..4bad1c7 100644--- a/src/core/include/tether/net.hpp+++ b/src/core/include/tether/net.hpp@@ -5,53 +5,53 @@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_;- std::map<int, std::string> client_buffers_;-};--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_;- std::map<int, std::string> client_buffers_;-};+ // 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_;+ std::map<int, std::string> client_buffers_;+ };++ 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_;+ std::map<int, std::string> client_buffers_;+ };} // namespace tetherdiff --git a/src/core/include/tether/wayland.hpp b/src/core/include/tether/wayland.hppindex 3dc408a..6adb404 100644--- a/src/core/include/tether/wayland.hpp+++ b/src/core/include/tether/wayland.hpp@@ -1,11 +1,11 @@#pragma once-#include "tether/event_loop.hpp"#include "tether/clipboard.hpp"-#include <memory>+#include "tether/event_loop.hpp"#include <functional>-#include <string>+#include <memory>#include <mutex>+#include <string>class CCWlDisplay;class CCWlRegistry;@@ -15,31 +15,31 @@ 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);- std::string get_clipboard();--private:- std::mutex clip_mutex_;- std::string cached_clipboard_;- 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_;-};--extern WaylandContext* g_wayland;+ 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);+ std::string get_clipboard();++ private:+ std::mutex clip_mutex_;+ std::string cached_clipboard_;+ 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_;+ };++ extern WaylandContext* g_wayland;} // namespace tetherdiff --git a/src/core/src/wayland_protocols/wayland.hpp b/src/core/src/wayland_protocols/wayland.hppindex 2aac0fc..5b4d695 100644--- a/src/core/src/wayland_protocols/wayland.hpp+++ b/src/core/src/wayland_protocols/wayland.hpp@@ -29,13 +29,13 @@ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.-+*/#pragma once-#include <functional>#include <cstdint>+#include <functional>#include <string>#include <wayland-client.h>@@ -43,7 +43,6 @@struct wl_proxy;-class CCWlDisplay;class CCWlCallback;class CCWlRegistry;@@ -142,38 +141,46 @@ extern const wl_interface wl_fixes_interface;#endif-class CCWlDisplay {- public:+public:CCWlDisplay(wl_proxy*);~CCWlDisplay();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setError(F<void(CCWlDisplay*, wl_proxy*, uint32_t, const char*)> handler);@@ -184,7 +191,7 @@ class CCWlDisplay {wl_proxy* sendSync();wl_proxy* sendGetRegistry();- private:+private:struct {F<void(CCWlDisplay*, wl_proxy*, uint32_t, const char*)> error;F<void(CCWlDisplay*, uint32_t)> deleteId;@@ -197,39 +204,46 @@ class CCWlDisplay {void* pData = nullptr;};--class CCWlRegistry {- public:+public:CCWlRegistry(wl_proxy*);~CCWlRegistry();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setGlobal(F<void(CCWlRegistry*, uint32_t, const char*, uint32_t)> handler);@@ -239,7 +253,7 @@ class CCWlRegistry {void sendBind(uint32_t);- private:+private:struct {F<void(CCWlRegistry*, uint32_t, const char*, uint32_t)> global;F<void(CCWlRegistry*, uint32_t)> globalRemove;@@ -252,47 +266,53 @@ class CCWlRegistry {void* pData = nullptr;};--class CCWlCallback {- public:+public:CCWlCallback(wl_proxy*);~CCWlCallback();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setDone(F<void(CCWlCallback*, uint32_t)> handler);// --------------- Events --------------- //-- private:+private:struct {F<void(CCWlCallback*, uint32_t)> done;} requests;@@ -304,48 +324,54 @@ class CCWlCallback {void* pData = nullptr;};--class CCWlCompositor {- public:+public:CCWlCompositor(wl_proxy*);~CCWlCompositor();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //wl_proxy* sendCreateSurface();wl_proxy* sendCreateRegion();- private:+private:struct {} requests;@@ -356,41 +382,47 @@ class CCWlCompositor {void* pData = nullptr;};--class CCWlShmPool {- public:+public:CCWlShmPool(wl_proxy*);~CCWlShmPool();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //@@ -398,7 +430,7 @@ class CCWlShmPool {void sendDestroy();void sendResize(int32_t);- private:+private:struct {} requests;@@ -409,39 +441,46 @@ class CCWlShmPool {void* pData = nullptr;};--class CCWlShm {- public:+public:CCWlShm(wl_proxy*);~CCWlShm();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setFormat(F<void(CCWlShm*, enum wl_shm_format)> handler);@@ -451,7 +490,7 @@ class CCWlShm {wl_proxy* sendCreatePool(int32_t, int32_t);void sendRelease();- private:+private:struct {F<void(CCWlShm*, enum wl_shm_format)> format;} requests;@@ -463,39 +502,46 @@ class CCWlShm {void* pData = nullptr;};--class CCWlBuffer {- public:+public:CCWlBuffer(wl_proxy*);~CCWlBuffer();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setRelease(F<void(CCWlBuffer*)> handler);@@ -504,7 +550,7 @@ class CCWlBuffer {void sendDestroy();- private:+private:struct {F<void(CCWlBuffer*)> release;} requests;@@ -516,39 +562,46 @@ class CCWlBuffer {void* pData = nullptr;};--class CCWlDataOffer {- public:+public:CCWlDataOffer(wl_proxy*);~CCWlDataOffer();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setOffer(F<void(CCWlDataOffer*, const char*)> handler);@@ -563,7 +616,7 @@ class CCWlDataOffer {void sendFinish();void sendSetActions(uint32_t, uint32_t);- private:+private:struct {F<void(CCWlDataOffer*, const char*)> offer;F<void(CCWlDataOffer*, uint32_t)> sourceActions;@@ -577,39 +630,46 @@ class CCWlDataOffer {void* pData = nullptr;};--class CCWlDataSource {- public:+public:CCWlDataSource(wl_proxy*);~CCWlDataSource();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setTarget(F<void(CCWlDataSource*, const char*)> handler);@@ -625,7 +685,7 @@ class CCWlDataSource {void sendDestroy();void sendSetActions(uint32_t);- private:+private:struct {F<void(CCWlDataSource*, const char*)> target;F<void(CCWlDataSource*, const char*, int32_t)> send;@@ -642,39 +702,46 @@ class CCWlDataSource {void* pData = nullptr;};--class CCWlDataDevice {- public:+public:CCWlDataDevice(wl_proxy*);~CCWlDataDevice();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setDataOffer(F<void(CCWlDataDevice*, wl_proxy*)> handler);@@ -690,7 +757,7 @@ class CCWlDataDevice {void sendSetSelection(CCWlDataSource*, uint32_t);void sendRelease();- private:+private:struct {F<void(CCWlDataDevice*, wl_proxy*)> dataOffer;F<void(CCWlDataDevice*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t, wl_proxy*)> enter;@@ -707,48 +774,54 @@ class CCWlDataDevice {void* pData = nullptr;};--class CCWlDataDeviceManager {- public:+public:CCWlDataDeviceManager(wl_proxy*);~CCWlDataDeviceManager();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //wl_proxy* sendCreateDataSource();wl_proxy* sendGetDataDevice(CCWlSeat*);- private:+private:struct {} requests;@@ -759,47 +832,53 @@ class CCWlDataDeviceManager {void* pData = nullptr;};--class CCWlShell {- public:+public:CCWlShell(wl_proxy*);~CCWlShell();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //wl_proxy* sendGetShellSurface(CCWlSurface*);- private:+private:struct {} requests;@@ -810,39 +889,46 @@ class CCWlShell {void* pData = nullptr;};--class CCWlShellSurface {- public:+public:CCWlShellSurface(wl_proxy*);~CCWlShellSurface();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setPing(F<void(CCWlShellSurface*, uint32_t)> handler);@@ -862,7 +948,7 @@ class CCWlShellSurface {void sendSetTitle(const char*);void sendSetClass(const char*);- private:+private:struct {F<void(CCWlShellSurface*, uint32_t)> ping;F<void(CCWlShellSurface*, enum wl_shell_surface_resize, int32_t, int32_t)> configure;@@ -876,39 +962,46 @@ class CCWlShellSurface {void* pData = nullptr;};--class CCWlSurface {- public:+public:CCWlSurface(wl_proxy*);~CCWlSurface();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setEnter(F<void(CCWlSurface*, wl_proxy*)> handler);@@ -930,7 +1023,7 @@ class CCWlSurface {void sendDamageBuffer(int32_t, int32_t, int32_t, int32_t);void sendOffset(int32_t, int32_t);- private:+private:struct {F<void(CCWlSurface*, wl_proxy*)> enter;F<void(CCWlSurface*, wl_proxy*)> leave;@@ -945,39 +1038,46 @@ class CCWlSurface {void* pData = nullptr;};--class CCWlSeat {- public:+public:CCWlSeat(wl_proxy*);~CCWlSeat();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setCapabilities(F<void(CCWlSeat*, enum wl_seat_capability)> handler);@@ -990,7 +1090,7 @@ class CCWlSeat {wl_proxy* sendGetTouch();void sendRelease();- private:+private:struct {F<void(CCWlSeat*, enum wl_seat_capability)> capabilities;F<void(CCWlSeat*, const char*)> name;@@ -1003,39 +1103,46 @@ class CCWlSeat {void* pData = nullptr;};--class CCWlPointer {- public:+public:CCWlPointer(wl_proxy*);~CCWlPointer();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ 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);@@ -1048,14 +1155,15 @@ class CCWlPointer {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);+ 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:+private:struct {F<void(CCWlPointer*, uint32_t, wl_proxy*, wl_fixed_t, wl_fixed_t)> enter;F<void(CCWlPointer*, uint32_t, wl_proxy*)> leave;@@ -1077,39 +1185,46 @@ class CCWlPointer {void* pData = nullptr;};--class CCWlKeyboard {- public:+public:CCWlKeyboard(wl_proxy*);~CCWlKeyboard();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setKeymap(F<void(CCWlKeyboard*, enum wl_keyboard_keymap_format, int32_t, uint32_t)> handler);@@ -1123,7 +1238,7 @@ class CCWlKeyboard {void sendRelease();- private:+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;@@ -1140,39 +1255,46 @@ class CCWlKeyboard {void* pData = nullptr;};--class CCWlTouch {- public:+public:CCWlTouch(wl_proxy*);~CCWlTouch();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ 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);@@ -1187,7 +1309,7 @@ class CCWlTouch {void sendRelease();- private:+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;@@ -1205,42 +1327,50 @@ class CCWlTouch {void* pData = nullptr;};--class CCWlOutput {- public:+public:CCWlOutput(wl_proxy*);~CCWlOutput();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ 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 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);@@ -1251,7 +1381,7 @@ class CCWlOutput {void sendRelease();- private:+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;@@ -1268,41 +1398,47 @@ class CCWlOutput {void* pData = nullptr;};--class CCWlRegion {- public:+public:CCWlRegion(wl_proxy*);~CCWlRegion();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //@@ -1310,7 +1446,7 @@ class CCWlRegion {void sendAdd(int32_t, int32_t, int32_t, int32_t);void sendSubtract(int32_t, int32_t, int32_t, int32_t);- private:+private:struct {} requests;@@ -1321,48 +1457,54 @@ class CCWlRegion {void* pData = nullptr;};--class CCWlSubcompositor {- public:+public:CCWlSubcompositor(wl_proxy*);~CCWlSubcompositor();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //void sendDestroy();wl_proxy* sendGetSubsurface(CCWlSurface*, CCWlSurface*);- private:+private:struct {} requests;@@ -1373,41 +1515,47 @@ class CCWlSubcompositor {void* pData = nullptr;};--class CCWlSubsurface {- public:+public:CCWlSubsurface(wl_proxy*);~CCWlSubsurface();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //@@ -1418,7 +1566,7 @@ class CCWlSubsurface {void sendSetSync();void sendSetDesync();- private:+private:struct {} requests;@@ -1429,48 +1577,54 @@ class CCWlSubsurface {void* pData = nullptr;};--class CCWlFixes {- public:+public:CCWlFixes(wl_proxy*);~CCWlFixes();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //void sendDestroy();void sendDestroyRegistry(CCWlRegistry*);- private:+private:struct {} requests;@@ -1481,6 +1635,4 @@ class CCWlFixes {void* pData = nullptr;};--#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.hppindex 68c305a..b84492f 100644--- a/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.hpp+++ b/src/core/src/wayland_protocols/wlr-data-control-unstable-v1.hpp@@ -28,13 +28,13 @@AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OFTHIS SOFTWARE.-+*/#pragma once-#include <functional>#include <cstdint>+#include <functional>#include <string>#include <wayland-client.h>@@ -42,7 +42,6 @@struct wl_proxy;-class CCZwlrDataControlManagerV1;class CCZwlrDataControlSourceV1;class CCZwlrDataControlDeviceV1;@@ -64,40 +63,47 @@ extern const wl_interface zwlr_data_control_offer_v1_interface;#endif-class CCZwlrDataControlManagerV1 {- public:+public:CCZwlrDataControlManagerV1(wl_proxy*);~CCZwlrDataControlManagerV1();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-- // --------------- Requests --------------- //+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+ // --------------- Requests --------------- //// --------------- Events --------------- //@@ -105,7 +111,7 @@ class CCZwlrDataControlManagerV1 {wl_proxy* sendGetDataDevice(wl_proxy*);void sendDestroy();- private:+private:struct {} requests;@@ -116,39 +122,46 @@ class CCZwlrDataControlManagerV1 {void* pData = nullptr;};--class CCZwlrDataControlDeviceV1 {- public:+public:CCZwlrDataControlDeviceV1(wl_proxy*);~CCZwlrDataControlDeviceV1();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setDataOffer(F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> handler);@@ -162,7 +175,7 @@ class CCZwlrDataControlDeviceV1 {void sendDestroy();void sendSetPrimarySelection(CCZwlrDataControlSourceV1*);- private:+private:struct {F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> dataOffer;F<void(CCZwlrDataControlDeviceV1*, wl_proxy*)> selection;@@ -177,39 +190,46 @@ class CCZwlrDataControlDeviceV1 {void* pData = nullptr;};--class CCZwlrDataControlSourceV1 {- public:+public:CCZwlrDataControlSourceV1(wl_proxy*);~CCZwlrDataControlSourceV1();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setSend(F<void(CCZwlrDataControlSourceV1*, const char*, int32_t)> handler);@@ -220,7 +240,7 @@ class CCZwlrDataControlSourceV1 {void sendOffer(const char*);void sendDestroy();- private:+private:struct {F<void(CCZwlrDataControlSourceV1*, const char*, int32_t)> send;F<void(CCZwlrDataControlSourceV1*)> cancelled;@@ -233,39 +253,46 @@ class CCZwlrDataControlSourceV1 {void* pData = nullptr;};--class CCZwlrDataControlOfferV1 {- public:+public:CCZwlrDataControlOfferV1(wl_proxy*);~CCZwlrDataControlOfferV1();-// set the data for this resource- void setData(void* data) {{- pData = data;- }}+ void setData(void* data) {+ {+ pData = data;+ }+ }// get the data for this resource- void* data() {{- return pData;- }}+ void* data() {+ {+ return pData;+ }+ }// get the raw wl_resource (wl_proxy) ptr- wl_proxy* resource() {{- return pResource;- }}+ wl_proxy* resource() {+ {+ return pResource;+ }+ }// get the raw wl_proxy ptr- wl_proxy* proxy() {{- return pResource;- }}+ wl_proxy* proxy() {+ {+ return pResource;+ }+ }// get the resource version- int version() {{- return wl_proxy_get_version(pResource);- }}-+ int version() {+ {+ return wl_proxy_get_version(pResource);+ }+ }+// --------------- Requests --------------- //void setOffer(F<void(CCZwlrDataControlOfferV1*, const char*)> handler);@@ -275,7 +302,7 @@ class CCZwlrDataControlOfferV1 {void sendReceive(const char*, int32_t);void sendDestroy();- private:+private:struct {F<void(CCZwlrDataControlOfferV1*, const char*)> offer;} requests;@@ -287,6 +314,4 @@ class CCZwlrDataControlOfferV1 {void* pData = nullptr;};--#undef F