chore: Improve logging for DESKFLOW_MOUSE_ADJUSTMENT env var
We plan to move this elsewhere, but in the meantime, the DEBUG1 logging was too noisy. Also fixed some code style that was bugging me.
This commit is contained in:
parent
54a7ef24d9
commit
739cdc1752
1 changed files with 12 additions and 13 deletions
|
|
@ -1423,7 +1423,8 @@ void Server::onClipboardChanged(const BaseClientProxy *sender, ClipboardID id, u
|
||||||
|
|
||||||
// ignore if data hasn't changed
|
// ignore if data hasn't changed
|
||||||
if (data == clipboard.m_clipboardData) {
|
if (data == clipboard.m_clipboardData) {
|
||||||
LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id)
|
LOG(
|
||||||
|
(CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1670,21 +1671,19 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y)
|
||||||
|
|
||||||
void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
|
void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
|
||||||
{
|
{
|
||||||
LOG((CLOG_DEBUG2 "onMouseMoveSecondary initial %+d,%+d", dx, dy));
|
LOG_DEBUG2("mouse move on secondary: %+d,%+d", dx, dy);
|
||||||
if (const char *envVal = std::getenv("DESKFLOW_MOUSE_ADJUSTMENT"); envVal) {
|
|
||||||
|
// TODO: move this to client side and use a qt setting or cli arg instead of env var.
|
||||||
|
const static auto adjustEnv = "DESKFLOW_MOUSE_ADJUSTMENT";
|
||||||
|
if (const char *envVal = std::getenv(adjustEnv); envVal) {
|
||||||
try {
|
try {
|
||||||
double multiplier = std::stod(envVal); // Convert to double
|
double multiplier = std::stod(envVal);
|
||||||
auto adjustedDx = static_cast<int32_t>(std::round(dx * multiplier)); // Apply multiplier and round
|
dx = static_cast<int32_t>(std::round(dx * multiplier));
|
||||||
auto adjustedDy = static_cast<int32_t>(std::round(dy * multiplier));
|
dy = static_cast<int32_t>(std::round(dy * multiplier));
|
||||||
LOG((CLOG_DEBUG2 "Adjusted to %+d,%+d using multiplier %.2f", adjustedDx, adjustedDy, multiplier));
|
LOG_DEBUG2("adjusted mouse x %.2f: %+d,%+d", multiplier, dx, dy);
|
||||||
dx = adjustedDx; // Update dx and dy to adjusted values
|
|
||||||
dy = adjustedDy;
|
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
// Log the error message from the exception
|
LOG_ERR("invalid %s value: %s", adjustEnv, e.what());
|
||||||
LOG((CLOG_ERR "Invalid DESKFLOW_MOUSE_ADJUSTMENT value: %s. Exception: %s", envVal, e.what()));
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
LOG((CLOG_DEBUG1 "DESKFLOW_MOUSE_ADJUSTMENT not set, using original values %+d,%+d", dx, dy));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouse move on secondary (client's) screen
|
// mouse move on secondary (client's) screen
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue