dwm-plugins: fix vibration test, AT debug channel, and Close softkey leak

This commit is contained in:
Luxferre
2026-10-24 21:11:57 +03:00
parent f394d2b135
commit 5646f03ebe
21 changed files with 160 additions and 54 deletions
+38 -6
View File
@@ -585,18 +585,44 @@ int runRingtonesApp(int argc, char** argv) {
}
}
writeIntFile(activePidPath, static_cast<int>(::getpid()));
visible = true;
if (!visible) {
visible = true;
XMapRaised(dpy, win);
XSync(dpy, False);
} else {
XRaiseWindow(dpy, win);
}
for (int i = 0; i < 20; ++i) {
if (XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync,
CurrentTime) == GrabSuccess) {
break;
}
usleep(2000);
}
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
startupIgnoreUntilMs = nowMs() + 180;
initialSoftkeysReleased = (querySoftkeysDown(dpy) == 0);
softkeyPending = 0;
XMapRaised(dpy, win);
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
render();
};
auto hideWindow = [&]() {
stopPreview();
if (!visible) return;
int xfdLocal = ConnectionNumber(dpy);
int64_t drainDeadline = nowMs() + 180;
while (nowMs() < drainDeadline && querySoftkeysDown(dpy) != 0) {
while (XPending(dpy) > 0) {
XEvent ev;
XNextEvent(dpy, &ev);
}
struct pollfd pfd {};
pfd.fd = xfdLocal;
pfd.events = POLLIN;
::poll(&pfd, 1, 10);
}
writeSoftkeySuppress(nowMs() + 450);
XUngrabKeyboard(dpy, CurrentTime);
visible = false;
softkeyPending = 0;
XUnmapWindow(dpy, win);
@@ -636,9 +662,15 @@ int runRingtonesApp(int argc, char** argv) {
((settings.vibrateStrength - 1 + 3 + delta) % 3) + 1;
saveRingSettings(settings);
} else if (settingsRow == 4) {
runAsyncCmd("sxmo_vibrate 600 " +
std::to_string(settings.vibrateStrength) +
" >/dev/null 2>&1");
int mag = (settings.vibrateStrength == 1)
? 20000
: (settings.vibrateStrength == 3 ? 65535 : 40000);
runAsyncCmd(
"for d in /dev/input/by-path/platform-vibrator-event "
"/dev/input/by-path/*vibrator*-event; do "
"[ -e \"$d\" ] && export SXMO_VIBRATE_DEV=\"$d\" && break; done; "
"sxmo_vibrate 600 " +
std::to_string(mag) + " >/dev/null 2>&1");
setBanner("Testing vibration...");
}
};