From 9a86804e583f082e1e568b8859e018cb3824bdeb Mon Sep 17 00:00:00 2001 From: Daniel Plakhotich Date: Fri, 9 Sep 2022 23:48:20 +0200 Subject: [PATCH] dpso/backend: Fix truncation when calculating selection border width --- src/dpso/backend/windows/windows_selection.cpp | 3 ++- src/dpso/backend/x11/x11_selection.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dpso/backend/windows/windows_selection.cpp b/src/dpso/backend/windows/windows_selection.cpp index d9db2844..cb3cf61c 100644 --- a/src/dpso/backend/windows/windows_selection.cpp +++ b/src/dpso/backend/windows/windows_selection.cpp @@ -361,7 +361,8 @@ LRESULT WindowsSelection::processMessage( void WindowsSelection::updateBorderWidth() { - borderWidth = baseBorderWidth * dpi / baseDpi + 0.5f; + borderWidth = static_cast(baseBorderWidth) + * dpi / baseDpi + 0.5f; if (borderWidth < 1) borderWidth = 1; } diff --git a/src/dpso/backend/x11/x11_selection.cpp b/src/dpso/backend/x11/x11_selection.cpp index 1688d885..0fd17572 100644 --- a/src/dpso/backend/x11/x11_selection.cpp +++ b/src/dpso/backend/x11/x11_selection.cpp @@ -200,7 +200,8 @@ void X11Selection::handleEvent(const XEvent& event) void X11Selection::updateBorderWidth() { - borderWidth = baseBorderWidth * getDpi(display) / baseDpi + 0.5f; + borderWidth = static_cast(baseBorderWidth) + * getDpi(display) / baseDpi + 0.5f; if (borderWidth < 1) borderWidth = 1; }