godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.56k stars 20.73k forks source link

"window_set_mouse_passthrough" With Transparent Window causes white flickering during runtime #80098

Closed riazey closed 1 year ago

riazey commented 1 year ago

Godot version

4.1.1.stable

System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3179) - Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz (6 Threads)

Issue description

https://github.com/godotengine/godot/assets/75141902/a8fa0a11-3a8b-474b-8a70-80dab030a947

When using window_set_mouse_passthrough with a transparent window in my project (a desktop Tamagotchi-like game) it causes white flickering/flashing across the newly set passthrough area (but not consistently)? I used the same setup in Godot 3.5 without flickering. The issue is occurring in my project when the player performs an action that would update the mouse passthrough such as dragging the device around on the monitor or adding new charms/etc which change the clickable area (and is very disorienting)!

Steps to reproduce

Set up a clickthrough area with a transparent window + change the clickable area periodically. Display > Window settings: f5e9c76abf2620a9fac93d6c487ac283

Minimal reproduction project

This project is set up the way mine is which causes the MOST flickering (setting the window area to cover all monitors), however you can _comment out set_gamewindow() to only cover a normal project area (flickering happens way less often but still happens).

Pressing TAB while the window is selected will cause the selected area to swap between full coverage and the little red square (present for your sanity). You will likely have to click the red square to actually focus on the window!

Test_passthrough_Flicker.zip

Sauermann commented 1 year ago

I am unable to replicate the flickering on LInux: Godot v4.2.dev (dcd187da9) - Debian GNU/Linux 12 (bookworm) 12 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 (nvidia)

bruvzg commented 1 year ago

Unrelated to the issue, but covering multiple screens with the single window will not work in many cases (if screens have different DPI, for example).

In general, if you want a moveable window like one in your video, the best way to do it should be:

riazey commented 1 year ago

@bruvzg Ah I see, good points! I originally started this in 3 so I am loving the new DisplayServer features! I am unsure I'd be able to figure out the window moving physics for the swinging charms using a window on my own though.

It's meant to be always on top so I'd like it to be as non-intrusive click-area wise* as I can possibly get it, I've included a video of my project so you can see why it might still need the runtime updates- which is why I'm VERY appreciative you're taking this on for me! (I just noticed my pet up and left the room while recording it how rude).

The biggest issue I've seen when I had a 4k/2k/1k all at once monitor setup was that depending on your highest resolution monitor the "base" size of the tama changes so I made it so it's resizable!

https://github.com/godotengine/godot/assets/75141902/7d192de6-6ded-4b7a-b4cb-e4460b980a1f