Repository: raphamorim/rio (language: rust)

Issue:
[BUG] Window doesn't receive mouse events on Windows 11
The terminal's window does not receive any mouse events other than scrolling. So you can't resize the window, select text, etc. The only thing that works is clicking on the title bar to bring the window into focus.

It looks like the problem came from this commit: https://github.com/raphamorim/rio/commit/b4287fde7779206d43ffa685e49546920014bb11

From these lines, to be exact:
https://github.com/raphamorim/rio/blob/2231e255d82bbff8155594ba00f383070f292e7a/rio-window/src/platform_impl/windows/event_loop.rs#L2166-L2168

According to the [docs](https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest), this branch must return values other than `HTNOWHERE` to work properly. I don't know much about the Win32 API, so I can't say how to do this correctly, but deleting this branch fixes all the problems with the mouse.

OS: Windows 11 (23H2)
OS Build: 22631.4317


Discussion / hints:
Thank you for the issue! I see, I will test it locally as well but would you like to send a PR reverting b4287fd ?

Fix patch:
diff --git a/rio-window/src/platform_impl/windows/event_loop.rs b/rio-window/src/platform_impl/windows/event_loop.rs
index 9705c42596..eb0d64b4c9 100644
--- a/rio-window/src/platform_impl/windows/event_loop.rs
+++ b/rio-window/src/platform_impl/windows/event_loop.rs
@@ -53,12 +53,12 @@ use windows_sys::Win32::UI::WindowsAndMessaging::{
     WM_IME_STARTCOMPOSITION, WM_INPUT, WM_INPUT_DEVICE_CHANGE, WM_KEYDOWN, WM_KEYUP,
     WM_KILLFOCUS, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP,
     WM_MENUCHAR, WM_MOUSEHWHEEL, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_NCACTIVATE,
-    WM_NCCALCSIZE, WM_NCCREATE, WM_NCDESTROY, WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_PAINT,
-    WM_POINTERDOWN, WM_POINTERUP, WM_POINTERUPDATE, WM_RBUTTONDOWN, WM_RBUTTONUP,
-    WM_SETCURSOR, WM_SETFOCUS, WM_SETTINGCHANGE, WM_SIZE, WM_SIZING, WM_SYSCOMMAND,
-    WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING,
-    WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE,
-    WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
+    WM_NCCALCSIZE, WM_NCCREATE, WM_NCDESTROY, WM_NCLBUTTONDOWN, WM_PAINT, WM_POINTERDOWN,
+    WM_POINTERUP, WM_POINTERUPDATE, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR,
+    WM_SETFOCUS, WM_SETTINGCHANGE, WM_SIZE, WM_SIZING, WM_SYSCOMMAND, WM_SYSKEYDOWN,
+    WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING, WM_XBUTTONDOWN,
+    WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW,
+    WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
 };
 
 use crate::dpi::{PhysicalPosition, PhysicalSize};
@@ -2163,10 +2163,6 @@ unsafe fn public_window_callback_inner(
             result = ProcResult::DefWindowProc(wparam);
         }
 
-        WM_NCHITTEST => {
-            result = ProcResult::Value(0);
-        }
-
         WM_SETFOCUS => {
             let active_focus_changed = userdata.window_state_lock().set_focused(true);
             if active_focus_changed {


Test patch: