您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xcb_request_check函数代码示例

51自学网 2021-06-03 10:16:31
  C++
这篇教程C++ xcb_request_check函数代码示例写得很实用,希望能帮到您。

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

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

示例1: cursor_set

static voidcursor_set (xcb_connection_t *c,            xcb_screen_t     *screen,            xcb_window_t      window,            int               cursor_id){  uint32_t             values_list[3];  xcb_void_cookie_t    cookie_font;  xcb_void_cookie_t    cookie_gc;  xcb_generic_error_t *error;  xcb_font_t           font;  xcb_cursor_t         cursor;  xcb_gcontext_t       gc;  uint32_t             mask;  uint32_t             value_list;  font = xcb_generate_id (c);  cookie_font = xcb_open_font_checked (c, font,                                       strlen ("cursor"),                                       "cursor");  error = xcb_request_check (c, cookie_font);  if (error) {    fprintf (stderr, "ERROR: can't open font : %d/n", error->error_code);    xcb_disconnect (c);    exit (-1);  }  cursor = xcb_generate_id (c);  xcb_create_glyph_cursor (c, cursor, font, font,                           cursor_id, cursor_id + 1,                           0, 0, 0,                           0, 0, 0);  gc = xcb_generate_id (c);  mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;  values_list[0] = screen->black_pixel;  values_list[1] = screen->white_pixel;  values_list[2] = font;  cookie_gc = xcb_create_gc_checked (c, gc, window, mask, values_list);  error = xcb_request_check (c, cookie_gc);  if (error) {    fprintf (stderr, "ERROR: can't create gc : %d/n", error->error_code);    xcb_disconnect (c);    exit (-1);  }  mask = XCB_CW_CURSOR;  value_list = cursor;  xcb_change_window_attributes (c, window, mask, &value_list);  xcb_free_cursor (c, cursor);  cookie_font = xcb_close_font_checked (c, font);  error = xcb_request_check (c, cookie_font);  if (error) {    fprintf (stderr, "ERROR: can't close font : %d/n", error->error_code);    xcb_disconnect (c);    exit (-1);  }}
开发者ID:digitaltembo,项目名称:jade,代码行数:60,


示例2: make_window

static xcb_window_t make_window(xcb_connection_t *c,				xcb_screen_t *s,				uint32_t bg,				uint32_t fg,				uint32_t width,				uint32_t height) {    uint32_t mask = 0;    xcb_params_cw_t cwa;    xcb_window_t w;    xcb_void_cookie_t check_cookie;    xcb_generic_error_t *error;    xcb_visualtype_t *v = xcb_aux_find_visual_by_id(s, s->root_visual);    assert(v);    XCB_AUX_ADD_PARAM(&mask, &cwa, back_pixel, bg);    XCB_AUX_ADD_PARAM(&mask, &cwa, border_pixel, fg);    XCB_AUX_ADD_PARAM(&mask, &cwa, override_redirect, 1);    XCB_AUX_ADD_PARAM(&mask, &cwa, event_mask,		      XCB_EVENT_MASK_BUTTON_PRESS |		      XCB_EVENT_MASK_EXPOSURE);    w = xcb_generate_id(c);    check_cookie = xcb_aux_create_window_checked(c,      s->root_depth, w, s->root, 0, 0, width, height, 1,      XCB_WINDOW_CLASS_INPUT_OUTPUT, v->visual_id, mask, &cwa);    error = xcb_request_check(c, check_cookie);    assert(!error);    check_cookie = xcb_map_window_checked(c, w);    error = xcb_request_check(c, check_cookie);    assert(!error);    return w;}
开发者ID:freedesktop-unofficial-mirror,项目名称:xcb__util-image,代码行数:30,


示例3: pixmap_depths_usable

/* Test each depth not explicitly advertised to see if pixmap creation * succeeds: if it does, that depth is usable. */static intpixmap_depths_usable (xcb_connection_t *c, uint32_t missing, xcb_pixmap_t pixmap, xcb_drawable_t root){    xcb_void_cookie_t create_cookie[32] = { { 0 } };    xcb_void_cookie_t free_cookie[32]   = { { 0 } };    int d;    int success = 1;    for (d = 1; d <= 32; d++)	if (missing & DEPTH_MASK(d))	{	    create_cookie[d - 1] = xcb_create_pixmap_checked (c, d, pixmap, root, 1, 1);	    free_cookie[d - 1] = xcb_free_pixmap_checked (c, pixmap);	    if (!create_cookie[d - 1].sequence || !free_cookie[d - 1].sequence)	    {		success = 0;		break;	    }	}    for (d = 0; d < 32; d++)	if (create_cookie[d].sequence || free_cookie[d].sequence)	{	    xcb_generic_error_t *create_error = xcb_request_check (c, create_cookie[d]);	    xcb_generic_error_t *free_error = xcb_request_check (c, free_cookie[d]);	    success = success && !create_error;	    free(create_error);	    free(free_error);	}    return success;}
开发者ID:aosm,项目名称:X11libs,代码行数:31,


示例4: xembed

  /// Xembeds a X window  void xembed(xcb_window_t client) {    client_win = client;    uint32_t values[4];    uint32_t mask;    xcb_void_cookie_t cookie;    xcb_generic_error_t *error;    // order of the following operations is important here!    // move window below other windows    values[0] = XCB_STACK_MODE_BELOW;    mask = XCB_CONFIG_WINDOW_STACK_MODE;    cookie = xcb_configure_window_checked(con, client_win, mask, values);    error = xcb_request_check(con, cookie);    if(error) {        std::cerr << "Could not change client attributes." << std::endl;        exit(1);    }    // reparent client    cookie = xcb_reparent_window_checked(con, client_win, win, 0, 0);    error = xcb_request_check(con, cookie);    if(error) {        std::cerr << "Could not reparent client." << std::endl;        exit(1);    }        // move and resize client window    values[0] = 0;    values[1] = 0;    values[2] = width;    values[3] = height;    mask = XCB_CONFIG_WINDOW_X |XCB_CONFIG_WINDOW_Y |      XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;    cookie = xcb_configure_window_checked(con, client_win, mask, values);    error = xcb_request_check(con, cookie);    if(error) {        std::cerr << "Could not resize client." << std::endl;        exit(1);    }    // make client overwrite-redirected    values[0] = true;    mask = XCB_CW_OVERRIDE_REDIRECT;    cookie = xcb_change_window_attributes(con, client_win, mask, values);    error = xcb_request_check(con, cookie);    if(error) {        std::cerr << "Could not change client attributes." << std::endl;        exit(1);    }  }
开发者ID:khandesh,项目名称:boinc,代码行数:56,


示例5: gc_font_get

static xcb_gc_tgc_font_get (xcb_connection_t *c,             xcb_screen_t     *screen,             xcb_window_t      window,             const char       *font_name){  uint32_t             value_list[3];  xcb_void_cookie_t    cookie_font;  xcb_void_cookie_t    cookie_gc;  xcb_generic_error_t *error;  xcb_font_t           font;  xcb_gcontext_t       gc;  uint32_t             mask;  font = xcb_generate_id (c);  cookie_font = xcb_open_font_checked (c, font,                                       strlen (font_name),                                       font_name);  error = xcb_request_check (c, cookie_font);  if (error) {    fprintf (stderr, "ERROR: can't open font : %d/n", error->error_code);    xcb_disconnect (c);    return -1;  }  gc = xcb_generate_id (c);  mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT;  value_list[0] = screen->black_pixel;  value_list[1] = screen->white_pixel;  value_list[2] = font;  cookie_gc = xcb_create_gc_checked (c, gc, window, mask, value_list);  error = xcb_request_check (c, cookie_gc);  if (error) {    fprintf (stderr, "ERROR: can't create gc : %d/n", error->error_code);    xcb_disconnect (c);    exit (-1);  }  cookie_font = xcb_close_font_checked (c, font);  error = xcb_request_check (c, cookie_font);  if (error) {    fprintf (stderr, "ERROR: can't close font : %d/n", error->error_code);    xcb_disconnect (c);    exit (-1);  }  return gc;}
开发者ID:digitaltembo,项目名称:jade,代码行数:49,


示例6: init_bar

staticint init_bar() {    uint32_t vals[4];    xcb_void_cookie_t cookie;    xcb_generic_error_t *err;    /* create status bar window at the bottom */    bar_.w = nil_.scr->width_in_pixels;    bar_.h = nil_.font.ascent + nil_.font.descent + 2;    bar_.x = 0;    bar_.y = nil_.scr->height_in_pixels - bar_.h;    bar_.win = xcb_generate_id(nil_.con);    vals[0] = XCB_BACK_PIXMAP_PARENT_RELATIVE;    vals[1] = 1;    /* override_redirect */    vals[2] = XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_EXPOSURE;    vals[3] = nil_.cursor[CURSOR_NORMAL];    cookie = xcb_create_window_checked(nil_.con, nil_.scr->root_depth, bar_.win,        nil_.scr->root, bar_.x, bar_.y, bar_.w, bar_.h, 0, XCB_COPY_FROM_PARENT,        nil_.scr->root_visual, XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT        | XCB_CW_EVENT_MASK | XCB_CW_CURSOR, vals);    err = xcb_request_check(nil_.con, cookie);    if (err) {        NIL_ERR("create window %d", err->error_code);        return -1;    }    vals[0] = XCB_STACK_MODE_ABOVE;    xcb_configure_window(nil_.con, bar_.win, XCB_CONFIG_WINDOW_STACK_MODE, &vals[0]);    cookie = xcb_map_window_checked(nil_.con, bar_.win);    err = xcb_request_check(nil_.con, cookie);    if (err) {        NIL_ERR("map window %d", err->error_code);        return -1;    }    /* graphic context */    bar_.gc = xcb_generate_id(nil_.con);    vals[0] = nil_.color.bar_fg;    vals[1] = nil_.color.bar_bg;    vals[2] = nil_.font.id;    cookie = xcb_create_gc_checked(nil_.con, bar_.gc, bar_.win, XCB_GC_FOREGROUND        | XCB_GC_BACKGROUND | XCB_GC_FONT, vals);    err = xcb_request_check(nil_.con, cookie);    if (err) {        NIL_ERR("map window %d", err->error_code);        return -1;    }    return 0;}
开发者ID:nqv,项目名称:nilwm,代码行数:48,


示例7: init_font

staticint init_font() {    xcb_void_cookie_t cookie;    xcb_generic_error_t *err;    xcb_list_fonts_with_info_cookie_t info_cookie;    xcb_list_fonts_with_info_reply_t *info;    /* open font */    nil_.font.id = xcb_generate_id(nil_.con);    cookie = xcb_open_font_checked(nil_.con, nil_.font.id,        strlen(cfg_.font_name), cfg_.font_name);    err = xcb_request_check(nil_.con, cookie);    if (err) {        NIL_ERR("open font: %d", err->error_code);        return -1;    }    info_cookie = xcb_list_fonts_with_info(nil_.con, 1,        strlen(cfg_.font_name), cfg_.font_name);    info = xcb_list_fonts_with_info_reply(nil_.con, info_cookie, 0);    if (!info) {        NIL_ERR("load font: %s", cfg_.font_name);        return -1;    }    NIL_LOG("font ascent=%d, descent=%d", info->font_ascent, info->font_descent);    nil_.font.ascent = info->font_ascent;    nil_.font.descent = info->font_descent;    free(info);    return 0;}
开发者ID:nqv,项目名称:nilwm,代码行数:29,


示例8: PRESENTPrivChangeWindow

static BOOL PRESENTPrivChangeWindow(PRESENTpriv *present_priv, XID window){    xcb_void_cookie_t cookie;    xcb_generic_error_t *error;    xcb_present_event_t eid;    PRESENTForceReleases(present_priv);    PRESENTFreeXcbQueue(present_priv);    present_priv->window = window;    if (window) {        cookie = xcb_present_select_input_checked(present_priv->xcb_connection,                                                  (eid = xcb_generate_id(present_priv->xcb_connection)),                                                  window,                                                  XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY|                                                  XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY);        present_priv->special_event = xcb_register_for_special_xge(present_priv->xcb_connection,                                                                   &xcb_present_id,                                                                   eid, NULL);        error = xcb_request_check(present_priv->xcb_connection, cookie); /* performs a flush */        if (error || !present_priv->special_event) {            ERR("FAILED to use the X PRESENT extension. Was the destination a window ?/n");            if (present_priv->special_event)                xcb_unregister_for_special_event(present_priv->xcb_connection, present_priv->special_event);            present_priv->special_event = NULL;            present_priv->window = 0;        }    }    return (present_priv->window != 0);}
开发者ID:sarnex,项目名称:wine,代码行数:30,


示例9: PRESENTHelperCopyFront

BOOLPRESENTHelperCopyFront(Display *dpy, PRESENTPixmapPriv *present_pixmap_priv){    PRESENTpriv *present_priv = present_pixmap_priv->present_priv;    xcb_void_cookie_t cookie;    xcb_generic_error_t *error;    uint32_t v = 0;    xcb_gcontext_t gc;    pthread_mutex_lock(&present_priv->mutex_present);    if (!present_priv->window) {        pthread_mutex_unlock(&present_priv->mutex_present);        return FALSE;    }    xcb_create_gc(present_priv->xcb_connection,                  (gc = xcb_generate_id(present_priv->xcb_connection)),                  present_priv->window,                  XCB_GC_GRAPHICS_EXPOSURES,                  &v);    cookie = xcb_copy_area_checked(present_priv->xcb_connection,                                   present_priv->window,                                   present_pixmap_priv->pixmap,                                   gc,                                   0, 0, 0, 0,                                   present_pixmap_priv->width,                                   present_pixmap_priv->height);    error = xcb_request_check(present_priv->xcb_connection, cookie);    xcb_free_gc(present_priv->xcb_connection, gc);    pthread_mutex_unlock(&present_priv->mutex_present);    return (error != NULL);}
开发者ID:sarnex,项目名称:wine,代码行数:34,


示例10: dri3_set_drawable

static 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,


示例11: QXcbObject

QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format)    : QXcbObject(screen->connection())    , m_gc(0)    , m_gc_window(0){    Q_XCB_NOOP(connection());    m_xcb_image = xcb_image_create_native(xcb_connection(),                                          size.width(),                                          size.height(),                                          XCB_IMAGE_FORMAT_Z_PIXMAP,                                          depth,                                          0,                                          ~0,                                          0);    m_shm_info.shmid = shmget (IPC_PRIVATE,          m_xcb_image->stride * m_xcb_image->height, IPC_CREAT|0777);    m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat (m_shm_info.shmid, 0, 0);    m_shm_info.shmseg = xcb_generate_id(xcb_connection());    xcb_generic_error_t *error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false));    if (error) {        qWarning() << "QXcbWindowSurface: Unable to attach to shared memory segment";        free(error);    }    if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1)        qWarning() << "QXcbWindowSurface: Error while marking the shared memory segment to be destroyed";    m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format);}
开发者ID:Suneal,项目名称:qt,代码行数:32,


示例12: randr_restore

voidrandr_restore(randr_state_t *state){	xcb_generic_error_t *error;	/* Restore CRTC gamma ramps */	for (int i = 0; i < state->crtc_count; i++) {		xcb_randr_crtc_t crtc = state->crtcs[i].crtc;		unsigned int ramp_size = state->crtcs[i].ramp_size;		uint16_t *gamma_r = &state->crtcs[i].saved_ramps[0*ramp_size];		uint16_t *gamma_g = &state->crtcs[i].saved_ramps[1*ramp_size];		uint16_t *gamma_b = &state->crtcs[i].saved_ramps[2*ramp_size];		/* Set gamma ramps */		xcb_void_cookie_t gamma_set_cookie =			xcb_randr_set_crtc_gamma_checked(state->conn, crtc,							 ramp_size, gamma_r,							 gamma_g, gamma_b);		error = xcb_request_check(state->conn, gamma_set_cookie);		if (error) {			fprintf(stderr, _("`%s' returned error %d/n"),				"RANDR Set CRTC Gamma", error->error_code);			fprintf(stderr, _("Unable to restore CRTC %i/n"), i);		}	}}
开发者ID:My2ndAngelic,项目名称:iris-colors-lite,代码行数:28,


示例13: ecore_x_fixes_selection_notification_request

EAPI Eina_Boolecore_x_fixes_selection_notification_request(Ecore_X_Atom selection){#ifdef ECORE_XCB_XFIXES   Ecore_X_Window root = 0;   xcb_void_cookie_t cookie;   xcb_generic_error_t *err;   int mask = 0;#endif   CHECK_XCB_CONN;   if (!_xfixes_avail) return EINA_FALSE;#ifdef ECORE_XCB_XFIXES   root = ((xcb_screen_t *)_ecore_xcb_screen)->root;   mask = (XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |           XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |           XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE);   cookie =     xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root,                                               selection, mask);   err = xcb_request_check(_ecore_xcb_conn, cookie);   if (err)     {        free(err);        return EINA_FALSE;     }   return EINA_TRUE;#endif   return EINA_FALSE;}
开发者ID:RomainNaour,项目名称:efl,代码行数:35,


示例14: screen_window_resize

ExcCode screen_window_resize(xcb_window_t window, int width, int height) {	xcb_window_t client_window;	find_toplevel_window(window, &client_window);	get_client_window(client_window, &client_window);		TRY(screen_window_unmaximize(client_window));		int coord, prev_width, prev_height;	TRY(screen_window_get_geometry(window, &coord, &coord,			&prev_width, &prev_height));	int prev_client_window_width, prev_client_window_height;	TRY(window_get_real_geometry(client_window, &coord, &coord,			&prev_client_window_width, &prev_client_window_height));	uint32_t values[2] = {		width - (prev_width - prev_client_window_width),		height - (prev_height - prev_client_window_height)	};    xcb_void_cookie_t cookie = xcb_configure_window_checked(display,			client_window, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,			values);	if (xcb_request_check(display, cookie) != NULL)		PANIC(ERR_X_REQUEST, "screen_window_resize (xcb_request_check)");    if (xcb_flush(display) <= 0)		PANIC(ERR_X_REQUEST, "screen_window_resize (xcb_flush)");	return 0;}
开发者ID:nkruglikov,项目名称:remoteink,代码行数:26,


示例15: get_font_id

/* * Returns the ID of the font matching the given pattern and stores the height * of the font (in pixels) in *font_height. die()s if no font matches. * */int get_font_id(xcb_connection_t *conn, char *pattern, int *font_height) {        xcb_void_cookie_t font_cookie;        xcb_list_fonts_with_info_cookie_t info_cookie;        /* Send all our requests first */        int result;        result = xcb_generate_id(conn);        font_cookie = xcb_open_font_checked(conn, result, strlen(pattern), pattern);        info_cookie = xcb_list_fonts_with_info(conn, 1, strlen(pattern), pattern);        xcb_generic_error_t *error = xcb_request_check(conn, font_cookie);        if (error != NULL) {                fprintf(stderr, "ERROR: Could not open font: %d/n", error->error_code);                exit(1);        }        /* Get information (height/name) for this font */        xcb_list_fonts_with_info_reply_t *reply = xcb_list_fonts_with_info_reply(conn, info_cookie, NULL);        if (reply == NULL)                errx(1, "Could not load font /"%s/"/n", pattern);        *font_height = reply->font_ascent + reply->font_descent;        return result;}
开发者ID:freexploit,项目名称:i3wm,代码行数:30,


示例16: screen_shm_init

ExcCode screen_shm_init() {	xcb_query_extension_cookie_t extension_cookie =			xcb_query_extension(display,			strlen(MIT_SHM_EXTENSION_NAME), MIT_SHM_EXTENSION_NAME);	xcb_query_extension_reply_t *extension_reply =			xcb_query_extension_reply(display, extension_cookie, NULL);	if (extension_reply == NULL)		PANIC(ERR_X_EXTENSION, MIT_SHM_EXTENSION_NAME);	free(extension_reply);	xcb_shm_query_version_cookie_t version_cookie =			xcb_shm_query_version(display);	xcb_shm_query_version_reply_t *version_reply =			xcb_shm_query_version_reply(display, version_cookie, NULL);	if (version_reply == NULL)		PANIC(ERR_X_EXTENSION, MIT_SHM_EXTENSION_NAME);	free(version_reply);		size_t max_size = screen->width_in_pixels * screen->height_in_pixels *			sizeof (unsigned);	shmid = shmget(IPC_PRIVATE, max_size, IPC_CREAT | 0777);	if (shmid < 0)		PANIC(ERR_SHM_ALLOC);			shmaddr = shmat(shmid, 0, 0);	if (shmaddr == (uint8_t *) -1)		PANIC(ERR_SHM_ATTACH);						shmseg = xcb_generate_id(display);	xcb_void_cookie_t attach_cookie = xcb_shm_attach_checked(display,			shmseg, shmid, 0);	if (xcb_request_check(display, attach_cookie) != NULL)		PANIC(ERR_SHM_ATTACH);	return 0;}
开发者ID:nkruglikov,项目名称:remoteink,代码行数:33,


示例17: screen_window_unmaximize

ExcCode screen_window_unmaximize(xcb_window_t window) {	xcb_atom_t net_wm_state,			net_wm_state_maximized_horz, net_wm_state_maximized_vert;	TRY(create_atom("_NET_WM_STATE", 0, &net_wm_state));	TRY(create_atom("_NET_WM_STATE_MAXIMIZED_HORZ", 0,			&net_wm_state_maximized_horz));	TRY(create_atom("_NET_WM_STATE_MAXIMIZED_VERT", 0,			&net_wm_state_maximized_vert));	xcb_client_message_event_t event;	event.response_type = XCB_CLIENT_MESSAGE;	event.format = 32;	event.sequence = 0;	event.window = window;	event.type = net_wm_state;	event.data.data32[0] = 0; // 0 - disable, 1 - enable, 2 - toggle	event.data.data32[1] = net_wm_state_maximized_horz;	event.data.data32[2] = net_wm_state_maximized_vert;	event.data.data32[3] = 0;	event.data.data32[4] = 0;	xcb_void_cookie_t cookie = xcb_send_event_checked(display, 0, root,			XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |			XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,			(const char*) &event);	if (xcb_request_check(display, cookie) != NULL)		PANIC(ERR_X_REQUEST, "screen_window_unmaximize (xcb_request_check)");	if (xcb_flush(display) <= 0)		PANIC(ERR_X_REQUEST, "screen_window_unmaximize (xcb_flush)");	return 0;}
开发者ID:nkruglikov,项目名称:remoteink,代码行数:29,


示例18: request_check

 virtual std::shared_ptr<xcb_generic_error_t> request_check(xcb_void_cookie_t cookie) const {   return std::shared_ptr<xcb_generic_error_t>(       xcb_request_check(m_c.get(), cookie)); }
开发者ID:jotrk,项目名称:xpp,代码行数:7,


示例19: OpenConnection

void InputImpl::setMousePosition(const Vector2i& position, const Window& relativeTo){    // Open a connection with the X server    xcb_connection_t* connection = OpenConnection();    WindowHandle handle = relativeTo.getSystemHandle();    if (handle)    {        ScopedXcbPtr<xcb_generic_error_t> error(xcb_request_check(                connection,                xcb_warp_pointer(                    connection,                    None,                  // Source window                    handle,                // Destination window                    0, 0,                  // Source position                    0, 0,                  // Source size                    position.x, position.y // Destination position                )                                                ));        if (error)            err() << "Failed to set mouse position" << std::endl;        xcb_flush(connection);    }    // Close the connection with the X server    CloseConnection(connection);}
开发者ID:Chaosus,项目名称:SFML,代码行数:29,


示例20: Display

static void Display(vout_display_t *vd, picture_t *pic){    vout_display_sys_t *sys = vd->sys;    xcb_connection_t *conn = sys->conn;    xcb_void_cookie_t ck;    vlc_xcb_Manage(vd, conn);    /* Copy the scaled picture into the target picture, in other words     * copy the rendered pixmap into the window.     */    ck = xcb_render_composite_checked(conn, XCB_RENDER_PICT_OP_SRC,                                      sys->picture.scale,                                      XCB_RENDER_PICTURE_NONE,                                      sys->picture.dest, 0, 0, 0, 0, 0, 0,                                      vd->cfg->display.width,                                      vd->cfg->display.height);    xcb_generic_error_t *e = xcb_request_check(conn, ck);    if (e != NULL) { /* Not all errors will be detected here. */        msg_Dbg(vd, "%s: RENDER error %d", "cannot composite",                e->error_code);        free(e);    }    (void) pic;}
开发者ID:mstorsjo,项目名称:vlc,代码行数:26,


示例21: CGSetDisplayTransferByTable

CGError CGSetDisplayTransferByTable(CGDirectDisplayID display, uint32_t gamma_size, const CGGammaValue* red,				    const CGGammaValue* green, const CGGammaValue* blue){  xcb_void_cookie_t gamma_cookie;  uint16_t r_int[256];  uint16_t g_int[256];  uint16_t b_int[256];  long i;  int32_t v;    if (gamma_size != 256)    {      fprintf(stderr, "Gamma size should be 256/n");      abort();    }    for (i = 0; i < 256; i++)    {      v = (int32_t)(red[i] * UINT16_MAX);      r_int[i] = (uint16_t)(v < 0 ? 0 : v > UINT16_MAX ? UINT16_MAX : v);            v = (int32_t)(green[i] * UINT16_MAX);      g_int[i] = (uint16_t)(v < 0 ? 0 : v > UINT16_MAX ? UINT16_MAX : v);            v = (int32_t)(blue[i] * UINT16_MAX);      b_int[i] = (uint16_t)(v < 0 ? 0 : v > UINT16_MAX ? UINT16_MAX : v);    }    gamma_cookie = xcb_randr_set_crtc_gamma_checked(conn, crtcs[display],						  (uint16_t)gamma_size, r_int, g_int, b_int);  return xcb_request_check(conn, gamma_cookie) == NULL ? kCGErrorSuccess : ~kCGErrorSuccess;}
开发者ID:prodigeni,项目名称:blueshift,代码行数:32,


示例22: check_error

/* * Checks a generic cookie for errors and quits with the given message if there * was an error. * */void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie, char *err_message) {    xcb_generic_error_t *error = xcb_request_check(conn, cookie);    if (error != NULL) {        fprintf(stderr, "ERROR: %s (X error %d)/n", err_message, error->error_code);        xcb_disconnect(conn);        exit(-1);    }}
开发者ID:Fresne,项目名称:i3-1,代码行数:13,


示例23: check_xcb_cookie

/* @brief Check the xcb cookie and prints an error if it has one. * * @param cookie A generic xcb cookie. * @param connection A connection to the Xorg server. * @param The error to be printed if the cookie contains an error. * @return */static inline int32_t check_xcb_cookie(xcb_void_cookie_t cookie, xcb_connection_t *connection, char *error) {  xcb_generic_error_t *xcb_error = xcb_request_check(connection, cookie);  if (xcb_error) {    fprintf(stderr, "[error:%"PRIu8"] %s/n", xcb_error->error_code, error);    return 1;  }  return 0;}
开发者ID:olzraiti,项目名称:dotfiles,代码行数:15,


示例24: main

int main(int argc, char **argv) {    uint32_t width = test_width - 2 * INSET_X;    uint32_t height = test_height - 2 * INSET_Y;    int snum;    xcb_void_cookie_t check_cookie;    xcb_window_t w;    xcb_gcontext_t gc;    xcb_pixmap_t pix;    xcb_connection_t *c = xcb_connect(0, &snum);    xcb_screen_t *s = xcb_aux_get_screen(c, snum);    xcb_alloc_named_color_cookie_t bg_cookie =	xcb_alloc_named_color(c, s->default_colormap,			      strlen("white"), "white");    xcb_alloc_named_color_cookie_t fg_cookie =	xcb_alloc_named_color(c, s->default_colormap,			      strlen("black"), "black");    xcb_alloc_named_color_reply_t *bg_reply =	xcb_alloc_named_color_reply(c, bg_cookie, 0);    xcb_alloc_named_color_reply_t *fg_reply =	xcb_alloc_named_color_reply(c, fg_cookie, 0);    uint32_t fg, bg;    xcb_image_t *image, *native_image, *subimage;    uint32_t mask = 0;    xcb_params_gc_t gcv;    assert(bg_reply && fg_reply);    bg = bg_reply->pixel;    fg = fg_reply->pixel;    free(bg_reply);    free(fg_reply);    w = make_window(c, s, bg, fg, width, height);    gc = xcb_generate_id(c);    check_cookie = xcb_create_gc_checked(c, gc, w, 0, 0);    assert(!xcb_request_check(c, check_cookie));    image = xcb_image_create_from_bitmap_data((uint8_t *)test_bits,					      test_width, test_height);    native_image = xcb_image_native(c, image, 1);    assert(native_image);    if (native_image != image)	xcb_image_destroy(image);    subimage = xcb_image_subimage(native_image, INSET_X, INSET_Y,				  width, height,				  0, 0, 0);    assert(subimage);    xcb_image_destroy(native_image);    subimage->format = XCB_IMAGE_FORMAT_XY_BITMAP;    pix = xcb_generate_id(c);    xcb_create_pixmap(c, s->root_depth, pix, w,		      subimage->width, subimage->height);    gc = xcb_generate_id(c);    XCB_AUX_ADD_PARAM(&mask, &gcv, foreground, fg);    XCB_AUX_ADD_PARAM(&mask, &gcv, background, bg);    xcb_aux_create_gc(c, gc, pix, mask, &gcv);    xcb_image_put(c, pix, gc, subimage, 0, 0, 0);    process_events(c, gc, w, pix, width, height);    xcb_disconnect(c);    return 1;}
开发者ID:freedesktop-unofficial-mirror,项目名称:xcb__util-image,代码行数:58,


示例25: check_request

void check_request(xcb_connection_t *dpy, xcb_void_cookie_t cookie, char *msg){	xcb_generic_error_t *err = xcb_request_check(dpy, cookie);	if (err != NULL) {		fprintf(stderr, "%s: error code: %u./n", msg, err->error_code);		xcb_disconnect(dpy);		exit(-1);	}}
开发者ID:Dissonant-Tech,项目名称:bspwm,代码行数:9,


示例26: register_events

void register_events(void){    uint32_t values[] = {ROOT_EVENT_MASK};    xcb_generic_error_t *e = xcb_request_check(dpy, xcb_change_window_attributes_checked(dpy, screen->root, XCB_CW_EVENT_MASK, values));    if (e != NULL) {        xcb_disconnect(dpy);        err("another WM is already running/n");    }}
开发者ID:sunaku,项目名称:bspwm,代码行数:9,


示例27: screen_cursor_set_position

ExcCode screen_cursor_set_position(int x, int y) {	xcb_void_cookie_t cookie =			xcb_warp_pointer(display, XCB_NONE, root, 0, 0, 0, 0, x, y);	if (xcb_request_check(display, cookie) != NULL)		PANIC(ERR_X_REQUEST, "screen_cursor_set_position (xcb_request_check)");	if (xcb_flush(display) <= 0)		PANIC(ERR_X_REQUEST, "screen_cursor_set_position (xcb_flush)");	return 0;}
开发者ID:nkruglikov,项目名称:remoteink,代码行数:9,


示例28: run

int run(config_t* config, key_handler_t key_handler){    int default_screen;    xcb_connection_t* c = xcb_connect(NULL, &default_screen);    if(xcb_connection_has_error(c))    {		fprintf(stderr, "Cannot open display %s/n",                getenv("DISPLAY") ? getenv("DISPLAY") : "<NULL>");        return -1;    }    xcb_screen_t* screen;    if(!(screen = xcb_aux_get_screen(c, default_screen)))    {        fprintf(stderr, "Cannot obtain default screen./n");        return -1;    }    context_t context = { config, key_handler };    xcb_event_handlers_t eh;    memset(&eh, 0, sizeof(xcb_event_handlers_t));    xcb_event_handlers_init(c, &eh);    xcb_event_set_key_press_handler(&eh, handle_keypress, &context);    xcb_void_cookie_t* cookies = alloca(sizeof(xcb_void_cookie_t)                                             * config->count);    if(!cookies)        return -1;    int i;    for(i = 0; i < config->count; ++i)        cookies[i] = xcb_grab_key(c, true, screen->root,                                  config->keys[i].is_alt ? XCB_MOD_MASK_1 : 0,                                  config->keys[i].keysym, XCB_GRAB_MODE_ASYNC,                                  XCB_GRAB_MODE_ASYNC);    for(i = 0; i < config->count; ++i)    {        xcb_generic_error_t* e = xcb_request_check(c, cookies[i]);        if(e)        {            fprintf(stderr, "WARNING: unable to grab key: %d/n", e->error_code);            free(e);        }    }    xcb_generic_event_t* e;    while((e = xcb_wait_for_event(c)))    {        xcb_event_handle(&eh, e);        free(e);    }    return 0;}
开发者ID:OpenInkpot-archive,项目名称:uk,代码行数:56,



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


C++ xcb_setup_roots_iterator函数代码示例
C++ xcb_map_window函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。