[Xcb] what events need to be handled to show a window
Micah Nordland
mpnordland at gmail.com
Sat Nov 24 02:45:01 PST 2012
I think that only map requests and configure requests should have to be
handled, but apparently, X thinks differently.
I have these two event handlers. I'm writing a window manager, using xcb
and c++11.
void handleMapRequest(xcb_generic_event_t* event)
{
xcb_map_request_event_t* ev = (xcb_map_request_event_t *) event;
xcb_void_cookie_t err = xcb_map_window_checked(global::conf.conn,
ev->window);
if(xcb_request_check(conn, err))
{
std::cout << "we had a problem mapping this window" << std::endl;
}
std::cout << "window " << ev->window << " has been mapped" << std::endl;
}
void handleConfigureRequest(xcb_generic_event_t* event)
{
uint16_t mask=0;
uint32_t values [7];
unsigned short i = 0;
xcb_configure_request_event_t* ev = (xcb_configure_request_event_t *)
event;
if (ev->value_mask & XCB_CONFIG_WINDOW_X)
{
mask |= XCB_CONFIG_WINDOW_X;
values[i++] = ev->x;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_Y)
{
mask |= XCB_CONFIG_WINDOW_Y;
values[i++] = ev->y;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
{
mask |= XCB_CONFIG_WINDOW_WIDTH;
values[i++] = ev->width;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
{
mask |= XCB_CONFIG_WINDOW_HEIGHT;
values[i++] = ev->height;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
{
mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
values[i++] = ev->border_width;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)
{
mask |= XCB_CONFIG_WINDOW_SIBLING;
values[i++] = ev->sibling;
}
if (ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
{
mask |= XCB_CONFIG_WINDOW_STACK_MODE;
values[i++] = ev->stack_mode;
}
xcb_void_cookie_t err = xcb_configure_window_checked(global::conf.conn,
ev->window, mask, values);
if (xcb_request_check(conn, err))
{
std::cout << "there was a problem configuring this window" <<
std::endl;
}
std::cout <<"window " << ev->window << " was configured"<< std::endl;
}
--
Praising my Savior all the day long,
Micah Nordland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20121124/5fd66d47/attachment.html>
More information about the Xcb
mailing list