Pass-through component

Hi,

Is there a way to make a desktop component act as pass-through for all mouse event (and not only mouse click) ?
Under windows, I used to override WM_HITTEST with HTTRANSPARENT. I’ve tried to override hitTest in component (returning false), but it doesn’t work (and it’s what setInterceptMouseClicks is supposed to do, right ?)

The idea is that I’m displaying a OSD (on-screen display) desktop component, but I still want the application to receive mouse move event even when the mouse cursor is over the OSD.
In fact, I don’t even want mouseExit to be called at all on component underneath when overing the OSD component.

There’s a special flag for this: ComponentPeer::windowIgnoresMouseClicks. Can’t remember whether it works on the mac though.

It doesn’t work, at least under windows. The mouse events are still directed to the desktop component.
I’ve read the code, and windowsIgnoreMouseClick set the WS_EX_TRANSPARENT style (from MSDN):

There is nothing about ignoring mouse event.
On the mac, it does:

[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0]; so this might work (but I don’t have a mac to test).

What about adding a new flag to the component peer ? (so under windows it would do:

case WM_HITTEST: if (windowStyleFlags & windowIgnoresMouseClicks) return HTTRANSPARENT; )

I wrote that code a long, long time ago, but am sure that using WS_EX_TRANSPARENT was important for some reason…

If your suggestion works, then it looks good to me! I suppose it’d also need to be checked in WM_NCHITTEST? E.g.

[code] case WM_NCHITTEST:
if ((windowStyleFlags & windowIgnoresMouseClicks) != 0)
return HTTRANSPARENT;

                    if (hasTitleBar())
                        break;

                    return HTCLIENT;

                case WM_HITTEST:
                    if ((windowStyleFlags & windowIgnoresMouseClicks) != 0)
                        return HTTRANSPARENT;

                    break;

[/code]

It’s used in the drag and drop component, (added to desktop with windowsIgnoreMouseClicks and windowsIsTemporary and windowsIgnoreKeyPress.

Maybe add another, move obvious flags then to avoid breaking existing code ?
Something like “ghostWindow” ?

I’ll try to implement this, and send you a patch by mail.

[quote]Maybe add another, move obvious flags then to avoid breaking existing code ?
Something like “ghostWindow” ?[/quote]

no, the existing flag is supposed to do this. I guess it’s just not working correctly.

Ok, it’s not working.
I don’t know why, it seems that the mouseexit message is generated anyway.
I’ve tried to intercept the WM_MOUSELEAVE message and only call doMouseExit() if the peer under the cursor doesn’t have Ghost flag, but it still doesn’t work.

I guess it’s not possible to do this way then.