Re: [gtk-list] 2 button press



On Tue, 21 Apr 1998, Simon Csaba Endre wrote:

>   How can I receive only _one_ double click and triple click event (on
> double click I don't want to receive simple click, simple click, double click,
> just one double click, and on triple click I don't want to receive
> simple click, simple click, double click, simple click, triple click).
>   My program (probably wrong) is:

I'm a total newbie when it comes to GTK+, but I wanted to offer my
insights.  The Amiga's Intuition user interface does not bother with the
complexities of trying to determine whether or not it's a double click or
not.  Instead, it transmits only "clicked" events.  (In all honesty, it
transmits button down and button up events independently; however, let's
play along here... :-) ).

To determine if a click is a double click, you'd use something like this:

void handle_click( GtkWidget *widget, GdkEventButton *event )
{
   static time_t lastClicked = NULL_TIME;

   /* Ideally, you should only initialize this once; but again, this is
    * only an example, so bear with me.
    */

   if( lastClicked == NULL_TIME )
      lastClicked = GetTime();

   if( event -> button == DESIRED_BUTTON )
   {
      if( ValidDoubleClick( lastClicked ) )
	 g_print( "Double-click.\n" );
      else
	 g_print( "Single-click.\n" );

      lastClicked = GetTime();
   }
}

Please understand that I've no knowledge of this level of GTK programming,
and I'm only going off of the source that I have seen others post.

In my opinion, I'd rather see GTK+ take the Intuition route of having a
gtk_valid_double_click()-type function, with execution semantics like that
above.  The benefits are that applications can then identify any number of
click-sequences, and quite possibly, more complex gestures.

Thanks for the time.

==========================================================================
      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]