/* Crafter®.Graphics Copyright (C) 2025 Catcrafts® catcrafts.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free Software Foundation; This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ module; #ifdef CRAFTER_GRAPHICS_WAYLAND #include #include "../lib/xdg-shell-client-protocol.h" #include "../lib/wayland-xdg-decoration-unstable-v1-client-protocol.h" #include #include #include #include #endif export module Crafter.Graphics:WindowBase; import std; import :Types; import Crafter.Event; export namespace Crafter { enum WindowCapabilities { CRAFTER_WINDOWCAPTABILITIES_FRAMEBUFFER = 0b1, CRAFTER_WINDOWCAPTABILITIES_KEYBOARD = 0b10, CRAFTER_WINDOWCAPTABILITIES_MOUSE = 0b100, }; class UiElementBase; class WindowBase { public: Event onClose; Event onUpdate; bool open; std::vector> elements; WindowBase(WindowBase&) = delete; WindowBase(WindowBase&&) = delete; WindowBase& operator=(const WindowBase&) = delete; void StartSync(); void StartUpdate(void* window); void StopUpdate(); #ifdef CRAFTER_GRAPHICS_WAYLAND WindowBase(); ~WindowBase(); #endif protected: friend class WindowKeyboard; friend class WindowFramebuffer; friend class WindowTitle; #ifdef CRAFTER_GRAPHICS_WAYLAND wl_surface* surface = nullptr; wl_callback* cb = nullptr; static void wl_surface_frame_done(void* data, struct wl_callback *cb, uint32_t time); static wl_callback_listener surface_frame_listener; #endif }; }