这篇教程C++ xcb_get_geometry函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xcb_get_geometry函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_get_geometry函数的具体用法?C++ xcb_get_geometry怎么用?C++ xcb_get_geometry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xcb_get_geometry函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dri3_set_drawablestatic booldri3_set_drawable(struct vl_dri3_screen *scrn, Drawable drawable){ xcb_get_geometry_cookie_t geom_cookie; xcb_get_geometry_reply_t *geom_reply; xcb_void_cookie_t cookie; xcb_generic_error_t *error; xcb_present_event_t peid; bool ret = true; assert(drawable); if (scrn->drawable == drawable) return true; scrn->drawable = drawable; geom_cookie = xcb_get_geometry(scrn->conn, scrn->drawable); geom_reply = xcb_get_geometry_reply(scrn->conn, geom_cookie, NULL); if (!geom_reply) return false; scrn->width = geom_reply->width; scrn->height = geom_reply->height; scrn->depth = geom_reply->depth; free(geom_reply); if (scrn->special_event) { xcb_unregister_for_special_event(scrn->conn, scrn->special_event); scrn->special_event = NULL; } scrn->is_pixmap = false; peid = xcb_generate_id(scrn->conn); cookie = xcb_present_select_input_checked(scrn->conn, peid, scrn->drawable, XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY | XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY | XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY); error = xcb_request_check(scrn->conn, cookie); if (error) { if (error->error_code != BadWindow) ret = false; else { scrn->is_pixmap = true; if (scrn->front_buffer) { dri3_free_front_buffer(scrn, scrn->front_buffer); scrn->front_buffer = NULL; } } free(error); } else scrn->special_event = xcb_register_for_special_xge(scrn->conn, &xcb_present_id, peid, 0); dri3_flush_present_events(scrn); return ret;}
开发者ID:airlied,项目名称:mesa,代码行数:60,
示例2: swrastGetDrawableInfostatic voidswrastGetDrawableInfo(__DRIdrawable * draw, int *x, int *y, int *w, int *h, void *loaderPrivate){ struct dri2_egl_surface *dri2_surf = loaderPrivate; struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); xcb_get_geometry_cookie_t cookie; xcb_get_geometry_reply_t *reply; xcb_generic_error_t *error; *w = *h = 0; cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable); reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error); if (reply == NULL) return; if (error != NULL) { _eglLog(_EGL_WARNING, "error in xcb_get_geometry"); free(error); } else { *w = reply->width; *h = reply->height; } free(reply);}
开发者ID:DirectFB,项目名称:mesa,代码行数:27,
示例3: handle_screen_resize/* * Called when the properties on the root window change, e.g. when the screen * resolution changes. If so we update the window to cover the whole screen * and also redraw the image, if any. * */void handle_screen_resize(void) { xcb_get_geometry_cookie_t geomc; xcb_get_geometry_reply_t *geom; geomc = xcb_get_geometry(conn, screen->root); if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) return; if (last_resolution[0] == geom->width && last_resolution[1] == geom->height) { free(geom); return; } last_resolution[0] = geom->width; last_resolution[1] = geom->height; free(geom); redraw_screen(); uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; xcb_configure_window(conn, win, mask, last_resolution); xcb_flush(conn); xinerama_query_screens(); redraw_screen();}
开发者ID:seirl,项目名称:i3lock,代码行数:33,
示例4: EmOpen/** * Wrap an existing X11 window to embed the video. */static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg){ xcb_window_t window = var_InheritInteger (wnd, "drawable-xid"); if (window == 0) return VLC_EGENERIC; if (AcquireDrawable (VLC_OBJECT(wnd), window)) return VLC_EGENERIC; vout_window_sys_t *p_sys = malloc (sizeof (*p_sys)); xcb_connection_t *conn = xcb_connect (NULL, NULL); if (p_sys == NULL || xcb_connection_has_error (conn)) goto error; p_sys->embedded = true; p_sys->keys = NULL; wnd->handle.xid = window; wnd->control = Control; wnd->sys = p_sys; p_sys->conn = conn; xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply (conn, xcb_get_geometry (conn, window), NULL); if (geo == NULL) { msg_Err (wnd, "bad X11 window 0x%08"PRIx8, window); goto error; } p_sys->root = geo->root; free (geo); if (var_InheritBool (wnd, "keyboard-events")) { p_sys->keys = CreateKeyHandler (VLC_OBJECT(wnd), conn); if (p_sys->keys != NULL) { const uint32_t mask = XCB_CW_EVENT_MASK; const uint32_t values[1] = { XCB_EVENT_MASK_KEY_PRESS, }; xcb_change_window_attributes (conn, window, mask, values); } } CacheAtoms (p_sys); if ((p_sys->keys != NULL) && vlc_clone (&p_sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW)) DestroyKeyHandler (p_sys->keys); xcb_flush (conn); (void) cfg; return VLC_SUCCESS;error: xcb_disconnect (conn); free (p_sys); ReleaseDrawable (VLC_OBJECT(wnd), window); return VLC_EGENERIC;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:63,
示例5: resizestatic voidresize(xcb_window_t w, int x, int y){ uint32_t val[3]; uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_STACK_MODE; xcb_get_geometry_cookie_t c; xcb_get_geometry_reply_t *r; c = xcb_get_geometry(conn, w); r = xcb_get_geometry_reply(conn, c, NULL); if (r == NULL) return; if ((r->x + r->width + 2*r->border_width + x) > scr->width_in_pixels) x = scr->width_in_pixels - ( r->x + r->width + (2*r->border_width)); if ((r->y + r->height + 2*r->border_width + y) > scr->height_in_pixels) y = scr->height_in_pixels - ( r->y + r->height + (2*r->border_width)); val[0] = r->width + x; val[1] = r->height + y; val[2] = XCB_STACK_MODE_ABOVE; xcb_configure_window(conn, w, mask, val); xcb_warp_pointer(conn, XCB_NONE, w, 0, 0, 0, 0, r->width + x, r->height + y); free(r);}
开发者ID:adbjesus,项目名称:wmutils-core,代码行数:35,
示例6: x11_get_drawable_infostatic boolx11_get_drawable_info(__DRIdrawable * draw, int *x, int *y, int *w, int *h, void *loaderPrivate){ struct dri2_egl_surface *dri2_surf = loaderPrivate; struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); xcb_get_geometry_cookie_t cookie; xcb_get_geometry_reply_t *reply; xcb_generic_error_t *error; bool ret; cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable); reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error); if (reply == NULL) return false; if (error != NULL) { ret = false; _eglLog(_EGL_WARNING, "error in xcb_get_geometry"); free(error); } else { *x = reply->x; *y = reply->y; *w = reply->width; *h = reply->height; ret = true; } free(reply); return ret;}
开发者ID:FireBurn,项目名称:mesa,代码行数:32,
示例7: update_motion_recordervoid update_motion_recorder(void){ xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, root), NULL); if (geo != NULL) { window_resize(motion_recorder, geo->width, geo->height); } free(geo);}
开发者ID:Stebalien,项目名称:bspwm,代码行数:10,
示例8: update_floating_rectanglevoid update_floating_rectangle(node_t *n){ client_t *c = n->client; xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, n->id), NULL); if (geo != NULL) { c->floating_rectangle = (xcb_rectangle_t) {geo->x, geo->y, geo->width, geo->height}; } free(geo);}
开发者ID:Stebalien,项目名称:bspwm,代码行数:12,
示例9: xcb_get_geometryQImage SNIProxy::getImageNonComposite(){ auto c = QX11Info::connection(); auto cookie = xcb_get_geometry(c, m_windowId); QScopedPointer<xcb_get_geometry_reply_t> geom(xcb_get_geometry_reply(c, cookie, Q_NULLPTR)); xcb_image_t *image = xcb_image_get(c, m_windowId, 0, 0, geom->width, geom->height, 0xFFFFFF, XCB_IMAGE_FORMAT_Z_PIXMAP); QImage qimage(image->data, image->width, image->height, image->stride, QImage::Format_ARGB32, sni_cleanup_xcb_image, image); return qimage;}
开发者ID:stativ,项目名称:xembed-sni-proxy,代码行数:12,
示例10: center_pointerstatic voidcenter_pointer (xcb_window_t win) { uint32_t values[1]; xcb_get_geometry_reply_t *geom; geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL); xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0, (geom->width + (BORDERWIDTH * 2)) / 2, (geom->height + (BORDERWIDTH * 2)) / 2); values[0] = XCB_STACK_MODE_ABOVE; xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);}
开发者ID:JuliusP,项目名称:swm,代码行数:13,
示例11: get_window_rectanglexcb_rectangle_t get_window_rectangle(node_t *n){ client_t *c = n->client; if (c != NULL) { xcb_get_geometry_reply_t *g = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, n->id), NULL); if (g != NULL) { xcb_rectangle_t rect = (xcb_rectangle_t) {g->x, g->y, g->width, g->height}; free(g); return rect; } } return (xcb_rectangle_t) {0, 0, screen_width, screen_height};}
开发者ID:nfnty,项目名称:bspwm,代码行数:13,
示例12: get_window_geometryxcb_get_geometry_reply_t *get_window_geometry(xcb_connection_t * conn, xcb_window_t window){ xcb_get_geometry_cookie_t get_geometry_cookie; xcb_get_geometry_reply_t *get_geometry_reply; get_geometry_cookie = xcb_get_geometry(conn, window); get_geometry_reply = xcb_get_geometry_reply(conn, get_geometry_cookie, NULL); if (!get_geometry_reply) errx(1, "0x%08x: no such window", window); return get_geometry_reply;}
开发者ID:tudurom,项目名称:disputils,代码行数:13,
示例13: xcb_get_geometryvoid VulkanReplay::GetOutputWindowDimensions(uint64_t id, int32_t &w, int32_t &h){ if(id == 0 || m_OutputWindows.find(id) == m_OutputWindows.end()) return; OutputWindow &outw = m_OutputWindows[id]; xcb_get_geometry_cookie_t geomCookie = xcb_get_geometry (outw.connection, outw.wnd); // window is a xcb_drawable_t xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply (outw.connection, geomCookie, NULL); w = (int32_t)geom->width; h = (int32_t)geom->height; free(geom);}
开发者ID:keencore,项目名称:renderdoc,代码行数:15,
示例14: window_get_real_geometryExcCode window_get_real_geometry(xcb_window_t window, int *left, int *top, int *width, int *height) { xcb_get_geometry_cookie_t cookie = xcb_get_geometry(display, window); xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(display, cookie, NULL); if (reply == NULL) PANIC(ERR_X_REQUEST, "window_get_real_geometry"); *left = reply->x; *top = reply->y; *width = reply->width; *height = reply->height; free(reply); return 0;}
开发者ID:nkruglikov,项目名称:remoteink,代码行数:15,
示例15: xcb_get_geometry void Window::get_geometry(int32_t& x, int32_t& y, uint32_t& width, uint32_t& height) { xcb_get_geometry_cookie_t c = xcb_get_geometry(conn->xcb(), window); xcb_generic_error_t* error; xcb_get_geometry_reply_t* reply = xcb_get_geometry_reply(conn->xcb(), c, &error); throw_if_error(error); x = reply->x; y = reply->y; width = reply->width; height = reply->height; free(reply); }
开发者ID:quadra,项目名称:manix,代码行数:15,
示例16: resizeAll/* Resizes all of the windows for the current frame for a tiled format */void resizeAll(xcb_connection_t *conn,int frameNum,std::vector<xcb_window_t> (&frames)[NUM_FRAMES],uint32_t screenWidth,uint32_t screenHeight) { /* Exits upon empty frame */ if(frames[frameNum].empty()) { return; } int size = frames[frameNum].size(); xyWindow(conn,frames[frameNum].at(0),0,0); whWindow(conn,frames[frameNum].at(0),screenWidth,screenHeight); for(int i = 1; i<size; i++) { xcb_window_t curWindow = frames[frameNum].at(i); xcb_window_t maxWindow; int maxArea = 0; xcb_get_geometry_reply_t *maxStats; xcb_get_geometry_reply_t *geometry; /* Checking the current frame for the largest window and retrieving data about its size */ for(int j = 0; j<i; j++) { geometry = xcb_get_geometry_reply(conn,xcb_get_geometry(conn,frames[frameNum].at(j)),NULL); if(maxArea <= geometry->width*geometry->height) { maxWindow = frames[frameNum].at(j); maxStats = geometry; maxArea = geometry->width*geometry->height; } } int gap = NUM_GAP_PIXELS/2; int width = (maxStats->width)/2; int height = (maxStats->height)/2; /* Splits vertically if the largest window has a larger height than width. Otherwise splits horisontally. Gaps of width NUM_GAP_PIXELS are added between each of the windows. */ if(maxStats->height > maxStats->width) { whWindow(conn,maxWindow,maxStats->width,height-gap); xyWindow(conn,curWindow,maxStats->x,maxStats->y+height+gap); whWindow(conn,curWindow,maxStats->width,height-gap); } else { whWindow(conn,maxWindow,width-gap,maxStats->height); xyWindow(conn,curWindow,maxStats->x+width+gap,maxStats->y); whWindow(conn,curWindow,width-gap,maxStats->height); } }}
开发者ID:RyanBaten,项目名称:RyanBatenWindowManager,代码行数:47,
示例17: xcb_aux_get_depthuint8_txcb_aux_get_depth (xcb_connection_t *c, xcb_screen_t *screen){ xcb_drawable_t drawable; xcb_get_geometry_reply_t *geom; int depth = 0; drawable = screen->root; geom = xcb_get_geometry_reply (c, xcb_get_geometry(c, drawable), 0); if (geom) { depth = geom->depth; free (geom); } return depth;}
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:18,
示例18: ANGLE_VK_TRYangle::Result WindowSurfaceVkXcb::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut){ VkXcbSurfaceCreateInfoKHR createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; createInfo.flags = 0; createInfo.connection = mXcbConnection; createInfo.window = mNativeWindowType; ANGLE_VK_TRY(context, vkCreateXcbSurfaceKHR(context->getRenderer()->getInstance(), &createInfo, nullptr, &mSurface)); xcb_get_geometry_cookie_t cookie = xcb_get_geometry(mXcbConnection, mNativeWindowType); xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, nullptr); ASSERT(reply); *extentsOut = gl::Extents(reply->width, reply->height, 0); free(reply); return angle::Result::Continue;}
开发者ID:null77,项目名称:angle,代码行数:18,
示例19: ANGLE_VK_TRYvk::ErrorOrResult<gl::Extents> WindowSurfaceVkXcb::createSurfaceVk(RendererVk *renderer){ VkXcbSurfaceCreateInfoKHR createInfo; createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; createInfo.pNext = nullptr; createInfo.flags = 0; createInfo.connection = mXcbConnection; createInfo.window = mNativeWindowType; ANGLE_VK_TRY(vkCreateXcbSurfaceKHR(renderer->getInstance(), &createInfo, nullptr, &mSurface)); xcb_get_geometry_cookie_t cookie = xcb_get_geometry(mXcbConnection, mNativeWindowType); xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, nullptr); ASSERT(reply); gl::Extents result(reply->width, reply->height, 0); free(reply); return result;}
开发者ID:jrmuizel,项目名称:angle,代码行数:18,
示例20: movestatic voidmove(xcb_window_t win, int mode, int x, int y){ uint32_t values[2]; int real; xcb_get_geometry_reply_t *geom; if (!win || win == scr->root) return; geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL); if (!geom) return; if (mode == ABSOLUTE) { x -= geom->x + geom->width /2; y -= geom->y + geom->height/2; } values[0] = x ? geom->x + x : geom->x; values[1] = y ? geom->y + y : geom->y; if (x) { real = geom->width + (geom->border_width * 2); if (geom->x + x < 1) values[0] = 0; if (geom->x + x > scr->width_in_pixels - real) values[0] = scr->width_in_pixels - real; } if (y) { real = geom->height + (geom->border_width * 2); if (geom->y + y < 1) values[1] = 0; if (geom->y + y > scr->height_in_pixels - real) values[1] = scr->height_in_pixels - real; } xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); free(geom);}
开发者ID:Faalentijn,项目名称:core,代码行数:44,
示例21: get_geometrystatic voidget_geometry(xcb_window_t window, struct wlc_geometry *out_g, uint32_t *out_depth){ if (out_g) *out_g = wlc_geometry_zero; if (out_depth) *out_depth = 0; xcb_get_geometry_reply_t *reply; if ((reply = xcb_get_geometry_reply(x11.connection, xcb_get_geometry(x11.connection, window), NULL))) { if (out_g) *out_g = (struct wlc_geometry){ .origin = { reply->x, reply->y }, .size = { reply->width, reply->height } }; if (out_depth) *out_depth = reply->depth; free(reply); }
开发者ID:Hummer12007,项目名称:wlc,代码行数:19,
示例22: toScreen/** * Converts a Weston compositor x,y coordinate into a global screen coordinate. * When Weston is using the x11 backend, the x,y coordinate is mapped to the X * display output (needed to correctly map a uinput pointer to weston). **/static void toScreen(int32_t *x, int32_t *y){ struct weston_output *output(Globals::output()); toDevice(x, y); std::string make(output->make); if (make == "xwayland" or make == "weston-X11") {#if defined(HAVE_X11_SUPPORT) struct x11_compositor *x11_compositor = (struct x11_compositor*)Globals::compositor(); struct x11_output *x11_output = (struct x11_output*) output; xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply( x11_compositor->conn, xcb_get_geometry( x11_compositor->conn, x11_output->window ), NULL ); xcb_translate_coordinates_reply_t *trans = xcb_translate_coordinates_reply( x11_compositor->conn, xcb_translate_coordinates( x11_compositor->conn, x11_output->window, geom->root, -(geom->border_width), -(geom->border_width) ), NULL ); *x += (int16_t)trans->dst_x; *y += (int16_t)trans->dst_y; delete trans; delete geom;#else exit(EXIT_FAILURE);#endif }}
开发者ID:01org,项目名称:wayland-fits,代码行数:48,
示例23: xcb_get_geometry// === WindowGeometry() ===QRect LXCB::WindowGeometry(WId win, bool includeFrame){ if(DEBUG){ qDebug() << "XCB: WindowGeometry()"; } QRect geom; if(win==0){ return geom; } xcb_get_geometry_cookie_t cookie = xcb_get_geometry(QX11Info::connection(), win); xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(QX11Info::connection(), cookie, NULL); //qDebug() << "Get Window Geometry:" << reply; if(reply != 0){ geom = QRect(0, 0, reply->width, reply->height); //make sure to use the origin point for the window //qDebug() << " - "<<reply->x << reply->y << reply->width << reply->height; free(reply); if(includeFrame){ //Need to add/include the frame extents as well (assuming the frame info is available) xcb_get_property_cookie_t cookie = xcb_ewmh_get_frame_extents_unchecked(&EWMH, win); if(cookie.sequence != 0){ xcb_ewmh_get_extents_reply_t frame; if(1== xcb_ewmh_get_frame_extents_reply(&EWMH, cookie, &frame, NULL) ){ //adjust the origin point to account for the frame geom.translate(-frame.left, -frame.top); //move to the orign point for the frame //adjust the size (include the frame sizes) geom.setWidth( geom.width() + frame.left + frame.right ); geom.setHeight( geom.height() + frame.top + frame.bottom ); } //qDebug() << " - Frame:" << frame.left << frame.right << frame.top << frame.bottom; //qDebug() << " - Modified with Frame:" << geom.x() << geom.y() << geom.width() << geom.height(); } } //Now need to convert this to absolute coordinates (not parent-relavitve) xcb_translate_coordinates_cookie_t tcookie = xcb_translate_coordinates(QX11Info::connection(), win, QX11Info::appRootWindow(), geom.x(), geom.y()); xcb_translate_coordinates_reply_t *trans = xcb_translate_coordinates_reply(QX11Info::connection(), tcookie, NULL); if(trans!=0){ //qDebug() << " - Got Translation:" << trans->dst_x << trans->dst_y; //Replace the origin point with the global position (sizing remains the same) geom.moveLeft(trans->dst_x); //adjust X coordinate (no size change) geom.moveTop(trans->dst_y); //adjust Y coordinate (no size change) free(trans); } }else{ //Need to do another catch for this situation (probably not mapped yet) } return geom;}
开发者ID:LeFroid,项目名称:lumina,代码行数:43,
示例24: movestatic voidmove (int x, int y) { uint32_t values[2]; int real; xcb_window_t win = (*focuswin); xcb_get_geometry_reply_t *geom; if (!win || win == scr->root) return; geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL); if (!geom) return; values[0] = x ? geom->x + x : geom->x; values[1] = y ? geom->y + y : geom->y; if (x) { real = geom->width + (BORDERWIDTH * 2); if (geom->x + x < 1) values[0] = 0; if (geom->x + x > scr->width_in_pixels - real) values[0] = scr->width_in_pixels - real; } if (y) { real = geom->height + (BORDERWIDTH * 2); if (geom->y + y < 1) values[1] = 0; if (geom->y + y > scr->height_in_pixels - real) values[1] = scr->height_in_pixels - real; } xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values); center_pointer(win); free(geom);}
开发者ID:JuliusP,项目名称:swm,代码行数:42,
示例25: get_window_geometrystatic xcb_get_geometry_reply_t* get_window_geometry( xcb_connection_t *xcb_conn, xcb_drawable_t drawable){ xcb_get_geometry_cookie_t cookie; xcb_generic_error_t *error; xcb_get_geometry_reply_t *reply; cookie = xcb_get_geometry(xcb_conn, drawable); reply = xcb_get_geometry_reply(xcb_conn, cookie, &error); if (error) { blog(LOG_ERROR, "Failed to fetch parent window geometry!"); free(error); free(reply); return 0; } free(error); return reply;}
开发者ID:xmxiaoq,项目名称:obs-studio,代码行数:20,
示例26: xcb_connectbool LinuxWindowCapture::WindowRect() { if( mWindow == 0 ) return false; xcb_connection_t* dpy = xcb_connect( NULL, NULL ); if ( xcb_connection_has_error( dpy ) ) qDebug() << "Can't open display"; xcb_screen_t* screen = xcb_setup_roots_iterator( xcb_get_setup( dpy ) ).data; if( !screen ) qDebug() << "Can't acquire screen"; xcb_get_geometry_cookie_t geometryC = xcb_get_geometry( dpy, mWindow ); xcb_get_geometry_reply_t* geometryR = xcb_get_geometry_reply( dpy, geometryC, NULL ); if( geometryR ) { xcb_translate_coordinates_cookie_t translateC = xcb_translate_coordinates( dpy, mWindow, screen->root, geometryR->x, geometryR->y ); xcb_translate_coordinates_reply_t* translateR = xcb_translate_coordinates_reply( dpy, translateC, NULL ); mRect.setRect( translateR->dst_x, translateR->dst_y, geometryR->width, geometryR->height ); free( geometryR ); free( translateR ); xcb_disconnect( dpy ); return true; } xcb_disconnect( dpy ); return false;}
开发者ID:xkoan,项目名称:track-o-bot,代码行数:40,
示例27: PRESENTPixmapInitBOOLPRESENTPixmapInit(PRESENTpriv *present_priv, Pixmap pixmap, PRESENTPixmapPriv **present_pixmap_priv){ xcb_get_geometry_cookie_t cookie; xcb_get_geometry_reply_t *reply; cookie = xcb_get_geometry(present_priv->xcb_connection, pixmap); reply = xcb_get_geometry_reply(present_priv->xcb_connection, cookie, NULL); if (!reply) return FALSE; *present_pixmap_priv = (PRESENTPixmapPriv *) calloc(1, sizeof(PRESENTPixmapPriv)); if (!*present_pixmap_priv) { free(reply); return FALSE; } pthread_mutex_lock(&present_priv->mutex_present); (*present_pixmap_priv)->released = TRUE; (*present_pixmap_priv)->pixmap = pixmap; (*present_pixmap_priv)->present_priv = present_priv; (*present_pixmap_priv)->next = present_priv->first_present_priv; (*present_pixmap_priv)->width = reply->width; (*present_pixmap_priv)->height = reply->height; (*present_pixmap_priv)->depth = reply->depth;#ifdef D3DADAPTER9_DRI2 (*present_pixmap_priv)->dri2_info.is_dri2 = FALSE;#endif free(reply); present_priv->last_serial_given++; (*present_pixmap_priv)->serial = present_priv->last_serial_given; present_priv->first_present_priv = *present_pixmap_priv; pthread_mutex_unlock(&present_priv->mutex_present); return TRUE;}
开发者ID:sarnex,项目名称:wine,代码行数:38,
示例28: resizestatic voidresize (int x, int y) { uint32_t values[2]; int real; xcb_get_geometry_reply_t *geom; xcb_drawable_t win = (*focuswin); if (!win || win == scr->root) return; geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL); values[0] = x ? geom->width + x : geom->width; values[1] = y ? geom->height + y : geom->height; if (x) { real = geom->width + (BORDERWIDTH * 2); if (geom->x + real + x > scr->width_in_pixels) values[0] = scr->width_in_pixels - geom->x - (BORDERWIDTH * 2); } if (y) { real = geom->height + (BORDERWIDTH *2); if (geom->y + real + y > scr->height_in_pixels) values[1] = scr->height_in_pixels - geom->y - (BORDERWIDTH * 2); } xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); focus(win, ACTIVE); center_pointer(win); free(geom);}
开发者ID:JuliusP,项目名称:swm,代码行数:38,
示例29: getattributestatic intgetattribute(xcb_window_t w, int attr){ xcb_get_geometry_cookie_t c; xcb_get_geometry_reply_t *r; c = xcb_get_geometry(conn, w); r = xcb_get_geometry_reply(conn, c, NULL); if (r == NULL) errx(1, "0x%08x: no such window", w); switch (attr) { case ATTR_X: attr = r->x; break; case ATTR_Y: attr = r->y; break; case ATTR_W: attr = r->width; break; case ATTR_H: attr = r->height; break; case ATTR_B: attr = r->border_width; break; } free(r); return attr;}
开发者ID:danil,项目名称:core,代码行数:23,
示例30: xcb_get_geometrybool LinuxWindowCapture::ExtractWindowProperties( xcb_window_t winId, QRect* winRect, bool* winFocus ) { if( !winId ) return false; xcb_connection_t* xcbConn = QX11Info::connection(); xcb_get_geometry_cookie_t geometryC = xcb_get_geometry( xcbConn, winId ); CScopedPointer< xcb_get_geometry_reply_t > geometryR( xcb_get_geometry_reply( xcbConn, geometryC, nullptr ) ); if( !geometryR ) return false; // assume the parent window is the screen then we can just use the coordinates directly int x = geometryR->x; int y = geometryR->y; CScopedPointer< xcb_query_tree_reply_t > treeR( xcb_query_tree_reply( xcbConn, xcb_query_tree( xcbConn, winId ), nullptr ) ); if ( !treeR ) return false; // if the parent isn't screen translate coords if ( treeR->parent != QX11Info::appRootWindow() ) { xcb_translate_coordinates_cookie_t translateC = xcb_translate_coordinates( xcbConn, winId, QX11Info::appRootWindow(), x, y ); CScopedPointer< xcb_translate_coordinates_reply_t > translateR( xcb_translate_coordinates_reply( xcbConn, translateC, nullptr ) ); if ( !translateR ) return false; x = translateR->dst_x; y = translateR->dst_y; } winRect->setRect( x, y, geometryR->width, geometryR->height ); xcb_get_input_focus_cookie_t focusC = xcb_get_input_focus( xcbConn ); CScopedPointer < xcb_get_input_focus_reply_t > focusR( xcb_get_input_focus_reply( xcbConn, focusC, nullptr ) ); if ( !focusR ) return false; *winFocus = ( focusR->focus == winId ); return true;}
开发者ID:BOSSoNe0013,项目名称:track-o-bot,代码行数:37,
注:本文中的xcb_get_geometry函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xcb_get_geometry_reply函数代码示例 C++ xcb_free_pixmap函数代码示例 |