texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] One more patch to cut&paste


From: Gubinelli Massimiliano
Subject: Re: [Texmacs-dev] One more patch to cut&paste
Date: Fri, 12 Jun 2009 10:21:24 +0200

Hi all,

On 12 juin 09, at 00:37, Norbert Nemec wrote:

Josef Weidendorfer wrote:
Hi,

On Thursday 11 June 2009, Norbert Nemec wrote:

Also, I am not fully content with the idling loop that is running to catch socket communications.


Just a comment here: busy polling (on sockets, for timers, ...)
in user space never should be needed.

I fully agree. In Qt alone, this is simple to avoid.

However, TeXmacs splits the GUI details into a "plugin" that follows a certain interface. That way, one can use X11, Qt and other widget sets. The interface for that GUI is homegrown and rather minimalistic.

Any clean solution that involves the event loop has to be implemented in the GUI in some way, so in the case of socket-IO, you not only have to think how to implement this in Qt, but how to define a interface for this functionality such that other GUI plugins can also offer the same functionality.

It is certainly possible, but needs some serious restructuring.



On Unix, the select() system call allows to wait for arbitrary file
descriptors to become ready, including sockets, and has a timeout to
allow for the implementation of timers. I am quite sure that Qt
internally uses this.
To wait on sockets in Qt (data to read available, error condition, ...) with the standard event loop (thus, without polling), use QSocketNotifier.
And any "texmacs internal timers" should be based on QTimer.

Josef





Up to know we tried not to change texmacs gui api in order to keep the X11 frontend in its current state since it is well tested and fine tuned for incremental rendering. This allow to have a fixed point of reference when evaluating the performances of the other frontends (Cocoa or Qt). On the other hand it is also true that this prevented corrent implementation of the runloop according to modern gui libraries. We have the same problem in the Cocoa frontend. An interim solution (waiting the Qt port to stabilize and beign fully debugged) would be to have an API to register in the gui side the file and socket descriptors looked at in the TeXmacs side in such a way that if some descriptor is ready to be read with new data the gui has the possibility to explicitly call the_interpose_handler or the specific TeXmacs listening routine. In this way we have only to insert appropriate registering and deregistering requests in the TeXmacs side without changing the structure of the code. Once we know the relevant descriptors on the Qt side we can set up Qt socket/file notifications instead of polling with an explicit timer. Note also that in the X11 frontend there is a very fancy timeout sistem which takes into account the frequency of the user inputs to balance computing resources between the update of the internal structures and the handling of the input. Would be nice to have this also in the Qt side. Moreover currently in the Qt port the ability to stop a redrawing of the canvas because of user input is disabled (the "check_event" function return always false).

Internal texmacs timers can be easily handled without changing the gui API.

Best,
Massimiliano









reply via email to

[Prev in Thread] Current Thread [Next in Thread]