Closed quozl closed 4 years ago
May be specific to the Sugar Toolkit, as it does not occur with Python GTK+ alone.
Test case: the Sugar Hello World activity.
Add to the end of __init__
a call to self.iconify()
and start the activity; result should be window not displayed. Incorrect behaviour on Ubuntu 18.04 with GTK+ 3.22.26.
Test case: the GTK+ Hello World application
Add a call to iconify()
and start; result should be window not displayed. Correct behaviour on Ubuntu 18.04 with GTK+ 3.22.26.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Hello World")
self.button = Gtk.Button(label="Click Here")
self.button.connect("clicked", self.on_button_clicked)
self.add(self.button)
def on_button_clicked(self, widget):
print("Hello World")
win = MyWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
win.iconify()
Gtk.main()
I was going through https://github.com/sugarlabs/sugar/blob/master/src/jarabe/journal/journalactivity.py What if we call self.iconify() before showing the window, I changed it in the journalactivity.py file. Although it didn't fix the issue, but I am wondering if there is another file where we can make this change.
P.S: "It’s permitted to call this function before showing a window, in which case the window will be iconified before it ever appears onscreen." I found this on Gnome Reference Guide. https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-iconify
Thanks, good try, but as you can see in the GTK+ Hello World application test case above it doesn't matter when iconify()
is called, as long as it is called before Gtk.main()
.
Given that the GTK+ Hello World application test case does not reproduce, the approaches to solve this problem include;
Understand Sugar Toolkit
Gtk.Window
is created, the iconify()
call, and the first call to the GTK+ main loop,Fix GTK+
git bisect
on GTK+ sources to find the commit which regressed,Instrumented an activity and the Toolkit and iterated through several tests. Two window-state-event occur when the Gtk.main()
begins, the first changing the state from nothing to Gdk.WindowState.FOCUSED | Gdk.WindowState.ICONIFIED
, and the second changing the state to just Gtk.WindowState.FOCUSED
. So the cause seems likely to be something that happens after the main loop begins processing events, idles, or timeouts.
A possible workaround might be to call iconify()
again in response to the window-state-event.
Dug further into this problem;
GLib.idle_add
callbacks, none were used,kill -STOP
of jarabe, reproduce, kill -CONT
; no change,Gtk.Widget.iconify
in the window-state-event callback; a viable workaround,GLib.timeout_add
callbacks, none were related,sugar-activity
by adding the minimum necessary code to the tail of the activity main file; no change,GDK_DEBUG=events
; several property notify events for window manager precede the problem, which hints at the window manager as cause,kill -STOP
of metacity, the reproducer no longer reproduced, which suggested strongly the window manager as cause,--no-force-fullscreen
option for metacity was in use by Sugar for a long time, and that the option was added by Sugar Labs as a workaround in ticket 602,--no-force-fullscreen
option; problem with an activity that calls self.iconify()
is resolved, problem with the Journal activity remains,Caused by upgrade of metacity from 3.24.0 to 3.25.2, git bisect shows first bad commit is unminimize windows with initial IconicState if first known on MapRequest ported from mutter.
Some testing done with a possible patch to force Journal to iconify when Metacity misbehaves and Metacity debugging flags; META_DEBUG=verbose
in .sugar/default/debug
. Result is that Journal does not cover home view, but an animated sequence of rectangles is shown by Metacity to indicate Journal is iconified. Logs.
Has this been tested by anyone using Top-of-Trunk Metacity? It's possible the bug (if they consider it one) has already been fixed there. The most recent release of Metacity is 3.30.1, which was released on September 9th of this year.
Also, I noticed at https://bodhi.fedoraproject.org/updates/metacity-3.30.1-1.fc29 that there is a testing build/RPM of metacity 3.30.1 for FC29.
Yes, I tested Metacity HEAD as of 24th November on Ubuntu 18.04 and it reproduced the bug. Also;
It's back, under certain conditions. https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/413.
On Ubuntu 17.10 Artful the
Gtk.Window.iconify
method called by an activity during__init__
does not result in the activity starting hidden. Works in previous versions. Unaffected GTK+ 3.22.11, affected GTK+ 3.22.15.