Re: XForms: Drawing in the browser prehandler (bug?)

From: Angus Leeming (angus.leeming@btopenworld.com)
Date: Mon Apr 07 2003 - 19:47:20 EDT

  • Next message: Serge B Bromow: "Re: XForms: uploading xforms-1.0.tar.gz to savannah.nongnu.org?"

    # To subscribers of the xforms list from Angus Leeming <angus.leeming@btopenworld.com> :

    On Monday 07 April 2003 9:53 pm, jac@casurgica.com wrote:
    > fl_drw_box(obj->boxtype, obj->x, obj->y, obj->w, obj->h, obj->col1,
    > obj->bw);

    > fprintf(stderr, "prehandler(%p, %i, %i, %i, %i, %p): %i,%i %i,%i\n",
    > obj, event, x, y, k, raw_event, obj->x, obj->y, obj->w, obj->h);

    Note that "x" and "y" above are the mouse coordinates. Might be better to name
    them as such...

    > What's the deal with this? Why is it drawing in the upper left corner of
    > the form when the browser is exposed, and why is the prehandler called
    > twice (with identical parameters) with FL_DRAW when this happens? The
    > first call of the two is the one that draws wrong.

    Note that the browser is a little odd in that it has an explicit call to its
    prehandler. It is the only widget to do this:

    $ grep prehandle *.c
    browser.c: return br->prehandle ? br->prehandle(br, ev, mx, my, key, xev) :
    0;
    browser.c: fl_set_object_prehandler(sp->tb, tbpre);
    input.c: return (ext && ext->prehandle) ? ext->prehandle(ext, ev, mx, my,
    key, xev) : 0;
    input.c: fl_set_object_prehandler(ob, input_pre);
    objects.c: if (obj->prehandle)
    objects.c: int st = obj->prehandle(obj, event, mx, my, key, xev);
    objects.c:fl_set_object_prehandler(FL_OBJECT * ob, FL_HANDLEPTR phandler)
    objects.c: FL_HANDLEPTR oldh = ob->prehandle;
    objects.c: ob->prehandle = phandler;

    The offending code is:
    static int
    tbpre(FL_OBJECT * ob, int ev, FL_Coord mx, FL_Coord my,
          int key, void *xev) {
        FL_OBJECT *br = GetPSpec(ob)->br;
        return br->prehandle ? br->prehandle(br, ev, mx, my, key, xev) : 0;
    }

    Put simply, the browser is a "composite" widget made up of other, simpler
    ones. The code above is the prehandler of the toolbar sub-part. Is this the
    thing that is causing you grief?

    As for "is it a bug?" Probably ;-)

    HTH and I'm now off to bed,
    Angus
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    Development: http://savannah.nongnu.org/files/?group=xforms



    This archive was generated by hypermail 2b29 : Mon Apr 07 2003 - 18:44:42 EDT