mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-23 10:59:45 +00:00
split the Wayland backend into files
WaylandWindow.cpp held the protocol bindings, the shared compositor state, the input implementation, the window itself, the free event listeners and the initialization code in one 2400-line file. Moved out of it: - WaylandCommon.hpp/.cpp: shared compositor state, the display event loop, keysym mapping and the window logger; - WaylandInput.hpp: the input implementation (keyboard, clipboard, cursors, key repeat). No functional change.
This commit is contained in:
parent
1e689e88b1
commit
cf92ebba76
4 changed files with 573 additions and 513 deletions
77
src/window/wayland/WaylandCommon.hpp
Normal file
77
src/window/wayland/WaylandCommon.hpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#pragma once
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include "debug/Logger.hpp"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <wayland-client.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include "cursor-shape-v1-client-protocol.h"
|
||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
||||
#include "relative-pointer-unstable-v1-client-protocol.h"
|
||||
#include "xdg-decoration-unstable-v1-client-protocol.h"
|
||||
#include "xdg-shell-client-protocol.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
extern debug::Logger waylandLogger;
|
||||
|
||||
struct WaylandState {
|
||||
wl_display* display = nullptr;
|
||||
wl_registry* registry = nullptr;
|
||||
wl_compositor* compositor = nullptr;
|
||||
wl_surface* surface = nullptr;
|
||||
xdg_wm_base* wmBase = nullptr;
|
||||
xdg_surface* xdgSurface = nullptr;
|
||||
xdg_toplevel* toplevel = nullptr;
|
||||
zxdg_toplevel_decoration_v1* decoration = nullptr;
|
||||
wl_seat* seat = nullptr;
|
||||
wl_pointer* pointer = nullptr;
|
||||
wl_keyboard* keyboard = nullptr;
|
||||
wl_data_device_manager* dataDeviceManager = nullptr;
|
||||
wl_data_device* dataDevice = nullptr;
|
||||
wp_cursor_shape_manager_v1* cursorShapeManager = nullptr;
|
||||
wp_cursor_shape_device_v1* cursorShapeDevice = nullptr;
|
||||
zwp_pointer_constraints_v1* pointerConstraints = nullptr;
|
||||
zwp_relative_pointer_manager_v1* relativePointerManager = nullptr;
|
||||
zwp_relative_pointer_v1* relativePointer = nullptr;
|
||||
zwp_locked_pointer_v1* lockedPointer = nullptr;
|
||||
zwp_idle_inhibit_manager_v1* idleInhibitManager = nullptr;
|
||||
zwp_idle_inhibitor_v1* idleInhibitor = nullptr;
|
||||
zxdg_decoration_manager_v1* decorationManager = nullptr;
|
||||
xkb_context* xkbContext = nullptr;
|
||||
xkb_keymap* xkbKeymap = nullptr;
|
||||
xkb_state* xkbState = nullptr;
|
||||
uint32_t pointerSerial = 0;
|
||||
uint32_t inputSerial = 0;
|
||||
uint32_t repeatRate = 25;
|
||||
uint32_t repeatDelay = 400;
|
||||
bool entered = false;
|
||||
};
|
||||
|
||||
extern WaylandState state;
|
||||
|
||||
class WaylandInput;
|
||||
class WaylandWindow;
|
||||
|
||||
extern WaylandInput* input;
|
||||
extern WaylandWindow* window;
|
||||
|
||||
template <typename... Args>
|
||||
void ignore_event(Args...) {
|
||||
}
|
||||
|
||||
bool decorations_enabled();
|
||||
void dispatch_events(int timeoutMs);
|
||||
int keycode_from_keysym(xkb_keysym_t sym);
|
||||
|
||||
extern bool serverDecorations;
|
||||
|
||||
void zxdg_decoration_configure(
|
||||
void*, zxdg_toplevel_decoration_v1*, uint32_t mode
|
||||
);
|
||||
void on_display_error();
|
||||
Loading…
Add table
Add a link
Reference in a new issue