diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index fc76161018..632cdcb055 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -377,6 +377,7 @@ x11GraphicsPipe(const std::string &display) : // Get some X atom numbers. _wm_delete_window = XInternAtom(_display, "WM_DELETE_WINDOW", false); _net_wm_pid = XInternAtom(_display, "_NET_WM_PID", false); + _net_wm_ping = XInternAtom(_display, "_NET_WM_PING", false); _net_wm_window_type = XInternAtom(_display, "_NET_WM_WINDOW_TYPE", false); _net_wm_window_type_splash = XInternAtom(_display, "_NET_WM_WINDOW_TYPE_SPLASH", false); _net_wm_window_type_fullscreen = XInternAtom(_display, "_NET_WM_WINDOW_TYPE_FULLSCREEN", false); diff --git a/panda/src/x11display/x11GraphicsPipe.h b/panda/src/x11display/x11GraphicsPipe.h index b363259f4e..d46218077e 100644 --- a/panda/src/x11display/x11GraphicsPipe.h +++ b/panda/src/x11display/x11GraphicsPipe.h @@ -167,6 +167,7 @@ public: // Atom specifications. Atom _wm_delete_window; Atom _net_wm_pid; + Atom _net_wm_ping; Atom _net_wm_window_type; Atom _net_wm_window_type_splash; Atom _net_wm_window_type_fullscreen; diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 4600af36a7..0595bc72d6 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -120,6 +120,7 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _raw_mouse_enabled = false; _override_redirect = False; _wm_delete_window = x11_pipe->_wm_delete_window; + _net_wm_ping = x11_pipe->_net_wm_ping; PT(GraphicsWindowInputDevice) device = GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse"); add_input_device(device); @@ -513,6 +514,12 @@ process_events() { system_changed_properties(properties); } } + else if ((Atom)(event.xclient.data.l[0]) == _net_wm_ping && + event.xclient.window == _xwindow) { + DCAST_INTO_V(x11_pipe, _pipe); + event.xclient.window = x11_pipe->get_root(); + XSendEvent(_display, x11_pipe->get_root(), False, SubstructureRedirectMask | SubstructureNotifyMask, &event); + } break; case DestroyNotify: @@ -1480,9 +1487,6 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { // mapped. To do this, we need to send a client message to the root // window for each change. - x11GraphicsPipe *x11_pipe; - DCAST_INTO_V(x11_pipe, _pipe); - for (int i = 0; i < next_set_data; ++i) { XClientMessageEvent event; memset(&event, 0, sizeof(event)); @@ -1519,6 +1523,7 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { // X server if the user requests a window close. Atom protocols[] = { _wm_delete_window, + _net_wm_ping, }; XSetWMProtocols(_display, _xwindow, protocols, diff --git a/panda/src/x11display/x11GraphicsWindow.h b/panda/src/x11display/x11GraphicsWindow.h index 9b637b58f1..49b878a904 100644 --- a/panda/src/x11display/x11GraphicsWindow.h +++ b/panda/src/x11display/x11GraphicsWindow.h @@ -108,6 +108,7 @@ protected: bool _raw_mouse_enabled; Bool _override_redirect; Atom _wm_delete_window; + Atom _net_wm_ping; x11GraphicsPipe::pfn_XRRGetScreenInfo _XRRGetScreenInfo; x11GraphicsPipe::pfn_XRRSetScreenConfig _XRRSetScreenConfig;