62 lines
1.4 KiB
C
62 lines
1.4 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <wayland-client.h>
|
|
#include <xkbcommon/xkbcommon.h>
|
|
|
|
enum pointer_event_mask
|
|
{
|
|
POINTER_EVENT_ENTER = 1 << 0,
|
|
POINTER_EVENT_LEAVE = 1 << 1,
|
|
POINTER_EVENT_MOTION = 1 << 2,
|
|
POINTER_EVENT_BUTTON = 1 << 3,
|
|
POINTER_EVENT_AXIS = 1 << 4,
|
|
POINTER_EVENT_AXIS_SOURCE = 1 << 5,
|
|
POINTER_EVENT_AXIS_STOP = 1 << 6,
|
|
POINTER_EVENT_AXIS_DISCRETE = 1 << 7,
|
|
};
|
|
|
|
struct pointer_event
|
|
{
|
|
uint32_t event_mask;
|
|
wl_fixed_t surface_x, surface_y;
|
|
uint32_t button, state;
|
|
uint32_t time;
|
|
uint32_t serial;
|
|
struct
|
|
{
|
|
bool valid;
|
|
wl_fixed_t value;
|
|
int32_t discrete;
|
|
} axes[2];
|
|
uint32_t axis_source;
|
|
};
|
|
|
|
struct client_state
|
|
{
|
|
/* Globals */
|
|
struct wl_display *wl_display;
|
|
struct wl_registry *wl_registry;
|
|
struct wl_shm *wl_shm;
|
|
struct wl_compositor *wl_compositor;
|
|
struct xdg_wm_base *xdg_wm_base;
|
|
struct wl_seat *wl_seat;
|
|
|
|
/* Objects */
|
|
struct wl_surface *wl_surface;
|
|
struct xdg_surface *xdg_surface;
|
|
struct xdg_toplevel *xdg_toplevel;
|
|
struct wl_keyboard *wl_keyboard;
|
|
struct wl_pointer *wl_pointer;
|
|
struct wl_touch *wl_touch;
|
|
|
|
/* State */
|
|
float offset;
|
|
uint32_t last_frame;
|
|
struct pointer_event pointer_event;
|
|
struct xkb_state *xkb_state;
|
|
struct xkb_context *xkb_context;
|
|
struct xkb_keymap *xkb_keymap;
|
|
};
|