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

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

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

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

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

示例1: 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,


示例2: deploy

static intdeploy(void){	/* init xcb and grab events */	uint32_t values[2];	int mask;	if (xcb_connection_has_error(conn = xcb_connect(NULL, NULL)))		return -1;	scr = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;	focuswin = scr->root;#ifdef ENABLE_MOUSE	xcb_grab_button(conn, 0, scr->root, XCB_EVENT_MASK_BUTTON_PRESS |			XCB_EVENT_MASK_BUTTON_RELEASE, XCB_GRAB_MODE_ASYNC,			XCB_GRAB_MODE_ASYNC, scr->root, XCB_NONE, 1, MOD);	xcb_grab_button(conn, 0, scr->root, XCB_EVENT_MASK_BUTTON_PRESS |			XCB_EVENT_MASK_BUTTON_RELEASE, XCB_GRAB_MODE_ASYNC,			XCB_GRAB_MODE_ASYNC, scr->root, XCB_NONE, 3, MOD);#endif	mask = XCB_CW_EVENT_MASK;	values[0] = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY;	xcb_change_window_attributes_checked(conn, scr->root, mask, values);	xcb_flush(conn);	return 0;}
开发者ID:Uladox,项目名称:.sxhkd.d,代码行数:31,


示例3: xcb_connect

	void SimplicityApplication::initialize_x_connection(void)	{		int nScreenNum = 0;		m_pXConnection = xcb_connect(m_sDisplayName.c_str(), &nScreenNum);		if (check_xcb_connection(m_pXConnection))		{			xcb_disconnect(m_pXConnection);			m_bRunning = false;			return;		}		xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(m_pXConnection));		for (int i = 0; i != nScreenNum; i++)			xcb_screen_next(&iter);		m_pRootScreen = iter.data;		if (m_pRootScreen == nullptr)		{			global_log_error << "Could not get the current screen. Exiting";			xcb_disconnect(m_pXConnection);			m_bRunning = false;		}		global_log_debug << "Root screen dimensions: "						 << m_pRootScreen->width_in_pixels						 << "x"						 << m_pRootScreen->height_in_pixels;		global_log_debug << "Root window: "						 << m_pRootScreen->root;	}
开发者ID:durandj,项目名称:simplicity,代码行数:31,


示例4: main

int main(int argc, char **argv) {    (void)argc;    (void)argv;    /* open connection with the server */    nil_.con = xcb_connect(0, 0);    if (xcb_connection_has_error(nil_.con)) {        NIL_ERR("xcb_connect %p", (void *)nil_.con);        exit(1);    }    /* 1st stage */    if ((init_screen() != 0) || (init_key() != 0) || (init_mouse() != 0)) {        xcb_disconnect(nil_.con);        exit(1);    }    /* 2nd stage */    if ((init_cursor() != 0) || (init_color() != 0) != (init_font() != 0)        || (init_bar() != 0) || (init_wm() != 0))  {        cleanup();        exit(1);    }    xcb_flush(nil_.con);    recv_events();    cleanup();    return 0;}
开发者ID:nqv,项目名称:nilwm,代码行数:26,


示例5: NGBInit

void NGBInit(){	event = NULL;	mask = 0;	con = xcb_connect(":0.0", NULL); //打开连接	if(xcb_connection_has_error(con))	{		printf("Cannot open display/n");		exit(1);	}	screen = xcb_setup_roots_iterator(xcb_get_setup(con)).data;	win = screen->root;	foreground = xcb_generate_id(con);	mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;	values[0] = screen->black_pixel;	values[1] = 0;	xcb_create_gc(con, foreground, win, mask, values);	win = xcb_generate_id(con);	mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;	values[0] = screen->white_pixel;	values[1] = XCB_EVENT_MASK_EXPOSURE;}
开发者ID:moemoechu,项目名称:NyanGraph2,代码行数:27,


示例6: main

int main(void){  xcb_connection_t    *conn;  xcb_screen_t        *screen;  xcb_window_t         win;  xcb_gcontext_t       gcontext;  xcb_generic_event_t *event;  uint32_t             mask;  uint32_t             values[2];                          /* open connection with the server */  conn = xcb_connect(NULL,NULL);  if (xcb_connection_has_error(conn)) {    printf("Cannot open display/n");    exit(1);  }                        /* get the first screen */  screen = xcb_setup_roots_iterator( xcb_get_setup(conn) ).data;                        /* create black graphics gcontext */  gcontext = xcb_generate_id(conn);  win = screen->root;  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;  values[0] = screen->black_pixel;  values[1] = 0;  xcb_create_gc(conn, gcontext, win, mask, values);                        /* create window */  win = xcb_generate_id(conn);  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;  values[0] = screen->white_pixel;  values[1] = XCB_EVENT_MASK_EXPOSURE               | XCB_EVENT_MASK_KEY_PRESS              | XCB_EVENT_MASK_KEY_RELEASE;  xcb_create_window(conn, screen->root_depth, win, screen->root,                    10, 10, 100, 100, 1,                    XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual,                    mask, values);                         /* map (show) the window */  xcb_map_window(conn, win);   xcb_flush(conn);  cterm_add_event_listener(XCB_KEY_PRESS, output_string);  cterm_add_event_listener(XCB_KEY_PRESS, close_window);                         /* event loop */  while (!done) {    event = xcb_poll_for_event(conn);    if(event == NULL) continue;    cterm_handle_event(event);    free(event);  }                        /* close connection to server */  xcb_disconnect(conn);  cterm_free_event_handlers();  return 0;}
开发者ID:TheNeikos,项目名称:cterm,代码行数:60,


示例7: init

void init(void){    int scrno;    xcb_screen_iterator_t iter;        conn = xcb_connect(NULL, &scrno);    if (!conn)    {        fprintf(stderr, "can't connect to an X server/n");        exit(1);    }    iter = xcb_setup_roots_iterator(xcb_get_setup(conn));    for (int i = 0; i < scrno; ++i)    {        xcb_screen_next(&iter);    }    screen = iter.data;    if (!screen)    {        fprintf(stderr, "can't get the current screen/n");        xcb_disconnect(conn);        exit(1);    }}
开发者ID:satran,项目名称:mcwm,代码行数:28,


示例8: main

int main() {  /* Open the connection to the server. Use de DISPLAY enviroment variable */  int i, screenNum;  xcb_connection_t *connection = xcb_connect(NULL, &screenNum);  // Get the screen whose number is screenNum  const xcb_setup_t *setup = xcb_get_setup(connection);  xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);  // We want the screen at index screenNum of the iterator  for (i = 0; i < screenNum; i++) {    xcb_screen_next(&iter);  }  xcb_screen_t *screen = iter.data;  // report  printf("/n");  printf("Informations of screen %" PRIu32 "/n", screen->root);  printf("  width.........: %" PRIu16 "/n", screen->width_in_pixels);  printf("  height........: %" PRIu16 "/n", screen->height_in_pixels);  printf("  white_pixel...: %" PRIu32 "/n", screen->white_pixel);  printf("  black pixel...: %" PRIu32 "/n", screen->black_pixel);  printf("/n");  return 0;}
开发者ID:heliogabalo,项目名称:The-side-of-the-source,代码行数:27,


示例9: xcb_connect

xcb_window_t LinuxWindowCapture::FindWindow( const QString& instanceName, const QString& windowClass ) {  xcb_window_t window = static_cast< xcb_window_t > ( 0 );  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_window_t root = screen->root;  QList< xcb_window_t > windows = listWindowsRecursive( dpy, root );  foreach( const xcb_window_t& win, windows ) {    xcb_icccm_get_wm_class_reply_t wmNameR;    xcb_get_property_cookie_t wmClassC = xcb_icccm_get_wm_class( dpy, win );    if ( xcb_icccm_get_wm_class_reply( dpy, wmClassC, &wmNameR, NULL ) ) {      if( !qstrcmp( wmNameR.class_name, windowClass.toStdString().c_str() ) ||          !qstrcmp( wmNameR.instance_name, instanceName.toStdString().c_str() ) ) {          qDebug() << wmNameR.instance_name;          qDebug() << wmNameR.class_name;          window = win;          break;      }    }  }
开发者ID:xkoan,项目名称:track-o-bot,代码行数:28,


示例10: init_vk

int vkDisplay::init(const unsigned int gpu_idx){    //m_gpuIdx = gpu_idx;#if 0    VkResult result = init_vk(gpu_idx);    if (result != VK_SUCCESS) {        vktrace_LogError("could not init vulkan library");        return -1;    } else {        m_initedVK = true;    }#endif#if defined(PLATFORM_LINUX)    const xcb_setup_t *setup;    xcb_screen_iterator_t iter;    int scr;    m_pXcbConnection = xcb_connect(NULL, &scr);    setup = xcb_get_setup(m_pXcbConnection);    iter = xcb_setup_roots_iterator(setup);    while (scr-- > 0)        xcb_screen_next(&iter);    m_pXcbScreen = iter.data;#endif    return 0;}
开发者ID:Dr-Shadow,项目名称:VulkanTools,代码行数:25,


示例11: main

int main(int argc, char **argv){	xcb_connection_t *c = xcb_connect(0, 0);	xcb_screen_t *s = xcb_setup_roots_iterator(xcb_get_setup(c)).data;	int w, h, n,		depth = s->root_depth,		win_class = XCB_WINDOW_CLASS_INPUT_OUTPUT,		format = XCB_IMAGE_FORMAT_Z_PIXMAP;	xcb_colormap_t colormap = s->default_colormap;	xcb_drawable_t win = xcb_generate_id(c);	xcb_gcontext_t gc = xcb_generate_id(c);	xcb_pixmap_t pixmap = xcb_generate_id(c);	xcb_generic_event_t *ev;	xcb_image_t *image;	char *data = NULL;	uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,		value_mask = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS,		values[] = { s->black_pixel, value_mask };	if (argc<2) return -1;	data = stbi_load(argv[1], &w, &h, &n, 4);	if (data) {		unsigned *dp = (unsigned *)data;		size_t i, len = w*h;		for(i=0;i<len;i++) //rgba to bgra			dp[i]=dp[i]&0xff00ff00|((dp[i]>>16)&0xFF)|((dp[i]<<16)&0xFF0000);	}else return -1;
开发者ID:technosaurus,项目名称:stb,代码行数:26,


示例12: main

int main(){    /* Open the connection to the X server */    xcb_connection_t *connection = xcb_connect(NULL, NULL);    /* Get the first screen */    const xcb_setup_t  *setup = xcb_get_setup(connection);    xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);    xcb_screen_t  *screen = iter.data;    /* Create the window */    xcb_window_t window = xcb_generate_id(connection);    xcb_create_window(connection,                 /* Connection */                      XCB_COPY_FROM_PARENT,      /* depth (same as root) */                      window,                     /* window Id */                      screen->root,               /* parent window */                      0, 0,                       /* x, y */                      150, 150,                   /* width, height */                      10,                         /* border_width */                      XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */                      screen->root_visual,        /* visual */                      0, NULL);                   /* masks, not used yet */    /* Map the window on the screen */    xcb_map_window(connection, window);    /* Make sure commands are sent before we pause so that the window gets shown */    xcb_flush(connection);    pause(); /* hold client until Ctrl-C */    xcb_disconnect(connection);    return 0;}
开发者ID:suxor,项目名称:graphic-samples,代码行数:35,


示例13: xcb_connect

bool X11IdleDetector::idleCheckPossible(){    m_connection = xcb_connect(NULL, NULL); //krazy:exclude=null    m_screen = xcb_setup_roots_iterator(xcb_get_setup(m_connection)).data;    if (m_screen)        return true;    return false;}
开发者ID:KDAB,项目名称:Charm,代码行数:8,


示例14: xcb_connect

xcb_connection_t *X11Info::xcbConnection(){    if (!_xcb) {        _xcb = xcb_connect(NULL, &_xcbPreferredScreen);        Q_ASSERT(_xcb);    }    return _xcb;}
开发者ID:eta-im-dev,项目名称:eta-im-snapshots,代码行数:8,


示例15: 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,


示例16: _cairo_boilerplate_xcb_create_surface

cairo_surface_t *_cairo_boilerplate_xcb_create_surface (const char		 *name,				       cairo_content_t		  content,				       int			  width,				       int			  height,				       int			  max_width,				       int			  max_height,				       cairo_boilerplate_mode_t	  mode,				       int                        id,				       void			**closure){    xcb_screen_t *root;    xcb_target_closure_t *xtc;    xcb_connection_t *c;    xcb_render_pictforminfo_t *render_format;    xcb_pict_standard_t format;    *closure = xtc = xmalloc (sizeof (xcb_target_closure_t));    if (width == 0)	width = 1;    if (height == 0)	height = 1;    xtc->c = c = xcb_connect(NULL,NULL);    if (xcb_connection_has_error(c)) {	fprintf (stderr, "Failed to connect to X server through XCB/n");	return NULL;    }    root = xcb_setup_roots_iterator(xcb_get_setup(c)).data;    xtc->pixmap = xcb_generate_id (c);    xcb_create_pixmap (c, 32, xtc->pixmap, root->root,			 width, height);    switch (content) {    case CAIRO_CONTENT_COLOR:	format = XCB_PICT_STANDARD_RGB_24;	break;    case CAIRO_CONTENT_COLOR_ALPHA:	format = XCB_PICT_STANDARD_ARGB_32;	break;    case CAIRO_CONTENT_ALPHA:  /* would be XCB_PICT_STANDARD_A_8 */    default:	fprintf (stderr, "Invalid content for XCB test: %d/n", content);	return NULL;    }    render_format = xcb_render_util_find_standard_format (xcb_render_util_query_formats (c), format);    if (render_format->id == 0)	return NULL;    return cairo_xcb_surface_create_with_xrender_format (c, xtc->pixmap, root,							 render_format,							 width, height);}
开发者ID:AliYousuf,项目名称:cairo,代码行数:57,


示例17: iterate_screens

int iterate_screens(int, char **){    xcb_connection_t *conn = xcb_connect(0, 0);    xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(conn));    std::vector<xcb_screen_t> screens;    std::copy(i, xcb::end(i), std::back_inserter(screens));    assert(screens.size() == xcb_setup_roots_length(xcb_get_setup(conn)));    return EXIT_SUCCESS;}
开发者ID:amezin,项目名称:xcb-cpp,代码行数:9,


示例18: Open

/***************************************************************************** * Open: *****************************************************************************/static int Open( vlc_object_t *p_this ){    intf_thread_t *p_intf = (intf_thread_t *)p_this;    intf_sys_t *p_sys;    p_intf->p_sys = p_sys = calloc( 1, sizeof(*p_sys) );    if( !p_sys )        return VLC_ENOMEM;    char *psz_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );    int i_screen_default;    p_sys->p_connection = xcb_connect( psz_display, &i_screen_default );    free( psz_display );    if( !p_sys->p_connection )        goto error;    /* Get the root windows of the default screen */    const xcb_setup_t* xcbsetup = xcb_get_setup( p_sys->p_connection );    if( !xcbsetup )        goto error;    xcb_screen_iterator_t iter = xcb_setup_roots_iterator( xcbsetup );    for( int i = 0; i < i_screen_default; i++ )    {        if( !iter.rem )            break;        xcb_screen_next( &iter );    }    if( !iter.rem )        goto error;    p_sys->root = iter.data->root;    /* */    p_sys->p_symbols = xcb_key_symbols_alloc( p_sys->p_connection ); // FIXME    if( !p_sys->p_symbols )        goto error;    Mapping( p_intf );    Register( p_intf );    if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )    {        Unregister( p_intf );        free( p_sys->p_map );        goto error;    }    return VLC_SUCCESS;error:    if( p_sys->p_symbols )        xcb_key_symbols_free( p_sys->p_symbols );    if( p_sys->p_connection )        xcb_disconnect( p_sys->p_connection );    free( p_sys );    return VLC_EGENERIC;}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:60,


示例19: xcb_connect

egl::Error DisplayVkXcb::initialize(egl::Display *display){    mXcbConnection = xcb_connect(nullptr, nullptr);    if (mXcbConnection == nullptr)    {        return egl::EglNotInitialized();    }    return DisplayVk::initialize(display);}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,


示例20: leaf_init

static leaf_error_t leaf_init(){	int first_screen = 0;	xcb_screen_iterator_t iter;	struct sigaction action;	uint32_t values;	xcb_void_cookie_t cookie;	xcb_generic_error_t *status = NULL;	gconf.running = false;	action.sa_handler = stop_signal_handler;	action.sa_flags = 0;	sigemptyset(&action.sa_mask);	/* Catch signals */	/*	 * TODO: Catch sighup	 */	sigaction(SIGINT, &action, NULL);	sigaction(SIGTERM, &action, NULL);	/* Initialize connection to the X server */	gconf.conn = xcb_connect(NULL, &first_screen);	if (xcb_connection_has_error(gconf.conn)) {		print_e("Cannot initialize connection to the X server");		return ERR_CONN;	}	print_d("First screen = %i", first_screen);	/* Get back X data */	gconf.xsetup = xcb_get_setup(gconf.conn);	/* Find the first screen */	iter = xcb_setup_roots_iterator(gconf.xsetup);	while (first_screen--)		xcb_screen_next(&iter);	gconf.screen = iter.data;	/* Configure the root screen to get window's events */	values = /		XCB_EVENT_MASK_STRUCTURE_NOTIFY |		XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY;	cookie = xcb_change_window_attributes_checked(gconf.conn,	                                              gconf.screen->root,	                                              XCB_CW_EVENT_MASK,	                                              &values);	status = xcb_request_check(gconf.conn, cookie);	xcb_flush(gconf.conn);    if (status)    {	    print_d("X is busy, another window manager may be running (%d)",	            status->error_code);	    free(status);	    return ERR_CONN;    }	return ERR_NONE;}
开发者ID:shaoner,项目名称:leaf,代码行数:56,


示例21: 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,


示例22: setup

static void setup(void) {    int screennr;    conn = xcb_connect(NULL, &screennr);    if (xcb_connection_has_error(conn)) {        fprintf(stderr, "Failed to connect to X11 server./n");        exit(EXIT_FAILURE);    }    screen = xcb_aux_get_screen(conn, 0);}
开发者ID:Airblader,项目名称:xcb-util-xrm,代码行数:10,


示例23: QTimer

Watcher::Watcher() : QTimer(){    connection = xcb_connect (NULL, NULL);    screen = xcb_setup_roots_iterator (xcb_get_setup (connection)).data;    xcb_dpms_disable (connection);    connect(this, SIGNAL(timeout()), this, SLOT(onTimeout()));    setInterval(1000);    start();}
开发者ID:gpocentek,项目名称:qslsaver,代码行数:10,


示例24: main

intmain(int argc, char *argv[]){  /* TODO: Accept DISPLAY environment or --display arguments */  xcb_connection_t *conn = xcb_connect(NULL, NULL);  towel_window_t *win = NULL;  for (;;) {    if (win == NULL) {      win = towel_create_window(conn);      towel_window_hide_cursor(win);    }    sleep(CHECK_PERIOD);    towel_window_update_working_time(win, CHECK_PERIOD);    if (win->idle_time > REST_TIME)      win->working_time = 0;    /* TODO: option processing */    if (win->working_time > WORKING_TIME) {      time_t prev = time(NULL);      towel_window_map(win);      xcb_flush(conn);      for (;;) {        xcb_generic_event_t *event = xcb_wait_for_event(conn);        if ((event->response_type & ~0x80) == XCB_EXPOSE) {#if !DEBUG          towel_window_grab_input(win);#endif          towel_window_render_time(win, REST_TIME);          xcb_flush(conn);          break;        }        free(event);      }      for (;;) {        int delta = time(NULL) - prev;        towel_window_render_time(win, REST_TIME - delta);        xcb_flush(conn);        if (delta >= REST_TIME) {          towel_window_unmap(win);          towel_window_destroy(win);          win = NULL;          xcb_flush(conn);          break;        }        sleep(1);      }    }  }  if (win)    towel_window_destroy(win);  xcb_disconnect(conn);  return EXIT_SUCCESS;}
开发者ID:kanru,项目名称:towel,代码行数:55,


示例25: main

intmain (){    xcb_connection_t*       connection;    xcb_screen_t*           screen;    xcb_window_t            root_window;    xcb_alloc_color_reply_t *color_reply;    xcb_colormap_t          colormap = { 0 };    uint32_t                params[1];    uint16_t                r,g,b;    connection = xcb_connect(NULL, NULL);    if (!connection) {        fprintf(stderr, "ERROR: can't connect to an X server/n");        return -1;    }    screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;    if (!screen)    {        fprintf(stderr, "ERROR: can't setup a screen/n");        xcb_disconnect(connection);        return -1;    }    root_window = screen->root;    colormap = screen->default_colormap;    r = 60000, g = 20000, b = 20000;    color_reply = xcb_alloc_color_reply(connection,            xcb_alloc_color(connection, colormap, r, g, b), NULL);    if(!color_reply)    {        fprintf(stderr, "ERROR: can't alloc an color/n");        xcb_disconnect(connection);        return 0;    }    params[0] = color_reply->pixel;    // sets the root_window back_pixel to pixel(params)    xcb_change_window_attributes(connection, root_window, XCB_CW_BACK_PIXEL, params);    // free color resources    free(color_reply);    // waits all things are send??    xcb_flush(connection);    // xcb_destroy_window(connection, window);    xcb_disconnect(connection);    return 0;}
开发者ID:tossu,项目名称:xcb-fun,代码行数:55,


示例26: m_displayName

QXcbConnection::QXcbConnection(const char *displayName)    : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))#ifdef XCB_USE_DRI2    , m_dri2_major(0)    , m_dri2_minor(0)    , m_dri2_support_probed(false)    , m_has_support_for_dri2(false)#endif{    int primaryScreen = 0;#ifdef XCB_USE_XLIB    Display *dpy = XOpenDisplay(m_displayName.constData());    primaryScreen = DefaultScreen(dpy);    m_connection = XGetXCBConnection(dpy);    XSetEventQueueOwner(dpy, XCBOwnsEventQueue);    m_xlib_display = dpy;#ifdef XCB_USE_EGL    EGLDisplay eglDisplay = eglGetDisplay(dpy);    m_egl_display = eglDisplay;    EGLint major, minor;    eglBindAPI(EGL_OPENGL_ES_API);    m_has_egl = eglInitialize(eglDisplay,&major,&minor);#endif //XCB_USE_EGL#else    m_connection = xcb_connect(m_displayName.constData(), &primaryScreen);#endif //XCB_USE_XLIB    m_setup = xcb_get_setup(xcb_connection());    initializeAllAtoms();    xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup);    int screenNumber = 0;    while (it.rem) {        m_screens << new QXcbScreen(this, it.data, screenNumber++);        xcb_screen_next(&it);    }    m_keyboard = new QXcbKeyboard(this);#ifdef XCB_USE_DRI2    initializeDri2();#endif    QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);    connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents()));    QAbstractEventDispatcher *dispatcher = QAbstractEventDispatcher::instance(qApp->thread());    connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents()));    sync();}
开发者ID:stephaneAG,项目名称:PengPod700,代码行数:54,


示例27: pipe_loader_drm_x_auth

static voidpipe_loader_drm_x_auth(int fd){#ifdef HAVE_PIPE_LOADER_XCB   /* Try authenticate with the X server to give us access to devices that X    * is running on. */   xcb_connection_t *xcb_conn;   const xcb_setup_t *xcb_setup;   xcb_screen_iterator_t s;   xcb_dri2_connect_cookie_t connect_cookie;   xcb_dri2_connect_reply_t *connect;   drm_magic_t magic;   xcb_dri2_authenticate_cookie_t authenticate_cookie;   xcb_dri2_authenticate_reply_t *authenticate;   int screen;   xcb_conn = xcb_connect(NULL, &screen);   if(!xcb_conn)      return;   xcb_setup = xcb_get_setup(xcb_conn);  if (!xcb_setup)    goto disconnect;   s = xcb_setup_roots_iterator(xcb_setup);   connect_cookie = xcb_dri2_connect_unchecked(xcb_conn,                                               get_xcb_screen(s, screen)->root,                                               XCB_DRI2_DRIVER_TYPE_DRI);   connect = xcb_dri2_connect_reply(xcb_conn, connect_cookie, NULL);   if (!connect || connect->driver_name_length                   + connect->device_name_length == 0) {      goto disconnect;   }   if (drmGetMagic(fd, &magic))      goto disconnect;   authenticate_cookie = xcb_dri2_authenticate_unchecked(xcb_conn,                                                         s.data->root,                                                         magic);   authenticate = xcb_dri2_authenticate_reply(xcb_conn,                                              authenticate_cookie,                                              NULL);   FREE(authenticate);disconnect:   xcb_disconnect(xcb_conn);#endif}
开发者ID:Gnurou,项目名称:mesa,代码行数:54,


示例28: _xcb_connect

static PyObject * _xcb_connect(PyObject *self, PyObject *args){    xcb_connection_t *connection;    /*    if (!PyArg_ParseTuple(args, "ls", &panel, &font))        return NULL;        */    connection = xcb_connect(0, 0);    _init_atoms(connection);    return Py_BuildValue("l", connection);}
开发者ID:Roger,项目名称:caw,代码行数:11,


示例29: init_xcb

intinit_xcb(xcb_connection_t **con){    *con = xcb_connect(NULL, NULL);        if (xcb_connection_has_error(*con)) {	perror("unable to connect to the X server");	return -1;    }    return 0;}
开发者ID:imwally,项目名称:tabover,代码行数:12,



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


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