It is currently April 19th, 2024, 1:30 am

[Bug] Deactivating/hiding configs causes focus to change, triggering OnFocus/UnfocusActions

Report bugs with the Rainmeter application and suggest features.
User avatar
Cariboudjan
Posts: 268
Joined: May 12th, 2019, 8:55 am

[Bug] Deactivating/hiding configs causes focus to change, triggering OnFocus/UnfocusActions

Post by Cariboudjan »

Downgraded to the March update and no problems with this. Seems to happen more often when deactivating or hiding multiple configs in a group bang.
User avatar
Brian
Developer
Posts: 2678
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Bug] Deactivating/hiding configs causes focus to change, triggering OnFocus/UnfocusActions

Post by Brian »

I can't replicate this.

Rainmeter doesn't ever transfer focus from one skin to another. In fact, the only time Rainmeter sets the focus is editing a label in the tree control on the New Skin dialog in order to monitor the key strokes (specifically the escape and return keys).

Windows (most of the time) controls focus, and usually transfers focus to last "active" window (usually the window next in the z order).

The OnFocus/OnUnFocuse bangs are only executed when Windows sends the WM_FOCUS/WM_KILLFOCUS messages.

So, maybe the skins being deactived are "next" in the z order, and Windows gives them focus before deactivating them, thus causing them to execute the focus actions? :confused:

-Brian
User avatar
Cariboudjan
Posts: 268
Joined: May 12th, 2019, 8:55 am

Re: [Bug] Deactivating/hiding configs causes focus to change, triggering OnFocus/UnfocusActions

Post by Cariboudjan »

Brian wrote: October 22nd, 2022, 7:22 am So, maybe the skins being deactived are "next" in the z order, and Windows gives them focus before deactivating them, thus causing them to execute the focus actions? :confused:

-Brian
I think that's exactly right. It occurs when multiple skins are hidden or deactivated at one time where:

There are 3 skins.
Focus is on Skin 2. Then on Skin 3.
Skin 1 gains focus, deactivating Skin 3 and Skin 2 in the process.
An Unfocus Action is triggered.