aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup d/Mouse.m
diff options
context:
space:
mode:
authorTeddy Wing2016-12-03 00:34:01 -0500
committerTeddy Wing2016-12-03 00:34:01 -0500
commit8fefa257b812f887270e6f38cc13df9e80471476 (patch)
tree0efcc32a04973272d617b9e9058a6eeb45560201 /Low Battery Yup d/Mouse.m
parent422d83d7572feb648f8dff966d36588e97cf4beb (diff)
parent7ffa846dff745feaccdc34d0d4caf72850bcd55d (diff)
downloadLow-Battery-Yup-8fefa257b812f887270e6f38cc13df9e80471476.tar.bz2
Merge branch 'mouse-location-should-be-right-on-all-screen-sizes'
Diffstat (limited to 'Low Battery Yup d/Mouse.m')
-rw-r--r--Low Battery Yup d/Mouse.m18
1 files changed, 15 insertions, 3 deletions
diff --git a/Low Battery Yup d/Mouse.m b/Low Battery Yup d/Mouse.m
index 9bade59..103909d 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,13 +36,17 @@
- (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;
+ point.x = _fake_alert_frame.origin.x + 420;
+ point.y = height - _fake_alert_frame.origin.y - 30;
[self moveToPoint:point];
}