gamescope/src/wlserver.h

118 lines
2.7 KiB
C
Raw Normal View History

2019-11-21 05:16:53 +00:00
// Wayland stuff
#pragma once
2019-11-23 06:58:07 +00:00
// Only define wlserver_t on the C side, as wlroots can't build as C++
#ifdef C_SIDE
2019-11-21 05:16:53 +00:00
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_relative_pointer_v1.h>
2019-11-21 05:16:53 +00:00
#include <wlr/xwayland.h>
struct wlserver_t {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
int wl_event_loop_fd;
2019-11-21 05:16:53 +00:00
struct {
struct wlr_backend *multi_backend;
struct wlr_backend *headless_backend;
struct wlr_backend *libinput_backend;
2019-11-21 05:16:53 +00:00
struct wlr_renderer *renderer;
struct wlr_compositor *compositor;
struct wlr_xwayland *xwayland;
struct wlr_session *session;
struct wlr_seat *seat;
struct wlr_output *output;
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
struct wl_listener relative_pointer_listener;
struct wlr_pointer_constraints_v1 *pointer_constraints;
struct wl_listener pointer_constraints_listener;
struct {
struct wlr_pointer_constraint_v1 *active;
pixman_region32_t confine; // invalid if active == NULL
struct wl_listener commit;
} constraint;
2019-11-21 05:16:53 +00:00
} wlr;
struct wlr_surface *mouse_focus_surface;
double mouse_surface_cursorx;
double mouse_surface_cursory;
double touchdown_x;
double touchdown_y;
unsigned int touchdown_time_ms;
bool dragging;
bool candrag;
};
struct wlserver_keyboard {
struct wlr_input_device *device;
struct wl_listener modifiers;
struct wl_listener key;
};
struct wlserver_pointer {
struct wlr_input_device *device;
struct wl_listener motion;
struct wl_listener button;
};
struct wlserver_touch {
struct wlr_input_device *device;
struct wl_listener down;
struct wl_listener up;
struct wl_listener motion;
2019-11-21 05:16:53 +00:00
};
extern struct wlserver_t wlserver;
2019-11-23 06:58:07 +00:00
#endif
#ifndef C_SIDE
extern "C" {
#endif
extern bool run;
extern int pointerX;
extern int pointerY;
2019-11-23 06:58:07 +00:00
void xwayland_surface_role_commit(struct wlr_surface *wlr_surface);
int wlserver_init( int argc, char **argv, bool bIsNested );
2019-11-23 06:58:07 +00:00
int wlserver_run(void);
void nudge_steamcompmgr(void);
void wlserver_lock(void);
void wlserver_unlock(void);
void wlserver_keyboardfocus( struct wlr_surface *surface );
2020-01-18 23:10:14 +00:00
void wlserver_key( uint32_t key, bool press, uint32_t time );
void wlserver_mousefocus( struct wlr_surface *wlrsurface );
void wlserver_mousemotion( int dx, int dy, uint32_t time );
void wlserver_mousebutton( int button, bool press, uint32_t time );
void wlserver_mousewheel( int x, int y, uint32_t time );
2020-01-23 05:50:01 +00:00
void wlserver_send_frame_done( struct wlr_surface *surf, const struct timespec *when );
struct wlr_surface *wlserver_get_surface( long surfaceID );
const char *wlserver_get_nested_display( void );
2019-11-23 06:58:07 +00:00
#ifndef C_SIDE
}
#endif