After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 107301 - gtk_window_move() behavior
gtk_window_move() behavior
Status: RESOLVED DUPLICATE of bug 107347
Product: gtk+
Classification: Platform
Component: Widget: Other
2.2.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-02-28 22:16 UTC by Yao Zhang
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.1/2.2



Description Yao Zhang 2003-02-28 22:16:54 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;
}
Comment 1 Havoc Pennington 2003-03-01 05:20:57 UTC
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.
Comment 2 Yao Zhang 2003-03-01 20:03:24 UTC
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.
Comment 3 Owen Taylor 2003-04-21 22:52:56 UTC

*** This bug has been marked as a duplicate of 107347 ***