gamescope/src/wlserver.hpp
Simon Ser bae255ee1a
Get rid of C_SIDE
wlroots headers can mostly be included with extern "C" blocks. Two
exceptions are the use of `static` for array args and `class` as a
struct field. These can be #define'ed to avoid C++ build errors.

This allows the whole project to be built as a single C++ codebase,
without having to maintain hybrid header files.
2020-06-11 12:44:36 +02:00

84 lines
1.9 KiB
C++

// Wayland stuff
#pragma once
#include <wayland-server-core.h>
#define WLSERVER_BUTTON_COUNT 4
struct wlserver_t {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
int wl_event_loop_fd;
struct {
struct wlr_backend *multi_backend;
struct wlr_backend *headless_backend;
struct wlr_backend *libinput_backend;
struct wlr_renderer *renderer;
struct wlr_compositor *compositor;
struct wlr_xwayland_server *xwayland_server;
struct wlr_session *session;
struct wlr_seat *seat;
struct wlr_output *output;
} wlr;
struct wlr_surface *mouse_focus_surface;
double mouse_surface_cursorx;
double mouse_surface_cursory;
bool button_held[ WLSERVER_BUTTON_COUNT ];
};
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;
};
extern struct wlserver_t wlserver;
extern bool run;
extern int g_nTouchClickMode;
void xwayland_surface_role_commit(struct wlr_surface *wlr_surface);
int wlserver_init( int argc, char **argv, bool bIsNested );
int wlserver_run(void);
void nudge_steamcompmgr(void);
void wlserver_lock(void);
void wlserver_unlock(void);
void wlserver_keyboardfocus( struct wlr_surface *surface );
void wlserver_key( uint32_t key, bool press, uint32_t time );
void wlserver_mousefocus( struct wlr_surface *wlrsurface );
void wlserver_mousemotion( int x, int y, uint32_t time );
void wlserver_mousebutton( int button, bool press, uint32_t time );
void wlserver_mousewheel( int x, int y, uint32_t time );
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 );