Windows position/size wrong on some Mac
Posted: Wed Jul 01, 2015 10:20 am
Hello,
I get position and dimensions of a PureBasic Window using WindowX(), WindowY(), WindowWidth() and WindowHeight(). On my Mac it returns correct values. On the Mac of some customers it returns only half the number of real pixels. So all the coordinates and sizes seem to be divided by 2 before I get them from PureBasic.
I also check the system DPI (snippet):
But on the affected systems, this is returning a factor of 1 only.
How I get the values: I do a full screenshot and measure the pixels in a painting program. The debug values are exactly the half of the real number of pixels.
Any idea what's wrong?
Best
Kukulkan
I get position and dimensions of a PureBasic Window using WindowX(), WindowY(), WindowWidth() and WindowHeight(). On my Mac it returns correct values. On the Mac of some customers it returns only half the number of real pixels. So all the coordinates and sizes seem to be divided by 2 before I get them from PureBasic.
I also check the system DPI (snippet):
Code: Select all
; Get DPI on Mac (default 72 DPI)
Protected dpi.NSSize
Protected Factor.f = 1
Protected screen.i = CocoaMessage(0, 0, "NSScreen mainScreen")
Protected description.i = CocoaMessage(0, screen, "deviceDescription")
CocoaMessage(@dpi, CocoaMessage(0, description, "objectForKey:$", @"NSDeviceResolution"), "sizeValue")
If dpi\width > 0
Factor.f = dpi\width / 72; 72 DPI is MacOS default for 100%
EndIf
Protected in.s = "WindowX: "+Str(WindowX(tWindow))+#CR$+
"WindowY: "+Str(WindowY(tWindow))+#CR$+
"WindowWidth: "+Str(WindowWidth(tWindow))+#CR$+
"WindowHeight: "+Str(WindowHeight(tWindow))+#CR$+
"DPI factor: "+Str(Factor.f)
MessageRequester("Debug!", in.s)
How I get the values: I do a full screenshot and measure the pixels in a painting program. The debug values are exactly the half of the real number of pixels.
Any idea what's wrong?
Best
Kukulkan