Make default touch mode configurable.

This commit is contained in:
Pierre-Loup A. Griffais 2021-10-04 15:00:29 -07:00
parent a5a31d46e3
commit 39c9e93e0c
4 changed files with 9 additions and 3 deletions

View file

@ -46,6 +46,7 @@ const struct option *gamescope_options = (struct option[]){
{ "disable-layers", no_argument, nullptr, 0 }, { "disable-layers", no_argument, nullptr, 0 },
{ "debug-layers", no_argument, nullptr, 0 }, { "debug-layers", no_argument, nullptr, 0 },
{ "prefer-output", required_argument, nullptr, 'O' }, { "prefer-output", required_argument, nullptr, 'O' },
{ "default-touch-mode", required_argument, nullptr, 0 },
// steamcompmgr options // steamcompmgr options
{ "cursor", required_argument, nullptr, 0 }, { "cursor", required_argument, nullptr, 0 },
@ -89,6 +90,7 @@ const char usage[] =
"\n" "\n"
"Embedded mode options:\n" "Embedded mode options:\n"
" -O, --prefer-output list of connectors in order of preference\n" " -O, --prefer-output list of connectors in order of preference\n"
" --default-touch-mode 0: hover, 1: left, 2: right, 3: middle, 4: passthrough\n"
"\n" "\n"
"Debug options:\n" "Debug options:\n"
" --disable-layers disable libliftoff (hardware planes)\n" " --disable-layers disable libliftoff (hardware planes)\n"
@ -235,6 +237,9 @@ int main(int argc, char **argv)
g_bUseLayers = false; g_bUseLayers = false;
} else if (strcmp(opt_name, "debug-layers") == 0) { } else if (strcmp(opt_name, "debug-layers") == 0) {
g_bDebugLayers = true; g_bDebugLayers = true;
} else if (strcmp(opt_name, "default-touch-mode") == 0) {
g_nDefaultTouchClickMode = (enum wlserver_touch_click_mode) atoi( optarg );
g_nTouchClickMode = g_nDefaultTouchClickMode;
} }
break; break;
case '?': case '?':

View file

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

View file

@ -65,7 +65,8 @@ struct wlserver_content_override {
static std::map<uint32_t, struct wlserver_content_override *> content_overrides; static std::map<uint32_t, struct wlserver_content_override *> content_overrides;
enum wlserver_touch_click_mode g_nTouchClickMode = WLSERVER_TOUCH_CLICK_LEFT; enum wlserver_touch_click_mode g_nDefaultTouchClickMode = WLSERVER_TOUCH_CLICK_LEFT;
enum wlserver_touch_click_mode g_nTouchClickMode = g_nDefaultTouchClickMode;
static struct wl_list pending_surfaces = {0}; static struct wl_list pending_surfaces = {0};

View file

@ -71,6 +71,7 @@ enum wlserver_touch_click_mode {
WLSERVER_TOUCH_CLICK_PASSTHROUGH = 4, WLSERVER_TOUCH_CLICK_PASSTHROUGH = 4,
}; };
extern enum wlserver_touch_click_mode g_nDefaultTouchClickMode;
extern enum wlserver_touch_click_mode g_nTouchClickMode; extern enum wlserver_touch_click_mode g_nTouchClickMode;
void xwayland_surface_role_commit(struct wlr_surface *wlr_surface); void xwayland_surface_role_commit(struct wlr_surface *wlr_surface);