int XConvertSelection(Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time)
| 1108 | |
| 1109 | // int XConvertSelection(Display* display, Atom selection, Atom target, Atom property, Window requestor, Time time) |
| 1110 | static void x11_ConvertSelection(CPU* cpu) { |
| 1111 | KMemory* memory = cpu->memory; |
| 1112 | XServer* server = XServer::getServer(); |
| 1113 | U32 selection = ARG2; |
| 1114 | U32 target = ARG3; |
| 1115 | U32 property = ARG4; |
| 1116 | U32 requestor = ARG5; |
| 1117 | DisplayDataPtr data = server->getDisplayDataByAddressOfDisplay(memory, ARG1); |
| 1118 | BString targetName; |
| 1119 | server->getAtom(target, targetName); |
| 1120 | BString propertyName; |
| 1121 | server->getAtom(property, propertyName); |
| 1122 | XWindowPtr wnd = server->getWindow(requestor); |
| 1123 | |
| 1124 | if (!wnd) { |
| 1125 | EAX = BadWindow; |
| 1126 | return; |
| 1127 | } |
| 1128 | if (selection == CLIPBOARD) { |
| 1129 | if (target == TARGETS) { |
| 1130 | U32 atom = UTF8_STRING; |
| 1131 | wnd->setProperty(property, XA_ATOM, 32, 4, (const U8*)&atom); |
| 1132 | } else if (target == UTF8_STRING) { |
| 1133 | BString text = KNativeSystem::getScreen()->clipboardGetText(); |
| 1134 | server->sdlLastSelection = text; |
| 1135 | wnd->setProperty(property, UTF8_STRING, 8, text.length(), (const U8*)text.c_str()); |
| 1136 | } else { |
| 1137 | property = None; |
| 1138 | } |
| 1139 | } else { |
| 1140 | property = None; |
| 1141 | } |
| 1142 | XEvent event; |
| 1143 | event.type = SelectionNotify; |
| 1144 | event.xselection.display = ARG1; |
| 1145 | event.xselection.requestor = requestor; |
| 1146 | event.xselection.selection = selection; |
| 1147 | event.xselection.target = target; |
| 1148 | event.xselection.property = property; |
| 1149 | event.xselection.serial = data->getNextEventSerial(); |
| 1150 | event.xselection.time = server->getEventTime(); |
| 1151 | event.xselection.send_event = False; |
| 1152 | data->putEvent(event); |
| 1153 | EAX = Success; |
| 1154 | } |
| 1155 | |
| 1156 | // Bool XCheckTypedWindowEvent(Display* display, Window w, int event_type, XEvent* event_return) { |
| 1157 | static void x11_CheckTypedWindowEvent(CPU* cpu) { |
nothing calls this directly
no test coverage detected