diff --git a/CMakeLists.txt b/CMakeLists.txt index b2c7ddc..0f5e48d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,7 @@ add_library(fennec STATIC include/fennec/lang/type_operators.h include/fennec/containers/tuple.h include/fennec/containers/detail/__tuple.h + include/fennec/platform/linux/wayland/window.h ) add_dependencies(fennec metaprogramming) diff --git a/doxy/Doxyfile b/doxy/Doxyfile index df913ab..26d134c 100644 --- a/doxy/Doxyfile +++ b/doxy/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = fennec # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.0.2 +PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/include/fennec/platform/interface/display.h b/include/fennec/platform/interface/display.h index 588ac10..c1ec968 100644 --- a/include/fennec/platform/interface/display.h +++ b/include/fennec/platform/interface/display.h @@ -34,8 +34,6 @@ public: }; virtual bool connected() const = 0; - -protected: virtual ~display() = default; private: diff --git a/include/fennec/platform/linux/wayland/display.h b/include/fennec/platform/linux/wayland/display.h index 5919174..ac14abe 100644 --- a/include/fennec/platform/linux/wayland/display.h +++ b/include/fennec/platform/linux/wayland/display.h @@ -28,9 +28,6 @@ namespace fennec { -namespace wayland -{ - class wayland_display : public display { public: wayland_display(linux_platform* platform); @@ -46,6 +43,4 @@ private: } -} - #endif // FENNEC_PLATFORM_LINUX_WAYLAND_DISPLAY_H diff --git a/include/fennec/platform/linux/wayland/lib/dyn.h b/include/fennec/platform/linux/wayland/lib/dyn.h index dac2bea..cfc66b6 100644 --- a/include/fennec/platform/linux/wayland/lib/dyn.h +++ b/include/fennec/platform/linux/wayland/lib/dyn.h @@ -24,7 +24,7 @@ namespace fennec { -namespace wayland +namespace libwayland { bool load_symbols(linux_platform* platform); diff --git a/include/fennec/platform/linux/wayland/window.h b/include/fennec/platform/linux/wayland/window.h new file mode 100644 index 0000000..6b38160 --- /dev/null +++ b/include/fennec/platform/linux/wayland/window.h @@ -0,0 +1,22 @@ +// ===================================================================================================================== +// fennec, a free and open source game engine +// Copyright © 2025 Medusa Slockbower +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// ===================================================================================================================== + +#ifndef FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H +#define FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H + +#endif // FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H diff --git a/source/platform/linux/platform.cpp b/source/platform/linux/platform.cpp index 8390dc3..aac3c01 100644 --- a/source/platform/linux/platform.cpp +++ b/source/platform/linux/platform.cpp @@ -28,8 +28,6 @@ namespace fennec { -using namespace wayland; - linux_platform::linux_platform(user _type) : platform(_type) , _display_driver(display_none) { @@ -45,7 +43,10 @@ linux_platform::linux_platform(user _type) } linux_platform::~linux_platform() { - + if (_display) { + delete _display; + _display = nullptr; + } } shared_object* linux_platform::load_object(const cstring& file) { @@ -77,10 +78,10 @@ display* linux_platform::get_display() { void linux_platform::_runtime_client_checks() { #ifdef FENNEC_LIB_WAYLAND - if (wayland::load_symbols(this)) { + if (libwayland::load_symbols(this)) { _display_driver = display_wayland; _display = new wayland_display(this); - wayland::unload_symbols(this); // Doesn't actually unload symbols, just resets ref counter to only consider + libwayland::unload_symbols(this); // Doesn't actually unload symbols, just resets ref counter to only consider // the created display } #endif diff --git a/source/platform/linux/wayland/display.cpp b/source/platform/linux/wayland/display.cpp index 0f4211c..0fea351 100644 --- a/source/platform/linux/wayland/display.cpp +++ b/source/platform/linux/wayland/display.cpp @@ -23,14 +23,11 @@ namespace fennec { -namespace wayland -{ - wayland_display::wayland_display(linux_platform* platform) : display() , _handle() , _platform(platform) { - load_symbols(_platform); + libwayland::load_symbols(_platform); _handle = wl_display_connect(nullptr); } @@ -38,13 +35,13 @@ wayland_display::wayland_display(linux_platform* platform, const cstring& drv) : display() , _handle() , _platform(platform) { - load_symbols(_platform); + libwayland::load_symbols(_platform); _handle = wl_display_connect(drv); } wayland_display::~wayland_display() { wl_display_disconnect(_handle); - unload_symbols(_platform); + libwayland::unload_symbols(_platform); _handle = nullptr; _platform = nullptr; } @@ -53,6 +50,4 @@ bool wayland_display::connected() const { return _handle != nullptr; } -} - } \ No newline at end of file diff --git a/source/platform/linux/wayland/lib/dyn.cpp b/source/platform/linux/wayland/lib/dyn.cpp index b3d18bb..7787b62 100644 --- a/source/platform/linux/wayland/lib/dyn.cpp +++ b/source/platform/linux/wayland/lib/dyn.cpp @@ -22,7 +22,7 @@ namespace fennec { -namespace wayland +namespace libwayland { using shared_lib = platform::shared_lib; diff --git a/test/tests/platform/linux/test_wayland.h b/test/tests/platform/linux/test_wayland.h index f7ec27d..bd3a291 100644 --- a/test/tests/platform/linux/test_wayland.h +++ b/test/tests/platform/linux/test_wayland.h @@ -25,8 +25,6 @@ namespace fennec::test { - using namespace wayland; - inline void fennec_test_platform_linux_wayland(linux_platform& platform) { wayland_display* display = static_cast(platform.get_display());