# Makie | Figure(resolution = Makie.primary\_resolution()) deprecated?

**URL:** <https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854>\
**Category:** Visualization\
**Tags:** question, package, makie\
**Created:** [February 1, 2023, 7:28am UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854 "2023-02-01T07:28:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Audrius-St](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/audrius-st/32/24175_2.png) [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Post date:** [February 1, 2023, 7:28am UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854/1 "2023-02-01T07:28:52Z")

</div>

`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

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [February 1, 2023, 12:23pm UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854/2 "2023-02-01T12:23:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Audrius-St](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/audrius-st/32/24175_2.png) [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Post date:** [February 1, 2023, 8:46pm UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854/3 "2023-02-01T20:46:17Z")

</div>

Thank you for your explanation.

I located the `primary_resolution()` function code in Makie 0.19.1

```julia
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))
        end
    end
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)
    end
else
    # TODO implement linux
    primary_resolution() = DEFAULT_RESOLUTION[]
end

```

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.

---

<div class="post-metadata">

**Author:** ![mkoculak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkoculak/32/28310_2.png) [@mkoculak](https://discourse.julialang.org/u/mkoculak)\
**Post date:** [February 2, 2023, 3:35am UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854/4 "2023-02-02T03:35:42Z")

</div>

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

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

```

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).

---

<div class="post-metadata">

**Author:** ![Audrius-St](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/audrius-st/32/24175_2.png) [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Post date:** [February 2, 2023, 4:44am UTC](https://discourse.julialang.org/t/makie-figure-resolution-makie-primary-resolution-deprecated/93854/5 "2023-02-02T04:44:41Z")

</div>

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](https://docs.makie.org/stable/documentation/backends/glmakie/index.html#activation_and_screen_config) including

- `fullscreen = false`: Starts the window in fullscreen

but no example code on how to do this.
