linux x11 copy paste event

Solutions on MaxInterview for linux x11 copy paste event by the best coders in the world

showing results for - "linux x11 copy paste event"
Travis
16 Nov 2018
1...
2if ( event.type == SelectionRequest ) {
3  Atom propertyOfRequestorToSet = event.xselectionrequest.property==None ? XA_PRIMARY : event.xselectionrequest.property;
4
5  XSelectionEvent selEvent;
6  selEvent.type = SelectionNotify;
7  // selEvent.serial = event.xselectionrequest.serial; // I don't know if this is correct
8  selEvent.send_event = True;
9  selEvent.display = my_display;
10  selEvent.requestor = event.xselectionrequest.requestor;
11  selEvent.selection = event.xselectionrequest.selection;
12  selEvent.target = event.xselectionrequest.target;
13  selEvent.property = None;
14  selEvent.time = event.xselectionrequest.time;
15
16  if ( event.xselectionrequest.target == XA_TARGETS ) {
17
18    Atom possibleTargets[] = { XA_UTF8_STRING, XA_STRING, XA_TEXT }; // [Note 2]
19
20    // I checked, and this call returns 1
21    XChangeProperty( my_display, event.xselectionrequest.requestor,
22      propertyOfRequestorToSet,
23      XA_ATOM,
24      32, // 32 bits actually means long, according to what I've read // [Note 1]
25      PropModeReplace,
26      (unsigned char *) possibleTargets,
27      sizeof(possibleTargets)/sizeof(possibleTargets[0])  // [Note 3]
28    );
29
30    selEvent.property = propertyOfRequestorToSet;
31  }
32  else ... {
33  }
34
35  if ( 0 == XSendEvent( my_display, selEvent.requestor, False, 0L, (XEvent*)&selEvent ) ) {
36    printf("call to XSendEvent() failed\n");
37  }
38}
39
similar questions
queries leading to this page
linux x11 copy paste event