Hi, I'm looking at a WINE issue in which some QT-based software isn't getting mouse clicks. The program in question is a VST plug-in. The plug-in, in our host, creates its UI in a child window. Now, in QT, HWNDs are created several layers deep-- seemingly one HWND per widget (QWidget), and then a few others like "QEventDispatcher". I think in doing this, I may have uncovered a bug in which grandchild HWNDs do not receive mouse-down events.
To summarize before I dive into the details: On these mouse-down events, WINE attempts to bring the HWND to the front, but fails because the HWND in question is not a top-level window or a top-level window's child and subsequently eats the message. Now for the gory details. Let's start at process_mouse_messages in user32/message.c. If the event in question is a button-down event, WINE tries to activate the window it's for. In the switch statement near the bottom of the function, there is a case MA_ACTIVATE. This calls FOCUS_MouseActivate which in turn calls set_foreground_window (both in user32/focus.c). Jump to the wineserver's set_foreground_window function (in server/queue.c). There is a line which reads:
if (is_top_level_window( req->handle ) && . . . )
What this is_top_level_window function says (in server/window.c) is to return true only if the HWND is_desktop_window or a child of the desktop window. is_desktop_window says to return true if there is no parent (because "only desktop windows have no parent"). So, if the HWND has no parent or is the parent of a window with no parent, WINE deems the window top level and the HWND receives the click. If this test fails, set_foreground_window returns an error and causes process_mouse_messages to eat the click instead of passing it on. So, I have a couple questions about WINE operation. My first question is whether the click really should be passed on even if WINE can't bring the HWND to the front in this case. My second question is whether the top-level window test works as expected-- my instinct was that the top-level window is just a window without a parent and that the check might not need to involve the desktop.
Thanks, Louis Gorenfeld Muse Research