这篇教程C++ xcb_flush函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xcb_flush函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_flush函数的具体用法?C++ xcb_flush怎么用?C++ xcb_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xcb_flush函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: finish//.........这里部分代码省略......... XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS }); /* Map the window (make it visible) */ xcb_map_window(conn, win); /* Setup NetWM atoms */ #define xmacro(name) / do { / xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, name ## _cookie, NULL); / if (!reply) / errx(EXIT_FAILURE, "Could not get atom " # name "/n"); / / A_ ## name = reply->atom; / free(reply); / } while (0); #include "atoms.xmacro" #undef xmacro /* Set dock mode */ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, A__NET_WM_WINDOW_TYPE, A_ATOM, 32, 1, (unsigned char*) &A__NET_WM_WINDOW_TYPE_DIALOG); /* Set window title */ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3: first configuration"), "i3: first configuration"); /* Create pixmap */ pixmap = xcb_generate_id(conn); pixmap_gc = xcb_generate_id(conn); xcb_create_pixmap(conn, root_screen->root_depth, pixmap, win, 500, 500); xcb_create_gc(conn, pixmap_gc, pixmap, 0, 0); /* Grab the keyboard to get all input */ xcb_flush(conn); /* Try (repeatedly, if necessary) to grab the keyboard. We might not * get the keyboard at the first attempt because of the keybinding * still being active when started via a wm’s keybinding. */ xcb_grab_keyboard_cookie_t cookie; xcb_grab_keyboard_reply_t *reply = NULL; int count = 0; while ((reply == NULL || reply->status != XCB_GRAB_STATUS_SUCCESS) && (count++ < 500)) { cookie = xcb_grab_keyboard(conn, false, win, XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); reply = xcb_grab_keyboard_reply(conn, cookie, NULL); usleep(1000); } if (reply->status != XCB_GRAB_STATUS_SUCCESS) { fprintf(stderr, "Could not grab keyboard, status = %d/n", reply->status); exit(-1); } xcb_flush(conn); xcb_generic_event_t *event; while ((event = xcb_wait_for_event(conn)) != NULL) { if (event->response_type == 0) { fprintf(stderr, "X11 Error received! sequence %x/n", event->sequence); continue; } /* Strip off the highest bit (set if the event is generated) */ int type = (event->response_type & 0x7F); switch (type) { case XCB_KEY_PRESS: handle_key_press(NULL, conn, (xcb_key_press_event_t*)event); break; /* TODO: handle mappingnotify */ case XCB_BUTTON_PRESS: handle_button_press((xcb_button_press_event_t*)event); break; case XCB_EXPOSE: handle_expose(); break; } free(event); } return 0;}
开发者ID:stfnm,项目名称:i3,代码行数:101,
示例2: xcb_prepare_cb/* * Flush before blocking (and waiting for new events) * */static void xcb_prepare_cb(EV_P_ ev_prepare *w, int revents) { xcb_flush(conn);}
开发者ID:seirl,项目名称:i3lock,代码行数:7,
示例3: set_wm_state/** Changes the EWMH state of the window */static void set_wm_state (vout_window_t *wnd, bool on, xcb_atom_t state){ vout_window_sys_t *sys = wnd->sys; /* From EWMH "_WM_STATE" */ xcb_client_message_event_t ev = { .response_type = XCB_CLIENT_MESSAGE, .format = 32, .window = wnd->handle.xid, .type = sys->wm_state, }; ev.data.data32[0] = on ? NET_WM_STATE_ADD : NET_WM_STATE_REMOVE; ev.data.data32[1] = state; ev.data.data32[2] = 0; ev.data.data32[3] = 1; /* From ICCCM "Changing Window State" */ xcb_send_event (sys->conn, 0, sys->root, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&ev);}static int Control (vout_window_t *wnd, int cmd, va_list ap){ vout_window_sys_t *p_sys = wnd->sys; xcb_connection_t *conn = p_sys->conn; switch (cmd) { case VOUT_WINDOW_SET_SIZE: { if (p_sys->embedded) return VLC_EGENERIC; unsigned width = va_arg (ap, unsigned); unsigned height = va_arg (ap, unsigned); const uint32_t values[] = { width, height, }; xcb_configure_window (conn, wnd->handle.xid, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); break; } case VOUT_WINDOW_SET_STATE: { unsigned state = va_arg (ap, unsigned); bool above = (state & VOUT_WINDOW_STATE_ABOVE) != 0; bool below = (state & VOUT_WINDOW_STATE_BELOW) != 0; set_wm_state (wnd, above, p_sys->wm_state_above); set_wm_state (wnd, below, p_sys->wm_state_below); break; } case VOUT_WINDOW_SET_FULLSCREEN: { bool fs = va_arg (ap, int); if (!fs && var_GetBool (wnd, "video-wallpaper")) return VLC_EGENERIC; set_wm_state (wnd, fs, p_sys->wm_state_fullscreen); break; } default: msg_Err (wnd, "request %d not implemented", cmd); return VLC_EGENERIC; } xcb_flush (p_sys->conn); return VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:74,
示例4: draw_gcvoid draw_gc(xcb_window_t win){ xcb_rectangle_t r = { 0, 0, 0,0 }; xcb_connection_t *c = G.conn; xcb_get_geometry_reply_t *geo; geo = xcb_get_geometry_reply(c, xcb_get_geometry(c, win), NULL); if(0)printf("get (%hdx%hd)@(%dx%d)/n", geo->x, geo->y, geo->width, geo->height); xcb_get_image_cookie_t cookie; xcb_get_image_reply_t *reply; xcb_generic_error_t *error; xcb_void_cookie_t ck; if(geo!=NULL){ r.width = geo->width ; r.height=geo->height; r.x=0; r.y=0; //printf("window depth=%d/n", geo->depth); if(geo->depth == 24 | geo->depth == 32) psize = r.width * r.height * 4; //correct else if(geo->depth==16) psize = r.width * r.height * 2; //correct else printf(" *** unsupported window depth/n"); }else psize = r.width * r.height * 4; //correct free(geo); static cairo_surface_t *cmask; if( pbuf == NULL){ // psize = geo->width *geo->height*4; //for test pbuf = malloc(psize); printf("malloc pbuf=0x%x size=%d/n",pbuf, psize); memset(pbuf, 0x18, psize); cmask = cairo_image_surface_create_for_data ((unsigned char *) pbuf, CAIRO_FORMAT_ARGB32, geo->width, geo->height, geo->width*4); // 12, 4, 48); if(cmask == NULL){ perror("cairo surface create"); exit(1); } } if(0)printf("width (%dx%d=%d/n", geo->width, geo->height, geo->width *geo->height*4); draw_cairo(cmask); //draw image with xcb_put_image // creat gc and draw to parent window xcb_gcontext_t g; g = xcb_generate_id(c); xcb_create_gc(c, g, win, 0,NULL); ck = xcb_put_image_checked(c, XCB_IMAGE_FORMAT_Z_PIXMAP, win, g, r.width, r.height, r.x,r.y, 0, G.s->root_depth, psize, pbuf); xcb_flush(c);}
开发者ID:wwzbwwzb,项目名称:truck,代码行数:66,
示例5: definedint vkDisplay::create_window(const unsigned int width, const unsigned int height){#if defined(PLATFORM_LINUX) uint32_t value_mask, value_list[32]; m_XcbWindow = xcb_generate_id(m_pXcbConnection); value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; value_list[0] = m_pXcbScreen->black_pixel; value_list[1] = XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_EXPOSURE; xcb_create_window(m_pXcbConnection, XCB_COPY_FROM_PARENT, m_XcbWindow, m_pXcbScreen->root, 0, 0, width, height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, m_pXcbScreen->root_visual, value_mask, value_list); xcb_map_window(m_pXcbConnection, m_XcbWindow); xcb_flush(m_pXcbConnection); // TODO : Not sure of best place to put this, but I have all the info I need here so just setting it all here for now //m_XcbPlatformHandle.connection = m_pXcbConnection; //m_XcbPlatformHandle.root = m_pXcbScreen->root; m_surface.base.platform = VK_ICD_WSI_PLATFORM_XCB; m_surface.connection = m_pXcbConnection; m_surface.window = m_XcbWindow; return 0;#elif defined(WIN32) // Register Window class WNDCLASSEX wcex = {}; m_connection = GetModuleHandle(0); wcex.cbSize = sizeof( WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WindowProcVk; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = m_connection; wcex.hIcon = LoadIcon(wcex.hInstance, MAKEINTRESOURCE( IDI_ICON)); wcex.hCursor = LoadCursor( NULL, IDC_ARROW); wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1); wcex.lpszMenuName = NULL; wcex.lpszClassName = APP_NAME; wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_ICON)); if( !RegisterClassEx( &wcex)) { vktrace_LogError("Failed to register windows class"); return -1; } // create the window m_windowHandle = CreateWindow(APP_NAME, APP_NAME, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 0, 0, width, height, NULL, NULL, wcex.hInstance, NULL); if (m_windowHandle) { ShowWindow( m_windowHandle, SW_SHOWDEFAULT); m_windowWidth = width; m_windowHeight = height; } else { vktrace_LogError("Failed to create window"); return -1; } // TODO : Not sure of best place to put this, but I have all the info I need here so just setting it all here for now m_surface.base.platform = VK_ICD_WSI_PLATFORM_WIN32; m_surface.hinstance = wcex.hInstance; m_surface.hwnd = m_windowHandle; return 0;#endif}
开发者ID:Dr-Shadow,项目名称:VulkanTools,代码行数:71,
示例6: manage_window//.........这里部分代码省略......... con_set_border_style(nc, motif_border_style, config.default_floating_border_width); } else { con_set_border_style(nc, motif_border_style, config.default_border_width); } } if (want_floating) { DLOG("geometry = %d x %d/n", nc->geometry.width, nc->geometry.height); /* automatically set the border to the default value if a motif border * was not specified */ bool automatic_border = (motif_border_style == BS_NORMAL); floating_enable(nc, automatic_border); } /* explicitly set the border width to the default */ if (nc->current_border_width == -1) { nc->current_border_width = (want_floating ? config.default_floating_border_width : config.default_border_width); } /* to avoid getting an UnmapNotify event due to reparenting, we temporarily * declare no interest in any state change event of this window */ values[0] = XCB_NONE; xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); xcb_void_cookie_t rcookie = xcb_reparent_window_checked(conn, window, nc->frame, 0, 0); if (xcb_request_check(conn, rcookie) != NULL) { LOG("Could not reparent the window, aborting/n"); goto geom_out; } values[0] = CHILD_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW; xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); xcb_flush(conn); /* Put the client inside the save set. Upon termination (whether killed or * normal exit does not matter) of the window manager, these clients will * be correctly reparented to their most closest living ancestor (= * cleanup) */ xcb_change_save_set(conn, XCB_SET_MODE_INSERT, window); /* Check if any assignments match */ run_assignments(cwindow); /* 'ws' may be invalid because of the assignments, e.g. when the user uses * "move window to workspace 1", but had it assigned to workspace 2. */ ws = con_get_workspace(nc); /* If this window was put onto an invisible workspace (via assignments), we * render this workspace. It wouldn’t be rendered in our normal code path * because only the visible workspaces get rendered. * * By rendering the workspace, we assign proper coordinates (read: not * width=0, height=0) to the window, which is important for windows who * actually use them to position their GUI elements, e.g. rhythmbox. */ if (ws && !workspace_is_visible(ws)) { /* This is a bit hackish: we need to copy the content container’s rect * to the workspace, because calling render_con() on the content * container would also take the shortcut and not render the invisible * workspace at all. However, just calling render_con() on the * workspace isn’t enough either C++ xcb_free_pixmap函数代码示例 C++ xcb_disconnect函数代码示例
|