printf("event = %s\n",xcb_event_get_label(event->response_type)); } static void client_message_management(xcb_client_message_event_t * event) { printf("event = %s\n",xcb_event_get_label(event->response_type)); } static void expose_management(xcb_expose_event_t *event) { printf("...
libxcb中的event和replay 和大部分的图形界面库一样, libxcb也是事件驱动的, 就像Windows的MFC, 不同的是libxcb还多了一个reply的概念 event event是XServer返回的X协议的事件, 例如:expose,selection等事件 用户可以使用xcb_poll_for_event/xcb_wait_for_event函数从event队列获取XServer返回的event, 取出event后...
xcb_generic_event_t* event; uint running = 1; while(running){ event = xcb_poll_for_event(connection); if(event){ switch (event->response_type) { case XCB_EXPOSE: glClearColor(0, .5, 1, 1); // Blue glFlush(); xcb_glx_swap_buffers(connection, glx_context_tag, glx_window); pu...
注意:程序员经常会在程序中添加代码来处理新的事件类型,而在创建窗口时却忘记为这些事件添加掩码。这样...
它取决于实际的事件类型,但对于大多数类型,都有一个单独的窗口ID字段。一些例子:
XCB_EXPOSE— window displays contentTo configure event handling, the value_mask and value_list arguments of xcb_create_window must identify events of interest. To be specific, value_mask must be set to an OR'ed combination that contains XCB_CW_EVENT_MASK. The corresponding entry in value_li...
XCB_WINDOW_CLASS_INPUT_OUTPUT,52screen->root_visual,53mask, values);54xcb_map_window(connection, window);55xcb_flush(connection);5657/*event loop*/58xcb_generic_event_t *event;59while((event=xcb_wait_for_event(connection))){60switch(event->response_type & ~0x80){61caseXCB_EXPOSE:62{63...
Event painting on the screen is sometimes done as a response to an event (an Expose event). If part of a program's window that was hidden, gets exposed (e.g. the window was raised above other widows), the X server will send an "expose" event to let the program know it should ...
handle_button_press((xcb_button_press_event_t*)event);break;caseXCB_EXPOSE: handle_expose();break; }free(event); }return0; } 开发者ID:stfnm,项目名称:i3,代码行数:101,代码来源:main.c 示例2: xcb_prepare_cb ▲点赞 7▼ /* * Flush before blocking (and waiting for new events) ...
intmain(void){xcb_connection_t*conn;xcb_screen_t*screen;xcb_window_twin;xcb_gcontext_tgcontext;xcb_generic_event_t*event;uint32_tmask;uint32_tvalues[2];/* open connection with the server */conn = xcb_connect(NULL,NULL);if(xcb_connection_has_error(conn)) {printf("Cannot open display...