DesktopWidth(0) returns wrong value
Posted: Mon Jan 13, 2025 11:06 pm
I have a Dell UltraSharp U3417W monitor. Its screen resolution is 3440w x 1440h.
On PureBasic 6.12 LTS, DesktopWidth(0) returns 1440, same as DesktopHeight(0)
I had to use Cocoa like so
** EDIT ** - It works correctly on my Mac mini at Home, with the same OS, But It has an external GPU and a 4k monitor
On PureBasic 6.12 LTS, DesktopWidth(0) returns 1440, same as DesktopHeight(0)
Code: Select all
Result = ExamineDesktops()
WinWidth.l = DesktopWidth(0) : WinHeight.l = DesktopHeight(0)
Debug "WindWidth = " + WinWidth
Debug "WinHeight = " + WinHeight
Code: Select all
Global VS.NSRect
Global Dim Screens.NSRect(0)
Procedure GetAvailableScreens()
Protected ScreenArray = CocoaMessage(0, 0, "NSScreen screens")
Protected i.l, NumScreens = CocoaMessage(0, ScreenArray, "count")
ReDim Screens(NumScreens - 1)
While i < NumScreens
CocoaMessage(@Screens(i), CocoaMessage(0, ScreenArray, "objectAtIndex:", i), "frame")
If i = 0
CocoaMessage(@VS, CocoaMessage(0, ScreenArray, "objectAtIndex:", i), "visibleFrame")
EndIf
i + 1
Wend
ProcedureReturn NumScreens
EndProcedure
NumScreens.l = GetAvailableScreens()
winWidth = VS\size\width : winHeight = VS\size\height
Debug "WindWidth = " + WinWidth
Debug "WinHeight = " + WinHeight