Files
fennec/include/fennec/platform/linux/wayland/window.h

98 lines
3.2 KiB
C++

// =====================================================================================================================
// 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 <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file wayland_window.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H
#define FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H
#include <fennec/platform/linux/wayland/fwd.h>
#include <fennec/platform/interface/window.h>
struct wl_array;
struct wl_callback;
struct wl_output;
struct wl_surface;
struct xdg_surface;
struct xdg_toplevel;
struct libdecor_frame;
struct libdecor_configuration;
namespace fennec
{
class wayland_window : public window_base<wayland_server> {
public:
wayland_window(display_server* server, uint32_t id, const config& cfg);
~wayland_window();
void show() override;
void hide() override;
void* get_native_handle() override;
bool set_flag(uint8_t flag, bool val) override;
private:
wl_surface* surface;
xdg_surface* xdgsurface;
xdg_toplevel* xdgtoplevel;
wl_callback* frame_callback;
#if FENNEC_HAS_LIBDECOR
libdecor_frame* libdecorframe;
#endif
static void _wl_surface_listen_enter(void*, wl_surface*, wl_output*);
static void _wl_surface_listen_leave(void*, wl_surface*, wl_output*);
static void _wl_surface_listen_preferred_buffer_scale(void*, wl_surface*, int32_t);
static void _wl_surface_listen_preferred_buffer_transform(void*, wl_surface*, uint32_t);
static void _wl_frame_listen_done(void*, wl_callback*, uint32_t);
static void _xdg_surface_listen_configure(void*, xdg_surface*, uint32_t);
static void _xdg_toplevel_listen_configure(void*, xdg_toplevel*, int32_t, int32_t, wl_array*);
static void _xdg_toplevel_listen_configure_bounds(void*, xdg_toplevel*, int32_t, int32_t);
static void _xdg_toplevel_listen_close(void*, xdg_toplevel*);
static void _xdg_toplevel_listen_wm_capabilities(void*, xdg_toplevel*, wl_array*);
#if FENNEC_HAS_LIBDECOR
static void _libdecor_frame_listen_configure(libdecor_frame*, libdecor_configuration*, void*);
static void _libdecor_frame_listen_close(libdecor_frame*, void*);
static void _libdecor_frame_listen_commit(libdecor_frame*, void*);
static void _libdecor_frame_listen_dismiss_popup(libdecor_frame*, const char*, void*);
#endif
};
}
#endif // FENNEC_PLATFORM_LINUX_WAYLAND_WINDOW_H