Merge pull request #1145 from auouymous/delay-window-position-restore

Delay restoring window position until after it has been shown.
This commit is contained in:
Eric Le Lay 2021-10-11 22:16:42 +02:00 committed by GitHub
commit 69e242184c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -165,6 +165,12 @@ class UIConfig(config.Config):
window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
else:
window.move(cfg.x, cfg.y)
# From Gtk docs: most window managers ignore requests for initial window
# positions (instead using a user-defined placement algorithm) and honor
# requests after the window has already been shown.
# Move it a second time after the window has been shown.
# The first move reduces chance of window jumping.
util.idle_add(window.move, cfg.x, cfg.y)
# Ignore events while we're connecting to the window
self.__ignore_window_events = True