aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup d/Mouse.m
diff options
context:
space:
mode:
Diffstat (limited to 'Low Battery Yup d/Mouse.m')
-rw-r--r--Low Battery Yup d/Mouse.m23
1 files changed, 21 insertions, 2 deletions
diff --git a/Low Battery Yup d/Mouse.m b/Low Battery Yup d/Mouse.m
index d5bf766..b3139fb 100644
--- a/Low Battery Yup d/Mouse.m
+++ b/Low Battery Yup d/Mouse.m
@@ -16,10 +16,18 @@
if (self) {
_current_display = CGMainDisplayID();
_cursor_position = CGPointMake(0, 0);
+ _fake_alert = [[FakeAlert alloc] init];
+ _fake_alert_frame = [_fake_alert frame];
}
return self;
}
+- (void)dealloc
+{
+ [_fake_alert release];
+ [super dealloc];
+}
+
- (void)moveToPoint:(CGPoint)point
{
_cursor_position = point;
@@ -28,14 +36,25 @@
- (void)moveToLowBatteryOK
{
+ if (_current_display != CGMainDisplayID()) {
+ _current_display = CGMainDisplayID();
+ _fake_alert_frame = [_fake_alert frame];
+ }
+
CGPoint point;
size_t width = CGDisplayPixelsWide(_current_display);
size_t height = CGDisplayPixelsHigh(_current_display);
point.x = width / 2 + 182;
-// point.y = height / 2 - 116; // 1440x900 | 450 - 116 = 334 | 900 / 334 | 3340 / 900 = 3.7111
- point.y = height / 2 - 292; // 2560x1600 | 800 - 292 = 508 | 1600 / 508 | 5080 / 1600 = 3.175
+ point.y = height / 2 - 116; // 1440x900 | 450 - 116 = 334 | 900 / 334 | 3340 / 900 = 3.7111
+// point.y = height / 2 - 292; // 2560x1600 | 800 - 292 = 508 | 1600 / 508 | 5080 / 1600 = 3.175
+
+ // x + 420
+ // y + 30
+ point.x = _fake_alert_frame.origin.x + 420;
+ point.y = height - _fake_alert_frame.origin.y - 30;
+ NSLog(@"%f, %f, %f, %f", _fake_alert_frame.origin.x, _fake_alert_frame.origin.y, _fake_alert_frame.size.width, _fake_alert_frame.size.height);
[self moveToPoint:point];
}