aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-12-02 18:53:55 -0500
committerTeddy Wing2016-12-02 18:53:55 -0500
commit954071bcc651ed5876d8ac0c3e8c253d4470c416 (patch)
tree5e22b447f0eae6a057922914f540d1fe6604ab5f
parent422d83d7572feb648f8dff966d36588e97cf4beb (diff)
downloadLow-Battery-Yup-954071bcc651ed5876d8ac0c3e8c253d4470c416.tar.bz2
Mouse.m: Some calculations on window center
Wanted to get a percentage that I could apply to the height to get to the right pixel position on the screen, but it doesn't seem like it's going to be that simple. The percentages are off for a big screen and a small screen, so I can't rely on a single percentage value. After some research, my current idea is to make a fake window, call NSWindow -center on it, and get the coordinates of that window to figure out where the mouse should be positioned.
-rw-r--r--Low Battery Yup d/Mouse.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/Low Battery Yup d/Mouse.m b/Low Battery Yup d/Mouse.m
index 9bade59..d5bf766 100644
--- a/Low Battery Yup d/Mouse.m
+++ b/Low Battery Yup d/Mouse.m
@@ -34,7 +34,8 @@
size_t height = CGDisplayPixelsHigh(_current_display);
point.x = width / 2 + 182;
- point.y = height / 2 - 116;
+// 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
[self moveToPoint:point];
}