[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    qt key compression patch/kword perfomance
From:       Jaymz Julian <jaymz () dspaudio ! com>
Date:       2002-07-28 13:08:49
[Download RAW message or body]

Hi.

Short explination: This patch fixes the problem of QT events not being
compressed due to X issues, and hence kword falling way, way, way behind a
typist on medium-low end systems with a large paragraph
(refrence: http://www.dspaudio.com/~jaymz/elephant.kwd - try to edit that
paragraph on anything less than a p500 without this patch, then with, and
you should *really* notice the difference.

Long explination (skip this unless you care):

What seems to be happening, is that QT is reading the xlib event queue,
which is all well and good, however, while it is doing this over and over
and over, the events we actually need are sitting idle in teh server's
event queue, which isn't being read by XPending() due to there being
other, non keyboard related, events in said queue.  This patch corrects
this behavious by placing an XSync() call just before QT checks for
keyboard events, which forces the queue to be read.

My understanding of X protocol gets quite fuzzy at this point, but my
understanding of XSync() is that it is really the equivalent of taking a
bludgeon to the XServer and telling it to get it's shit in order.  This is
perhaps more than a tad extereme for this case, however the usual
XPending() of course failed, even when pretty pleased (although it did
half work when pretty pleased ;)) due to, as mentioned above, other
non-keyboard events (which, according to the man pages, will cause it to
just reutrn a count and not actully do anything useful :-p).

There is probably a better X Call to use, but I couldn't find it/am
unfamiliar with it.

Anyhow, long story short (see short verison above :-p), this fixes the
problem with kword falling behind the users on my systems :-p (tested on a
p3-500/512meg/kde3.0.2/xfree4.2, and a p133/32meg/kde3.0.2/xfree4.1).  
Who knows if it works for anyone else etc etc.

	- Jaymz (who is not on the list, and hence would appriciate being 
cc'd on replies - thanks :)

["qtEventCompressionSync.patch" (TEXT/PLAIN)]

diff -ru ./qt-3.0.5-orig/src/kernel/qapplication_x11.cpp \
                ./qt-x11-free-3.0.5/src/kernel/qapplication_x11.cpp
--- ./qt-3.0.5-orig/src/kernel/qapplication_x11.cpp	2002-07-08 20:26:53.000000000 \
                +1000
+++ ./qt-x11-free-3.0.5/src/kernel/qapplication_x11.cpp	2002-07-28 22:06:41.000000000 \
+1000 @@ -5416,6 +5416,13 @@
 	XEvent	evPress;
 	for (;;) {
 	    QString textIntern;
+	    // This makes the event queue actully update so that text compression
+	    // actully works.  No, XPending() does not achieve this correctly...
+	    // it only adds to the queue when the queue is empty, which is all well and
+	    // good, unless the queue has repaint events and mouse events, meaning the our
+	    // poor unloved key events stay lonely back at the server.  There is probably a
+	    // better way to do this.....
+	    XSync(dpy, false);
 	    if ( !XCheckTypedWindowEvent(dpy,event->xkey.window,
 					 XKeyRelease,&evRelease) )
 		break;


____________________________________
koffice mailing list
koffice@mail.kde.org
To unsubscribe please visit:
http://mail.kde.org/mailman/listinfo/koffice

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic