Leaflet becomes broken if visible-child is changed too fast
When a HdyLeaflet is navigated, but there is already an ongoing navigation animation, the positions of the child widgets are left in an incorrect state. This seems to be the cause of fractal#635, where clicking a room while holding Escape results in a blank window.
Resizing the leaflet so that it unfolds will bring it back to a correct state.
The following Python program reproduces the error:
#!/usr/bin/env python3
TIMEOUT=75
from gi.repository import GLib, Gtk, Handy
w = Gtk.Window()
l = Handy.Leaflet()
b1 = Gtk.Button(label="button........1")
b2 = Gtk.Button(label="button........2")
def on_timeout():
l.set_visible_child(b1)
return False
def b1_clicked(_):
l.set_visible_child(b2)
GLib.timeout_add(TIMEOUT, on_timeout)
b1.connect("clicked", b1_clicked)
l.add(b1)
l.add(b2)
w.add(l)
w.show_all()
w.connect("destroy", Gtk.main_quit)
Gtk.main()
Note the TIMEOUT
variable. If this is 0, the first child widget will be left completely offscreen, but as it gets higher, the widget ends up closer to where it should be. According to my tests, around 180-190 ms, the bug stops occurring.
Tested in efb36a10.