[comp.windows.x] bug/misfeature with

sherouse@godot.radonc.unc.edu (George W. Sherouse) (09/28/87)

I would very much like to select motion events on Button2-down in such
a away that I receive a sparse stream of "sorta-latest" positions
rather than a very fine-grained stream of barely-perceptible motions.
In X10 this compression was semi-automatic - if you wanted to see all
events you had to say so with XExpandEvents.

[In the following please excuse the many waffle words but the document
is abundantly unhelpful regarding these details.]

It appears that the X11 routine XGetMotionEvents was intended to
provide this functionality by allowing me to skim all the MotionNotify
events off the queue whenever I needed to and compress them myself.
It further appears that PointerMotionHintMask is intended to partially
address this as well but by my reading does not guarantee that you
will receive an event reflecting the latest stop position unless you
release the button.

Well,

1.  I have been unable to bet XGetMotionEvents to return any more than
0 events under any circumstances.  I have twiddled *everything*.
What's the magic?  BTW, where is the meaning of the Time structure
defined?  Yes, I know it is milliseconds, but milliseconds since Jim
Gettys' birth or what?  I have been setting 'start' to the time of the
first motion event I see and adding 1000 to that for 'stop'.  I would
expect that to return all events within one second after the first
event.  I have also tried numerous other fruitless variations.

2.  I have been unable to generate a motion event with state ==
'NotifyHint'.

3.  Is PointerMotionHintMask intended to be a modifier of the other
MotionMasks or a peer?  That is, am I supposed to get hints about
motion with button2 pressed or ((hints about motion) && (button2
pressed motion events)) if I specify (PointerMotionHintMask |
Button2MotionMask)?

4.  It appears that (PointerMotionMask | PointerMotionHintMask)
generates events with much coarser granularity (perhaps compressed?)
than does PointerMotionMask alone or Button2MotionMask alone or
(Button2MotionMask | PointerMotionHintMask).

I apologize if there is something "well documented" which I am missing
but god knows, I've tried...  :-)  Thanks for any insight.

Configuration: clients running on a VAX-11/750 under BSD 4.3, server
running on an 8-plane VAXstation-II/GPX under Ultrix 1.2.

- George

oj@apollo.uucp (Ellis Oliver Jones) (09/29/87)

In article <873@godot.radonc.unc.edu> sherouse@godot.UUCP (George W. Sherouse) writes:
>I would like to select motion events such that I receive a 
>sparse stream of "sorta-latest" positions...
>
>It appears that the X11 routine XGetMotionEvents was intended to
>provide this functionality by allowing me to skim all the MotionNotify
>events off the queue whenever I needed to and compress them myself.

Not exactly.  XGetMotionEvents is a request. In RWS's protocol document, it
is described as follows
 "Returns all events in the motion history buffer that fall between ..."
Note that this is quite different from queue manipulation; for one thing
it supposedly cuts *way* down on the number of events the server sends you.

> [you may not] receive an event reflecting the latest stop position unless you
>release the button...

True.  But have you tried specifying a Stop-time
of "CurrentTime?"  That should give you
up-to-the-instant motion history
...provided you get any at all...keep reading...

>1.  I have been unable to get XGetMotionEvents to return any more than
>0 events under any circumstances. 

Not all servers have a motion history buffer.  Check the int field

         display->motion_buffer

If it's zero no amount of twiddling in your client program is going
to help.  It's a good idea, in a portable client,
to check this field before attempting any kind of motion history stuff.
(BTW, the spec says that servers "may" have a motion history buffer).
 The server source I have around here--still beta, unfortunately--
 has the MOTION_BUFFER_SIZE parameter set to zero (in the init.c routine)
 for just about all devices..  You may be out of luck.

> What's the meaning of the Time structure ?

It's the low-order bits of the "system time" in milliseconds (since the
system time epoch).

>3.  Is PointerMotionHintMask intended to be a modifier of the other
>MotionMasks or a peer?

Modifier, the way I read it.

>4.  It appears that (PointerMotionMask | PointerMotionHintMask)
>generates events with much coarser granularity (perhaps compressed?)
>than does PointerMotionMask alone or Button2MotionMask alone or
>(Button2MotionMask | PointerMotionHintMask).

Are these events motion hints?  
You identify hints by looking at the fields event->xmotion.is_hint, not
at the state field--the state field records the positions of the mouse
buttons and modifier keys just before the event.
is_hint will have either NotifyNormal or NotifyHint for a value.

It looks like you're getting reasonable motion hints.  Trouble is, there's
no way to get the intervening motion history unless your server
has a motion history buffer.
The protocol document says
"If PointerMotionHint is selected, the server is free to send only one
	MotionNotify event (with detail Hint) to the client for the event
	window, until either the key or button state changes, or the pointer
	leaves the event window, or the client issues a QueryPointer or
	GetMotionEvents request."