X-Git-Url: http://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/44d94e72539dd1fba3d4ec2772792b04e6c078d4..c44fd73cfd97f75ebfba25abe766b44f9d0346d2:/src/gui/lbxgui.c diff --git a/src/gui/lbxgui.c b/src/gui/lbxgui.c index 429e59f..9e462e6 100644 --- a/src/gui/lbxgui.c +++ b/src/gui/lbxgui.c @@ -63,7 +63,7 @@ void set_frame(GtkSpinButton *spin, gpointer data) { unsigned frame = gtk_spin_button_get_value_as_int(spin); - if (image) + if (image && framebuf) render_to_pixbuf(image, framebuf, frame); gdk_window_invalidate_rect(canvas->window, NULL, FALSE); } @@ -83,7 +83,7 @@ static void tick(void *p, double delta) struct lbx_imginfo info; GtkSpinButton *spin; GtkToggleButton *play; - unsigned frame; + unsigned frame, newframe; if (!image) return; @@ -97,20 +97,22 @@ static void tick(void *p, double delta) return; elapsed += delta; + newframe = frame; while (elapsed > seconds_per_frame) { elapsed -= seconds_per_frame; - if (++frame >= info.nframes) { + if (++newframe >= info.nframes) { if (!info.looping) { gtk_toggle_button_set_active(play, FALSE); break; } - frame = info.loopstart; + newframe = info.loopstart; } - - gtk_spin_button_set_value(spin, frame); } + + if (frame != newframe) + gtk_spin_button_set_value(spin, newframe); } static gboolean timeout(gpointer data) @@ -333,7 +335,7 @@ static int load_archive(const char *path) for (unsigned i = 0; i < nfiles; i++) { struct lbx_statbuf stat; - lbx_stat(lbx, i, &stat); + lbx_file_stat(lbx, i, &stat); gtk_tree_store_append(archives, &iter2, &iter1); gtk_tree_store_set(archives, &iter2, 0, stat.name, @@ -492,7 +494,7 @@ int main(int argc, char **argv) init_interface(); gtk_builder_connect_signals(builder, window); - g_timeout_add(10, timeout, NULL); + g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, 10, timeout, NULL, NULL); gtk_widget_show_all(window); init_background(canvas->window);