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

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

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

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

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

示例1: initScreen

void initScreen() {    /* Open Xlib Display */    display = XOpenDisplay(0);    if (!display) printf("Can't open display");    default_screen = ((_XPrivDisplay)display)->default_screen;    /* Get the XCB connection from the display */    connection = XGetXCBConnection(display);    if (!connection) printf("Can't get xcb connection from display");    /* Acquire event queue ownership */    XSetEventQueueOwner(display, XCBOwnsEventQueue);    /* Find XCB screen */    screen = 0;    xcb_screen_iterator_t screen_iter =            xcb_setup_roots_iterator(xcb_get_setup(connection));    for (int screen_num = default_screen;        screen_iter.rem && screen_num > 0;        --screen_num, xcb_screen_next(&screen_iter));    screen = screen_iter.data;/*  width = screen->width_in_pixels;  height = screen->height_in_pixels;*/  width = 250;  height = 260;}
开发者ID:lubosz,项目名称:smalldemo,代码行数:30,


示例2: systray_process_client_message

/** Handle systray message. * /param ev The event. * /return 0 on no error. */intsystray_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;}
开发者ID:azuwis,项目名称:awesome,代码行数:31,


示例3: _best_depth_get

static int_best_depth_get(int backend, void *connection, int screen){   if (!connection) return 0;#ifdef BUILD_ENGINE_SOFTWARE_XLIB   if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)     {        return DefaultDepth((Display *)connection, screen);     }#endif#ifdef BUILD_ENGINE_SOFTWARE_XCB   if (backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB)     {        xcb_screen_iterator_t iter_screen;        xcb_screen_t          *s;        iter_screen = xcb_setup_roots_iterator(xcb_get_setup((xcb_connection_t *)connection));        for (; iter_screen.rem; --screen, xcb_screen_next (&iter_screen))          if (screen == 0)            {               s = iter_screen.data;               break;            }        return s->root_depth;     }#endif   return 0;}
开发者ID:OpenInkpot-archive,项目名称:iplinux-evas,代码行数:32,


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


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


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


示例7: xcb_setup_roots_iterator

void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask){    if (pos)        *pos = QPoint();    xcb_screen_iterator_t it = xcb_setup_roots_iterator(c->setup());    while (it.rem) {        xcb_window_t root = it.data->root;        xcb_query_pointer_cookie_t cookie = xcb_query_pointer(c->xcb_connection(), root);        xcb_generic_error_t *err = 0;        xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(c->xcb_connection(), cookie, &err);        if (!err && reply) {            if (pos)                *pos = QPoint(reply->root_x, reply->root_y);            if (rootWin)                *rootWin = root;            if (keybMask)                *keybMask = reply->mask;            free(reply);            return;        }        free(err);        free(reply);        xcb_screen_next(&it);    }}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:25,


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


示例9: 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:ZLixing,项目名称:VulkanTools,代码行数:25,


示例10: has_required_depths

static inthas_required_depths (xcb_connection_t *c){    xcb_screen_iterator_t screens;    xcb_pixmap_t pixmap = { -1 };    for (screens = xcb_setup_roots_iterator(xcb_get_setup(c)); screens.rem; xcb_screen_next(&screens))    {	xcb_depth_iterator_t depths;	uint32_t missing = REQUIRED_DEPTHS;	xcb_drawable_t root;	for (depths = xcb_screen_allowed_depths_iterator(screens.data); depths.rem; xcb_depth_next(&depths))	    missing &= ~DEPTH_MASK(depths.data->depth);	if (!missing)	    continue;	/*	 * Ok, this is ugly.  It should be sufficient at this	 * point to just return false, but Xinerama is broken at	 * this point and only advertises depths which have an	 * associated visual.  Of course, the other depths still	 * work, but the only way to find out is to try them.	 */	if (pixmap == -1)	    pixmap = xcb_generate_id(c);	root = screens.data->root;	if (!pixmap_depths_usable (c, missing, pixmap, root))	    return 0;    }    return 1;}
开发者ID:aosm,项目名称:X11libs,代码行数:31,


示例11: _cairo_xcb_screen_from_visual

static xcb_screen_t *_cairo_xcb_screen_from_visual (xcb_connection_t *connection,			       xcb_visualtype_t *visual,			       int *depth){    xcb_depth_iterator_t d;    xcb_screen_iterator_t s;    s = xcb_setup_roots_iterator (xcb_get_setup (connection));    for (; s.rem; xcb_screen_next (&s)) {	if (s.data->root_visual == visual->visual_id) {	    *depth = s.data->root_depth;	    return s.data;	}	d = xcb_screen_allowed_depths_iterator(s.data);	for (; d.rem; xcb_depth_next (&d)) {	    xcb_visualtype_iterator_t v = xcb_depth_visuals_iterator (d.data);	    for (; v.rem; xcb_visualtype_next (&v)) {		if (v.data->visual_id == visual->visual_id) {		    *depth = d.data->depth;		    return s.data;		}	    }	}    }    return NULL;}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:30,


示例12: 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:RP-Deliverance,项目名称:2bwm,代码行数:28,


示例13: xcb_setup_roots_iterator

xcb_screen_t* IdlenessWatcher::screenOfDisplay(xcb_connection_t* conn, int screen){    xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(conn));    for (; iter.rem; --screen, xcb_screen_next(&iter))        if (screen == 0)            return iter.data;    return NULL;}
开发者ID:Ilya87,项目名称:lxqt-powermanagement,代码行数:8,


示例14: xconn_get_root

static xcb_window_t xconn_get_root(xconn_t c){	const xcb_setup_t *setup;	setup=xcb_get_setup(c->c);	xcb_screen_iterator_t iter = xcb_setup_roots_iterator (setup);	xcb_screen_t *screen = iter.data;	return screen->root;}
开发者ID:carlodoro88,项目名称:lxdm,代码行数:8,


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


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


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


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


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


示例20:

xcb_screen_t *defaultScreen(xcb_connection_t *c, int screen){    for (auto it = xcb_setup_roots_iterator(xcb_get_setup(c)); it.rem; --screen, xcb_screen_next(&it)) {        if (screen == 0) {            return it.data;        }    }    return nullptr;}
开发者ID:KDE,项目名称:kscreenlocker,代码行数:10,


示例21: xcb_aux_get_screen

xcb_screen_t *xcb_aux_get_screen (xcb_connection_t *c,                    int               screen){  xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(c));  for (; i.rem; --screen, xcb_screen_next(&i))    if (screen == 0)      return i.data;  return 0;}
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:10,


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


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


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


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


示例26: screen_of_display

    xcb_screen_t *    screen_of_display(int screen)    {      xcb_screen_iterator_t iter;      iter = xcb_setup_roots_iterator(xcb_get_setup(m_c.get()));      for (; iter.rem; --screen, xcb_screen_next(&iter))        if (screen == 0)          return iter.data;      return NULL;    }
开发者ID:jotrk,项目名称:xpp,代码行数:12,


示例27: get_screen

intget_screen(xcb_connection_t *con, xcb_screen_t **scr){    *scr = xcb_setup_roots_iterator(xcb_get_setup(con)).data;        if (*scr == NULL) {	perror("unable to retrieve screen information");	return -1;    }    return 0;}
开发者ID:imwally,项目名称:tabover,代码行数:12,


示例28: find_xcb_screen

static xcb_screen_t *find_xcb_screen(xcb_connection_t *c, int default_screen){    xcb_screen_iterator_t screen_iter;    int screen_num;    screen_iter = xcb_setup_roots_iterator(xcb_get_setup(c));    for (screen_num = default_screen; screen_iter.rem && screen_num > 0;            --screen_num, xcb_screen_next(&screen_iter));    return screen_iter.data;}
开发者ID:kristiandelay,项目名称:rutabaga,代码行数:12,


示例29: Q_UNUSED

EGLNativeWindowType QEglFSX11Hooks::createNativeWindow(QPlatformWindow *platformWindow,                                                       const QSize &size,                                                       const QSurfaceFormat &format){    Q_UNUSED(format);    m_platformWindow = platformWindow;    xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));    m_window = xcb_generate_id(m_connection);    xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_window, it.data->root,                      0, 0, size.width(), size.height(), 0,                      XCB_WINDOW_CLASS_INPUT_OUTPUT, it.data->root_visual,                      0, 0);    xcb_map_window(m_connection, m_window);    xcb_intern_atom_cookie_t cookies[Atoms::N_ATOMS];    static const char *atomNames[Atoms::N_ATOMS] = {        "_NET_WM_NAME",        "UTF8_STRING",        "WM_PROTOCOLS",        "WM_DELETE_WINDOW",        "_NET_WM_STATE",        "_NET_WM_STATE_FULLSCREEN"    };    for (int i = 0; i < Atoms::N_ATOMS; ++i) {        cookies[i] = xcb_intern_atom(m_connection, false, strlen(atomNames[i]), atomNames[i]);        xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(m_connection, cookies[i], 0);        m_atoms[i] = reply->atom;        free(reply);    }    // Set window title    xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,                        m_atoms[Atoms::_NET_WM_NAME], m_atoms[Atoms::UTF8_STRING], 8, 5, "EGLFS");    // Enable WM_DELETE_WINDOW    xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,                        m_atoms[Atoms::WM_PROTOCOLS], XCB_ATOM_ATOM, 32, 1, &m_atoms[Atoms::WM_DELETE_WINDOW]);    if (qgetenv("EGLFS_X11_FULLSCREEN").toInt()) {        // Go fullscreen. The QScreen and QWindow size is controlled by EGLFS_X11_SIZE regardless,        // this is just the native window.        xcb_change_property(m_connection, XCB_PROP_MODE_REPLACE, m_window,                            m_atoms[Atoms::_NET_WM_STATE], XCB_ATOM_ATOM, 32, 1, &m_atoms[Atoms::_NET_WM_STATE_FULLSCREEN]);    }    xcb_flush(m_connection);    return m_window;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:53,


示例30: dri2_add_configs_for_visuals

static EGLBooleandri2_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,			     _EGLDisplay *disp){   xcb_screen_iterator_t s;   xcb_depth_iterator_t d;   xcb_visualtype_t *visuals;   int i, j, id;   EGLint surface_type;   EGLint config_attrs[] = {	   EGL_NATIVE_VISUAL_ID,   0,	   EGL_NATIVE_VISUAL_TYPE, 0,	   EGL_NONE   };   s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));   d = xcb_screen_allowed_depths_iterator(s.data);   id = 1;   surface_type =      EGL_WINDOW_BIT |      EGL_PIXMAP_BIT |      EGL_PBUFFER_BIT |      EGL_SWAP_BEHAVIOR_PRESERVED_BIT;   while (d.rem > 0) {      EGLBoolean class_added[6] = { 0, };      visuals = xcb_depth_visuals(d.data);      for (i = 0; i < xcb_depth_visuals_length(d.data); i++) {	 if (class_added[visuals[i]._class])	    continue;	 class_added[visuals[i]._class] = EGL_TRUE;	 for (j = 0; dri2_dpy->driver_configs[j]; j++) {            config_attrs[1] = visuals[i].visual_id;            config_attrs[3] = visuals[i]._class;	    dri2_add_config(disp, dri2_dpy->driver_configs[j], id++,			    d.data->depth, surface_type, config_attrs, NULL);	 }      }      xcb_depth_next(&d);   }   if (!_eglGetArraySize(disp->Configs)) {      _eglLog(_EGL_WARNING, "DRI2: failed to create any config");      return EGL_FALSE;   }   return EGL_TRUE;}
开发者ID:blckshrk,项目名称:Mesa,代码行数:53,



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


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