Fixed Wayland window resizing and closing.

This commit is contained in:
2024-07-08 21:17:09 -07:00
parent 2ef28273b0
commit 126fc92fae
3 changed files with 114 additions and 138 deletions

View File

@@ -1,9 +1,7 @@
#pragma once
#include "ehs/EHS.h"
#include "ehs/Str.h"
#include "ehs/Vec2.h"
#include "ehs/Rect.h"
#include "ehs/io/hid/Input.h"
namespace ehs
@@ -60,10 +58,6 @@ namespace ehs
bool HasFocus() const;
void EnableResizing(bool enable);
bool IsResizable() const;
/// Gets the cursors position on the desktop in pixels.
/// @param [in] relative Whether the position should be relative to the windows client.
/// @returns The current value.

View File

@@ -18,16 +18,13 @@ namespace ehs
xdg_wm_base *xdgShell;
xdg_surface *xdgSurface;
xdg_toplevel *xdgToplevel;
wl_shm *shm;
wl_buffer *buffer;
zxdg_decoration_manager_v1 *decManager;
zxdg_toplevel_decoration_v1 *dec;
wl_seat *seat;
wl_pointer *pointer;
Vec2_u32 scale;
static Int_32 CreateShmFile(Size size);
void CreateBuffer(Vec2_u32 scale);
static void SurfaceConfigure(void *data, xdg_surface *xdg_surface, UInt_32 serial);
static void SurfaceConfigEvent(void *data, xdg_surface *xdg_surface, UInt_32 serial);
static void ShellPing(void *data, xdg_wm_base *shell, UInt_32 serial);
@@ -35,7 +32,13 @@ namespace ehs
static void RegistryRemoved(void *data, wl_registry *registry, UInt_32 id);
static void Resolution(void *data, struct xdg_toplevel *xdg_toplevel, Int_32 width, Int_32 height, wl_array *states);
static void ResizeEvent(void *data, xdg_toplevel *xdg_toplevel, Int_32 width, Int_32 height, wl_array *states);
static void CloseEvent(void *data, xdg_toplevel *xdg_toplevel);
static void SeatCapabilitiesEvent(void *data, wl_seat *seat, UInt_32 capabilities);
static void PointerMotionEvent(void *data, wl_pointer *pointer, UInt_32 time, wl_fixed_t sx, wl_fixed_t sy);
public:
~Window() override;
@@ -50,11 +53,11 @@ namespace ehs
Window &operator=(const Window &win);
void Create_32(const Str_32& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void Create_32(const Str_32& title, const Vec2_s32& pos, Vec2_u32 scale) override;
void Create_16(const Str_16& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void Create_16(const Str_16& title, const Vec2_s32& pos, Vec2_u32 scale) override;
void Create_8(const Str_8& title, const Vec2_s32& pos, const Vec2_u32 scale) override;
void Create_8(const Str_8& title, const Vec2_s32& pos, Vec2_u32 scale) override;
void OnCreated() override;