Skip to content

window_open Observables not notified #2414

@lmshk

Description

@lmshk

I am creating a GLMakie window from a script and want to block that script until the window is closed (because otherwise the process exits). For this purpose, I attach a listener to the Figure's window_open Observable that notifies s a Base.Event when the value becomes false. This worked correctly before, but the listener stopped being called starting with Makie v0.18.0.

A simplified example looks like this:

using GLMakie
closed = Base.Event()
f = Figure()
display(f)
on(events(f).window_open) do is_open
    !is_open && notify(closed)
end
wait(closed)

When running this and manually closing the window, the script will remain blocked.

(I suspected that this is somehow related to #2306 but didn't confirm that because I couldn't figure out how to ]add both Makie and GLMakie at the specific commits and without error.)

After looking around a little, I noticed that there are multiple Events instances related to my plot, all of which have a window_open Observable, but I am confused about which of these I should use:

screen = begin
    f = Figure()
    display(f)
end

on(events(f).window_open) do _; @info "events(f)" end
on(screen.window_open) do _; @info "screen" end
on(events(f.scene).window_open) do _; @info "events(f.scene)" end

On Makie v0.17, when closing the window, the preceding code prints

[ Info: events(f.scene)
[ Info: events(f)
[ Info: events(f.scene)
[ Info: screen

while on v0.18 this prints just

[ Info: events(f.scene)

It seems like I can just use the scene events as a workaround, but the fact that this is triggered twice on v0.17 makes me think that I am doing something wrong. Am I meant to use it this way, or is there another Events instance I missed, or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions