Skip to content

gtk: Ensure pending draws are done before GTK draw #27988

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

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Mar 28, 2024

PR summary

Originally, the resize event happens first, adds an idle draw callback, and then the widget draws itself. Since the draw callback only happens when idle, it happens after the widget's draw, so the figure appears blank. After the mouse is released, the idle draw callback fires, and the figure appears again.

This is already done in the Qt backend [1], and doing so ensures the figure remains visible during resizes with the mouse.

This fixes the bug reported at #25861 (comment)

[1]

self._draw_idle() # Only does something if a draw is pending.

PR checklist

Originally, the resize event happens first, adds an idle draw callback,
and then the widget draws itself. Since the draw callback only happens
when _idle_, it happens after the draw, so the figure appears blank.
After the mouse is released, the idle draw callback fires, and the
figure appears again.

This is already done in the Qt backend [1], and doing so ensures the
figure remains visible during resizes with the mouse.

[1] https://github.com/matplotlib/matplotlib/blob/0afc5d6ca49cf6e8aa1da76b5bab0faca2f340f2/lib/matplotlib/backends/backend_qtagg.py#L25
@oscargus oscargus merged commit 78b6bdc into matplotlib:main Mar 29, 2024
39 of 42 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 29, 2024
@QuLogic QuLogic deleted the gtk-ensure-draw branch March 29, 2024 05:46
dstansby added a commit that referenced this pull request Mar 29, 2024
…988-on-v3.8.x

Backport PR #27988 on branch v3.8.x (gtk: Ensure pending draws are done before GTK draw)
@ksunden ksunden mentioned this pull request Apr 4, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants