Add enum for g_nTouchClickMode

Makes it clearer what the values mean.
This commit is contained in:
Simon Ser 2021-06-18 10:44:13 +02:00
parent 2807bb27c1
commit 3e17ea2e6f
3 changed files with 13 additions and 6 deletions

View file

@ -2548,7 +2548,7 @@ handle_property_notify(Display *dpy, XPropertyEvent *ev)
if (ev->atom == steamTouchClickModeAtom )
{
// Default to 1, left click
g_nTouchClickMode = get_prop(dpy, root, steamTouchClickModeAtom, 1 );
g_nTouchClickMode = (enum wlserver_touch_click_mode) get_prop(dpy, root, steamTouchClickModeAtom, 1 );
}
if (ev->atom == steamStreamingClientAtom)
{

View file

@ -59,8 +59,7 @@ struct wlserver_content_override {
std::map<uint32_t, struct wlserver_content_override *> content_overrides;
// O = hover, 1/2/3 = left/right/middle, 4 = touch passthrough
int g_nTouchClickMode = 1;
enum wlserver_touch_click_mode g_nTouchClickMode = WLSERVER_TOUCH_CLICK_LEFT;
static struct wl_list pending_surfaces = {0};
@ -245,7 +244,7 @@ static void wlserver_handle_touch_down(struct wl_listener *listener, void *data)
wlserver.mouse_surface_cursorx = x;
wlserver.mouse_surface_cursory = y;
if ( g_nTouchClickMode == 4 )
if ( g_nTouchClickMode == WLSERVER_TOUCH_CLICK_PASSTHROUGH )
{
if ( event->touch_id >= 0 && event->touch_id < WLSERVER_TOUCH_COUNT )
{
@ -338,7 +337,7 @@ static void wlserver_handle_touch_motion(struct wl_listener *listener, void *dat
wlserver.mouse_surface_cursorx = x;
wlserver.mouse_surface_cursory = y;
if ( g_nTouchClickMode == 4 )
if ( g_nTouchClickMode == WLSERVER_TOUCH_CLICK_PASSTHROUGH )
{
wlr_seat_touch_notify_motion( wlserver.wlr.seat, event->time_msec, event->touch_id, wlserver.mouse_surface_cursorx, wlserver.mouse_surface_cursory );
}

View file

@ -62,7 +62,15 @@ extern struct wlserver_t wlserver;
extern bool run;
extern int g_nTouchClickMode;
enum wlserver_touch_click_mode {
WLSERVER_TOUCH_CLICK_HOVER = 0,
WLSERVER_TOUCH_CLICK_LEFT = 1,
WLSERVER_TOUCH_CLICK_RIGHT = 2,
WLSERVER_TOUCH_CLICK_MIDDLE = 3,
WLSERVER_TOUCH_CLICK_PASSTHROUGH = 4,
};
extern enum wlserver_touch_click_mode g_nTouchClickMode;
void xwayland_surface_role_commit(struct wlr_surface *wlr_surface);