Files
wayland-starter/include/input/wayland.h
2026-02-25 12:19:59 +01:00

79 lines
2.2 KiB
C++

#pragma once
#ifndef H_WAYLAND_INPUT_
#define H_WAYLAND_INPUT_
#include "input.h"
#include <vector>
#include <wayland-client-protocol.h>
#include "event.h"
class WaylandInputHandler : public InputHandlerImpl {
private:
static void handle_pointer_enter(void *data,
struct wl_pointer *wl_pointer,
uint32_t serial,
struct wl_surface *surface,
wl_fixed_t surface_x,
wl_fixed_t surface_y);
static void handle_pointer_leave(void *data,
struct wl_pointer *wl_pointer,
uint32_t serial,
struct wl_surface *surface);
static void handle_pointer_motion(void *data,
struct wl_pointer *wl_pointer,
uint32_t time,
wl_fixed_t surface_x,
wl_fixed_t surface_y);
static void handle_pointer_button(void *data,
struct wl_pointer *wl_pointer,
uint32_t serial,
uint32_t time,
uint32_t button,
uint32_t state);
static void handle_pointer_axis(void *data,
struct wl_pointer *wl_pointer,
uint32_t time,
uint32_t axis,
wl_fixed_t value);
static void handle_pointer_frame(void *data,
struct wl_pointer *wl_pointer);
static void handle_pointer_axis_source(void *data,
struct wl_pointer *wl_pointer,
uint32_t axis_source);
static void handle_pointer_axis_stop(void *data,
struct wl_pointer *wl_pointer,
uint32_t time,
uint32_t axis);
static void handle_pointer_axis_discrete(void *data,
struct wl_pointer *wl_pointer,
uint32_t axis,
int32_t discrete);
static void handle_pointer_axis_value120(void *data,
struct wl_pointer *wl_pointer,
uint32_t axis,
int32_t value120);
static void handle_pointer_axis_relative_direction(void *data,
struct wl_pointer *wl_pointer,
uint32_t axis,
uint32_t direction);
private:
WaylandInputHandler();
~WaylandInputHandler() = default;
friend class InputHandler;
public:
size_t GetMouseX() override;
size_t GetMouseY() override;
private:
struct wl_pointer_listener m_pointer_listener;
wl_fixed_t m_surface_x;
wl_fixed_t m_surface_y;
private:
std::vector<Event*> m_event_queue;
};
#endif // H_WAYLAND_INPUT_