[Xcb] Responding to _NET_WM_PING

Nicholas Allen nick.allen at onlinehome.de
Mon Mar 22 09:13:27 PDT 2010


Hi,

One bug that seems to have appeared since our conversion from xlib to
xcb is that we no longer respond correctly to NET_WM_PING message from
the window manager. This means that our window is greyed out and appears
as though it's hung even though it is working correctly.

I'm sure this used to work in our xlib implementation (but maybe I was
using a different window manager that didn't care about it then).

I've used the xtrace command to see what's going on. What I see is this:

000:>:0097: Event (generated) ClientMessage(33) format=0x20
window=0x06600013 type=0xf5("WM_PROTOCOLS")
data=0x02,0x01,0x00,0x00,0xd3,0x05,0x00,0x00,0x13,0x00,0x60,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;
Got ping
000:<:0098: 44: Request(25): SendEvent propagate=false(0x00)
destination=0x0000013c event-mask=StructureNotify,SubstructureRedirect
(generated) unknown code 80
000:>:98:Error 2=Value: major=0, minor=25, bad=208

The way we send the ping back is just to change the window field of the
client message:

case XCB_CLIENT_MESSAGE:
      {
         xcb_client_message_event_t* clientEvent =
(xcb_client_message_event_t*)event;

         if (clientEvent->type == displayData->WM_PROTOCOLS_ATOM)
         {
            if (clientEvent->data.data32[0] ==
displayData->WM_DELETE_WINDOW_ATOM)
            {
               handleCloseWindowRequestEvent(
                     env,
                     getTopLevelWindowHandle(env, javaDisplay,
clientEvent->window));
            }
            else if (clientEvent->data.data32[0] ==
displayData->NET_WM_PING_ATOM)
            {
               printf("Got ping\n");
               clientEvent->response_type = XCB_CLIENT_MESSAGE;
               clientEvent->window = screen->root;
               xcb_send_event(connection, false, screen->root,
XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char*)&clientEvent);
            }
         }

It seems like the type of the message is incorrect but I've even
explicitly set it to XCB_CLIENT_MESSAGE. Am I supposed to copy the event
first before sending it back? The documentation implies I should not do
this
(http://standards.freedesktop.org/wm-spec/latest/ar01s06.html#id2569888).

Thanks in advance for any help.

Nick


More information about the Xcb mailing list