Re: gtk_widget_get_toplevel() weirdness.
- From: Owen Taylor <otaylor redhat com>
- To: John C Atkeson <jcatkeson juno com>
- Cc: gtk-list redhat com
- Subject: Re: gtk_widget_get_toplevel() weirdness.
- Date: 24 Nov 1999 09:23:00 -0500
John C Atkeson <jcatkeson@juno.com> writes:
>
> I'm getting weird behavior out of gtk_widget_get_toplevel in KDE under
> RH Linux, but no similar problems in gtk-Win32....
>
> For example if I retrieve a widget's toplevel window in Linux:
>
> GtkWidget *Top=gtk_widget_get_toplevel(child);
>
> and then print the top's name:
>
> g_print("Top is:%s \n",gtk_widget_get_name(Top));
>
> It *always* returns the string "GtkWindow", no matter what the
> toplevel's name really was set to. In Win32 on the other hand it returns
> the right answer.
> More importantly though, none of Top's user-data is accessible either;
> it's almost as if Top is a completely different widget from the real top.
>
>
> My theory is that somehow the KDE wm is holding my gtk windows in
> higher-level containers, and gtk_widget_get_toplevel is finding those
> instead.
Well, without seeing some example code, I can't say what is
going, on, but I can say that this isn't the explanation. ;-)
The windows that kwm uses are completely separate from anything
in the GTK+ widget system. (Not only are the widgets in different
processes, but kwm uses Qt not GTK+.)
gtk_widget_get_toplevel() is not a complicated function:
===============
GtkWidget*
gtk_widget_get_toplevel (GtkWidget *widget)
{
g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
while (widget->parent)
widget = widget->parent;
return widget;
}
===============
I'd have to guess there is a logic bug somewhere in your code, since
if the widget that it returns is a GtkWindow, than it will be
your GtkWindow.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]