// ===================================================================================================================== // 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 . // ===================================================================================================================== #include #include #include #include namespace fennec { bool wayland_window::running() { return _surface != nullptr; } void wayland_window::configure(const config& config) { _config = config; } bool wayland_window::initialize(bool) { wayland_display* display = static_cast(_display); _handle = wl_compositor_create_surface(display->get_compositor()); _surface = display->get_context()->create_surface(this); return false; } bool wayland_window::shutdown() { delete _surface; wl_surface_destroy(_handle); _display = nullptr; _surface = nullptr; _shell = nullptr; _handle = nullptr; return false; } bool wayland_window::set_title(const cstring& title) { if (not _config) { return true; } _config->title = title; wl_shell_surface_set_title(_shell, _config->title.cstr()); return false; } bool wayland_window::set_title(const string& title) { if (not _config) { return true; } _config->title = title; wl_shell_surface_set_title(_shell, _config->title.cstr()); return false; } bool wayland_window::set_width(size_t w) { if (not _config) { return true; } _config->width = w; _surface->resize(_config->width, _config->height); return false; } bool wayland_window::set_height(size_t h) { if (not _config) { return true; } _config->height = h; _surface->resize(_config->width, _config->height); return false; } bool wayland_window::resize(size_t w, size_t h) { if (not _config) { return true; } _config->width = w; _config->height = h; _surface->resize(_config->width, _config->height); return false; } bool wayland_window::set_resizable(bool) { return false; // TODO } bool wayland_window::set_fullscreen_mode(fullscreen_mode) { return false; // TODO } bool wayland_window::grab_keyboard(bool) { return false; // TODO } bool wayland_window::grab_mouse(bool) { return false; // TODO } bool wayland_window::block_screensaver(bool) { return false; // TODO } wayland_window::wayland_window(wayland_display* display, wayland_window* parent) : window(display, parent, this) , _handle() , _shell() , _nfs_width(0), _nfs_height(0) { } wayland_window::~wayland_window() { wayland_window::shutdown(); } }