core: mouse reports should always send on release even if outside

Fixes #481
This commit is contained in:
Mitchell Hashimoto
2023-09-17 14:22:24 -07:00
parent 37cf0b2321
commit ef7e0f7fdb

View File

@ -1305,8 +1305,9 @@ fn mouseReport(
.any => {}, .any => {},
} }
// The maximum pos values so we can determine if we're outside the window. // Handle scenarios where the mouse position is outside the viewport.
// If we're outside the window, we do not report mouse events. // We always report release events no matter where they happen.
if (action != .release) {
const pos_out_viewport = pos_out_viewport: { const pos_out_viewport = pos_out_viewport: {
const max_x: f32 = @floatFromInt(self.screen_size.width); const max_x: f32 = @floatFromInt(self.screen_size.width);
const max_y: f32 = @floatFromInt(self.screen_size.height); const max_y: f32 = @floatFromInt(self.screen_size.height);
@ -1325,6 +1326,7 @@ fn mouseReport(
return; return;
} }
}
// This format reports X/Y // This format reports X/Y
const viewport_point = self.posToViewport(pos.x, pos.y); const viewport_point = self.posToViewport(pos.x, pos.y);