Skip to content

Commit

Permalink
Fix title bar buttons on Windows
Browse files Browse the repository at this point in the history
This fixes the broken mouse event handling by not consuming events
supposed to go to the title bar, making it possible to move/resize/close
the window.
  • Loading branch information
adamhalim committed Sep 10, 2024
1 parent 2f8fe06 commit 4ce6d23
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions vncviewer/Viewport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,16 @@ int Viewport::handleSystemPointerEvent(void *event, void *data)

mouse_x = GET_X_LPARAM(msg->lParam) - x();
mouse_y = GET_Y_LPARAM(msg->lParam) - y();
if ((mouse_x < 0 || mouse_x > w() || mouse_y < 0 || mouse_y > h())
&& !(mouseButtonMask & 0x187))

bool outOfBounds = (mouse_x < 0 || mouse_x > w() ||
mouse_y < 0 || mouse_y > h());

// Leave events going to title bar
if (outOfBounds && mouseHasLeft)
return 0;

// Consume mouse events when dragging button outside window
if (outOfBounds && !(mouseButtonMask & 0x187))
return 1;

if (self->altGrArmed)
Expand Down

0 comments on commit 4ce6d23

Please sign in to comment.