Evento de Paste de Copiar Linux X11

...
if ( event.type == SelectionRequest ) {
  Atom propertyOfRequestorToSet = event.xselectionrequest.property==None ? XA_PRIMARY : event.xselectionrequest.property;

  XSelectionEvent selEvent;
  selEvent.type = SelectionNotify;
  // selEvent.serial = event.xselectionrequest.serial; // I don't know if this is correct
  selEvent.send_event = True;
  selEvent.display = my_display;
  selEvent.requestor = event.xselectionrequest.requestor;
  selEvent.selection = event.xselectionrequest.selection;
  selEvent.target = event.xselectionrequest.target;
  selEvent.property = None;
  selEvent.time = event.xselectionrequest.time;

  if ( event.xselectionrequest.target == XA_TARGETS ) {

    Atom possibleTargets[] = { XA_UTF8_STRING, XA_STRING, XA_TEXT }; // [Note 2]

    // I checked, and this call returns 1
    XChangeProperty( my_display, event.xselectionrequest.requestor,
      propertyOfRequestorToSet,
      XA_ATOM,
      32, // 32 bits actually means long, according to what I've read // [Note 1]
      PropModeReplace,
      (unsigned char *) possibleTargets,
      sizeof(possibleTargets)/sizeof(possibleTargets[0])  // [Note 3]
    );

    selEvent.property = propertyOfRequestorToSet;
  }
  else ... {
  }

  if ( 0 == XSendEvent( my_display, selEvent.requestor, False, 0L, (XEvent*)&selEvent ) ) {
    printf("call to XSendEvent() failed\n");
  }
}
Exuberant Eland