fix(camera,sms,dwm): fix CAMSS AXI frame-boundary stop, SMS draft button label, and post-reboot softkey responsiveness

This commit is contained in:
Luxferre
2026-10-21 16:00:41 +03:00
parent 55b20c5b85
commit 4bb95d42b0
26 changed files with 152 additions and 33 deletions
+7 -4
View File
@@ -161,9 +161,7 @@ int runCameraApp(int argc, char** argv) {
std::string daemonPidPath = getPluginDaemonPidPath("camera");
std::string activePidPath = getRuntimeFile("xcamera.pid");
int existingDaemon = readIntFile(daemonPidPath, -1);
if (existingDaemon > 0 && existingDaemon != static_cast<int>(::getpid()) &&
::kill(existingDaemon, 0) == 0) {
if (isPluginDaemonAlive("camera")) {
if (!isPreload) {
sendPluginCommand("camera",
initArg.empty() ? "OPEN" : ("OPEN " + initArg));
@@ -422,6 +420,7 @@ int runCameraApp(int argc, char** argv) {
{
std::lock_guard<std::mutex> lk(frameMutex);
vfFront.swap(vfBack);
xImgVf->data = reinterpret_cast<char*>(vfFront.data());
cameraReady = true;
cameraStatus.clear();
if (!savedName.empty()) {
@@ -434,8 +433,12 @@ int runCameraApp(int argc, char** argv) {
char c = 'F';
(void)::write(writePipe, &c, 1);
}
for (int s = 0; s < 5 && !vfShouldStop && gRunning && !snapRequested.load(); ++s) {
struct timespec ts {0, 20 * 1000 * 1000};
nanosleep(&ts, nullptr);
}
} else {
struct timespec ts {0, 30 * 1000 * 1000};
struct timespec ts {0, 50 * 1000 * 1000};
nanosleep(&ts, nullptr);
}
}
+1 -3
View File
@@ -72,9 +72,7 @@ int runContactsApp(int argc, char** argv) {
std::string daemonPidPath = getPluginDaemonPidPath("contacts");
std::string activePidPath = getRuntimeFile("xcontacts.pid");
int existingDaemon = readIntFile(daemonPidPath, -1);
if (existingDaemon > 0 && existingDaemon != static_cast<int>(::getpid()) &&
::kill(existingDaemon, 0) == 0) {
if (isPluginDaemonAlive("contacts")) {
if (!isPreload) {
sendPluginCommand("contacts",
initArg.empty() ? "OPEN" : ("OPEN " + initArg));
+1 -3
View File
@@ -208,9 +208,7 @@ int runFilesApp(int argc, char** argv) {
std::string daemonPidPath = getPluginDaemonPidPath("files");
std::string activePidPath = getRuntimeFile("xfiles.pid");
int existingDaemon = readIntFile(daemonPidPath, -1);
if (existingDaemon > 0 && existingDaemon != static_cast<int>(::getpid()) &&
::kill(existingDaemon, 0) == 0) {
if (isPluginDaemonAlive("files")) {
if (!isPreload) {
sendPluginCommand("files", initDir.empty() ? "OPEN" : ("OPEN " + initDir));
}
+30 -1
View File
@@ -125,11 +125,40 @@ inline std::string getPluginDaemonPidPath(const char* name) {
return std::string("/tmp/dwm_plugin_") + name + ".pid";
}
inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {
inline bool isPluginDaemonAlive(const char* name) {
if (!name || !name[0]) {
return false;
}
int pid = readIntFile(getPluginDaemonPidPath(name), -1);
if (pid <= 0 || pid == static_cast<int>(::getpid()) || ::kill(pid, 0) != 0) {
return false;
}
char cmdPath[64];
std::snprintf(cmdPath, sizeof(cmdPath), "/proc/%d/cmdline", pid);
int fd = ::open(cmdPath, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
return false;
}
char buf[256];
ssize_t n = ::read(fd, buf, sizeof(buf) - 1);
::close(fd);
if (n <= 0) {
return false;
}
for (ssize_t i = 0; i < n; ++i) {
if (buf[i] == '\0') {
buf[i] = ' ';
}
}
buf[n] = '\0';
return (std::strstr(buf, "dwm-plugin") != nullptr &&
std::strstr(buf, name) != nullptr);
}
inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {
if (!isPluginDaemonAlive(name)) {
return false;
}
std::string fifoPath = getPluginFifoPath(name);
int fd = ::open(fifoPath.c_str(), O_WRONLY | O_NONBLOCK | O_CLOEXEC);
if (fd < 0) {
+8 -5
View File
@@ -94,9 +94,7 @@ int runSmsApp(int argc, char** argv) {
std::string daemonPidPath = getPluginDaemonPidPath("sms");
std::string activePidPath = getRuntimeFile("xsms.pid");
int existingDaemon = readIntFile(daemonPidPath, -1);
if (existingDaemon > 0 && existingDaemon != static_cast<int>(::getpid()) &&
::kill(existingDaemon, 0) == 0) {
if (isPluginDaemonAlive("sms")) {
if (!isPreload) {
sendPluginCommand("sms", initArg.empty() ? "OPEN" : ("OPEN " + initArg));
}
@@ -767,11 +765,16 @@ int runSmsApp(int argc, char** argv) {
drawPango(layoutMain, &colYellow, 146, 234, 30, "Draft", 84);
if (composeField == 0) {
drawSoftkeyBar("Contacts", "Next",
drawSoftkeyBar("Contacts",
composeRecipient.empty() ? "Contacts" : "Next",
composeRecipient.empty() ? "Cancel" : "Clear");
} else {
} else if (composeField == 1) {
drawSoftkeyBar("Send", "Send",
composeText.empty() ? "Cancel" : "Del");
} else if (composeField == 2) {
drawSoftkeyBar("Send", "Send", "Cancel");
} else {
drawSoftkeyBar("Send", "Draft", "Cancel");
}
} else if (mode == ViewMode::PickContact) {