Moving window after show changes focus on map order. Is it a bug?

This sample works as expected, unless I uncomment gtk_window_move then the order changes.

This is with gtk3 / Xorg.

With the expected result:

Focus in Window 1
Focus in Window 2
Focus in Window 3

With the gtk_window_move():

Focus in Window 2
Focus in Window 3
Focus in Window 1

How can I work-around this?

#include <gtk/gtk.h>

static void on_focus_in(GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
    g_print("Focus in %s\n", gtk_window_get_title(GTK_WINDOW(widget)));

int main(int argc, char *argv[])
    GtkWidget *win1, *win2, *win3;
    gtk_init(&argc, &argv);

    win3 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(win3), "Window 3");
    g_signal_connect(G_OBJECT(win3), "focus-in-event", G_CALLBACK(on_focus_in), NULL);

    win1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(win1), "Window 1");
    g_signal_connect(G_OBJECT(win1), "focus-in-event", G_CALLBACK(on_focus_in), NULL);

    win2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(win2), "Window 2");
    g_signal_connect(G_OBJECT(win2), "focus-in-event", G_CALLBACK(on_focus_in), NULL);

//    gtk_window_move(GTK_WINDOW(win1), 10, 10);

    return 0;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.