From 9e7a93afba13470464700673dec6a3f9750cfd34 Mon Sep 17 00:00:00 2001 From: James Cameron Date: Tue, 27 Nov 2018 18:04:51 +1100 Subject: [PATCH] Journal - iconify again if Metacity misbehaves (RHBZ #1519042) Journal covers Home View on startup when Metacity is 3.25.1 or later, isolated to Metacity 6875256 ("unminimize windows with initial IconicState if first known on MapRequest"). Detect the window state event where ICONIFIED is cleared without any action by the user. Repeat the iconify request. Has side-effect of showing a Metacity iconify animation, but this is better than not fixing it. Fixes https://github.com/sugarlabs/sugar/issues/769 Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/368 Tested on Fedora 18 and Ubuntu 16.04; does not trigger. Tested on Ubuntu 18.04; does trigger. --- src/jarabe/journal/journalactivity.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py index afef81b8f7..1db49b555a 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -226,6 +226,7 @@ def __init__(self): self._dbus_service = JournalActivityDBusService(self) + self._unwanted = True # user has not asked to see Journal self.iconify() self._critical_space_alert = None @@ -520,10 +521,16 @@ def _focus_out_event_cb(self, window, event): self._set_is_visible(False) def __window_state_event_cb(self, window, event): - logging.debug('window_state_event_cb %r', self) + logging.debug('window_state_event_cb %r', event.new_window_state) if event.changed_mask & Gdk.WindowState.ICONIFIED: state = event.new_window_state visible = not state & Gdk.WindowState.ICONIFIED + if self._unwanted and visible: + self._unwanted = False + self.iconify() + logging.warning('Journal premature deiconify ' + 'by Metacity (RHBZ #1519042), try again.') + return self._set_is_visible(visible) def _set_is_visible(self, visible): @@ -559,6 +566,7 @@ def set_active_volume(self, mount): def show_journal(self): """Become visible and show main view""" + self._unwanted = False self.reveal() self.show_main_view()