[moserial] pause to process gtk/gdk events while receiving data



commit b77db54955ca516bfef8f88fafc5f2c221608b72
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Thu Aug 25 10:01:19 2011 -0400

    pause to process gtk/gdk events while receiving data

 src/SerialConnection.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/SerialConnection.vala b/src/SerialConnection.vala
index d90fbe3..abd04b3 100644
--- a/src/SerialConnection.vala
+++ b/src/SerialConnection.vala
@@ -127,9 +127,13 @@ public class moserial.SerialConnection : GLib.Object
         }
 
         private bool readBytes(GLib.IOChannel source, GLib.IOCondition condition) {
-                uchar[] m_buf = new uchar[1000];
-                int bytesRead=(int)Posix.read(m_fd, m_buf, 1000);
+                uchar[] m_buf = new uchar[128];
+                int bytesRead=(int)Posix.read(m_fd, m_buf, 128);
 		rx += (ulong) bytesRead;
+
+                while(Gtk.events_pending() || Gdk.events_pending())
+                        Gtk.main_iteration_do(true);
+
                 if (bytesRead<0)
                         return false;
                 newData(m_buf, bytesRead);



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