Makie | Figure(resolution = Makie.primary_resolution()) deprecated?

Makie.primary_resolution() is [was?] a useful function for setting images to full screen size in GLMakie.

However, after the release of
Makie v0.19.2

a call to this function generates an error message stating that the function is not found:

LoadError: UndefVarError: primary_resolution not defined

Has Makie.primary_resolution() been deprecated and, if so, is there a new method available to set images to full screen size without hard-coding the screen dimensions?

OS: Windows 11
Julia: 1.8.5

Ah sorry, that was considered to be an internal method, which Makie wasn’t using anymore for quite a while, so I removed it.
I’m not sure I want to bring it back, since it didn’t work very well cross platform…
Maybe we should add it to GLFW.jl, or you should just add it to your own project.

Thank you for your explanation.

I located the primary_resolution() function code in Makie 0.19.1

const DEFAULT_RESOLUTION = Ref((1920, 1080))

if Sys.iswindows()
    function primary_resolution()
        dc = ccall((:GetDC, :user32), Ptr{Cvoid}, (Ptr{Cvoid},), C_NULL)
        ntuple(2) do i
            Int(ccall((:GetDeviceCaps, :gdi32), Cint, (Ptr{Cvoid}, Cint), dc, (2 - i) + 117))
elseif Sys.isapple()
    const _CoreGraphics = "CoreGraphics.framework/CoreGraphics"
    function primary_resolution()
        dispid = ccall((:CGMainDisplayID, _CoreGraphics), UInt32,())
        height = ccall((:CGDisplayPixelsHigh,_CoreGraphics), Int, (UInt32,), dispid)
        width = ccall((:CGDisplayPixelsWide,_CoreGraphics), Int, (UInt32,), dispid)
        return (width, height)
    # TODO implement linux
    primary_resolution() = DEFAULT_RESOLUTION[]

and have incorporated it into my project.

It works, However, I can see why you have deprecated it.

I suggest that a function with such capability cross-platform be added to GLFW.jl as I think other users besides myself would also find it quite useful.

You can also use a combination of existing functions to make your own version:

function primary_resolution()
    monitor = GLMakie.GLFW.GetPrimaryMonitor()
    videomode = GLMakie.MonitorProperties(monitor).videomode
    return (videomode.width, videomode.hieght)

There are reports of this calls not working on remote connections and on headless systems, but if you are not in that situation, it should work fine (plus the MonitorProperties can give you additional info, if you would need it).

Your primary_resolution() function works well on Windows 11.
Much appreciated. Thank you.

In the Makie documentation I found a section that refers to
GLFW window attributes including

  • fullscreen = false: Starts the window in fullscreen

but no example code on how to do this.