- Setup EGL context for Wayland. Test window now opens as black rectangle.

This commit is contained in:
2025-12-15 13:20:08 -05:00
parent 5dcb58f53c
commit 1acf00138a
36 changed files with 992 additions and 80 deletions

View File

@@ -16,29 +16,18 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file window.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#include <fennec/platform/interface/display_server.h>
#include <fennec/platform/linux/wayland/server.h>
#include <fennec/platform/linux/wayland/window.h>
#include <fennec/platform/linux/wayland/lib/wayland.h>
#include <fennec/platform/linux/wayland/lib/headers/xdg-shell-client-protocols.h>
#include <fennec/renderers/interface/gfxcontext.h>
using namespace fennec;
wayland_window::wayland_window(display_server* server, uint32_t id, const config& cfg)
: window(server, id, cfg)
: window_base(server, id, cfg)
, surface(nullptr)
, xdgsurface(nullptr) {
@@ -99,10 +88,12 @@ void wayland_window::show() {
cfg.flags.set(flag_visible);
cfg.flags.set(flag_running);
gfx_surface = wl_server->get_gfx_context()->create_surface(this);
}
void wayland_window::hide() {
if (not is_visible()) {
if (not is_running()) {
return;
}
@@ -134,9 +125,8 @@ void wayland_window::hide() {
cfg.flags.clear(flag_running);
}
void wayland_window::dispatch() {
wayland_server* wl_server = static_cast<wayland_server*>(server);
wl_display_dispatch(wl_server->display);
void* wayland_window::get_native_handle() {
return surface;
}
bool wayland_window::set_flag(uint8_t, bool) {
@@ -156,5 +146,11 @@ void wayland_window::listen_xdg_surface_configure(void*, xdg_surface* xdg, uint3
void wayland_window::listen_xdg_toplevel_configure(void*, xdg_toplevel*, int32_t, int32_t, wl_array*) {}
void wayland_window::listen_xdg_toplevel_configure_bounds(void*, xdg_toplevel*, int32_t, int32_t) {}
void wayland_window::listen_xdg_toplevel_close(void*, xdg_toplevel*) {}
void wayland_window::listen_xdg_toplevel_close(void* data, xdg_toplevel*) {
wayland_window* window = static_cast<wayland_window*>(data);
window->hide();
}
void wayland_window::listen_xdg_toplevel_capabilities(void*, xdg_toplevel*, wl_array*) {}