Re: [gtk-list] Re: wheel support, was: Re: Plans for 1.3/1.4



In message <199903030242.TAA22246@rhuidean.cs.nmsu.edu>you write:
>It seems pretty clear that the right answer is to add a ``scroll''
>event to the X protocol.  But this isn't the Open Group mailing list --
>does anybody know if TOG is considering it?  If not, what's the best
>(temporary) way to work around the lack?

The problem is already solved, because I was wrong in claiming that
a MotionEvent doesn't have a modifier field.

I quote:

typedef struct {
	int type;		/* of event */
	unsigned long serial;	/* # of last request processed by server */
	Bool send_event;	/* true if this came from a SendEvent request */
	Display *display;	/* Display the event was read from */
	Window window;	        /* "event" window reported relative to */
	Window root;	        /* root window that the event occured on */
	Window subwindow;	/* child window */
	Time time;		/* milliseconds */
	int x, y;		/* pointer x, y coordinates in event window */
	int x_root, y_root;	/* coordinates relative to root */
	unsigned int state;	/* key or button mask */
	char is_hint;		/* detail */
	Bool same_screen;	/* same screen flag */
} XMotionEvent;

Notice the presence of the "state" field. Now, all you Trackman FX
users, run xev(1X), and see what it tells you when you click button 4 and
move the marble ball. Notice the value of the state field.

Now, on my Trackman, it seems that I currently have the red button
(button 4) mapped to button 2, but even so, its not hard to write a
toolkit fragment that looks at "state" and does scrolling if either a
particular bit in "state" is set, or even if *any* button bits are set.

Notice that, in retrospect, its obvious that this has to work, because
its the exact mechanism used, or rather, the exact same semantics as,
cutting from a window and resizing under most window managers. Granted
most of them look at ButtonPress then use MotionEvents until the
ButtonRelease, but the state field could be used in the same way.

So, the only problem standing between nice use of the marble series
(or any equivalent trackball) is that XFree86 currently thinks that a
button4 event is actually a button2 one. I'm not sure if this is
because of my particular setup, or a problem with the mouse code in
the server. Pretty workable though, I'd say :)

--p



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]