I think that only map requests and configure requests should have to be handled, but apparently, X thinks differently.<div><br></div><div>I have these two event handlers. I'm writing a window manager, using xcb and c++11.</div>
<div><br></div><div><div>void handleMapRequest(xcb_generic_event_t* event)</div><div>{</div><div> xcb_map_request_event_t* ev = (xcb_map_request_event_t *) event;</div><div> xcb_void_cookie_t err = xcb_map_window_checked(global::conf.conn, ev->window);</div>
<div> if(xcb_request_check(conn, err))</div><div> {</div><div> std::cout << "we had a problem mapping this window" << std::endl;</div><div> }</div><div> std::cout << "window " << ev->window << " has been mapped" << std::endl;</div>
<div>}</div><div><br></div><div>void handleConfigureRequest(xcb_generic_event_t* event)</div><div>{</div><div> uint16_t mask=0;</div><div> uint32_t values [7];</div><div> unsigned short i = 0;</div><div><br></div>
<div> xcb_configure_request_event_t* ev = (xcb_configure_request_event_t *) event;</div><div><br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_X)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_X;</div>
<div> values[i++] = ev->x;</div><div> }</div><div><br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_Y)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_Y;</div><div> values[i++] = ev->y;</div>
<div> }</div><div><br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_WIDTH;</div><div> values[i++] = ev->width;</div><div> }</div>
<div><br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_HEIGHT;</div><div> values[i++] = ev->height;</div><div> }</div><div><br>
</div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;</div><div> values[i++] = ev->border_width;</div><div> }</div>
<div><br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_SIBLING;</div><div> values[i++] = ev->sibling;</div><div> }</div><div>
<br></div><div> if (ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)</div><div> {</div><div> mask |= XCB_CONFIG_WINDOW_STACK_MODE;</div><div> values[i++] = ev->stack_mode;</div><div> }</div>
<div><br></div><div> xcb_void_cookie_t err = xcb_configure_window_checked(global::conf.conn, ev->window, mask, values);</div><div><br></div><div> if (xcb_request_check(conn, err))</div><div> {</div><div> std::cout << "there was a problem configuring this window" << std::endl;</div>
<div> }</div><div><br></div><div> std::cout <<"window " << ev->window << " was configured"<< std::endl;</div><div>}</div><div><br></div>-- <br>Praising my Savior all the day long,<div>
Micah Nordland</div><br>
</div>