libui icon indicating copy to clipboard operation
libui copied to clipboard

Child windows created on libui applications do not receive some events (Windows)

Open rzumer opened this issue 6 years ago • 2 comments

The event filtering mechanism of libui seems to discard events aimed at windows that are children (or in my experience, children of children) of the libui main HWND. I have a library linked to a libui application which uses the Windows API to spawn extra windows, and then further spawns extra text field "windows" (via CreateWindowsEx with the EDIT type). These text fields can be navigated with the arrow keys if there is text in them, and they can be edited via copying and pasting using the context menu, but whatever events (WM_CHAR?) associated with the keyboard text inputs are not received anymore because, I guess, they are passed to the main HWND instead and then discarded. I'd like to have a way to interface with a libui application without relinquishing all the input event handling to it.

The only solution I have right now involves awful application-specific hacks to libui.

rzumer avatar Dec 15 '19 22:12 rzumer

To narrow it down, does it go away if you remove the areaFilter() call in windows/main.cpp? If not, then the problem is the event plumbing that happens elsewhere in the codebase.

andlabs avatar Dec 16 '19 02:12 andlabs

Yes it does - I'm actually avoiding the call to IsDialogMessage() inside of processMessage(), but that should be equivalent. As expected, merely removing it breaks some of the event handling logic in the application I tested it on. In my case I was able to resort to counting ancestors and only filtering the event if the root window is up to a 3rd ancestor of the HWND targeted by the event, and that is fine for my specific use case, but of course that won't work in many others.

rzumer avatar Dec 16 '19 02:12 rzumer