Refactor _receive_configure_event().
Add comment about bug when state event is sent after configure event.
This commit is contained in:
parent
ab7b93d4d7
commit
7323e0c604
|
@ -203,14 +203,18 @@ class UIConfig(config.Config):
|
||||||
# Get window state, correct size comes from window.get_size(),
|
# Get window state, correct size comes from window.get_size(),
|
||||||
# see https://developer.gnome.org/SaveWindowState/
|
# see https://developer.gnome.org/SaveWindowState/
|
||||||
def _receive_configure_event(widget, event):
|
def _receive_configure_event(widget, event):
|
||||||
x_pos, y_pos = widget.get_position()
|
if not self.__ignore_window_events:
|
||||||
width_size, height_size = widget.get_size()
|
# TODO: The maximize event might arrive after the configure event.
|
||||||
maximized = bool(event.window.get_state() & Gdk.WindowState.MAXIMIZED)
|
# This causes the maximized size to be saved, and restoring the
|
||||||
if not self.__ignore_window_events and not maximized:
|
# window will not save its smaller size. Delaying the save with
|
||||||
cfg.x = x_pos
|
# idle_add() is not enough time for the state event to arrive.
|
||||||
cfg.y = y_pos
|
if not bool(event.window.get_state() & Gdk.WindowState.MAXIMIZED):
|
||||||
cfg.width = width_size
|
x_pos, y_pos = widget.get_position()
|
||||||
cfg.height = height_size
|
width_size, height_size = widget.get_size()
|
||||||
|
cfg.x = x_pos
|
||||||
|
cfg.y = y_pos
|
||||||
|
cfg.width = width_size
|
||||||
|
cfg.height = height_size
|
||||||
|
|
||||||
window.connect('configure-event', _receive_configure_event)
|
window.connect('configure-event', _receive_configure_event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue