Re: XForms: Q : losing mouse events && desktop transparencie

Steve Lamont (
Sun, 4 Jan 98 12:26:57 PST

To subscribers of the xforms list from (Steve Lamont) :

> 1. I am trying to 'drag' an object in a form by catching FL_MOTION and
> FL_MOUSE in a posthandler. The problem is that when the posthandler moves
> the object, no more FL_MOUSE events are generated until the mouse is
> released and pressed again. Is there some workaround for this problem ?

Hm. I just crufted up a quick test and it worked fine for me. How
are you handling the object redraw? Here's what I hacked up...

int drag_me_handler( FL_OBJECT *obj, int event,
FL_Coord mx, FL_Coord my,
int key, void *raw_event )


static int p;
static int q;
static int x;
static int y;

if ( event == FL_PUSH ) {

* Mark the point from which we are to move.

p = mx;
q = my;
x = obj->x;
y = obj->y;

} else if ( event == FL_MOUSE ) {

obj->x = x + ( mx - p );
obj->y = y + ( my - q );

* Redraw the whole form to avoid leaving ortlets around.
* Freeze to avoid flicker of stationary objects.

fl_freeze_form( obj->form );
fl_redraw_form( obj->form );
fl_unfreeze_form( obj->form );


return 0;


int main(int argc, char *argv[])
FD_try *fd_try;

fl_initialize(&argc, argv, 0, 0, 0);
fd_try = create_form_try();

fl_set_object_posthandler( fd_try->drag_me, drag_me_handler );

return 0;


> 2. Is there a way of creating forms that are transparent on the desktop ?
> If I create a form with FL_NO_BOX and FL_NOBORDER, it is transparant, but
> when moving it around it will 'grab' and take the contents of what was
> underneath it with it.

I don't know if this would work or not but you might try catching the
ConfigureNotify event and forcing a redraw of the form with
fl_redraw_form() whenever the form has been moved (refer to the Dirty
Tricks section of the manual for details on how to catch form events).

The other thing which occurs to me is some sort of Pixmap shape_mask
trickery -- refer to your favorite Xlib manual for a discussion of
XSetClipMask() -- though the details would probably be pretty ugly.


To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: