Oh ho! Break through.
I noticed that if, elsewhere in my program I ask it to open a second window, it opens it into a different location. This got me thinking that, as usual, I'm not letting GTK main iteration do what it needs to do. So, adding this between the two gtk_widget_show_all() instances: // Check for pending GTK click events. while (gtk_events_pending ()) { gtk_main_iteration (); } allows the window manager time to come up with a new location, and it now opens the windows in different locations. Dave ________________________________ From: David Buchan <pdbuc...@yahoo.com> To: gtk-list list <gtk-l...@gnome.org> Sent: Tuesday, September 18, 2012 9:51 PM Subject: GTK window positioning It just occurred to me that maybe I should be sending to the gtk-list mailing list instead (more active). Pls see below... ----- Forwarded Message ----- From: David Buchan <pdbuc...@yahoo.com> To: gtk-app-devel-list list <gtk-app-devel-list@gnome.org> Sent: Tuesday, September 18, 2012 9:05 PM Subject: GTK window positioning Hi, I've made a program that creates two new windows when demanded: GtkWidget *window1, *scrolled_win1, *textview1; GtkTextBuffer *buffer1; GtkWidget *window2, *scrolled_win2, *textview2; GtkTextBuffer *buffer2; PangoFontDescription *textview_font1; PangoFontDescription *textview_font2; // Create new window to display unfragmented packet. window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable (GTK_WINDOW (window1), TRUE); gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_NONE); gtk_window_set_title (GTK_WINDOW (window1), title); gtk_window_set_default_size (GTK_WINDOW (window1), 1000, 200); gtk_container_set_border_width (GTK_CONTAINER (window1), 1); // Create a textview object to display unfragmented packet. textview1 = gtk_text_view_new (); buffer1 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1)); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview1), TRUE); textview_font1 = pango_font_description_from_string ("Courier 10 Pitch 12"); gtk_widget_modify_font (textview1, textview_font1); // Create new window to display fragmented packet. window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable (GTK_WINDOW (window2), TRUE); gtk_window_set_position (GTK_WINDOW (window2), GTK_WIN_POS_NONE); gtk_window_set_title (GTK_WINDOW (window2), title); gtk_window_set_default_size (GTK_WINDOW (window2), 1000, 200); gtk_container_set_border_width (GTK_CONTAINER (window2), 1); // Create a textview object to display fragmented packet. textview2 = gtk_text_view_new (); buffer2 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview2)); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview2), TRUE); textview_font2 = pango_font_description_from_string ("Courier 10 Pitch 12"); gtk_widget_modify_font (textview2, textview_font2); I then do some stuff and then display the buffers within textviews within scrollbars within windows: scrolled_win1 = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win1), textview1); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win1), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_container_add (GTK_CONTAINER (window1), scrolled_win1); gtk_widget_show_all (window1); scrolled_win2 = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win2), textview2); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win2), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_container_add (GTK_CONTAINER (window2), scrolled_win2); gtk_widget_show_all (window2); I find that the two windows are always placed right on top of each other. I can drag the top one off the one underneath, but I'd like the window manager to choose placements that are separate. Suggestions? Have I bungled something? Thanks, Dave _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list