2020-06-11 10:42:27 +00:00
|
|
|
// Wayland stuff
|
2019-11-21 05:16:53 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wayland-server-core.h>
|
|
|
|
|
2020-04-02 02:13:58 +00:00
|
|
|
#define WLSERVER_BUTTON_COUNT 4
|
2020-09-18 21:59:26 +00:00
|
|
|
#define WLSERVER_TOUCH_COUNT 11 // Ten fingers + nose ought to be enough for anyone
|
2020-04-02 02:13:58 +00:00
|
|
|
|
2019-11-21 05:16:53 +00:00
|
|
|
struct wlserver_t {
|
|
|
|
struct wl_display *wl_display;
|
|
|
|
struct wl_event_loop *wl_event_loop;
|
2019-12-31 06:50:49 +00:00
|
|
|
int wl_event_loop_fd;
|
2019-11-21 05:16:53 +00:00
|
|
|
|
|
|
|
struct {
|
2020-01-17 09:57:39 +00:00
|
|
|
struct wlr_backend *multi_backend;
|
2021-02-01 09:24:39 +00:00
|
|
|
struct wlr_backend *noop_backend;
|
2020-01-17 09:57:39 +00:00
|
|
|
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;
|
2020-05-19 15:25:43 +00:00
|
|
|
struct wlr_xwayland_server *xwayland_server;
|
2019-11-21 05:16:53 +00:00
|
|
|
struct wlr_session *session;
|
|
|
|
struct wlr_seat *seat;
|
|
|
|
struct wlr_output *output;
|
|
|
|
} wlr;
|
2020-01-17 09:57:39 +00:00
|
|
|
|
|
|
|
struct wlr_surface *mouse_focus_surface;
|
|
|
|
double mouse_surface_cursorx;
|
|
|
|
double mouse_surface_cursory;
|
|
|
|
|
2020-04-02 02:13:58 +00:00
|
|
|
bool button_held[ WLSERVER_BUTTON_COUNT ];
|
2020-09-18 21:59:26 +00:00
|
|
|
bool touch_down[ WLSERVER_TOUCH_COUNT ];
|
2020-01-17 09:57:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
2020-01-23 06:15:22 +00:00
|
|
|
extern bool run;
|
2019-11-23 06:58:07 +00:00
|
|
|
|
2020-04-02 02:13:58 +00:00
|
|
|
extern int g_nTouchClickMode;
|
|
|
|
|
2020-01-17 00:43:21 +00:00
|
|
|
void xwayland_surface_role_commit(struct wlr_surface *wlr_surface);
|
|
|
|
|
2020-01-02 07:23:39 +00:00
|
|
|
int wlserver_init( int argc, char **argv, bool bIsNested );
|
2019-11-23 06:58:07 +00:00
|
|
|
|
|
|
|
int wlserver_run(void);
|
|
|
|
|
2019-11-24 21:55:02 +00:00
|
|
|
void nudge_steamcompmgr(void);
|
2019-11-23 07:42:02 +00:00
|
|
|
|
2019-12-31 01:50:22 +00:00
|
|
|
void wlserver_lock(void);
|
|
|
|
void wlserver_unlock(void);
|
|
|
|
|
2020-01-17 09:57:39 +00:00
|
|
|
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 );
|
2020-01-17 09:57:39 +00:00
|
|
|
|
2020-01-02 07:23:39 +00:00
|
|
|
void wlserver_mousefocus( struct wlr_surface *wlrsurface );
|
2020-04-01 20:41:58 +00:00
|
|
|
void wlserver_mousemotion( int x, int y, uint32_t time );
|
2020-01-02 07:23:39 +00:00
|
|
|
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 );
|