Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK animated widgets freeze until first resize #1826

Closed
freakboy3742 opened this issue Mar 24, 2023 · 0 comments · Fixed by #1827
Closed

GTK animated widgets freeze until first resize #1826

freakboy3742 opened this issue Mar 24, 2023 · 0 comments · Fixed by #1827
Labels
bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@freakboy3742
Copy link
Member

Describe the bug

GTK Widgets that contain an "animated" component - e.g., Switch (the slide left/right animation) or an indeterminate ProgressBar (pulse animation) won't animate when the window is first drawn. However, if you resize the window, the animation will resume, including any historical state.

Steps to reproduce

  1. Run the toga_switch example.

Try to toggle the "initial state" button. The color of the switch will change, but the switch itself won't "slide".

Also worth note: The exterior border of the "change label" button is very slightly clipped.

  1. Run the progressbar example

The indeterminate progress bar may not start.

Toggle the Running Mode and Indeterminate Mode buttons. With sufficient toggling, you will eventually be able to cause the running indeterminate progress bar to stop animating.

Expected behavior

Animated widgets should consistently render.

Screenshots

No response

Environment

  • Operating System: Linux (any; tested on Fedora 36 and Ubuntu 22.04)
  • Python version: 3.10 (but likely any)
  • Software versions:

Logs


Additional context

The problem appears to be related to the GTK Container fixes introduced in #1794.

In both examples listed above, I have found that the first time I run examples after making a code change, it sometimes works. However, on second and subsequent runs, the problem reliably occurs. There may be a timing issue at play - maybe the slowdown of PYC recompilation is sufficient to mask event order problems?

A suboptimal fix: if the optimisation on L166 that only does a refresh() if resized or self.needs_redraw is removed (so a lot more refreshes are performed), the problem goes away

A partial fix: If window listens for the window-state-event signal, and marks the container dirty when that event occurs, the switch demo works. The switches on the progress bar demo are also fixed. However, the animation of the indeterminate progress bar isn't fixed (at least, not consistently)

This suggests that the issue is a signal that constitutes a "dirty" window, but isn't being treated as a dirty signal.

@freakboy3742 freakboy3742 added bug A crash or error in behavior. linux The issue relates Linux support. labels Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant