chore: use c++17 style if,switch init-initilizer where possible
chore: correct spelling of "colon" in NetworkAddresses variables chore: correct some multi line defines near needed init-initilizers
This commit is contained in:
parent
bdffda9a2f
commit
0ff72441e6
43 changed files with 102 additions and 171 deletions
|
|
@ -55,8 +55,7 @@ int IArchString::convStringWCToMB(char *dst, const wchar_t *src, uint32_t n, boo
|
|||
len += mblen;
|
||||
++scan;
|
||||
}
|
||||
ptrdiff_t mblen = wctomb(dummy, L'\0');
|
||||
if (mblen != -1) {
|
||||
if (ptrdiff_t mblen = wctomb(dummy, L'\0'); mblen != -1) {
|
||||
len += mblen - 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -72,8 +71,7 @@ int IArchString::convStringWCToMB(char *dst, const wchar_t *src, uint32_t n, boo
|
|||
}
|
||||
++scan;
|
||||
}
|
||||
ptrdiff_t mblen = wctomb(dst, L'\0');
|
||||
if (mblen != -1) {
|
||||
if (ptrdiff_t mblen = wctomb(dst, L'\0'); mblen != -1) {
|
||||
// don't include nul terminator
|
||||
dst += mblen - 1;
|
||||
}
|
||||
|
|
@ -104,8 +102,7 @@ int IArchString::convStringMBToWC(wchar_t *dst, const char *src, uint32_t n, boo
|
|||
if (dst == nullptr) {
|
||||
const char *scan = src;
|
||||
while (n > 0) {
|
||||
ptrdiff_t mblen = mbtowc(&dummy, scan, n);
|
||||
switch (mblen) {
|
||||
switch (ptrdiff_t mblen = mbtowc(&dummy, scan, n); mblen) {
|
||||
case -2:
|
||||
// incomplete last character. convert to unknown character.
|
||||
*errors = true;
|
||||
|
|
@ -140,8 +137,7 @@ int IArchString::convStringMBToWC(wchar_t *dst, const char *src, uint32_t n, boo
|
|||
wchar_t *dst0 = dst;
|
||||
const char *scan = src;
|
||||
while (n > 0) {
|
||||
ptrdiff_t mblen = mbtowc(dst, scan, n);
|
||||
switch (mblen) {
|
||||
switch (ptrdiff_t mblen = mbtowc(dst, scan, n); mblen) {
|
||||
case -2:
|
||||
// incomplete character. convert to unknown character.
|
||||
*errors = true;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ int ArchDaemonUnix::daemonize(const char *name, DaemonFunc const &func)
|
|||
// NB: don't run chdir on apple; causes strange behaviour.
|
||||
// chdir to root so we don't keep mounted filesystems points busy
|
||||
// TODO: this is a bit of a hack - can we find a better solution?
|
||||
int chdirErr = chdir("/");
|
||||
if (chdirErr)
|
||||
if (int chdirErr = chdir("/"); chdirErr)
|
||||
// NB: file logging actually isn't working at this point!
|
||||
LOG((CLOG_ERR "chdir error: %i", chdirErr));
|
||||
#endif
|
||||
|
|
@ -93,9 +92,7 @@ int ArchDaemonUnix::daemonize(const char *name, DaemonFunc const &func)
|
|||
open("/dev/null", O_RDONLY);
|
||||
open("/dev/null", O_RDWR);
|
||||
|
||||
int dupErr = dup(1);
|
||||
|
||||
if (dupErr < 0) {
|
||||
if (int dupErr = dup(1); dupErr < 0) {
|
||||
// NB: file logging actually isn't working at this point!
|
||||
LOG((CLOG_ERR "dup error: %i", dupErr));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,8 +204,7 @@ bool ArchMultithreadPosix::waitCondVar(ArchCond cond, ArchMutex mutex, double ti
|
|||
// so we have to return to the caller. since the caller will
|
||||
// always check for spurious wakeups the only drawback here is
|
||||
// performance: we're waking up a lot more than desired.
|
||||
static const double maxCancellationLatency = 0.1;
|
||||
if (timeout < 0.0 || timeout > maxCancellationLatency) {
|
||||
if (static const double maxCancellationLatency = 0.1; timeout < 0.0 || timeout > maxCancellationLatency) {
|
||||
timeout = maxCancellationLatency;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -404,8 +404,8 @@ void ArchNetworkBSD::throwErrorOnSocket(ArchSocket s)
|
|||
|
||||
// get the error from the socket layer
|
||||
int err = 0;
|
||||
auto size = static_cast<socklen_t>(sizeof(err));
|
||||
if (getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<optval_t *>(&err), &size) == -1) {
|
||||
if (auto size = static_cast<socklen_t>(sizeof(err));
|
||||
getsockopt(s->m_fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<optval_t *>(&err), &size) == -1) {
|
||||
err = errno;
|
||||
}
|
||||
|
||||
|
|
@ -545,8 +545,8 @@ std::vector<ArchNetAddress> ArchNetworkBSD::nameToAddr(const std::string &name)
|
|||
// done with static buffer
|
||||
ARCH->lockMutex(m_mutex);
|
||||
struct addrinfo *pResult = nullptr;
|
||||
int ret = getaddrinfo(name.c_str(), nullptr, &hints, &pResult);
|
||||
if (ret != 0) {
|
||||
|
||||
if (int ret = getaddrinfo(name.c_str(), nullptr, &hints, &pResult); ret != 0) {
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
throwNameError(ret);
|
||||
}
|
||||
|
|
@ -585,9 +585,10 @@ std::string ArchNetworkBSD::addrToName(ArchNetAddress addr)
|
|||
ARCH->lockMutex(m_mutex);
|
||||
char host[1024];
|
||||
char service[20];
|
||||
int ret =
|
||||
getnameinfo(TYPED_ADDR(struct sockaddr, addr), addr->m_len, host, sizeof(host), service, sizeof(service), 0);
|
||||
if (ret != 0) {
|
||||
|
||||
if (int ret =
|
||||
getnameinfo(TYPED_ADDR(struct sockaddr, addr), addr->m_len, host, sizeof(host), service, sizeof(service), 0);
|
||||
ret != 0) {
|
||||
ARCH->unlockMutex(m_mutex);
|
||||
throwNameError(ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ retry:
|
|||
// get time until next timer expires. if there is a timer
|
||||
// and it'll expire before the client's timeout then use
|
||||
// that duration for our timeout instead.
|
||||
double timerTimeout = getNextTimerTimeout();
|
||||
if (timeout < 0.0 || (timerTimeout >= 0.0 && timerTimeout < timeLeft)) {
|
||||
if (double timerTimeout = getNextTimerTimeout();
|
||||
timeout < 0.0 || (timerTimeout >= 0.0 && timerTimeout < timeLeft)) {
|
||||
timeLeft = timerTimeout;
|
||||
}
|
||||
|
||||
|
|
@ -253,8 +253,7 @@ void EventQueue::deleteTimer(EventQueueTimer *timer)
|
|||
break;
|
||||
}
|
||||
}
|
||||
Timers::iterator index = m_timers.find(timer);
|
||||
if (index != m_timers.end()) {
|
||||
if (Timers::iterator index = m_timers.find(timer); index != m_timers.end()) {
|
||||
m_timers.erase(index);
|
||||
}
|
||||
m_buffer->deleteTimer(timer);
|
||||
|
|
@ -316,8 +315,7 @@ bool EventQueue::isEmpty() const
|
|||
IEventJob *EventQueue::getHandler(EventTypes type, void *target) const
|
||||
{
|
||||
ArchMutexLock lock(m_mutex);
|
||||
HandlerTable::const_iterator index = m_handlers.find(target);
|
||||
if (index != m_handlers.end()) {
|
||||
if (HandlerTable::const_iterator index = m_handlers.find(target); index != m_handlers.end()) {
|
||||
const TypeHandlerTable &typeHandlers = index->second;
|
||||
TypeHandlerTable::const_iterator index2 = typeHandlers.find(type);
|
||||
if (index2 != typeHandlers.end()) {
|
||||
|
|
|
|||
|
|
@ -439,8 +439,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, uint32_t n, bool *errors
|
|||
|
||||
// convert each character
|
||||
while (n > 0) {
|
||||
uint32_t c = decode16(data, byteSwapped);
|
||||
if (c < 0x0000d800 || c > 0x0000dfff) {
|
||||
if (uint32_t c = decode16(data, byteSwapped); c < 0x0000d800 || c > 0x0000dfff) {
|
||||
toUTF8(dst, c, errors);
|
||||
} else if (n == 1) {
|
||||
// error -- missing second word
|
||||
|
|
@ -449,8 +448,7 @@ std::string Unicode::doUTF16ToUTF8(const uint8_t *data, uint32_t n, bool *errors
|
|||
} else if (c >= 0x0000d800 && c <= 0x0000dbff) {
|
||||
data += 2;
|
||||
--n;
|
||||
uint32_t c2 = decode16(data, byteSwapped);
|
||||
if (c2 < 0x0000dc00 || c2 > 0x0000dfff) {
|
||||
if (uint32_t c2 = decode16(data, byteSwapped); c2 < 0x0000dc00 || c2 > 0x0000dfff) {
|
||||
// error -- [d800,dbff] not followed by [dc00,dfff]
|
||||
setError(errors);
|
||||
toUTF8(dst, s_replacement, nullptr);
|
||||
|
|
@ -644,8 +642,8 @@ uint32_t Unicode::fromUTF8(const uint8_t *&data, uint32_t &n)
|
|||
}
|
||||
|
||||
// check for characters that didn't use the smallest possible encoding
|
||||
static uint32_t s_minChar[] = {0, 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000};
|
||||
if (c < s_minChar[size]) {
|
||||
if (static uint32_t s_minChar[] = {0, 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000};
|
||||
c < s_minChar[size]) {
|
||||
return s_invalid;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,9 +218,7 @@ bool ArgParser::isArg(
|
|||
int argi, int argc, const char *const *argv, const char *name1, const char *name2, int minRequiredParameters
|
||||
)
|
||||
{
|
||||
const auto match1 = (name1 != nullptr && strcmp(argv[argi], name1) == 0);
|
||||
const auto match2 = (name2 != nullptr && strcmp(argv[argi], name2) == 0);
|
||||
if (match1 || match2) {
|
||||
if ((name1 != nullptr && strcmp(argv[argi], name1) == 0) || (name2 != nullptr && strcmp(argv[argi], name2) == 0)) {
|
||||
// match. check args left.
|
||||
if (argi + minRequiredParameters >= argc) {
|
||||
LOG((CLOG_PRINT "%s: missing arguments for `%s'" BYE, argsBase().m_pname, argv[argi], argsBase().m_pname));
|
||||
|
|
|
|||
|
|
@ -303,8 +303,7 @@ int32_t KeyMap::getLanguageGroupID(int32_t group, const std::string &lang) const
|
|||
{
|
||||
int32_t id = group;
|
||||
|
||||
auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang);
|
||||
if (it != m_keyboardLayouts.end()) {
|
||||
if (auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang); it != m_keyboardLayouts.end()) {
|
||||
id = static_cast<int>(std::distance(m_keyboardLayouts.begin(), it));
|
||||
LOG((CLOG_DEBUG1 "language %s has group id %d", lang.c_str(), id));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -319,11 +319,7 @@ bool Screen::isOnScreen() const
|
|||
|
||||
bool Screen::isLockedToScreen() const
|
||||
{
|
||||
// check for pressed mouse buttons
|
||||
// HACK: commented out as it breaks new drag drop feature
|
||||
uint32_t buttonID = 0;
|
||||
|
||||
if (m_screen->isAnyMouseButtonDown(buttonID)) {
|
||||
if (uint32_t buttonID = 0; m_screen->isAnyMouseButtonDown(buttonID)) {
|
||||
LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -638,8 +638,7 @@ int ServerApp::mainLoop()
|
|||
}
|
||||
|
||||
// canonicalize the primary screen name
|
||||
std::string primaryName = args().m_config->getCanonicalName(args().m_name);
|
||||
if (primaryName.empty()) {
|
||||
if (std::string primaryName = args().m_config->getCanonicalName(args().m_name); primaryName.empty()) {
|
||||
LOG((CLOG_CRIT "unknown screen name `%s'", args().m_name.c_str()));
|
||||
return kExitFailed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ std::string AppUtilUnix::getCurrentLanguageCode()
|
|||
continue;
|
||||
}
|
||||
|
||||
auto group = rawLayouts.substr(groupStartI, strI - groupStartI);
|
||||
if (group.find("group", 0, 5) == std::string::npos && group.find("inet", 0, 4) == std::string::npos &&
|
||||
if (auto group = rawLayouts.substr(groupStartI, strI - groupStartI);
|
||||
group.find("group", 0, 5) == std::string::npos && group.find("inet", 0, 4) == std::string::npos &&
|
||||
group.find("pc", 0, 2) == std::string::npos) {
|
||||
if (nedeedGroupIndex == groupIdx) {
|
||||
result = group.substr(0, std::min(group.find('(', 0), group.find(':', 0)));
|
||||
|
|
|
|||
|
|
@ -41,12 +41,10 @@ bool X11LayoutsParser::readXMLConfigItemElem(const QDomNode &node, std::vector<L
|
|||
}
|
||||
|
||||
langList.emplace_back();
|
||||
auto nameElem = configItemElem.firstChildElement("name");
|
||||
if (!nameElem.isNull())
|
||||
if (auto nameElem = configItemElem.firstChildElement("name"); !nameElem.isNull())
|
||||
langList.back().name = nameElem.toElement().text().toStdString();
|
||||
|
||||
auto languageListElem = configItemElem.elementsByTagName("languageList");
|
||||
if (!languageListElem.isEmpty()) {
|
||||
if (auto languageListElem = configItemElem.elementsByTagName("languageList"); !languageListElem.isEmpty()) {
|
||||
for (int i = 0; i < languageListElem.count(); i++) {
|
||||
const auto isoElem = languageListElem.at(i).namedItem("iso639Id").toElement();
|
||||
langList.back().layoutBaseISO639_2.emplace_back(isoElem.text().toStdString());
|
||||
|
|
|
|||
|
|
@ -405,8 +405,7 @@ void MainWindow::settingsChanged(const QString &key)
|
|||
|
||||
if ((key == Settings::Security::Certificate) || (key == Settings::Security::KeySize) ||
|
||||
(key == Settings::Security::TlsEnabled) || (key == Settings::Security::CheckPeers)) {
|
||||
const auto certificate = Settings::value(Settings::Security::Certificate).toString();
|
||||
if (m_tlsUtility.isEnabled() && !QFile::exists(certificate)) {
|
||||
if (m_tlsUtility.isEnabled() && !QFile::exists(Settings::value(Settings::Security::Certificate).toString())) {
|
||||
m_tlsUtility.generateCertificate();
|
||||
}
|
||||
updateSecurityIcon(m_lblSecurityStatus->isVisible());
|
||||
|
|
@ -1130,8 +1129,7 @@ bool MainWindow::regenerateLocalFingerprints()
|
|||
return false;
|
||||
}
|
||||
|
||||
TlsCertificate tls;
|
||||
if (!tls.generateFingerprint(certificate)) {
|
||||
if (TlsCertificate tls; !tls.generateFingerprint(certificate)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -514,8 +514,7 @@ bool CoreProcess::addServerArgs(QStringList &args, QString &app)
|
|||
// since it's not clear why (it is only needed for the server), this has now
|
||||
// been moved to server args.
|
||||
if (Settings::value(Settings::Security::TlsEnabled).toBool()) {
|
||||
TlsUtility tlsUtility(this);
|
||||
if (!tlsUtility.persistCertificate()) {
|
||||
if (TlsUtility tlsUtility(this); !tlsUtility.persistCertificate()) {
|
||||
qCritical("failed to persist tls certificate");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@ void ServerConnection::handleLogLine(const QString &logLine)
|
|||
return;
|
||||
}
|
||||
|
||||
const auto client = message.getClientName();
|
||||
|
||||
if (m_receivedClients.contains(client)) {
|
||||
if (const auto client = message.getClientName(); m_receivedClients.contains(client)) {
|
||||
qDebug("already got request, skipping new client prompt for: %s", qPrintable(client));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ const QString &ServerMessage::getClientName() const
|
|||
QString ServerMessage::parseClientName(const QString &line) const
|
||||
{
|
||||
QString clientName("Unknown");
|
||||
auto nameStart = line.indexOf('"') + 1;
|
||||
auto nameEnd = line.indexOf('"', nameStart);
|
||||
|
||||
if (nameEnd > nameStart) {
|
||||
auto nameStart = line.indexOf('"') + 1;
|
||||
|
||||
if (auto nameEnd = line.indexOf('"', nameStart); nameEnd > nameStart) {
|
||||
clientName = line.mid(nameStart, nameEnd - nameStart);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -485,8 +485,7 @@ bool ServerConfigDialog::addComputer(const QString &clientName, bool doSilent)
|
|||
bool isAccepted = false;
|
||||
Screen newScreen(clientName);
|
||||
|
||||
ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens);
|
||||
if (doSilent || dlg.exec() == QDialog::Accepted) {
|
||||
if (ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens); doSilent || dlg.exec() == QDialog::Accepted) {
|
||||
model().addScreen(newScreen);
|
||||
isAccepted = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,14 +88,12 @@ bool TlsCertificate::isCertificateValid(const QString &path)
|
|||
}
|
||||
auto pubkeyFree = deskflow::finally([pubkey]() { EVP_PKEY_free(pubkey); });
|
||||
|
||||
auto type = EVP_PKEY_type(EVP_PKEY_id(pubkey));
|
||||
if (type != EVP_PKEY_RSA && type != EVP_PKEY_DSA) {
|
||||
if (auto type = EVP_PKEY_type(EVP_PKEY_id(pubkey)); type != EVP_PKEY_RSA && type != EVP_PKEY_DSA) {
|
||||
qWarning() << tr("public key in default certificate key file is not RSA or DSA");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto bits = EVP_PKEY_bits(pubkey);
|
||||
if (bits < 2048) {
|
||||
if (EVP_PKEY_bits(pubkey) < 2048) {
|
||||
// We could have small keys in old barrier installations
|
||||
qWarning() << tr("public key in default certificate key file is too small");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,11 @@ Fingerprint Fingerprint::fromDbLine(const QString &line)
|
|||
result.data = QByteArray::fromHex(sLine.at(2).toLower().toLatin1());
|
||||
} else {
|
||||
// v1 fallback
|
||||
const auto kSha1ColonCount = 19;
|
||||
const auto kSha1HexCharCount = 40;
|
||||
const auto kSha1ExpectedSize = kSha1HexCharCount + kSha1ColonCount;
|
||||
if (line.size() != kSha1ExpectedSize || line.count(':') != kSha1ColonCount)
|
||||
static const auto kSha1ColonCount = 19;
|
||||
static const auto kSha1HexCharCount = 40;
|
||||
static const auto kSha1ExpectedSize = kSha1HexCharCount + kSha1ColonCount;
|
||||
const bool wrongSize = line.size() != kSha1ExpectedSize;
|
||||
if (bool badColonCount = line.count(':') != kSha1ColonCount; wrongSize || badColonCount)
|
||||
return result;
|
||||
result.type = Fingerprint::Type::SHA1;
|
||||
auto l2 = line;
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ NetworkAddress::NetworkAddress(const NetworkAddress &addr) : m_hostname(addr.m_h
|
|||
|
||||
NetworkAddress::NetworkAddress(const std::string &hostname, int port) : m_hostname(hostname), m_port(port)
|
||||
{
|
||||
// detect internet protocol version with colom count
|
||||
auto isColomPredicate = [](char c) { return c == ':'; };
|
||||
auto colomCount = std::count_if(m_hostname.begin(), m_hostname.end(), isColomPredicate);
|
||||
// detect internet protocol version with colon count
|
||||
auto isColon = [](char c) { return c == ':'; };
|
||||
|
||||
if (colomCount == 1) {
|
||||
if (auto colonCount = std::count_if(m_hostname.begin(), m_hostname.end(), isColon); colonCount == 1) {
|
||||
// ipv4 with port part
|
||||
auto hostIt = m_hostname.find(':');
|
||||
try {
|
||||
|
|
@ -49,7 +48,7 @@ NetworkAddress::NetworkAddress(const std::string &hostname, int port) : m_hostna
|
|||
|
||||
auto endHostnameIt = static_cast<int>(hostIt);
|
||||
m_hostname = m_hostname.substr(0, endHostnameIt > 0 ? endHostnameIt : 0);
|
||||
} else if (colomCount > 1) {
|
||||
} else if (colonCount > 1) {
|
||||
// ipv6 part
|
||||
if (m_hostname[0] == '[') {
|
||||
// ipv6 with port part
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ IDataSocket *SecureListenSocket::accept()
|
|||
certificateFilename = ArgParser::argsBase().m_tlsCertFile;
|
||||
}
|
||||
|
||||
bool loaded = socket->loadCertificates(certificateFilename);
|
||||
if (!loaded) {
|
||||
if (!socket->loadCertificates(certificateFilename)) {
|
||||
delete socket;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,8 @@ Fingerprint sslCertFingerprint(X509 *cert, Fingerprint::Type type)
|
|||
|
||||
unsigned char digest[EVP_MAX_MD_SIZE];
|
||||
unsigned int digestLength = 0;
|
||||
int result = X509_digest(cert, digestForType(type), digest, &digestLength);
|
||||
|
||||
if (result <= 0) {
|
||||
if (int result = X509_digest(cert, digestForType(type), digest, &digestLength); result <= 0) {
|
||||
throw std::runtime_error("failed to calculate fingerprint, digest result: " + std::to_string(result));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,7 @@ void SocketMultiplexer::addSocket(ISocket *socket, ISocketMultiplexerJob *job)
|
|||
lockJobList();
|
||||
|
||||
// insert/replace job
|
||||
SocketJobMap::iterator i = m_socketJobMap.find(socket);
|
||||
if (i == m_socketJobMap.end()) {
|
||||
if (SocketJobMap::iterator i = m_socketJobMap.find(socket); i == m_socketJobMap.end()) {
|
||||
// we *must* put the job at the end so the order of jobs in
|
||||
// the list continue to match the order of jobs in pfds in
|
||||
// serviceThread().
|
||||
|
|
@ -86,8 +85,7 @@ void SocketMultiplexer::addSocket(ISocket *socket, ISocketMultiplexerJob *job)
|
|||
m_update = true;
|
||||
m_socketJobMap.insert(std::make_pair(socket, j));
|
||||
} else {
|
||||
JobCursor j = i->second;
|
||||
if (*j != job) {
|
||||
if (JobCursor j = i->second; *j != job) {
|
||||
delete *j;
|
||||
*j = job;
|
||||
}
|
||||
|
|
@ -114,8 +112,7 @@ void SocketMultiplexer::removeSocket(ISocket *socket)
|
|||
// remove job. rather than removing it from the map we put nullptr
|
||||
// in the list instead so the order of jobs in the list continues
|
||||
// to match the order of jobs in pfds in serviceThread().
|
||||
SocketJobMap::iterator i = m_socketJobMap.find(socket);
|
||||
if (i != m_socketJobMap.end()) {
|
||||
if (SocketJobMap::iterator i = m_socketJobMap.find(socket); i != m_socketJobMap.end()) {
|
||||
if (*(i->second) != nullptr) {
|
||||
delete *(i->second);
|
||||
*(i->second) = nullptr;
|
||||
|
|
@ -157,8 +154,7 @@ void SocketMultiplexer::serviceThread(void *)
|
|||
JobCursor cursor = newCursor();
|
||||
JobCursor jobCursor = nextCursor(cursor);
|
||||
while (jobCursor != m_socketJobs.end()) {
|
||||
ISocketMultiplexerJob *job = *jobCursor;
|
||||
if (job != nullptr) {
|
||||
if (ISocketMultiplexerJob *job = *jobCursor; job) {
|
||||
pfd.m_socket = job->getSocket();
|
||||
pfd.m_events = 0;
|
||||
if (job->isReadable()) {
|
||||
|
|
@ -203,10 +199,9 @@ void SocketMultiplexer::serviceThread(void *)
|
|||
|
||||
// run job
|
||||
ISocketMultiplexerJob *job = *jobCursor;
|
||||
ISocketMultiplexerJob *newJob = job->run(read, write, error);
|
||||
|
||||
// save job, if different
|
||||
if (newJob != job) {
|
||||
if (ISocketMultiplexerJob *newJob = job->run(read, write, error); newJob != job) {
|
||||
Lock lock(m_mutex);
|
||||
delete job;
|
||||
*jobCursor = newJob;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ void showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack)
|
|||
SSL_CIPHER_description(cipher, msg, sizeof(msg));
|
||||
|
||||
// SSL puts a newline in the description
|
||||
auto pos = strnlen(msg, sizeof(msg)) - 1;
|
||||
if (msg[pos] == '\n') {
|
||||
if (auto pos = strnlen(msg, sizeof(msg)) - 1; msg[pos] == '\n') {
|
||||
msg[pos] = '\0';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,8 +122,7 @@ uint32_t TCPSocket::read(void *buffer, uint32_t n)
|
|||
{
|
||||
// copy data directly from our input buffer
|
||||
Lock lock(&m_mutex);
|
||||
uint32_t size = m_inputBuffer.getSize();
|
||||
if (n > size) {
|
||||
if (uint32_t size = m_inputBuffer.getSize(); n > size) {
|
||||
n = size;
|
||||
}
|
||||
if (buffer != nullptr && n != 0) {
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ void EiEventQueueBuffer::waitForEvent(double timeout_in_ms)
|
|||
|
||||
int timeout = (timeout_in_ms < 0.0) ? -1 : static_cast<int>(1000.0 * timeout_in_ms);
|
||||
|
||||
int retval = poll(pfds, POLLFD_COUNT, timeout);
|
||||
if (retval > 0) {
|
||||
if (int retval = poll(pfds, POLLFD_COUNT, timeout); retval > 0) {
|
||||
if (pfds[EIFD].revents & POLLIN) {
|
||||
std::lock_guard lock(mutex_);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,8 @@ void EiKeyState::init(int fd, size_t len)
|
|||
{
|
||||
auto buffer = std::make_unique<char[]>(len + 1);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
auto sz = read(fd, buffer.get(), len);
|
||||
|
||||
if ((size_t)sz < len) {
|
||||
if (auto sz = read(fd, buffer.get(), len); (size_t)sz < len) {
|
||||
LOG_WARN("failed to create xkb context: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
|
@ -143,9 +142,8 @@ void EiKeyState::assign_generated_modifiers(std::uint32_t keycode, deskflow::Key
|
|||
{
|
||||
std::uint32_t mods_generates = 0;
|
||||
auto state = xkb_state_new(xkb_keymap_);
|
||||
enum xkb_state_component changed = xkb_state_update_key(state, keycode, XKB_KEY_DOWN);
|
||||
|
||||
if (changed) {
|
||||
if (enum xkb_state_component changed = xkb_state_update_key(state, keycode, XKB_KEY_DOWN); changed) {
|
||||
for (xkb_mod_index_t m = 0; m < xkb_keymap_num_mods(xkb_keymap_); m++) {
|
||||
if (xkb_state_mod_index_is_active(state, m, XKB_STATE_MODS_LOCKED))
|
||||
item.m_lock = true;
|
||||
|
|
|
|||
|
|
@ -459,8 +459,8 @@ void EiScreen::add_device(struct ei_device *device)
|
|||
if (!ei_keyboard_ && ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD)) {
|
||||
ei_keyboard_ = ei_device_ref(device);
|
||||
|
||||
struct ei_keymap *keymap = ei_device_keyboard_get_keymap(device);
|
||||
if (keymap && ei_keymap_get_type(keymap) == EI_KEYMAP_TYPE_XKB) {
|
||||
if (auto keymap = ei_device_keyboard_get_keymap(device);
|
||||
keymap && ei_keymap_get_type(keymap) == EI_KEYMAP_TYPE_XKB) {
|
||||
int fd = ei_keymap_get_fd(keymap);
|
||||
size_t len = ei_keymap_get_size(keymap);
|
||||
key_state_->init(fd, len);
|
||||
|
|
@ -516,9 +516,7 @@ void EiScreen::sendEvent(EventTypes type, void *data)
|
|||
|
||||
ButtonID EiScreen::map_button_from_evdev(ei_event *event) const
|
||||
{
|
||||
uint32_t button = ei_event_button_get_button(event);
|
||||
|
||||
switch (button) {
|
||||
switch (ei_event_button_get_button(event)) {
|
||||
case 0x110:
|
||||
return kButtonLeft;
|
||||
case 0x111:
|
||||
|
|
@ -547,8 +545,7 @@ bool EiScreen::on_hotkey(KeyID keyid, bool is_pressed, KeyModifierMask mask)
|
|||
// Note: our mask (see on_key_event) only contains some modifiers
|
||||
// but we don't put a limitation on modifiers in the hotkeys. So some
|
||||
// key combinations may not work correctly, more effort is needed here.
|
||||
auto id = it->second.find_by_mask(mask);
|
||||
if (id != 0) {
|
||||
if (auto id = it->second.find_by_mask(mask); id != 0) {
|
||||
EventTypes type = is_pressed ? EventTypes::PrimaryScreenHotkeyDown : EventTypes::PrimaryScreenHotkeyUp;
|
||||
sendEvent(type, HotKeyInfo::alloc(id));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ int PortalInputCapture::fake_eis_fd()
|
|||
};
|
||||
std::snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
|
||||
|
||||
auto result = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||
if (result != 0) {
|
||||
if (auto result = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); result != 0) {
|
||||
LOG_DEBUG("faked eis fd failed: %s", strerror(errno));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ void PortalRemoteDesktop::cb_session_started(GObject *object, GAsyncResult *res)
|
|||
{
|
||||
g_autoptr(GError) error = nullptr;
|
||||
auto session = XDP_SESSION(object);
|
||||
auto success = xdp_session_start_finish(session, res, &error);
|
||||
if (!success) {
|
||||
if (!xdp_session_start_finish(session, res, &error)) {
|
||||
LOG_ERR("failed to start portal remote desktop session, quitting: %s", error->message);
|
||||
g_main_loop_quit(glib_main_loop_);
|
||||
events_->addEvent(EventTypes::Quit);
|
||||
|
|
|
|||
|
|
@ -581,8 +581,7 @@ void XWindowsClipboard::motifUnlockClipboard() const
|
|||
LOG((CLOG_DEBUG1 "unlocked motif clipboard"));
|
||||
|
||||
// fail if we don't own the lock
|
||||
Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock);
|
||||
if (lockOwner != m_window) {
|
||||
if (Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock); lockOwner != m_window) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -606,8 +605,8 @@ bool XWindowsClipboard::motifOwnsClipboard() const
|
|||
Atom target;
|
||||
int32_t format;
|
||||
std::string data;
|
||||
Window root = RootWindow(m_display, DefaultScreen(m_display));
|
||||
if (!XWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, &data, &target, &format, False)) {
|
||||
if (Window root = RootWindow(m_display, DefaultScreen(m_display));
|
||||
!XWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, &data, &target, &format, False)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,10 +66,9 @@ void XWindowsEventQueueBuffer::waitForEvent(double dtimeout)
|
|||
// clear out the pipe in preparation for waiting.
|
||||
|
||||
char buf[16];
|
||||
ssize_t read_response = read(m_pipefd[0], buf, 15);
|
||||
|
||||
// with linux automake, warnings are treated as errors by default
|
||||
if (read_response < 0) {
|
||||
if (ssize_t read_response = read(m_pipefd[0], buf, 15); read_response < 0) {
|
||||
// todo: handle read response
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -611,8 +611,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
|
|||
}
|
||||
|
||||
// note half-duplex keys
|
||||
const XkbBehavior &b = m_xkb->server->behaviors[keycode];
|
||||
if ((b.type & XkbKB_OpMask) == XkbKB_Lock) {
|
||||
if (const XkbBehavior &b = m_xkb->server->behaviors[keycode]; (b.type & XkbKB_OpMask) == XkbKB_Lock) {
|
||||
keyMap.addHalfDuplexButton(item.m_button);
|
||||
}
|
||||
|
||||
|
|
@ -697,8 +696,8 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
|
|||
// record the modifier mask for this key. don't bother
|
||||
// for keys that change the group.
|
||||
item.m_generates = 0;
|
||||
uint32_t modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym);
|
||||
if (isModifier && modifierBit != kKeyModifierBitNone) {
|
||||
if (uint32_t modifierBit = XWindowsUtil::getModifierBitForKeySym(keysym);
|
||||
isModifier && modifierBit != kKeyModifierBitNone) {
|
||||
item.m_generates = (1u << modifierBit);
|
||||
for (int32_t j = 0; j < 8; ++j) {
|
||||
// skip modifiers this key doesn't generate
|
||||
|
|
@ -819,8 +818,7 @@ int XWindowsKeyState::getEffectiveGroup(KeyCode keycode, int group) const
|
|||
(void)keycode;
|
||||
#if HAVE_XKB_EXTENSION
|
||||
// get effective group for key
|
||||
int numGroups = XkbKeyNumGroups(m_xkb, keycode);
|
||||
if (group >= numGroups) {
|
||||
if (int numGroups = XkbKeyNumGroups(m_xkb, keycode); group >= numGroups) {
|
||||
unsigned char groupInfo = XkbKeyGroupInfo(m_xkb, keycode);
|
||||
switch (XkbOutOfRangeGroupAction(groupInfo)) {
|
||||
case XkbClampIntoRange:
|
||||
|
|
|
|||
|
|
@ -19,9 +19,7 @@ namespace {
|
|||
|
||||
bool sleepInhibitCall(bool state, XWindowsPowerManager::InhibitScreenServices serviceID)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
if (!XWindowsPowerManager::inhibitScreenCall(serviceID, state, error)) {
|
||||
if (std::string error; !XWindowsPowerManager::inhibitScreenCall(serviceID, state, error)) {
|
||||
LOG((CLOG_DEBUG "dbus inhibit error %s", error.c_str()));
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,9 +282,8 @@ void XWindowsScreen::enter()
|
|||
// actually cause physical hardware input to trigger it
|
||||
int dummy;
|
||||
CARD16 powerlevel;
|
||||
BOOL enabled;
|
||||
if (DPMSQueryExtension(m_display, &dummy, &dummy) && DPMSCapable(m_display) &&
|
||||
DPMSInfo(m_display, &powerlevel, &enabled)) {
|
||||
if (BOOL enabled; DPMSQueryExtension(m_display, &dummy, &dummy) && DPMSCapable(m_display) &&
|
||||
DPMSInfo(m_display, &powerlevel, &enabled)) {
|
||||
if (enabled && powerlevel != DPMSModeOn)
|
||||
DPMSForceLevel(m_display, DPMSModeOn);
|
||||
}
|
||||
|
|
@ -591,8 +590,7 @@ uint32_t XWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
|||
|
||||
// skip with error if we can't map remaining modifiers
|
||||
unsigned int modifiers2;
|
||||
KeyModifierMask mask2 = (mask & ~s_hotKeyModifiers[j]);
|
||||
if (!m_keyState->mapModifiersToX(mask2, modifiers2)) {
|
||||
if (KeyModifierMask mask2 = (mask & ~s_hotKeyModifiers[j]); !m_keyState->mapModifiersToX(mask2, modifiers2)) {
|
||||
err = true;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -769,8 +767,8 @@ bool XWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
|
|||
// query the pointer to get the button state
|
||||
Window root, window;
|
||||
int xRoot, yRoot, xWindow, yWindow;
|
||||
unsigned int state;
|
||||
if (XQueryPointer(m_display, m_root, &root, &window, &xRoot, &yRoot, &xWindow, &yWindow, &state)) {
|
||||
if (unsigned int state;
|
||||
XQueryPointer(m_display, m_root, &root, &window, &xRoot, &yRoot, &xWindow, &yWindow, &state)) {
|
||||
return ((state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)) != 0);
|
||||
}
|
||||
|
||||
|
|
@ -1566,9 +1564,8 @@ void XWindowsScreen::onMouseMove(const XMotionEvent &xmotion)
|
|||
// pixel) but the latter is a PITA. to work around
|
||||
// it we only warp when the mouse has moved more
|
||||
// than s_size pixels from the center.
|
||||
static const int32_t s_size = 32;
|
||||
if (xmotion.x_root - m_xCenter < -s_size || xmotion.x_root - m_xCenter > s_size ||
|
||||
xmotion.y_root - m_yCenter < -s_size || xmotion.y_root - m_yCenter > s_size) {
|
||||
if (static const int32_t s_size = 32; xmotion.x_root - m_xCenter < -s_size || xmotion.x_root - m_xCenter > s_size ||
|
||||
xmotion.y_root - m_yCenter < -s_size || xmotion.y_root - m_yCenter > s_size) {
|
||||
warpCursorNoFlush(m_xCenter, m_yCenter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -406,8 +406,8 @@ void XWindowsScreenSaver::watchForXScreenSaver()
|
|||
// add every child of the root to the list of windows to watch
|
||||
Window root = DefaultRootWindow(m_display);
|
||||
Window rw, pw, *cw;
|
||||
unsigned int nc;
|
||||
if (XQueryTree(m_display, root, &rw, &pw, &cw, &nc)) {
|
||||
|
||||
if (unsigned int nc; XQueryTree(m_display, root, &rw, &pw, &cw, &nc)) {
|
||||
for (unsigned int i = 0; i < nc; ++i) {
|
||||
addWatchXScreenSaver(cw[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1748,8 +1748,7 @@ KeyID XWindowsUtil::mapKeySymToKeyID(KeySym k)
|
|||
|
||||
default: {
|
||||
// lookup character in table
|
||||
KeySymMap::const_iterator index = s_keySymToUCS4.find(k);
|
||||
if (index != s_keySymToUCS4.end()) {
|
||||
if (KeySymMap::const_iterator index = s_keySymToUCS4.find(k); index != s_keySymToUCS4.end()) {
|
||||
return static_cast<KeyID>(index->second);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,8 +180,7 @@ void ClientListener::handleUnknownClient(const Event &, void *vclient)
|
|||
assert(m_newClients.count(unknownClient) == 1);
|
||||
|
||||
// get the real client proxy and install it
|
||||
auto client = unknownClient->orphanClientProxy();
|
||||
if (client) {
|
||||
if (auto client = unknownClient->orphanClientProxy(); client) {
|
||||
// handshake was successful
|
||||
m_waitingClients.push_back(client);
|
||||
m_events->addEvent(Event(EventTypes::ClientListenerAccepted, this));
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ bool ClientProxy1_6::recvClipboard()
|
|||
ClipboardID id;
|
||||
uint32_t seq;
|
||||
|
||||
int r = ClipboardChunk::assemble(getStream(), dataCached, id, seq);
|
||||
|
||||
if (r == kStart) {
|
||||
if (int r = ClipboardChunk::assemble(getStream(), dataCached, id, seq); r == kStart) {
|
||||
size_t size = ClipboardChunk::getExpectedSize();
|
||||
LOG((CLOG_DEBUG "receiving clipboard %d size=%d", id, size));
|
||||
} else if (r == kFinish) {
|
||||
|
|
|
|||
|
|
@ -213,16 +213,14 @@ void ClientProxyUnknown::handleData(const Event &, void *)
|
|||
|
||||
try {
|
||||
// limit the maximum length of the hello
|
||||
uint32_t n = m_stream->getSize();
|
||||
if (n > kMaxHelloLength) {
|
||||
if (uint32_t n = m_stream->getSize(); n > kMaxHelloLength) {
|
||||
LOG((CLOG_DEBUG1 "hello reply too long"));
|
||||
throw XBadClient();
|
||||
}
|
||||
|
||||
// parse the reply to hello
|
||||
int16_t major, minor;
|
||||
std::string protocolName;
|
||||
if (!ProtocolUtil::readf(m_stream, kMsgHelloBack, &protocolName, &major, &minor, &name)) {
|
||||
if (std::string protocolName; !ProtocolUtil::readf(m_stream, kMsgHelloBack, &protocolName, &major, &minor, &name)) {
|
||||
throw XBadClient();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1647,8 +1647,7 @@ std::ostream &operator<<(std::ostream &s, const Config &config)
|
|||
|
||||
// options section
|
||||
s << "section: options" << std::endl;
|
||||
const Config::ScreenOptions *options = config.getOptions("");
|
||||
if (options != nullptr && options->size() > 0) {
|
||||
if (const Config::ScreenOptions *options = config.getOptions(""); options && options->size() > 0) {
|
||||
for (auto option = options->begin(); option != options->end(); ++option) {
|
||||
const char *name = Config::getOptionName(option->first);
|
||||
std::string value = Config::getOptionValue(option->first, option->second);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ InputFilter::EFilterStatus InputFilter::KeystrokeCondition::match(const Event &e
|
|||
EFilterStatus status;
|
||||
|
||||
// check for hotkey events
|
||||
EventTypes type = event.getType();
|
||||
if (type == EventTypes::PrimaryScreenHotkeyDown) {
|
||||
if (EventTypes type = event.getType(); type == EventTypes::PrimaryScreenHotkeyDown) {
|
||||
status = kActivate;
|
||||
} else if (type == EventTypes::PrimaryScreenHotkeyUp) {
|
||||
status = kDeactivate;
|
||||
|
|
@ -83,8 +82,7 @@ InputFilter::EFilterStatus InputFilter::KeystrokeCondition::match(const Event &e
|
|||
}
|
||||
|
||||
// check if it's our hotkey
|
||||
auto *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData());
|
||||
if (kinfo->m_id != m_id) {
|
||||
if (auto *kinfo = static_cast<IPlatformScreen::HotKeyInfo *>(event.getData()); kinfo->m_id != m_id) {
|
||||
return kNoMatch;
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +148,7 @@ InputFilter::EFilterStatus InputFilter::MouseButtonCondition::match(const Event
|
|||
EFilterStatus status;
|
||||
|
||||
// check for hotkey events
|
||||
EventTypes type = event.getType();
|
||||
if (type == EventTypes::PrimaryScreenButtonDown) {
|
||||
if (EventTypes type = event.getType(); type == EventTypes::PrimaryScreenButtonDown) {
|
||||
status = kActivate;
|
||||
} else if (type == EventTypes::PrimaryScreenButtonUp) {
|
||||
status = kDeactivate;
|
||||
|
|
@ -161,8 +158,8 @@ InputFilter::EFilterStatus InputFilter::MouseButtonCondition::match(const Event
|
|||
|
||||
// check if it's the right button and modifiers. ignore modifiers
|
||||
// that cannot be combined with a mouse button.
|
||||
auto *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||
if (minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) {
|
||||
if (auto *minfo = static_cast<IPlatformScreen::ButtonInfo *>(event.getData());
|
||||
minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) {
|
||||
return kNoMatch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -599,8 +599,7 @@ BaseClientProxy *Server::getNeighbor(BaseClientProxy *src, EDirection dir, int32
|
|||
|
||||
// look up neighbor cell. if the screen is connected and
|
||||
// ready then we can stop.
|
||||
ClientList::const_iterator index = m_clients.find(dstName);
|
||||
if (index != m_clients.end()) {
|
||||
if (ClientList::const_iterator index = m_clients.find(dstName); index != m_clients.end()) {
|
||||
LOG((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t));
|
||||
mapToPixel(index->second, dir, tTmp, x, y);
|
||||
return index->second;
|
||||
|
|
@ -843,9 +842,8 @@ bool Server::isSwitchOkay(
|
|||
}
|
||||
|
||||
// check for optional needed modifiers
|
||||
KeyModifierMask mods = this->m_primaryClient->getToggleMask();
|
||||
|
||||
if (!preventSwitch && ((this->m_switchNeedsShift && ((mods & KeyModifierShift) != KeyModifierShift)) ||
|
||||
if (KeyModifierMask mods = this->m_primaryClient->getToggleMask();
|
||||
!preventSwitch && ((this->m_switchNeedsShift && ((mods & KeyModifierShift) != KeyModifierShift)) ||
|
||||
(this->m_switchNeedsControl && ((mods & KeyModifierControl) != KeyModifierControl)) ||
|
||||
(this->m_switchNeedsAlt && ((mods & KeyModifierAlt) != KeyModifierAlt)))) {
|
||||
LOG((CLOG_DEBUG1 "need modifiers to switch"));
|
||||
|
|
@ -1687,8 +1685,7 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y)
|
|||
void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
|
||||
{
|
||||
LOG((CLOG_DEBUG2 "onMouseMoveSecondary initial %+d,%+d", dx, dy));
|
||||
const char *envVal = std::getenv("DESKFLOW_MOUSE_ADJUSTMENT");
|
||||
if (envVal != nullptr) {
|
||||
if (const char *envVal = std::getenv("DESKFLOW_MOUSE_ADJUSTMENT"); envVal) {
|
||||
try {
|
||||
double multiplier = std::stod(envVal); // Convert to double
|
||||
auto adjustedDx = static_cast<int32_t>(std::round(dx * multiplier)); // Apply multiplier and round
|
||||
|
|
@ -2004,8 +2001,7 @@ void Server::removeOldClient(BaseClientProxy *client)
|
|||
|
||||
void Server::forceLeaveClient(BaseClientProxy *client)
|
||||
{
|
||||
BaseClientProxy *active = (m_activeSaver != nullptr) ? m_activeSaver : m_active;
|
||||
if (active == client) {
|
||||
if (BaseClientProxy *active = (m_activeSaver != nullptr) ? m_activeSaver : m_active; active == client) {
|
||||
// record new position (center of primary screen)
|
||||
m_primaryClient->getCursorCenter(m_x, m_y);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue