After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 356033 - Oddness in GtkWindow vs GdkWindow
Oddness in GtkWindow vs GdkWindow
Status: RESOLVED INVALID
Product: pygtk
Classification: Bindings
Component: gdk
Git Master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-15 00:00 UTC by Elijah Newren
Modified: 2006-09-15 15:37 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Elijah Newren 2006-09-15 00:00:37 UTC
I'm still a python and pygtk newbie, so there may be reasons against this, but I was wondering if it'd make sense to have set_user_time() automatically realize the window for the user if it hasn't been already?

Trying to help debug bug 351797, I found out that pygtk allows GdkWindow functions to be called on GtkWindow objects.  i.e.
  window.set_user_time(timestamp)
makes sense even though window is a GtkDialog.  However, this function will silently fail if window has not been realized, forcing users to instead type
  window.realize()
  window.set_user_time(timestamp)
to get correct behavior.  That seems error prone given that there's no hint from the code why set_user_time might silently fail.

In C, this isn't really fixable but at least the problem is slightly more noticable.  The calls there are actually
  GdkWindow *gdk_window = GTK_WIDGET (window)->window;
  gdk_x11_window_set_user_time(gdk_window, timestamp);
Thus gdk_x11_window_set_user_time doesn't have a GtkWindow object and can't realize one in order to obtain a valid gdk_window.  It instead has to just exit early without doing anything.  But, at least with this code it's a little more clear that gdk_window might be invalid (in this case, due to the fact that the window isn't realized).  This means that if they do correctly guess that their gdk_window is invalid (or they just look up the function definition and see it has an early-exit possibility) then they are more likely to be able to discover the correct C version:
  GdkWindow *gdk_window;
  gtk_window_realize (window);
  gdk_window = GTK_WIDGET (window)->window;
  gdk_x11_window_set_user_time(gdk_window, timestamp);
Comment 1 Gustavo Carneiro 2006-09-15 10:22:00 UTC
> pygtk allows GdkWindow functions to be called on GtkWindow objects

Are you  sure?! That's news to me :o

At least _my_ pygtk doesn't seem to allow it, as expected... what kind of broken pygtk version do you have?
Comment 2 Elijah Newren 2006-09-15 15:37:23 UTC
Oops, I misread the orca code.  It was window.window.set_user_time not window.set_user_time.  Sorry for the noise...