Question re gtk_timeout_add and/or SIGALRMs



Hello.

I am developing an application which is basically a lots of buttons, no
drawing areas. When one button is depressed, the application runs a
compute intensive job for 20 minutes. While this is happening though the
main screen does not refresh, and slowly becomes obiterated.

I have tried two possible solutions.

One using a SIGALRM running each second to force a 
gtk_widget_draw(MainWindow, NULL), then reset the alarm for another
second.
########################################################
i.e.
void pathRepaintTopDaemon (int sig)
{
 gtk_widget_draw(pTOPWindow, NULL);
 alarm(1);
}	

and in main code prior to gtk_main()

signal(SIGALRM, pathRepaintTopDaemon);
alarm(1);

#########################################################

This seems to happily refresh every second, until the big button is
depressed and the compute intensive job starts, when it appears never to
get a piece of the action....

I have also tried using 

#########################################################
gint Repaint (void * v)
{
 gtk_widget_draw(pTOPWindow, NULL);
 return 1;
}

with 
  gtk_timeout_add(500, Repaint , 0);
prior to gtk_main().
#########################################################

This again seems to suffer the same fate.

Apart from setting up a thread just to run a gtk_widget_draw 
in the background, what would be the "preferred" solution to this
problem of keeping menu/widgets refreshed while the application is busy?

I look forward to your collective wisdom.

Best regards


Colin Thomas 



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