[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: Raising Windows to the top



I thought I had something with:

gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(GTK_BIN(w_ptr)->chi
ld)));

But the window still doesn't raise to the top.  I do not get any console
messages from gtk when I run it.


The complete code segment is:


void
on_salvo_button_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{

	  /* Get the salvo_window pointer from the parent window */
        GtkWidget       *w_ptr = gtk_object_get_data(GTK_OBJECT(
		lookup_widget(GTK_WIDGET(button), "nsems_gui")),
"salvo_window");

	  /* If the window hasn't been created yet, create it and set the
	   * pointers so that each knows where the other is.
	   */
        if (!w_ptr) {
                w_ptr = create_salvo_window();
                gtk_object_set_data(GTK_OBJECT(w_ptr), "nsems_gui",
				GTK_WIDGET(lookup_widget(GTK_WIDGET(button),
"nsems_gui")));
 
gtk_object_set_data(GTK_OBJECT(lookup_widget(GTK_WIDGET(button),
				"nsems_gui")), "salvo_window",
GTK_WIDGET(w_ptr));
        }

	  /* Put the window under the mouse, display it, and raise it to the
top */
        gtk_window_set_position(GTK_WINDOW(w_ptr), GTK_WIN_POS_MOUSE);
        gtk_widget_show(GTK_WIDGET(w_ptr));
 
gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(GTK_BIN(w_ptr)->chi
ld)));
}

When the parent window (nsems_gui) is created, the "salvo_window" data
object is initialized to NULL.  This way, each window is created only once,
and is hidden when not being used.

Am I making this harder than it needs to be?

JATF


-----Original Message-----
From: Havoc Pennington [mailto:hp@redhat.com]
Sent: Wednesday, October 17, 2001 7:06 PM
To: Tara M
Cc: LIST: GTKAppDevel
Subject: Re: Raising Windows to the top



"Tara M" <learfox@furry.ao.net> writes: 
> I don't think there is a gtk way of doing this but there is
> a solution you can try. If the widget is a GTK_WINDOW, get the
> GdkWindow associated with it and then get the GdkWindow's XID,
> this means you then go to the gdkx level and use XMapRaised() on
> that window (you'll also need the display pointer).

gdk_window_show() calls XMapRaised(), so the gdk_window_raise() I
suggested earlier is pointless.

Havoc
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]