zaafar / ClickableTransparentOverlay

A library for creating transparent overlay using windows API & ImGui.NET
Apache License 2.0
97 stars 32 forks source link

Application focus changes when clicking on a form #29

Closed Yarik124421 closed 3 years ago

Yarik124421 commented 3 years ago

Hi, there is such a problem that when you click on the imgui menu, the application behind it loses focus. That is, the click does not reach it. In my case, the application pauses after clicking on imgui, any ideas how to fix this? I also wanted to say thank you for this package, this is a very convenient solution. It would be convenient if you would like to leave any wallet for voluntary donations.

zaafar commented 3 years ago

there is such a problem that when you click on the imgui menu, the application behind it loses focus. That is, the click does not reach it.

ofcourse, that’s the intended behaviour, when user wants to click the ImGui, the OS seamlessly focuses on ImGui and blocks any input to the underlying application. Also, once user is done clicking the ImGui, the OS seamlessly gives the focus back to the underlying application.

If you do not want to do this, you can always ( at runtime ~ from within the Render loop ) set the ‘ImGuiWindowFlags.NoInputs’ ImGui flag to your ImGui window.

This allows you to have more control in the Render loop to do whatever you wish to do.

In my case, the application pauses after clicking on imgui, any ideas how to fix this?

sounds like a bug in your application. Your application might be doing something resource intensive on window focus change but yeah, no idea how to fix it or where to start. All I can say is that I use this library in my personal project where I create an overlay and there are no pauses when moving from ImGui to the application and vice versa.

It would be convenient if you would like to leave any wallet for voluntary donations.

Great idea! Will push a change to the readme. Thanks!

EDIT: there are other overlays out there that (rather than seamlessly switching between application and the overlay) hooks to the OS mouse/keyboard events and use them to manipulate the overlay. I personally dislike those since they make debugging and software development PITA and require re-implementing keyboard/mouse stuff from scratch (I.e. Very Non DRY approach).