Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06269cd

Browse filesBrowse files
authored
Merge pull request #27990 from meeseeksmachine/auto-backport-of-pr-27988-on-v3.8.x
Backport PR #27988 on branch v3.8.x (gtk: Ensure pending draws are done before GTK draw)
2 parents 473b407 + 0fb44b5 commit 06269cd
Copy full SHA for 06269cd

File tree

4 files changed

+24
-4
lines changed
Filter options

4 files changed

+24
-4
lines changed

‎lib/matplotlib/backends/backend_gtk3agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3agg.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from .. import cbook, transforms
44
from . import backend_agg, backend_gtk3
5-
from .backend_gtk3 import Gtk, _BackendGTK3
5+
from .backend_gtk3 import GLib, Gtk, _BackendGTK3
66

77
import cairo # Presence of cairo is already checked by _backend_gtk.
88

@@ -14,6 +14,11 @@ def __init__(self, figure):
1414
self._bbox_queue = []
1515

1616
def on_draw_event(self, widget, ctx):
17+
if self._idle_draw_id:
18+
GLib.source_remove(self._idle_draw_id)
19+
self._idle_draw_id = 0
20+
self.draw()
21+
1722
scale = self.device_pixel_ratio
1823
allocation = self.get_allocation()
1924
w = allocation.width * scale

‎lib/matplotlib/backends/backend_gtk3cairo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3cairo.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from contextlib import nullcontext
22

33
from .backend_cairo import FigureCanvasCairo
4-
from .backend_gtk3 import Gtk, FigureCanvasGTK3, _BackendGTK3
4+
from .backend_gtk3 import GLib, Gtk, FigureCanvasGTK3, _BackendGTK3
55

66

77
class FigureCanvasGTK3Cairo(FigureCanvasCairo, FigureCanvasGTK3):
88
def on_draw_event(self, widget, ctx):
9+
if self._idle_draw_id:
10+
GLib.source_remove(self._idle_draw_id)
11+
self._idle_draw_id = 0
12+
self.draw()
13+
914
with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
1015
else nullcontext()):
1116
self._renderer.set_context(ctx)

‎lib/matplotlib/backends/backend_gtk4agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk4agg.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from .. import cbook
44
from . import backend_agg, backend_gtk4
5-
from .backend_gtk4 import Gtk, _BackendGTK4
5+
from .backend_gtk4 import GLib, Gtk, _BackendGTK4
66

77
import cairo # Presence of cairo is already checked by _backend_gtk.
88

@@ -11,6 +11,11 @@ class FigureCanvasGTK4Agg(backend_agg.FigureCanvasAgg,
1111
backend_gtk4.FigureCanvasGTK4):
1212

1313
def on_draw_event(self, widget, ctx):
14+
if self._idle_draw_id:
15+
GLib.source_remove(self._idle_draw_id)
16+
self._idle_draw_id = 0
17+
self.draw()
18+
1419
scale = self.device_pixel_ratio
1520
allocation = self.get_allocation()
1621

‎lib/matplotlib/backends/backend_gtk4cairo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk4cairo.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
from contextlib import nullcontext
22

33
from .backend_cairo import FigureCanvasCairo
4-
from .backend_gtk4 import Gtk, FigureCanvasGTK4, _BackendGTK4
4+
from .backend_gtk4 import GLib, Gtk, FigureCanvasGTK4, _BackendGTK4
55

66

77
class FigureCanvasGTK4Cairo(FigureCanvasCairo, FigureCanvasGTK4):
88
_context_is_scaled = True
99

1010
def on_draw_event(self, widget, ctx):
11+
if self._idle_draw_id:
12+
GLib.source_remove(self._idle_draw_id)
13+
self._idle_draw_id = 0
14+
self.draw()
15+
1116
with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
1217
else nullcontext()):
1318
self._renderer.set_context(ctx)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.