GNOME Bugzilla – Bug 662036
gtk_window_move() doesn't work reliably in some circumstances
Last modified: 2018-02-10 04:34:01 UTC
GtkTreeView uses a quite funky hack to display a "typeahead find" search window popup when text is typed with no explicit keyboard focus. NautilusIconContainer has a copy of that code adapted to its canvas implementation. Both the code in GtkTreeView and NautilusIconContainer fail to properly display the typeahead fine entry under certain circumstances (see e.g. bug 660807), and I tracked this down to be a more general problem either in the code that creates and positions the entry itself or in GTK+. Attached you can find a testcase which is a reduction of the code used by both GtkTreeView and NautilusIconContainer. Apparently, changing the gtk_window_move() call to gdk_window_move(gtk_widget_get_window()) always works reliably, while calling gtk_window_move() alone is sometimes not enough. The behaviour I observe with the testcase is: - from popup_position_func(), gtk_window_move() will move the window in the right position the first time only; after the first time it will mostly fail to display the window, but will randomly succeed once in a while too - if I remove the gtk_window_move() call processing the event offscreen, gtk_window_move() in popup_position_func() always succeeds - in both cases, moving the toplevel window causes *the first* call to _window_move() to use the wrong previous toplevel attach position, even if the numbers returned from gtk_window_get_origin() (and thus, those passed to _window_move()) are correctly updated
Created attachment 199266 [details] test case Build with $ gcc `pkg-config --cflags --libs gtk+-3.0` ./testwindows.c -o ./testwindows
This only happens with POPUP windows; the same testcase seems to work fine with TOPLEVEL windows.
It also doesn't happen with Metacity. Not sure if it's Mutter-specific though, since the original Nautilus report comes from Ubuntu.
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.