It is currently April 25th, 2024, 4:00 pm

Mouse Action Workaround?

Get help with creating, editing & fixing problems with skins
lhindir
Posts: 8
Joined: July 26th, 2016, 5:15 am

Mouse Action Workaround?

Post by lhindir »

I'm editing a skin using roundline meters to display things like CPU usage, dates and times, and many others. Here's a simplified version of the skin just to replicate the issue.

Code: Select all

[MeasureTime]
Measure=Time

[StyleArc]
X=0
Y=0
Solid=1
AntiAlias=1

[MeterMinutesBarBG]
Meter=ROUNDLINE
MeterStyle=StyleArc
W=122
H=122
StartAngle=4.7123889
RotationAngle=6.2831853
LineLength=61
LineStart=56
LineColor=255,255,255,80

[MeterMinutesBar]
Meter=ROUNDLINE
MeasureName=MeasureTime
MeterStyle=StyleArc | MeterMinutesBarBG
LineColor=255,255,255,200
ValueReminder=3600
LeftMouseUpAction=[C:\]
This code draws one circle as a background and overlays another arc on top of it in a more opaque color that shows the minute progress during an hour. My issue is that clicking either meter, not just the MinutesBar one, opens the C:\ directory. I believe this is because mouse actions have this target area: "The target area detected by the mouse will be any non-transparent areas of the meter, or any part of the meter which has a non-transparent meter or skin background behind it." Is there any way to get mouse actions to only register on non-transparent areas of a meter, without registering on backgrounds?

Also, what use cases would there be when you would want to have the mouse detect backgrounds automatically? Wouldn't it be more logical to have actions only register on the meter itself, and then just copy the mouse action code onto any background meters that you would want it to register on?
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Mouse Action Workaround?

Post by Mor3bane »

make the chosen selection area a specific meter within the skin.

Something kinda like this:

Code: Select all

[MeterClick]
Meter=Image
X=Xreference
Y=Yreference
W=clickareawidth
H=clickareaheight
SolidColor=0,0,0,1
LeftMouseDownAction=actionsomething
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Mouse Action Workaround?

Post by Mor3bane »

Also, what use cases would there be when you would want to have the mouse detect backgrounds automatically? Wouldn't it be more logical to have actions only register on the meter itself, and then just copy the mouse action code onto any background meters that you would want it to register on?
even though you are drawing circles - the skin still is technically a square.

That may be what you are finding out is happening there.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
lhindir
Posts: 8
Joined: July 26th, 2016, 5:15 am

Re: Mouse Action Workaround?

Post by lhindir »

As far as I can tell, that will not fix my problem. The mouse action will still work when hovering over other "background" meters within the same area on the skin.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Mouse Action Workaround?

Post by Mor3bane »

since the circle/arc share the same space - there is no work around
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
lhindir
Posts: 8
Joined: July 26th, 2016, 5:15 am

Re: Mouse Action Workaround?

Post by lhindir »

If that is the case, then I don't get why having mouse actions affect other meters is necessary! Shouldn't it be an option?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Mouse Action Workaround?

Post by jsmorley »

The long and the short of it is:

Meters

Meters are always a square or rectangle, defined by the explicit or implicit W and H of the meter. The meter is a "container" and the objects the meter creates (text, images, roundlines, bars, whatever) are drawn inside this container. Again though, no matter what, a meter is always a square or rectangle.

Meters are drawn on the skin window (think of it as "painting" on a single "canvas") in the order they are in the skin .ini file. This is done in every "redraw" of the skin, which happens at the end of each skin Update cycle, and when you explicitly tell it to with a !Redraw bang.

Mouse Detection

Mouse detection is based on any "solid" pixels within the meter container boundaries defined by W and H.

Rainmeter doesn't know or care "who" made a given pixel solid.

Mouse detection simply asks "is the mouse within the meter boundaries for the meter the mouse action is assigned to? Is the current pixel solid?" It can ask no more, it can ask no less. If the answer to both of those is "yes", it's a go...

Conflicts

If two or more meters (or the skin background) occupying the same spot have the same mouse action on them, the "last" one defined in the skin will be acted upon, with any action on the overall skin window being seen as "first", followed by all meters in the order they are in the skin .ini file. Again, "last" wins.

However, mouse actions are distinct. If a spot has one meter with a LeftMouseUpAction on it, and at the same time another meter with a MiddleMouseUpAction on it, both actions are evaluated and acted upon.

A meter with no mouse action does not "cover up" or "hide" mouse detection by other meters occupying the same spot. That meter is simply ignored as far as mouse detection goes.

There are cases where you can use this conflict resolution to your advantage. A mouse action like LeftMouseUpAction=[] is a perfectly valid mouse action that does nothing, and might be used to in fact "hide" a mouse action on a meter earlier in the skin.


This is why things behave the way they do. You can't think of a Rainmeter skin having distinct "layers". Any concept of "behind" or "in front" in the finished skin window is just an illusion. You have to think of Rainmeter as a "canvas" that you "paint" meters on. At the end of the day, it's all just pixels. No meter "owns" a pixel, and Rainmeter doesn't know or care "who" drew that pixel. Many meters or even the skin background may have affected that pixel as the paint was being applied. The only thing a mouse action can know is that it was triggered because your mouse was within the boundaries of the meter, and the pixel the mouse is on is solid.
lhindir
Posts: 8
Joined: July 26th, 2016, 5:15 am

Re: Mouse Action Workaround?

Post by lhindir »

Well, that's a shame. Thanks for the descriptive answer!