NetBSD-Bugs archive

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

Re: xsrc/39209: XGrabKeyboard time problem seen with openmotif menu



The following reply was made to PR xsrc/39209; it has been noted by GNATS.

From: Cliff Wright <cliff%snipe444.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: xsrc/39209: XGrabKeyboard time problem seen with openmotif menu
Date: Mon, 28 Jul 2008 09:39:24 -0700

 This is a multi-part message in MIME format.
 
 --Multipart=_Mon__28_Jul_2008_09_39_24_-0700_F3EDm/VfJgP.mLz6
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 Looking at the code I see that an increasing time can be returned as an
 absolute(actually semi, as an overflow will occur after multipling seconds
 by 1000 to make into milliseconds) time with the followig patch.
 -- 
 Cliff Wright <cliff%snipe444.org@localhost>
 
 --Multipart=_Mon__28_Jul_2008_09_39_24_-0700_F3EDm/VfJgP.mLz6
 Content-Type: text/plain;
  name="xpatch.txt"
 Content-Disposition: attachment;
  filename="xpatch.txt"
 Content-Transfer-Encoding: 7bit
 
 --- Xserver/os/GetTimeInMillis.c.distrib       2005-03-18 06:55:16.000000000 
-0800
 +++ Xserver/os/GetTimeInMillis.c       2008-07-28 09:11:36.000000000 -0700
 @@ -6,18 +6,15 @@
  {
      struct timeval  tp;
      register CARD32 val;
 -    register INT32 diff;
      static CARD32 oldval = 0;
 -    static CARD32 time = 0;
  
      X_GETTIMEOFDAY(&tp);
      val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
 -    if (oldval) {
 -      diff = val - oldval;
 -      if (diff > 0)
 -          time += diff;
 -    }
 -    oldval = val;
 +    /* make sure time always increases */
 +    if (val - oldval < 0)
 +      val = oldval;
 +    else
 +      oldval = val;
  
 -    return time;
 +    return val;
  }
 
 --Multipart=_Mon__28_Jul_2008_09_39_24_-0700_F3EDm/VfJgP.mLz6--
 


Home | Main Index | Thread Index | Old Index