dwm-plugins: fix vibration test, AT debug channel, and Close softkey leak
This commit is contained in:
@@ -1110,6 +1110,19 @@ int runModemApp(int argc, char** argv) {
|
||||
|
||||
auto hideWindow = [&]() {
|
||||
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);
|
||||
XUnmapWindow(dpy, win);
|
||||
XFlush(dpy);
|
||||
|
||||
@@ -952,6 +952,19 @@ int runNetworksApp(int argc, char** argv) {
|
||||
|
||||
auto hideWindow = [&]() {
|
||||
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);
|
||||
XUnmapWindow(dpy, win);
|
||||
XFlush(dpy);
|
||||
|
||||
@@ -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...");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -490,17 +490,43 @@ int runWallpapersApp(int argc, char** argv) {
|
||||
}
|
||||
updatePreviewCache();
|
||||
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 = [&]() {
|
||||
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;
|
||||
fullscreenPreview = false;
|
||||
softkeyPending = 0;
|
||||
|
||||
Reference in New Issue
Block a user