diff --git a/src/widget.jl b/src/widget.jl index 560568a..6e3337c 100644 --- a/src/widget.jl +++ b/src/widget.jl @@ -83,6 +83,7 @@ function realizewidgetcb(glareaptr, user_data) GLMakie.apply_config!(screen, config) a.render_id = Gtk4.signal_connect(refreshwidgetcb, a, "render", Cint, (Ptr{Gtk4.Gtk4.GdkGLContext},)) + nothing end function unrealizewidgetcb(glareaptr, glarea) @@ -97,7 +98,8 @@ end function Makie.window_area(scene::Scene, screen::GLMakie.Screen{T}) where T <: GtkGLMakie glarea=screen.glscreen - _window_area(scene, glarea) + winscale = screen.scalefactor[] / Gtk4.scale_factor(glarea) + _window_area(scene, glarea, winscale) end glarea(screen::GLMakie.Screen{T}) where T <: GtkGLArea = screen.glscreen @@ -114,6 +116,15 @@ function Base.isopen(win::GtkGLMakie) return true end +function GLMakie.set_screen_visibility!(nw::GtkGLMakie, b::Bool) + if b + Gtk4.show(nw) + else + Gtk4.hide(nw) + end +end + + function GLMakie.apply_config!(screen::GLMakie.Screen{T},config::GLMakie.ScreenConfig; start_renderloop=true) where T <: GtkGLArea return _apply_config!(screen, config, start_renderloop) end diff --git a/test/runtests.jl b/test/runtests.jl index 83a5ef9..cbe36b4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -31,5 +31,16 @@ using Gtk4Makie, GLMakie, Gtk4 end @testset "widget screen" begin - + win = GtkWindow("2 Makie widgets in one window", 600, 600, true, false) + p=GtkPaned(:v;position=200) + p[1]=GtkMakieWidget() + p[2]=GtkMakieWidget() + win[]=p + + show(win) + + push!(p[1],lines(rand(10))) + push!(p[2],scatter(rand(10))) + + destroy(win) end