本文整理汇总了C++中xcb_get_geometry_reply函数的典型用法代码示例。如果您正苦于以下问题:C++ xcb_get_geometry_reply函数的具体用法?C++ xcb_get_geometry_reply怎么用?C++ xcb_get_geometry_reply使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcb_get_geometry_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: systray_process_client_message
/** Handle systray message.
* \param ev The event.
* \return 0 on no error.
*/
int
systray_process_client_message(xcb_client_message_event_t *ev)
{
int screen_nbr = 0, ret = 0;
xcb_get_geometry_cookie_t geom_c;
xcb_get_geometry_reply_t *geom_r;
xcb_screen_iterator_t iter;
switch(ev->data.data32[1])
{
case SYSTEM_TRAY_REQUEST_DOCK:
geom_c = xcb_get_geometry_unchecked(globalconf.connection, ev->window);
if(!(geom_r = xcb_get_geometry_reply(globalconf.connection, geom_c, NULL)))
return -1;
for(iter = xcb_setup_roots_iterator(xcb_get_setup(globalconf.connection)), screen_nbr = 0;
iter.rem && iter.data->root != geom_r->root; xcb_screen_next (&iter), ++screen_nbr);
p_delete(&geom_r);
ret = systray_request_handle(ev->data.data32[2], screen_nbr, NULL);
break;
}
return ret;
}
示例2: 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);
}
示例3: 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);
}
示例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;
}
示例5: 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();
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
示例9: ecore_x_drawable_geometry_get_fetch
/**
* Gets the reply of the GetGeometry request sent by ecore_x_atom_get_prefetch().
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
ecore_x_drawable_geometry_get_fetch(void)
{
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
示例10: 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;
}
示例11: 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);
}
示例12: event_handle_maprequest
/** The map request event handler.
* \param ev The event.
*/
static void
event_handle_maprequest(xcb_map_request_event_t *ev)
{
client_t *c;
xcb_get_window_attributes_cookie_t wa_c;
xcb_get_window_attributes_reply_t *wa_r;
xcb_get_geometry_cookie_t geom_c;
xcb_get_geometry_reply_t *geom_r;
wa_c = xcb_get_window_attributes_unchecked(globalconf.connection, ev->window);
if(!(wa_r = xcb_get_window_attributes_reply(globalconf.connection, wa_c, NULL)))
return;
if(wa_r->override_redirect)
goto bailout;
if(xembed_getbywin(&globalconf.embedded, ev->window))
{
xcb_map_window(globalconf.connection, ev->window);
xembed_window_activate(globalconf.connection, ev->window);
}
else if((c = client_getbywin(ev->window)))
{
/* Check that it may be visible, but not asked to be hidden */
if(client_on_selected_tags(c) && !c->hidden)
{
lua_State *L = globalconf_get_lua_State();
luaA_object_push(L, c);
client_set_minimized(L, -1, false);
lua_pop(L, 1);
/* it will be raised, so just update ourself */
client_raise(c);
}
}
else
{
geom_c = xcb_get_geometry_unchecked(globalconf.connection, ev->window);
if(!(geom_r = xcb_get_geometry_reply(globalconf.connection, geom_c, NULL)))
{
goto bailout;
}
client_manage(ev->window, geom_r, wa_r);
p_delete(&geom_r);
}
bailout:
p_delete(&wa_r);
}
示例13: 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};
}
示例14: 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;
}
示例15: 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);
}