gtk_widget_set_uposition()



I'm trying to create a transient window where a user clicks with a mouse
button.  The obvious way to do this is to use:
w = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_window_position (GTK_WINDOW (w), GTK_WIN_POS_MOUSE);

But this doesn't seem to work if I place the gtk_widget_show (w) at the
end, ie:

w = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_window_position (GTK_WINDOW (w), GTK_WIN_POS_MOUSE);
da = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (da), width + 20, (height + 2) * num);
gtk_signal_connect (GTK_OBJECT (da), "expose_event",
        (GtkSignalFunc) gbuffy_display_expose, box);
gtk_widget_set_events (da, GDK_EXPOSURE_MASK);
gtk_container_add (GTK_CONTAINER (w), da);
gtk_widget_show (da);
gtk_signal_connect (GTK_OBJECT(da),"configure_event",
        (GtkSignalFunc) configure_event, box);
gtk_widget_show (w);

The window doesn't get drawn at the mouse point.  If I instead place the
gtk_widget_show (w) before creating the drawing_area, it works
correctly, but I get multiple configure events, which is visually
annoying (it first creates the window at the default size of 200,200,
then does a resize).

So, I'm trying to use gtk_widget_set_uposition (w, xpos, ypos)
using the x_root and y_root from GdkEventButton, but this only works
if I call gtk_widget_realize (w) first, and then only on 1.0.5, 1.1.1
just draws it in the same place as the above code does.

Am I just confused?

Brandon
-- 
 Brandon Long              "I think, therefore, I am confused." -- RAW
 MD6 Crash Test Dummy             "Of all the things I've lost,
 Intel Corporation                 I miss my mind the most."
          I'm too low on the totem pole to speak for Intel.
                  http://www.fiction.net/blong/



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