~mil/sxmo-dwm

098c3b23ee82cf64559009a3a48eda88238a47ed — Stacy Harper 2 months ago 198c2e0 6.2.14
Make threshold configurable with SXMO_THRESHOLD

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
1 files changed, 9 insertions(+), 4 deletions(-)

M dwm.c
M dwm.c => dwm.c +9 -4
@@ 308,8 308,9 @@ static Window root, wmcheckwin;
static char *colors[4][3]; /* 4 schemes, 3 colors each */
static char *fonts[] = {0};

#define KEYPRESS_MS_THRESHOLD 250
#define KEYHOLD_MS_THRESHOLD 800
int keyhold_ms_threshold = 500;
int keypress_ms_threshold = 300;

static int multikeypendingindex = -1;
timer_t multikeypendingtimer;
static int multikeyup = 1;


@@ 1278,7 1279,7 @@ void keypresstimerdonesync(int idx) {
		for (i = 0; i < LENGTH(keys); i++)
			if (keys[i].keysym == keys[idx].keysym) maxidx = i;
		if (maxidx != -1)
			keypresstimerdispatch(KEYHOLD_MS_THRESHOLD - KEYPRESS_MS_THRESHOLD, maxidx);
			keypresstimerdispatch(keyhold_ms_threshold - keypress_ms_threshold, maxidx);
	} else if (keys[idx].func) {
		// Run the actual keys' fn
		keys[idx].func(&(keys[idx].arg));


@@ 1347,7 1348,7 @@ keypress(XEvent *e)
			) {
			  multikeyup = 0;
			  multikeypendingindex = i;
  			keypresstimerdispatch(KEYPRESS_MS_THRESHOLD, i);
  			keypresstimerdispatch(keypress_ms_threshold, i);
  			break;
  		}
		}


@@ 1935,6 1936,10 @@ setup(void)
		}
	}

	if (getenv("SXMO_THRESHOLD")) {
		keypress_ms_threshold = atoi(getenv("SXMO_THRESHOLD"));
		keyhold_ms_threshold = keypress_ms_threshold + 300; // To match sway input delay multikey config
	}

	if (!drw_fontset_create(drw, (const char**) fonts, LENGTH(fonts)))
		die("no fonts could be loaded.");