Where to get timestamp for selection?

Zhang, Xing Z xing.z.zhang at intel.com
Sun Feb 28 18:08:33 PST 2010


Thanks Jamey and Yann Droneaud

> 
> I think xorg at lists.x.org is the preferred place for this kind of
> question, but that's OK.
[Wing]  I will move to xorg at lists.x.org next time :)

> 
> 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.

[Wing] It is clear now. This also makes me understand why WM (e.g
MatchBox) uses XNextEvent to process events.

> 
> 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. :-)
[Wing] Thank you for pointing out this. I didn't know there is a replacement of Xlib
before.


> 
> > 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