| 194 | } |
| 195 | |
| 196 | void EmbeddedProcess::embed_process(OS::ProcessID p_pid) { |
| 197 | if (!window) { |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | ERR_FAIL_COND_MSG(!DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_WINDOW_EMBEDDING), "Embedded process not supported by this display server."); |
| 202 | |
| 203 | if (current_process_id != 0) { |
| 204 | // Stop embedding the last process. |
| 205 | OS::get_singleton()->kill(current_process_id); |
| 206 | } |
| 207 | |
| 208 | reset(); |
| 209 | |
| 210 | current_process_id = p_pid; |
| 211 | start_embedding_time = OS::get_singleton()->get_ticks_msec(); |
| 212 | embedding_grab_focus = has_focus(); |
| 213 | timer_update_embedded_process->start(); |
| 214 | set_process(true); |
| 215 | set_notify_transform(true); |
| 216 | |
| 217 | // Attempt to embed the process, but if it has just started and the window is not ready yet, |
| 218 | // we will retry in this case. |
| 219 | _try_embed_process(); |
| 220 | } |
| 221 | |
| 222 | void EmbeddedProcess::reset() { |
| 223 | if (current_process_id != 0 && embedding_completed) { |
no test coverage detected