Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME - Motif

This is a discussion on Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME - Motif ; Hei, I compile the following exampe It is taken from the Motif programming manual. For some reason double click are not recognized. Double click is recognized if I hold down the Shift button or the right mouse button while double ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME

  1. Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME

    Hei, I compile the following exampe

    It is taken from the Motif programming manual.
    For some reason double click are not recognized.

    Double click is recognized if I hold down the Shift button
    or the right mouse button while double clicking.

    I am useing RedHat 8 out of the boxs. No upgrads what so
    ever.

    > uname -arm

    Linux heroin.localdomain 2.4.18-14 #1 Wed Sep 4 12:13:11 EDT 2002 i686
    athlon i386 GNU/Linux
    XFree86-4.2.0-72
    openmotif-2.2.2-12
    gnome 2.0


    It looks like he callback structure does not count to more than 1
    cbs->click_count

    The same code works fine using KDE.


    Best regards,
    Birgir Sigurjonsson,
    Roxar AS, Oslo.


    /* multi_click.c -- demonstrate handling multiple PushButton clicks.
    ** First, obtain the time interval of what constitutes a multiple
    ** button click from the display and pass this as the client_data
    ** for the button_click() callback function. In the callback, single
    ** button clicks set a timer to expire on that interval and call the
    ** function process_clicks(). Double clicks remove the timer and
    ** just call process_clicks() directly.
    */

    #include
    XtAppContext app;

    main (int argc, char *argv[])
    {
    Widget toplevel, button;
    void button_click(Widget, XtPointer, XtPointer);
    XmString btn_text;
    int interval;
    Arg args[2];

    XtSetLanguageProc (NULL, NULL, NULL);
    toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc,
    argv, NULL,
    sessionShellWidgetClass, NULL);

    /* get how long for a double click */
    interval = XtGetMultiClickTime (XtDisplay (toplevel));
    printf ("Interval = %d\n", interval);

    btn_text = XmStringCreateLocalized ("Push Here");
    XtSetArg (args[0], XmNlabelString, btn_text);
    button = XmCreatePushButton (toplevel, "button", args, 1);
    XtManageChild (button);
    XmStringFree (btn_text);
    XtAddCallback (button, XmNactivateCallback, button_click,
    (XtPointer) interval);
    XtRealizeWidget (toplevel);
    XtAppMainLoop (app);
    }


    /* Process button clicks. Single clicks set a timer, double clicks
    ** remove the timer, and extended clicks are ignored.
    */
    void button_click (Widget w, XtPointer client_data, XtPointer
    call_data)
    {
    static XtIntervalId id;
    void process_clicks(XtPointer, XtIntervalId *);
    int interval = (int) client_data;
    XmPushButtonCallbackStruct *cbs =
    (XmPushButtonCallbackStruct *) call_data;

    if (cbs->click_count == 1)
    id = XtAppAddTimeOut (app, (unsigned long) interval,
    process_clicks, (XtPointer) False);
    else if (cbs->click_count == 2) {
    XtRemoveTimeOut (id);
    process_clicks ((XtPointer) True, (XtIntervalId *) 0);
    }
    }

    /* This function won't be called until we've established whether
    ** or not a single or a double click has occurred.
    */
    void process_clicks (XtPointer client_data, XtIntervalId *id)
    {
    int double_click = (int) client_data;

    if (double_click)
    puts ("Double click");
    else
    puts ("Single click");
    }

  2. Re: Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME

    The double-click not being recognized is a problem in the metacity window
    manager of GNOME 2.0.

    They consider it a "feature". As far I know the only workaround is to modify
    your code to look for two single clicks within the timer span.

    -Pete Z.

    In article <4af4fce2.0406200237.5b36ba4d@posting.google.com> birgir.sigurjonsson@roxar.com (Birgir Sigurjonsson) writes:
    >Hei, I compile the following exampe
    >
    >It is taken from the Motif programming manual.
    >For some reason double click are not recognized.
    >
    >Double click is recognized if I hold down the Shift button
    >or the right mouse button while double clicking.
    >
    >I am useing RedHat 8 out of the boxs. No upgrads what so
    >ever.
    >
    >> uname -arm

    >Linux heroin.localdomain 2.4.18-14 #1 Wed Sep 4 12:13:11 EDT 2002 i686
    >athlon i386 GNU/Linux
    >XFree86-4.2.0-72
    >openmotif-2.2.2-12
    >gnome 2.0
    >
    >
    >It looks like he callback structure does not count to more than 1
    >cbs->click_count
    >
    >The same code works fine using KDE.
    >
    >
    >Best regards,
    >Birgir Sigurjonsson,
    >Roxar AS, Oslo.
    >
    >
    >/* multi_click.c -- demonstrate handling multiple PushButton clicks.
    >** First, obtain the time interval of what constitutes a multiple
    >** button click from the display and pass this as the client_data
    >** for the button_click() callback function. In the callback, single
    >** button clicks set a timer to expire on that interval and call the
    >** function process_clicks(). Double clicks remove the timer and
    >** just call process_clicks() directly.
    >*/
    >
    >#include
    >XtAppContext app;
    >
    >main (int argc, char *argv[])
    >{
    > Widget toplevel, button;
    > void button_click(Widget, XtPointer, XtPointer);
    > XmString btn_text;
    > int interval;
    > Arg args[2];
    >
    > XtSetLanguageProc (NULL, NULL, NULL);
    > toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc,
    >argv, NULL,
    > sessionShellWidgetClass, NULL);
    >
    > /* get how long for a double click */
    > interval = XtGetMultiClickTime (XtDisplay (toplevel));
    > printf ("Interval = %d\n", interval);
    >
    > btn_text = XmStringCreateLocalized ("Push Here");
    > XtSetArg (args[0], XmNlabelString, btn_text);
    > button = XmCreatePushButton (toplevel, "button", args, 1);
    > XtManageChild (button);
    > XmStringFree (btn_text);
    > XtAddCallback (button, XmNactivateCallback, button_click,
    > (XtPointer) interval);
    > XtRealizeWidget (toplevel);
    > XtAppMainLoop (app);
    >}
    >
    >
    >/* Process button clicks. Single clicks set a timer, double clicks
    >** remove the timer, and extended clicks are ignored.
    >*/
    >void button_click (Widget w, XtPointer client_data, XtPointer
    >call_data)
    >{
    > static XtIntervalId id;
    > void process_clicks(XtPointer, XtIntervalId *);
    > int interval = (int) client_data;
    > XmPushButtonCallbackStruct *cbs =
    > (XmPushButtonCallbackStruct *) call_data;
    >
    > if (cbs->click_count == 1)
    > id = XtAppAddTimeOut (app, (unsigned long) interval,
    > process_clicks, (XtPointer) False);
    > else if (cbs->click_count == 2) {
    > XtRemoveTimeOut (id);
    > process_clicks ((XtPointer) True, (XtIntervalId *) 0);
    > }
    >}
    >
    >/* This function won't be called until we've established whether
    >** or not a single or a double click has occurred.
    >*/
    >void process_clicks (XtPointer client_data, XtIntervalId *id)
    >{
    > int double_click = (int) client_data;
    >
    > if (double_click)
    > puts ("Double click");
    > else
    > puts ("Single click");
    >}




  3. Re: Probems with double-click in OpenMotif 2.2, XFree86, RedHat8 and GNOME

    Hei thanks, there is something strange going on somewhere.

    I have now a code that will recognise the double clicks in
    GNOME, that is done by using translaltions, but the call
    XtOverwriteTranslation cannot be used unless I first delete the
    default translation to the widget.

    Birgir.


    EX:
    //================================================== ==========================
    // AUTHOR : Birgir Sigurjonsson - Roxar Software Solutions AS
    // DATE : 21/6/2004
    // DESCRIPTION : Implementation of class
    // HISTORY : birgirs - 21/6/2004: Created.
    //----------------------------------------------------------------------------


    #include
    XtAppContext app;

    main (int argc, char *argv[])
    {
    Widget toplevel, l1, l2;
    void DClick(Widget, XEvent *, String *, Cardinal *);
    void SClick(Widget, XEvent *, String *, Cardinal *);
    XmString btn_text;
    int interval;
    Arg args[2];
    static XtActionsRec actions[2];
    static char newTrans[] = ",,,: DClick()
    \n\
    ,: SClick()";

    XtTranslations transTable;

    XtSetLanguageProc (NULL, NULL, NULL);
    toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc, argv, NULL,
    sessionShellWidgetClass, NULL);

    actions[0].string = "DClick";
    actions[0].proc = DClick;
    actions[1].string = "SClick";
    actions[1].proc = SClick;
    XtAppAddActions (app, actions, XtNumber(actions));

    transTable = XtParseTranslationTable("");
    XtSetArg (args[0], XmNtranslations, transTable);

    btn_text = XmStringCreateLocalized ("Click me Click");
    XtSetArg (args[1], XmNlabelString, btn_text);
    l1 = XmCreateLabel (toplevel, "one_click", args, 2);

    transTable = XtParseTranslationTable(newTrans);
    XtOverrideTranslations(l1, transTable);

    XtManageChild (l1);
    XmStringFree (btn_text);
    XtRealizeWidget (toplevel);
    XtAppMainLoop (app);
    }

    void DClick(Widget widget, XEvent *event, String *args, Cardinal *num_args) {
    printf("D-Click\n");
    }

    void SClick(Widget widget, XEvent *event, String *args, Cardinal *num_args) {
    printf("S-Click\n");
    }


    pxhxz@cadence.com (Pete nospam Zakel) wrote in message news:<40d7245b$1@news.cadence.com>...
    > The double-click not being recognized is a problem in the metacity window
    > manager of GNOME 2.0.
    >
    > They consider it a "feature". As far I know the only workaround is to modify
    > your code to look for two single clicks within the timer span.
    >
    > -Pete Z.
    >
    > In article <4af4fce2.0406200237.5b36ba4d@posting.google.com> birgir.sigurjonsson@roxar.com (Birgir Sigurjonsson) writes:
    > >Hei, I compile the following exampe
    > >
    > >It is taken from the Motif programming manual.
    > >For some reason double click are not recognized.
    > >
    > >Double click is recognized if I hold down the Shift button
    > >or the right mouse button while double clicking.
    > >
    > >I am useing RedHat 8 out of the boxs. No upgrads what so
    > >ever.
    > >
    > >> uname -arm

    > >Linux heroin.localdomain 2.4.18-14 #1 Wed Sep 4 12:13:11 EDT 2002 i686
    > >athlon i386 GNU/Linux
    > >XFree86-4.2.0-72
    > >openmotif-2.2.2-12
    > >gnome 2.0
    > >
    > >
    > >It looks like he callback structure does not count to more than 1
    > >cbs->click_count
    > >
    > >The same code works fine using KDE.
    > >
    > >
    > >Best regards,
    > >Birgir Sigurjonsson,
    > >Roxar AS, Oslo.
    > >
    > >
    > >/* multi_click.c -- demonstrate handling multiple PushButton clicks.
    > >** First, obtain the time interval of what constitutes a multiple
    > >** button click from the display and pass this as the client_data
    > >** for the button_click() callback function. In the callback, single
    > >** button clicks set a timer to expire on that interval and call the
    > >** function process_clicks(). Double clicks remove the timer and
    > >** just call process_clicks() directly.
    > >*/
    > >
    > >#include
    > >XtAppContext app;
    > >
    > >main (int argc, char *argv[])
    > >{
    > > Widget toplevel, button;
    > > void button_click(Widget, XtPointer, XtPointer);
    > > XmString btn_text;
    > > int interval;
    > > Arg args[2];
    > >
    > > XtSetLanguageProc (NULL, NULL, NULL);
    > > toplevel = XtVaOpenApplication (&app, "Demos", NULL, 0, &argc,
    > >argv, NULL,
    > > sessionShellWidgetClass, NULL);
    > >
    > > /* get how long for a double click */
    > > interval = XtGetMultiClickTime (XtDisplay (toplevel));
    > > printf ("Interval = %d\n", interval);
    > >
    > > btn_text = XmStringCreateLocalized ("Push Here");
    > > XtSetArg (args[0], XmNlabelString, btn_text);
    > > button = XmCreatePushButton (toplevel, "button", args, 1);
    > > XtManageChild (button);
    > > XmStringFree (btn_text);
    > > XtAddCallback (button, XmNactivateCallback, button_click,
    > > (XtPointer) interval);
    > > XtRealizeWidget (toplevel);
    > > XtAppMainLoop (app);
    > >}
    > >
    > >
    > >/* Process button clicks. Single clicks set a timer, double clicks
    > >** remove the timer, and extended clicks are ignored.
    > >*/
    > >void button_click (Widget w, XtPointer client_data, XtPointer
    > >call_data)
    > >{
    > > static XtIntervalId id;
    > > void process_clicks(XtPointer, XtIntervalId *);
    > > int interval = (int) client_data;
    > > XmPushButtonCallbackStruct *cbs =
    > > (XmPushButtonCallbackStruct *) call_data;
    > >
    > > if (cbs->click_count == 1)
    > > id = XtAppAddTimeOut (app, (unsigned long) interval,
    > > process_clicks, (XtPointer) False);
    > > else if (cbs->click_count == 2) {
    > > XtRemoveTimeOut (id);
    > > process_clicks ((XtPointer) True, (XtIntervalId *) 0);
    > > }
    > >}
    > >
    > >/* This function won't be called until we've established whether
    > >** or not a single or a double click has occurred.
    > >*/
    > >void process_clicks (XtPointer client_data, XtIntervalId *id)
    > >{
    > > int double_click = (int) client_data;
    > >
    > > if (double_click)
    > > puts ("Double click");
    > > else
    > > puts ("Single click");
    > >}


+ Reply to Thread