Re: [gtk-list] Re: 2 button press



> This is OK (well, *nearly* OK) on a single-user system like an Amiga
> or a PC, but not on a multi-tasking system like *N*X. If you try to make
> the application code use the 'time now' to evaluate the delay between
> button press/release events, you can get indeterminate results.

Are you sure you mean multi-USER operating system?  AmigaOS is known to
multitask better than most Unices...

You get indeterminate results now as it is.  Somewhere, somehow, you must
measure the time between mouse clicks.  I'm saying move it OUT of GTK
libraries, and into application code, where it is far more flexible.

> After the X server has delivered the button press event, you must then
> wait for the kernel to schedule your process before you get the chance
> to examine the current time. There is *no guarantee* that your process
> will be scheduled immediately. There may be a delay of several milliseconds,
> particularly if the system is busy, which would defeat your calculation
> of the time between the two events.

And GTK doesn't suffer from this problem now?  If so, how come it doesn't?
What does it do to determine a double-click?

> Similarly, a scheduling delay might make your application erroneously
> interpret two clicks as a double-click, if it (the application) doesn't
> get scheduled until after the second click has been queued by the server.

The way to solve this is to couple time information with individual click
events.  This would slightly modify my posted example, but not the basic
idea.

> The way to do it (without examining the source code, I assume that GTK
> does it this way) is to make the toolkit (i.e. GTK) calculate the time
> between the events, based on the timestamp which the X server puts in
> the event structure.

Basically what I said in the previous paragraph... :-)

> Allan

Thanks for taking the time to reply.  Your insights are helpful.

==========================================================================
      KC5TJA/6     |                  -| TEAM DOLPHIN |-
        DM13       |                  Samuel A. Falvo II
    QRP-L #1447    |          Chief Architect and Project Founder



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