I have an application which uses system.mouseX and system.mouseY to determine which sections of the screen to collect into an image. It works well on my Mac Pro but when used on my MacBook Pro with retina display running Sierra, the system.mouseX and system.mouseY return values that are lower than is correct for the pixels associated with the retina display. The display has a reported pixel resolution of 2880 x 1800. But the mouseX and Y values go to 1680 x 1049. I assume this is due to the retina display, but I am wondering how I can get access to the correct pixels. Selecting Hi-DPI does not alter the result.
regardless of Points, Pixels, Hi-DPI or not, those numbers do not make sense
1680x1049 is 58.3% of 2880x1800 … one would expect exactly 50% if it were going to report a “lower” value…
I agree they do not make sense. But this is what I am getting. The question is why! Note that when i run the identical program on my Mac Pro with external display, the numbers track perfectly with the screen size.
Sometimes a solid dose of pragmatism saves the day. What does Screen(0).Width and Screen(0).Height report ? If it is 1680 x 1049 then you will get adequate response from MouseX and MouseY.
Try to use ScaleX and ScaleY to make the pixels coordinate equal to the values in MouseX and MouseY.
g.ScaleX = 2880/1680
g.ScaleY = 1800/1049
That way you can work in points rather than pixels, like you do on a non Retina display.
On my MacBookPro retina running Sierra 10.12.3
The window(0).width is 1280 and the height is 800
In a normal window, using mousemove to check the mouse, the highest value I see is the size of the window, which is smaller than the screen by the size of the menu and possibly taskbar. (system.mousex stops reporting when the mouse moves out of the window in my mousemove event)
If I full-screen the window, I get maximum values of 1279 and 799 , which is correct given that the top left corner reports as 0,0
Oddly, although the system report tells me that the display is 2560 x 1600 Retina, there is no setting in Preferences which allows me to use the full 2560 x 1600 pixels.
‘default for display’ is 1280, and the scaled options only go as high as 1680
Control Panels --> Monitor --> More Space
More Space is the rightmost icon (you have four).
will enable you to get the largest resolution.
Nota: I use a French OS, so I translated the names; yours may be a bit different (or the same).
On my MacBook Pro 13", my screen resolution is actually 3,360 x 2,100.
[quote]Control Panels --> Monitor --> More Space
More Space is the rightmost icon (you have four).[/quote]
More space setting offers ‘looks like 1680 x 1050’
I repeat, there is no setting that allows me to use individually addressable pixels at 2560 x 1600
Just make an ALT-Click on the “Scaled” Radio-Button. This will show the list with different resolutions.
On my iMac I can choose 5120*2880.
[quote]Just make an ALT-Click on the “Scaled” Radio-Button. This will show the list with different resolutions.
As soon as I press alt i get a new button ‘Detect displays’ but clicking on the radio button while holding alt (or CMD or ctrl) doesnt offer any extra resolutions
Now Im paranoid…
Get QuickRes. It brings all the resolutions together, and even Retina mode to non Retina displays.
With macOS Sierra 1012.5b5:
Control Panels --> Monitor --> “Monitor tab” --> More Space
You will see 4 (four) icons (leftmost/topmost part of a window).
Click in the rightmost one to get the largest resolution (in the build-in monitor of a MacBook Pro).
If not, maybe you have to start to be worry ?
Previous answer with last El Capitan
[quote]Click in the rightmost one to get the largest resolution (in the build-in monitor of a MacBook Pro).
The right most one offers the largest resolution ‘available’ but not the full resolution of the monitor, according to the ‘about this mac’ system report
there is really a strange thing happening here:
Built-in Screen says (here):
13.3-inch (2560 x 1600)
Intel Iris 1536MB
And the max built-in screen resolution (still here) is 3,360 x 2,100.
Lets get back to the OP’s problem.
Looks like Apple messed something else up in their quest to turn my Mac into a phone.
[quote=329234:@Emile Schwarz]Control Panels --> Monitor --> More Space
More Space is the rightmost icon (you have four).[/quote]
Thanks Emile- that solved the problem. Never even considered the problem was associated with choosing the default diplay resolution.
Assuming this app is for sale, will you recommend that your customers do that?
My app is not for sale, as it is a chess program that I will give away for free. I am writing it primarily to learn how to use shells to run companion apps (in this case, stockfish). However, when I select “more space”, the screen becomes too hard to read. So I reverted back to the default and I am doing essentially what Michael Bujardet suggested and using a scaled value. This works fine for my application.
I am using the MBS screenshotRectMBS(x1,y1,nsx,nsy) to grab a subsection of the screen, and it was my discovery that I could not use values from system.mouseX/Y to select the desired region using the mouse that prompted this conversation. Now I simply scale the values by 1.715 and I get the desired native coordinates. Apparently screenshotRectMBS and screenshotMBS work at the native resolution, and not the default (scaled) resolution.
The retina display is a wonderful thing, but it makes programming more challenging!
2560 x 1600 are the “hardware pixels” in Retina
1280 x 800 (the half of them) are the “software pixels”, named as “standard resolution”.
I dont think that applies to all the macbook pros. My display is listed as a 15.4-inch (2880 x 1800) display. That I assume represents the “hardware pixels”. The default resolution, however, is not half of that but rather 1.715 of that. Dont ask me why. Apple strikes again.
The very principle of scaling is precisely that if the max resolution is 2550 x 1600, you have the latitude to choose the actual scale of screen which is comfortable for you.
On a 13" screen, 1400 x 800 could be nice for some people. The same scaling on a 27" iMac would be way too big. It is somewhat comfortable to see Retina as only 1:2. In practice, whatever scaling you choose for your machine, Retina works with.
Apple has elected to present scaling displays in points.
On Windows, users can select a percentage, for instance 150%, 175%, 200%. In the end, HiDPI works the same.
Unless you absolutely NEED to get the actual pixels, Xojo has kept the good old 72 dpi reference points, which means code written before HiDPI still works just the same. That is very comfortable.
The only place where I would see a usage for full res, is to display high res pictures, where 2550 x 1600 may make a lot of difference, especially on a large screen.