Re: [gtk-list] Re: slow drags



On  6 Mar, Stefan Wille shouted:
->  Rupert Littlewood wrote:
->  > 
->  > Hi all,
->  > 
->  > When I try the `dnd' test with testgtk (0.99.4) I'm finding that there
->  > is quite a lag between the movement of the mouse and the position of
->  > the dragged icon. (That is, if I move the mouse haphazardly across the
->  > screen the icon will belatedly trace out the path of the mouse until
->  > it catches up, rather than keeping pace).  Now, this is on an
->  > X-terminal, and I vaguely remember (but can't check right now) that the
->  > performance is much better on my home machine (not networked) but I'm
->  > reluctant just to blame the Xserver for this, since moving the icons
->  > using the window manager gives perfectly adequate response.
->  
->  If you use xfm, the icons move just fine because (I think) they are set 
->  as the mouse cursor image. Sadly this limits the icons to black & white.
->  
->  On my Millenium II / P200, the shapes demo in testgtk works 
->  acceptable at 32 BPP, but not perfectly.
->  
->  By setting the pixmap as a background pixmap instead of drawing it
->  explicitly after an expose event, the whole thing could be made a little
->  faster, but I am afraid it still wouldn't be perfect.

It would save client-side initiated redraws.. definietly faster and more
server traffic efficient. The real solution is to check the event
queue like follows:

void HandleEvent(XEvent *ev)
{
   int type;

   type=ev->type;
   switch (ev->type)
     {
       case KeyPress:
            break;
       case KeyRelease:
            break;
       case ButtonPress:
            HandlePress(ev);
            break;
       case ButtonRelease:
            HandleRelease(ev);
            break;
       case MotionNotify:
             while (XCheckTypedEvent(disp,type,ev));
             HandleMotion(ev);
             break;
	etc.

get the idea? it works perfectly and will probably be what dfm and the
windowmanager are doing. they check the event queue for more motion
events in the queue - if there are any it takes all of them out until it
finds the last one - then uses the last event in the queue - this means
coarser event iterations, but with correct code in HandleMotion it works
perfectly.

this is Xlib code - a similar one in gtk using gdk would be needed.	

-- 
--------------- Codito, ergo sum - "I code, therefore I am" --------------------
raster@rasterman.com       /\___ /\ ___/||\___ ____/|/\___  raster@redhat.com
Carsten Haitzler           | _ //__\\ __||_ __\\ ___|| _ /  Red Hat Advanced
218/21 Conner Drive        || // __ \\_ \ | |   \ _/_|| /   Development Labs
Chapel Hill NC 27514 USA   ||\\\/  \//__/ |_|   /___/||\\   919 547 0012 ext 282
+1 (919) 929 9443, 801 4392   For pure Enlightenmenthttp://www.rasterman.com/ 



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