- Started setting up a thread safe window manager

- Created thread & atomic structures
This commit is contained in:
2025-12-17 01:11:28 -05:00
parent 520a0e1363
commit aee4e340dd
41 changed files with 2179 additions and 428 deletions

View File

@@ -20,6 +20,7 @@
#include <fennec/math/relational.h>
#include <fennec/platform/interface/display_server.h>
#include <fennec/renderers/interface/gfxsurface.h>
#include <fennec/renderers/interface/gfxcontext.h>
#include <fennec/platform/linux/wayland/server.h>
@@ -27,7 +28,6 @@
#include <fennec/platform/linux/wayland/lib/wayland.h>
#include <fennec/platform/linux/wayland/lib/headers/xdg-shell-client-protocols.h>
#include <fennec/platform/linux/wayland/libdecor/libdecor.h>
#include <fennec/renderers/interface/gfxsurface.h>
#if FENNEC_HAS_LIBDECOR
#include <fennec/platform/linux/wayland/libdecor/libdecor.h>
@@ -35,11 +35,10 @@
using namespace fennec;
wayland_window::wayland_window(display_server* server, uint32_t id, const config& cfg)
: window_base(server, id, cfg)
wayland_window::wayland_window(display_server* server, const config& cfg, window* parent)
: window_base(server, cfg, parent)
, surface(nullptr)
, xdgsurface(nullptr) {
}
wayland_window::~wayland_window() {
@@ -79,7 +78,7 @@ void wayland_window::initialize() {
}
wayland_window* root = this;
root = parent;
while (root != nullptr and root->is_popup()) {
root = static_cast<wayland_window*>(root->get_parent());
}
@@ -110,7 +109,7 @@ void wayland_window::initialize() {
.reserved9 = nullptr,
};
gfx_surface = wl_server->get_gfx_context()->create_surface(this);
gfx_surface = unique_ptr(wl_server->get_gfx_context()->create_surface(this));
if (wl_server->has_libdecor) {
@@ -151,11 +150,6 @@ void wayland_window::shutdown() {
wayland_server* wl_server = static_cast<wayland_server*>(server);
if (frame_callback) {
wl_callback_destroy(frame_callback);
frame_callback = nullptr;
}
#if FENNEC_HAS_LIBDECOR
if (libdecorframe) {
libdecor_frame_unref(libdecorframe);
@@ -164,6 +158,15 @@ void wayland_window::shutdown() {
}
#endif
if (gfx_surface) {
gfx_surface.reset();
}
if (frame_callback) {
wl_callback_destroy(frame_callback);
frame_callback = nullptr;
}
if (xdgtoplevel) {
xdg_toplevel_destroy(xdgtoplevel);
xdgtoplevel = nullptr;