Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
only start eventloop when widget is actually going to be drawn
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 14, 2022
1 parent cb15a81 commit 2e6d48d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ visible(w::GtkWidget, state::Bool) = @sigatom ccall((:gtk_widget_set_visible, li
const shown_widgets = WeakKeyDict()
function handle_auto_idle(w::GtkWidget)
if auto_idle[]
enable_eventloop(true)
shown_widgets[w] = nothing
signal_connect(w, :destroy) do w
delete!(shown_widgets, w)
isempty(shown_widgets) && enable_eventloop(false)
signal_connect(w, :realize) do w
enable_eventloop(true)
shown_widgets[w] = nothing
signal_connect(w, :destroy) do w
delete!(shown_widgets, w)
isempty(shown_widgets) && enable_eventloop(false)
end
end
end
end
Expand Down

0 comments on commit 2e6d48d

Please sign in to comment.