/* Get XCB_EVENT_MASK_BUTTON_PRESS event */ xcb_generic_event_t *event; while ((event = xcb_wait_for_event (connection))) { switch (event ->response_type & ~0x80) { case XCB_EVENT_MASK_BUTTON_PRESS: printf("Button pressed!\n"); break; default: /* Unknown event type */ printf...
xcb_grab_button(conn,0, scr->root, XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, scr->root, XCB_NONE,3, MOD);#endifmask = XCB_CW_EVENT_MASK; values[0] = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY; xcb_change_window_attributes_check...
vals[1] =1;/* override_redirect */vals[2] = XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_EXPOSURE; vals[3] = nil_.cursor[CURSOR_NORMAL]; cookie = xcb_create_window_checked(nil_.con, nil_.scr->root_depth, bar_.win, nil_.scr->root, bar_.x, bar_.y, bar_.w, bar_.h,0,...
编译时需要指定链接xcb-record库,例如: gcc -o record-clicks record-clicks.c -lxcb -lxcb-record 运行程序后,点击鼠标按钮时,程序会打印出类似以下的输出: ButtonPress event received by 2 ButtonRelease event received by 2
XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS };xcb_create_window(conn,XCB_COPY_FROM_PARENT,window,screen->root,0, 0,150, 150,10,XCB_WINDOW_CLASS_INPUT_OUTPUT,screen->root_visual,mask, values);新手玩家还可以阅读相关的文档并试用XCB的高级功能,比如设计自己的GUI界面。XCB...
mask = XCB_CW_EVENT_MASK | XCB_CW_BACK_PIXMAP; valwin[0] = XCB_NONE; /* for XCB_CW_BACK_PIXMAP (whose value is 1) */ valwin[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS; /* for XCB_CW_EVENT_MASK, whose value (2048) */ /* is greater than the one of XC...
(connection);43uint32_t mask = XCB_CW_BACK_PIXEL |XCB_CW_EVENT_MASK;44uint32_t values[2];45values[0] = screen->white_pixel;46values[1] = XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_PRESS |47XCB_EVENT_MASK_EXPOSURE |XCB_EVENT_MASK_POINTER_MOTION;48xcb_create_window(...
value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; value_list[0] = screen->white_pixel; value_list[1] = XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_EXPOSURE;The first entry in value_list identifies the background color (which corresponds to XCB_BACK_...
我在xtrace下运行了这个程序,发现它的CreateGC请求失败了,出现了一个BadPixmap错误:
我认为您的xcb_poly_fill_rectangle()等正在尝试在根窗口上绘制。至少,您可以将screen->root作为...