GTK ignores any type of window positioning

117 views Asked by At

I've been trying to position a splash screen at the center of the screen. In Windows, such a request is easy using SetWindowPos and a bit of geometric arithmetic. I found out that all requests to move a window are ignored by the windowing manager. So my question is, how come I see so many applications with pretty splash screens properly centered? I started with GTK_WINDOW_TOPLEVEL BTW and just switch to popup trying a few things. Setting the gravity and position do not fail, they are just ignored. Even defined in a .glade file, the window is ignored.

{
    GtkWidget *pNewWindow = gtk_window_new(GTK_WINDOW_POPUP);
    gtk_window_move(GTK_WINDOW(pNewWindow), 0, 0);

    gtk_widget_show_all(pNewWindow);
    while (gtk_events_pending())
        gtk_main_iteration();
    gtk_widget_set_size_request(pNewWindow, width, height);
    gtk_window_set_decorated(GTK_WINDOW(pNewWindow), FALSE);
//  gtk_window_set_position(GTK_WINDOW(pNewWindow), GTK_WIN_POS_CENTER_ALWAYS);
    gtk_window_set_resizable(GTK_WINDOW(pNewWindow), FALSE);
//  gtk_window_set_gravity(GTK_WINDOW(pNewWindow), GDK_GRAVITY_CENTER);
    gtk_window_move(GTK_WINDOW(pNewWindow), 0, 0);
    while (gtk_events_pending())
        gtk_main_iteration();
    return pNewWindow;
}
0

There are 0 answers