Fix NOTIFICATION_WM_CLOSE_REQUEST in Embedded Floating Window
This commit is contained in:
parent
a7146ef807
commit
9eed43d429
6 changed files with 53 additions and 15 deletions
|
|
@ -5849,6 +5849,24 @@ Error DisplayServerX11::remove_embedded_process(OS::ProcessID p_pid) {
|
|||
}
|
||||
|
||||
EmbeddedProcessData *ep = embedded_processes.get(p_pid);
|
||||
|
||||
// Handle bad window errors silently because just in case the embedded window was closed.
|
||||
int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&bad_window_error_handler);
|
||||
|
||||
// Send the message to gracefully close the window.
|
||||
XEvent ev;
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
ev.xclient.type = ClientMessage;
|
||||
ev.xclient.window = ep->process_window;
|
||||
ev.xclient.message_type = XInternAtom(x11_display, "WM_PROTOCOLS", True);
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = XInternAtom(x11_display, "WM_DELETE_WINDOW", False);
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(x11_display, ep->process_window, False, NoEventMask, &ev);
|
||||
|
||||
// Restore default error handler.
|
||||
XSetErrorHandler(oldHandler);
|
||||
|
||||
embedded_processes.erase(p_pid);
|
||||
memdelete(ep);
|
||||
|
||||
|
|
|
|||
|
|
@ -2975,6 +2975,9 @@ Error DisplayServerWindows::remove_embedded_process(OS::ProcessID p_pid) {
|
|||
|
||||
EmbeddedProcessData *ep = embedded_processes.get(p_pid);
|
||||
|
||||
// Send a close message to gracefully close the process.
|
||||
PostMessage(ep->window_handle, WM_CLOSE, 0, 0);
|
||||
|
||||
// This is a workaround to ensure the parent window correctly regains focus after the
|
||||
// embedded window is closed. When the embedded window is closed while it has focus,
|
||||
// the parent window (the editor) does not become active. It appears focused but is not truly activated.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue