GNOME Bugzilla – Bug 107301
gtk_window_move() behavior
Last modified: 2004-12-22 21:47:04 UTC
To place a dialog box in a specified location, I was doing something like gtk_widget_show_all(dialog); gtk_window_move(GTK_WINDOW(dialog), 128, 128); But this make the dialog not the active window on screen. If I comment out the line gtk_window_move(GTK_WINDOW(dialog), 128, 128); The dialog box is showing as active window. I think gtk_window_move() should not affect the active state of the window. The testing code is attached: #include <gtk/gtk.h> void hello( GtkWidget *widget, gpointer data ) { GtkWidget *dialog; dialog = gtk_dialog_new_with_buttons("Move", GTK_WINDOW(data), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_widget_show_all(dialog); /* Comment out the following line to see the right behavior. */ gtk_window_move(GTK_WINDOW(dialog), 128, 128); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } gint delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit (); return TRUE; } int main( int argc, char *argv[] ) { GtkWidget *window; GtkWidget *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_window_set_default_size (GTK_WINDOW (window), 256, 256); button = gtk_button_new_with_label ("Dialog"); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hello), window); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); gtk_main (); return 0; }
Has to be a window manager issue, pretty much. Maybe you are using mouse focus and that's related? But I'd suggest filing a WM bug.
Filed under Metacity BUG#107347. The window manager I am using is Metacity. All the settings are as a newly installed RedHat Phoebe 3, not mouse focus.
*** This bug has been marked as a duplicate of 107347 ***