Skip to content

Commit

Permalink
dpso/backend: Fix truncation when calculating selection border width
Browse files Browse the repository at this point in the history
  • Loading branch information
danpla committed Sep 9, 2022
1 parent 0ecf509 commit 9a86804
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/dpso/backend/windows/windows_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ LRESULT WindowsSelection::processMessage(

void WindowsSelection::updateBorderWidth()
{
borderWidth = baseBorderWidth * dpi / baseDpi + 0.5f;
borderWidth = static_cast<float>(baseBorderWidth)
* dpi / baseDpi + 0.5f;
if (borderWidth < 1)
borderWidth = 1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/dpso/backend/x11/x11_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ void X11Selection::handleEvent(const XEvent& event)

void X11Selection::updateBorderWidth()
{
borderWidth = baseBorderWidth * getDpi(display) / baseDpi + 0.5f;
borderWidth = static_cast<float>(baseBorderWidth)
* getDpi(display) / baseDpi + 0.5f;
if (borderWidth < 1)
borderWidth = 1;
}
Expand Down

0 comments on commit 9a86804

Please sign in to comment.