gtk_window_move



I'm trying to move a gtk window multiple times within a period of time
but it seems that it doesn't update the window position for each
window move until gtk_main() is called and then all window moves are
done at once it seems. I want to move a window with a usleep call
inbetween window moves.

Can any provide me with some guidance? Is there a flush or update call
I'm missing?

Below is my code..

#include <gdk/gdk.h>
#include <gtk/gtk.h>

int main (int argc, char **argv) {

   GtkWidget *window;
   int w=200, h=200;
   int x, y;

   x=100;
   y=50;

   gtk_init(&argc, &argv);
   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_show_all(window);
   g_signal_connect (G_OBJECT (window), "delete-event", gtk_main_quit, NULL);
   usleep(500000);
   printf("sleep fnished\n");
   gtk_widget_show(window);
   gtk_window_resize (GTK_WINDOW (window), w, h);
   usleep(500000);
   printf("sleep fnished\n");
   gtk_window_move (GTK_WINDOW (window), x, y);

   usleep(500000);
   gtk_widget_show(window);
   gtk_window_resize (GTK_WINDOW (window), w+300, h);

   printf("gtk_main()\n");
   gtk_main();

   return 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]