当前位置: 首页>>代码示例>>C++>>正文


C++ xcb_get_geometry函数代码示例

本文整理汇总了C++中xcb_get_geometry函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_get_geometry函数的具体用法?C++ xcb_get_geometry怎么用?C++ xcb_get_geometry使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xcb_get_geometry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dri3_set_drawable

static bool
dri3_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,代码来源:vl_winsys_dri3.c

示例2: swrastGetDrawableInfo

static void
swrastGetDrawableInfo(__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,代码来源:platform_x11.c

示例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,代码来源:i3lock.c

示例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,代码来源:window.c

示例5: resize

static void
resize(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,代码来源:wrs.c

示例6: x11_get_drawable_info

static bool
x11_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,代码来源:platform_x11.c

示例7: update_motion_recorder

void 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,代码来源:window.c

示例8: update_floating_rectangle

void 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,代码来源:window.c

示例9: xcb_get_geometry

QImage 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,代码来源:sniproxy.cpp

示例10: center_pointer

static void
center_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,代码来源:swm.c

示例11: get_window_rectangle

xcb_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,代码来源:window.c

示例12: get_window_geometry

xcb_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,代码来源:randr.c

示例13: xcb_get_geometry

void 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,代码来源:vk_linux.cpp

示例14: window_get_real_geometry

ExcCode 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,代码来源:screen.c

示例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,代码来源:Window.cpp


注:本文中的xcb_get_geometry函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。