File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [Rainmeter]
2+ Update =50
3+ BackGroundMode =2
4+ SolidColor =ffffff
5+
6+ [MeasureMouseX]
7+ Measure =Plugin
8+ Plugin =MousePos
9+ MeasureType =MouseX
10+ DynamicVariables =1
11+
12+ [MeasureMouseY]
13+ Measure =Plugin
14+ Plugin =MousePos
15+ MeasureType =MouseY
16+ DynamicVariables =1
17+
18+ [MeterMouseX]
19+ Meter =STRING
20+ X =10
21+ Y =10
22+ FontColor =10,10,10
23+ Text =Mouse X: [MeasureMouseX]
24+ DynamicVariables =1
25+ Antialias =1
26+
27+ [MeterMouseY]
28+ Meter =STRING
29+ X =10
30+ Y =30
31+ FontColor =10,10,10
32+ Text =Mouse Y: [MeasureMouseY]
33+ DynamicVariables =1
34+ Antialias =1
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Runtime . InteropServices ;
3+ using System . Windows . Forms ;
4+ using System . Drawing ;
5+ using Rainmeter ;
6+
7+ namespace MousePositionPlugin
8+ {
9+ public class Measure
10+ {
11+ private string type ;
12+
13+ internal void Reload ( API api , ref double maxValue )
14+ {
15+ type = api . ReadString ( "MeasureType" , "MouseX" ) . ToLowerInvariant ( ) ;
16+ }
17+
18+ internal double Update ( )
19+ {
20+ if ( type == "mousex" )
21+ {
22+ return Cursor . Position . X ;
23+ }
24+ else if ( type == "mousey" )
25+ {
26+ return Cursor . Position . Y ;
27+ }
28+
29+ return 0.0 ;
30+ }
31+ }
32+
33+ public static class Plugin
34+ {
35+ [ DllExport ]
36+ public static void Initialize ( ref IntPtr data , IntPtr rm )
37+ {
38+ data = GCHandle . ToIntPtr ( GCHandle . Alloc ( new Measure ( ) ) ) ;
39+ }
40+
41+ [ DllExport ]
42+ public static void Finalize ( IntPtr data )
43+ {
44+ GCHandle . FromIntPtr ( data ) . Free ( ) ;
45+ }
46+
47+ [ DllExport ]
48+ public static void Reload ( IntPtr data , IntPtr rm , ref double maxValue )
49+ {
50+ Measure measure = ( Measure ) GCHandle . FromIntPtr ( data ) . Target ;
51+ measure . Reload ( new API ( rm ) , ref maxValue ) ;
52+ }
53+
54+ [ DllExport ]
55+ public static double Update ( IntPtr data )
56+ {
57+ Measure measure = ( Measure ) GCHandle . FromIntPtr ( data ) . Target ;
58+ return measure . Update ( ) ;
59+ }
60+ }
61+ }
You can’t perform that action at this time.
0 commit comments