maemo.org Bugzilla – Bug 3501
hildon_window_update_topmost() should handle/ignore windows that haven't been realized
Last modified: 2008-12-01 12:42:59 UTC
You need to log in before you can comment on or make changes to this bug.
I've hit a small problem with the hildon library. The application I'm debugging creates two top-level windows. However, only one of them is initially visible, the second is created invisible and made visible later when needed. I've replaced gtk_window_new() calls with hildon_window_new() calls, and added hildon_program_add_window() calls right after creating the window. However, when I run the application, I always get the following warning during startup: GLIB WARNING ** Gdk - gdkdrawable-x11.c:878 drawable is not a pixmap or window I've debugged the problem down to hildon-window.c, function hildon_window_update_topmost. It contains a line: my_window = GDK_WINDOW_XID (GTK_WIDGET(self)->window); Problem is, when it's called for the window that wasn't yet mapped (hildon_window_realize() was not called), the 'window' field in GtkWidget is zero, this GDK_WINDOW_XID call will emit a warning. To work around this problem I have either to delay the hildon_program_add_window() call until the window is actually made visible, or after adding the window to HildonProgram call immediately gtk_widget_show() followed by a gtk_widget_hide(). I think hildon_window_update_topmost() should ignore invisible widgets at all.
Was little wrong, deferring the call to hildon_add_window() does not change anything. It's just enough to create a invisible HildonWindow object and the warning will appear. I tried to call gtk_widget_realize(): this indeed removes the above warning, but a different one appears telling me that I'm trying to allocate a widget with a height of -24 and a width of 0 :) So, the show/hide() sequence is the only reliable solution so far.
... interested in providing a patch, or do you think that this needs to be clarified in the developer documentation (if so, please provide a link)?
(In reply to comment #0) > I've replaced gtk_window_new() calls with hildon_window_new() calls, and added > hildon_program_add_window() calls right after creating the window. However, > when I run the application, I always get the following warning during startup: > > GLIB WARNING ** Gdk - gdkdrawable-x11.c:878 drawable is not a pixmap or window > > I've debugged the problem down to hildon-window.c, function > hildon_window_update_topmost. It contains a line: > > my_window = GDK_WINDOW_XID (GTK_WIDGET(self)->window); I looked into code and this seems a clear bug. I've seen this warning also in logs from our apps, maybe the cause is the same. > Problem is, when it's called for the window that wasn't yet mapped > (hildon_window_realize() was not called), the 'window' field in > GtkWidget is zero, this GDK_WINDOW_XID call will emit a warning. > > I think hildon_window_update_topmost() should ignore invisible widgets at all. A check for "GTK_WIDGET_REALIZED(self)" or "self->window" in line 1466 libhildon::hildon-window.c should be enough: -------------------------------------------- 1456 void 1457 hildon_window_update_topmost (HildonWindow *self, 1458 Window window_id) 1459 { 1460 HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (self); 1461 1462 Window my_window; 1463 1464 g_return_if_fail (HILDON_IS_WINDOW (self)); 1465 g_assert (priv); 1466 1467 my_window = GDK_WINDOW_XID (GTK_WIDGET (self)->window); -------------------------------------------- Thanks!
was already internally reported with a patch...
Can you share your test code ? Thanks!
This bug has been fixed. Now trying to find out if/when it was publically released...
Fixed in package libhildon 2.0.7-1 which is part of the internal build version diablo build x.2008.47 (Note that 2008 is the year and the number after is the week.) Any public update released with or after this build version will include the fix. Please verify that the new version fixes the bug by marking this bug report as VERIFIED after the public update has been released and if you have some time.