Win32: box-shadow pass-thought for mouse events


Gtk4 windows draw their own shadows, which can be pretty huge (measured up to 67 pixels for libadwaita apps, see old discussion here).

On windows10, the problem is that those large shadows catch all mouse events, so we can’t for example click to select another window stacked just behind.

Is there a way to make these shadows pass-thought for mouse events?
(at least outside the small border area used for resizing)

Hello @gwillems!

Unfortunately not, the method we use to implement input regions is based on WM_NCHITTEST + HTTRANSPARENT, which only works for windows belonging to the same thread. So it’s usually OK for popovers (because popovers usually appear on top of the parent window), but not so much for window shadows (because most of the times you have windows of other applications behind).

We may use two HWNDs, one to present the graphics (output-only) and another to capture input (input-only), but…well, it’s complicated :slightly_smiling_face:

The best way forward is to use native shadows, see [macos] Use system shadow on macOS (!6785) · Merge requests · GNOME / gtk · GitLab

1 Like

Thanks @lb90 !

Sounds like looking for troubles… let’s forget about this :slight_smile:

Interesting, yes!
But can we really get rid of the client-side shadows on Win32?

  • I thought the shadows were necessary for resizing: back then on Windows7+Gtk3, I tried to disable the shadows with CSS but at the end couldn’t resize the windows anymore… Did it change with gtk4?
  • Alice said those large shadows were expected, is there any functional reason behind this? something for Wayland? or is that just cosmetic?

Right, GTK shadows have a small resize area, and by disabling GTK shadows (for example via CSS) you loose the ability to resize surfaces interactively. However native shadows also provide a small area for interactive resizes. Try with notepad, firefox etc.

I believe it’s just cosmetic

1 Like

OK, I see.
I’ll try to look at those native shadows.

Thank you!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.