MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / HandleSelectionNotify

Function HandleSelectionNotify

src/Window_X11.c:687–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687static void HandleSelectionNotify(XEvent* e) {
688 Atom prop_type;
689 int prop_format;
690 unsigned long items, after;
691 cc_uint8* data = NULL;
692 Window win = Window_Main.Handle.val;
693
694 if (e->xselection.selection != xa_clipboard) return;
695 if (e->xselection.target != xa_utf8_string) return;
696 if (e->xselection.property != xa_data_sel) return;
697
698 XGetWindowProperty(win_display, win, xa_data_sel, 0, 1024, false, 0,
699 &prop_type, &prop_format, &items, &after, &data);
700 XDeleteProperty(win_display, win, xa_data_sel);
701
702 if (data && items && prop_type == xa_utf8_string) {
703 clipboard_paste_received = true;
704 clipboard_paste_text.length = 0;
705 String_AppendUtf8(&clipboard_paste_text, data, items);
706 }
707 if (data) XFree(data);
708}
709
710static void HandleSelectionRequest(XEvent* e) {
711 XEvent reply = { 0 };

Callers 1

Window_ProcessEventsFunction · 0.85

Calls 1

String_AppendUtf8Function · 0.85

Tested by

no test coverage detected