Skip to content

Commit

Permalink
Apply configuration before resizing
Browse files Browse the repository at this point in the history
This works around a crash that otherwise occurs when creating a
screen directly with something like
```julia
screen = GLMakie.Screen(resolution = (100, 100), visible = false)
```

I'm not sure why this is necessary, though, so that probably points
at some subtle logic error in handling scaling factors and/or dimensions
of windows and buffers.
  • Loading branch information
jmert committed Jan 4, 2023
1 parent 64d7113 commit 41e4e8d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions GLMakie/src/screen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ function Makie.apply_screen_config!(screen::Screen, config::ScreenConfig, scene:
end

function apply_config!(screen::Screen, config::ScreenConfig; visible::Bool=true, start_renderloop::Bool=true)
ShaderAbstractions.switch_context!(screen.glscreen)
glw = screen.glscreen
ShaderAbstractions.switch_context!(glw)
GLFW.SetWindowAttrib(glw, GLFW.FOCUS_ON_SHOW, config.focus_on_show)
Expand Down Expand Up @@ -364,11 +363,10 @@ function Screen(;
# Screen config is managed by the current active theme, so managed by Makie
config = Makie.merge_screen_config(ScreenConfig, screen_config)
screen = screen_from_pool(config.debugging)
screen.config = config
apply_config!(screen, config; visible=visible, start_renderloop=start_renderloop)
if !isnothing(resolution)
resize!(screen, resolution...)
end
apply_config!(screen, config; visible=visible, start_renderloop=start_renderloop)
return screen
end

Expand Down

0 comments on commit 41e4e8d

Please sign in to comment.