text widget performance



Hello, 

        I'm build a GTK-- GUI for a log server. 
        I uses Gtk::Text widget to print logs that come from the server.


        Basic solution
        ----------------------------------------------------------------------
        In my main program, I set a callback to read new datas received 
        on my socket :

                gdk_input_add (sock, GDK_INPUT_READ, netInputCallback, data);

        and the netInputCallback does 

                text->insert(dataRed)
        

        But I have a lake of performance when I receive many logs.


        (not) Improved solution
        ----------------------------------------------------------------------
        To improve the performances, I canged netInputCallback introducing
        a buffer and a timer.

        netInputCallback does

                _buffer+=datared

        I create a timer like this

                SigC::Slot0<gint> my_slot = bind(slot(this, flushText), 0);
                _connection = Gtk::Main::timeout.connect(my_slot, 500);

        where flushText does

                text->insert(_buffer)
                _buffer=""

        But it doesn't improve anything, the GUI is frozen while receiving datas :-|


        Is there any GTK's way to do this ?


                Thanks a lot

                François                



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