GTK high speed interface



Hey all,

I'm a complete GTK n00b developer, and was trying to hurridly implement a GUI for a project I'm completing as part of a final year Uni course.

The task was to implement a MIPS emulator, and then display the results of the pipeline registers and so on at emulator run time. I generated a very basic GUI using glade-2, which was basically just labels and entry classes. I found a nice tutorial on writing a simple program, but it seems to fall apart when I push it.

If I "single step" my emulator, then each of the register values are displayed in the appropriate field. However, if I run the emulator (for some 130,000 cycles, each cycle with a callback to place text in the entry fields), then no text is written to the entry elements until the entire program is finished. The interface itself appears to lock up, but I (partially) understand the reasons for this.

Here is the basic bad style to which I'm currently doing the write operation for the entry classes.

GtkWidget *entry = NULL;
float result = 0.0;
gchar *string = NULL;
entry = lookup_widget(widget, "entry_bla");	
result = g_strdup_printf("%5.2f", result);
gtk_entry_set_text(GTK_ENTRY(other_entry), string);
g_free(string);

...is there some form of double-buffering or class flushing that I need to be doing to get the updates to work at the faster rates? In case I'm not clear, I also wrote a test program that had a tight for loop that simply counted to 10,000 and attempted to print the current loop variable to an entry field in the same method - and the results were much the same - complete lockup until the final result was available, which was then displayed on the screen.

Thoughts, links, abuse or suggestions would be appreciated :D

Cheers

Tim



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