[sane-devel] small xscanimage patch

Matto Marjanovic maddog at mir.com
Wed Aug 21 17:43:47 BST 2002


Hiya,

Here are a couple of small patches for xscanimage, which I will happily
 commit to CVS if there are no objections.

They make the dialog window and progress bar update more immediately,
 i.e. before the completion of the first sane_read().  For backends
 such as microtek, which may have pretty lengthy, blocking sane_start()
 and sane_read() operations, this gives the user immediate feedback
 that something is happening (aside from the strange sounds from the
 scanner).

-matt m.


Index: progress.c
===================================================================
RCS file: /cvsroot/external/sane/sane-frontends/src/progress.c,v
retrieving revision 1.1
diff -u -r1.1 progress.c
--- progress.c	2000/11/10 06:33:25	1.1
+++ progress.c	2002/08/21 16:42:58
@@ -69,6 +69,7 @@
   gtk_widget_show (p->pbar);
   gtk_widget_show (button);
   gtk_widget_show (GTK_WIDGET (p->shell));
+  gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), 0);
   return p;
 }
 
Index: xscanimage.c
===================================================================
RCS file: /cvsroot/external/sane/sane-frontends/src/xscanimage.c,v
retrieving revision 1.15
diff -u -r1.15 xscanimage.c
--- xscanimage.c	2002/04/06 10:31:23	1.15
+++ xscanimage.c	2002/08/21 16:42:59
@@ -890,6 +890,8 @@
 
   scan_win.x = scan_win.y = 0;
 
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
   status = sane_start (dev);
   if (status != SANE_STATUS_GOOD)
     {
@@ -1032,8 +1034,12 @@
       && sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD)
     scan_win.input_tag = gdk_input_add (fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
 					input_available, 0);
-  else
-    input_available (0, -1, GDK_INPUT_READ);
+  else 
+    {
+      while (gtk_events_pending ())
+	gtk_main_iteration ();
+      input_available (0, -1, GDK_INPUT_READ);
+    }
 }
 
 /* Invoked when the scan button is pressed */




More information about the sane-devel mailing list