tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.38k stars 2.58k forks source link

[feat] Expose raw window procedure messages on Windows #11650

Open lars-berger opened 1 week ago

lars-berger commented 1 week ago

Describe the problem

On Windows, there isn't a way to inspect raw incoming wndproc messages. This is useful in a lot of advanced Win32 API use cases, and is necessary for e.g. the appbar APIs. An appbar is a special window that reserves a portion of the monitor screen space, like the native Windows taskbar. To be properly registered as an appbar, there are several window messages that need to be responded to in a certain way - example of appbar wndproc.

This would also avoid the need for spawning supplementary message windows (e.g. for listening to window events, hardware/device events, etc.).

Describe the solution you'd like

Perhaps it'd be feasible to expose a new enum member RunEvent::WindowEvent::Raw(u32, usize, isize) (corresponding to msg, wParam, lParam) that could then be used with run_iteration.

Alternatives considered

No response

Additional context

No response

amrbashir commented 1 week ago

Can't you use window.hwnd() to get the HWND then call SetWindowSubclass to attach a window procedure and respond to these messages?