Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40d76b6

Browse files
committed
Make gtk3 full_screen_toggle more robust against external changes.
The fullscreen state can also change via the window manager, so read the state instead of trying to keep an internal flag. All other backends already use a similar strategy. (`self.window` is a GtkWindow, whereas `self.window.get_window()` is a GdkWindow...)
1 parent 95463c3 commit 40d76b6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,10 @@ def show(self):
395395
_api.warn_external("Cannot raise window yet to be setup")
396396

397397
def full_screen_toggle(self):
398-
self._full_screen_flag = not self._full_screen_flag
399-
if self._full_screen_flag:
400-
self.window.fullscreen()
401-
else:
398+
if self.window.get_window().get_state() & Gdk.WindowState.FULLSCREEN:
402399
self.window.unfullscreen()
403-
_full_screen_flag = False
400+
else:
401+
self.window.fullscreen()
404402

405403
def _get_toolbar(self):
406404
# must be inited after the window, drawingArea and figure

0 commit comments

Comments
 (0)