Linux X11 Copy Paste Event

[Solved] Linux X11 Copy Paste Event | Shell - Code Explorer | yomemimo.com
Question : linux x11 copy paste event

Answered by : exuberant-eland-tpi27qgotbmi

...
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"); }
}

Source : https://stackoverflow.com/questions/20828324/copy-paste-of-selections-with-xlib-in-x11-xa-targets-array-of-atoms | Last Update : Wed, 09 Dec 20

Answers related to linux x11 copy paste event

Code Explorer Popular Question For Shell