| 685 | } |
| 686 | |
| 687 | static 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 | |
| 710 | static void HandleSelectionRequest(XEvent* e) { |
| 711 | XEvent reply = { 0 }; |
no test coverage detected