browser DOM support

This commit is contained in:
Jorijn van der Graaf 2026-05-18 02:07:48 +02:00
commit 5352ef69a2
37 changed files with 2637 additions and 59 deletions

View file

@ -18,7 +18,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
module;
#ifndef CRAFTER_GRAPHICS_WINDOW_DOM
#include "vulkan/vulkan.h"
#endif
#ifdef CRAFTER_GRAPHICS_WINDOW_WAYLAND
#include <wayland-client.h>
#include <wayland-client-protocol.h>
@ -53,6 +55,7 @@ export namespace Crafter {
struct Device {
static void Initialize();
#ifndef CRAFTER_GRAPHICS_WINDOW_DOM
#ifdef CRAFTER_GRAPHICS_WINDOW_WAYLAND
inline static wl_display* display = nullptr;
inline static wl_seat* seat = nullptr;
@ -178,5 +181,13 @@ export namespace Crafter {
#else
static void TickKeyRepeats() {}
#endif
#else // CRAFTER_GRAPHICS_WINDOW_DOM
// DOM mode: Device collapses to just `Initialize()` (currently a
// no-op since the JS runtime initializes itself). The function is
// kept so user code calling `Device::Initialize()` still compiles
// cross-platform. Browser key repeat is delivered through the
// KeyboardEvent.repeat flag directly — no manual synthesis.
static void TickKeyRepeats() {}
#endif
};
}