[comp.windows.x] What goes down, must come up!

ken@hpcvlo.HP.COM (Ken Bronstein) (06/24/87)

I have run into a semantic problem with the X10 behavior.  I would
appreciate any helpful comments regarding this issue.

If an application wants to see ONLY button release events, and if that
application does XSelectInput() on ButtonRelease and NOT ButtonPress,
then the application may not ever see the button release. To ensure
that the application will see the button release it MUST perform
XSelectInput() on both ButtonPress and ButtonRelease, and then perhaps
throw away the Button Presses.

Here's why you may never see the Button Release.  Imagine a window
manager that reads button events off the RootWindow.  That window
manager may choose to use either XGrabButton or XSelectInput on events
in the RootWindow.  If the window manager does XSelectInput() for both
ButtonPress and ButtonRelease on the root window,  then when a button
press is sent to the window manager, the X server performs an implicit
GrabMouse until the corresponding ButtonRelease.

Hence with the above scenario, a window manager looking for
ButtonPresses and Button Releases on the RootWindow, and an
application looking for only ButtonReleases,  then the application
will never see the ButtonRelease.  the window manager will always bet
the Button Down and do an implicit GrabMouse.

The semantic problem is that the application thinks it deserves first
chance at the ButtonRelease in its window.  Perhaps if the ButtonDown
occurs in the window looking for the ButtonRelease then the server
should not give the down event and GrabMouse to the client reading
events from the root window.  That is, before the X Server gives the
ButtonPress to a client, and a subsequent implicit GrabMouse, it
should check if there is a window interested in the corresponding
button release that has precedence over the release event.

Note also that the mouse may move from window to window between the
press and release events.

Are we dealing with the same semantics for Xv11?

Also I am not terribly upset. I just never realized the implications
of calling XSelectInput(... | ButtonRelease & ~ButtonPress ... )

		-Ken Bronstein
		 hp-pcd!ken
		 Hewlett-Packard;  Corvallis, Oregon