diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-04-09 12:54:00 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-09 17:27:27 +0200 |
commit | fb96966f1eaf3f3ce9370167552831ee624f1460 (patch) | |
tree | a310036d488b3b2792bcc4295abec96da971cf3f /Userland/Libraries/LibWeb/WebGL | |
parent | f9d50e6eca9c740487d0f1fa3c1024df3133d065 (diff) | |
download | serenity-fb96966f1eaf3f3ce9370167552831ee624f1460.zip |
LibWeb: Add WebGL::EventNames
Diffstat (limited to 'Userland/Libraries/LibWeb/WebGL')
-rw-r--r-- | Userland/Libraries/LibWeb/WebGL/EventNames.cpp | 29 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/WebGL/EventNames.h | 25 |
2 files changed, 54 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/WebGL/EventNames.cpp b/Userland/Libraries/LibWeb/WebGL/EventNames.cpp new file mode 100644 index 0000000000..497863e98f --- /dev/null +++ b/Userland/Libraries/LibWeb/WebGL/EventNames.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibWeb/WebGL/EventNames.h> + +namespace Web::WebGL::EventNames { + +#define __ENUMERATE_GL_EVENT(name) FlyString name; +ENUMERATE_GL_EVENTS +#undef __ENUMERATE_GL_EVENT + +ErrorOr<void> initialize_strings() +{ + static bool s_initialized = false; + VERIFY(!s_initialized); + +#define __ENUMERATE_GL_EVENT(name) \ + name = TRY(#name##_fly_string); + ENUMERATE_GL_EVENTS +#undef __ENUMERATE_GL_EVENT + + s_initialized = true; + return {}; +} + +} diff --git a/Userland/Libraries/LibWeb/WebGL/EventNames.h b/Userland/Libraries/LibWeb/WebGL/EventNames.h new file mode 100644 index 0000000000..4d757317c5 --- /dev/null +++ b/Userland/Libraries/LibWeb/WebGL/EventNames.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <AK/Error.h> +#include <AK/FlyString.h> + +namespace Web::WebGL::EventNames { + +#define ENUMERATE_GL_EVENTS \ + __ENUMERATE_GL_EVENT(webglcontextcreationerror) \ + __ENUMERATE_GL_EVENT(webglcontextlost) \ + __ENUMERATE_GL_EVENT(webglcontextrestored) + +#define __ENUMERATE_GL_EVENT(name) extern FlyString name; +ENUMERATE_GL_EVENTS +#undef __ENUMERATE_GL_EVENT + +ErrorOr<void> initialize_strings(); + +} |