Where to get timestamp for selection?

Jamey Sharp jamey at minilop.net
Fri Feb 26 08:15:22 PST 2010


I think xorg at lists.x.org is the preferred place for this kind of
question, but that's OK.

On Fri, Feb 26, 2010 at 12:45 AM, Zhang, Xing Z <xing.z.zhang at intel.com> wrote:
> From Xlib manual, Chapter 10.4 “Event Processing Overview”, event mask
> for SelectionRequest is “N.A” as well as other selection events. If I
> want to listen a SelectionRequest event by XWindowEvent, what value I
> should specify in parameter event_mask? NoEventMask?

As far as I can tell from reading WinEvent.c and evtomask.c in
libX11/src/, you can't get selection events with XWindowEvent.

I've been on a quiet crusade to convince people to quit writing X
clients that process events out-of-order anyway. :-) XNextEvent and
XPending are OK, but I believe the other event functions should never
have been in Xlib.

And naturally I think you should be using XCB rather than Xlib for new
code, which would mean you'd have to look at events in-order. :-)

> ICCCM said “Clients attempting to acquire a selection must set the
> time value of the SetSelectionOwner request to the timestamp of the
> event triggering the acquisition attempt, not to CurrentTime”. In my
> simple code, there is no event happen before SetSelectionOwner, how
> can I get the timestamp? I didn’t see a function used to require
> timestamp in Xlib, so I have to trigger an event just for getting
> timestamp?

That's my understanding, yes. I'm not an X protocol expert though.
You're already reading Metacity source, which is probably as good of an
example as anything.

Jamey


More information about the xorg-devel mailing list