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

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

51自学网 2021-06-01 20:26:07
  C++
这篇教程C++ DefaultRootWindow函数代码示例写得很实用,希望能帮到您。

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

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

示例1: xf_CreateDummyWindow

Window xf_CreateDummyWindow(xfContext* xfc){	return XCreateSimpleWindow(xfc->display, DefaultRootWindow(xfc->display),	                           0, 0, 1, 1, 0, 0, 0);}
开发者ID:byteboon,项目名称:FreeRDP,代码行数:5,


示例2: winopen

static void winopen(void){	XWMHints *wmhints;	XClassHint *classhint;	xdpy = XOpenDisplay(NULL);	if (!xdpy)		winerror(&gapp, fz_throw("cannot open display"));	XA_TARGETS = XInternAtom(xdpy, "TARGETS", False);	XA_TIMESTAMP = XInternAtom(xdpy, "TIMESTAMP", False);	XA_UTF8_STRING = XInternAtom(xdpy, "UTF8_STRING", False);	WM_DELETE_WINDOW = XInternAtom(xdpy, "WM_DELETE_WINDOW", False);	xscr = DefaultScreen(xdpy);	ximage_init(xdpy, xscr, DefaultVisual(xdpy, xscr));	xcarrow = XCreateFontCursor(xdpy, XC_left_ptr);	xchand = XCreateFontCursor(xdpy, XC_hand2);	xcwait = XCreateFontCursor(xdpy, XC_watch);	xbgcolor.red = 0x7000;	xbgcolor.green = 0x7000;	xbgcolor.blue = 0x7000;	xshcolor.red = 0x4000;	xshcolor.green = 0x4000;	xshcolor.blue = 0x4000;	XAllocColor(xdpy, DefaultColormap(xdpy, xscr), &xbgcolor);	XAllocColor(xdpy, DefaultColormap(xdpy, xscr), &xshcolor);	xwin = XCreateWindow(xdpy, DefaultRootWindow(xdpy),		10, 10, 200, 100, 1,		ximage_get_depth(),		InputOutput,		ximage_get_visual(),		0,		NULL);	if (xwin == None)		winerror(&gapp, fz_throw("cannot create window"));	XSetWindowColormap(xdpy, xwin, ximage_get_colormap());	XSelectInput(xdpy, xwin,		StructureNotifyMask | ExposureMask | KeyPressMask |		PointerMotionMask | ButtonPressMask | ButtonReleaseMask);	mapped = 0;	xgc = XCreateGC(xdpy, xwin, 0, NULL);	XDefineCursor(xdpy, xwin, xcarrow);	wmhints = XAllocWMHints();	if (wmhints)	{		wmhints->flags = IconPixmapHint | IconMaskHint;		xicon = XCreateBitmapFromData(xdpy, xwin,			(char*)mupdf_icon_bitmap_16_bits,			mupdf_icon_bitmap_16_width,			mupdf_icon_bitmap_16_height);		xmask = XCreateBitmapFromData(xdpy, xwin,			(char*)mupdf_icon_bitmap_16_mask_bits,			mupdf_icon_bitmap_16_mask_width,			mupdf_icon_bitmap_16_mask_height);		if (xicon && xmask)		{			wmhints->icon_pixmap = xicon;			wmhints->icon_mask = xmask;			XSetWMHints(xdpy, xwin, wmhints);		}		XFree(wmhints);	}	classhint = XAllocClassHint();	if (classhint)	{		classhint->res_name = "mupdf";		classhint->res_class = "MuPDF";		XSetClassHint(xdpy, xwin, classhint);		XFree(classhint);	}	XSetWMProtocols(xdpy, xwin, &WM_DELETE_WINDOW, 1);	x11fd = ConnectionNumber(xdpy);}
开发者ID:Asido,项目名称:MuPDF,代码行数:88,


示例3: m_screen

CXWindowsScreenSaver::CXWindowsScreenSaver(				CXWindowsScreen* screen, Display* display) :	m_screen(screen),	m_display(display),	m_notify(None),	m_xscreensaver(None),	m_xscreensaverActive(false),	m_disabled(false),	m_suppressDisable(false),	m_disableJobInstalled(false){	// screen saver disable callback	m_disableJob = new TMethodJob<CXWindowsScreenSaver>(this,								&CXWindowsScreenSaver::disableCallback);	// get atoms	m_atomScreenSaver           = XInternAtom(m_display,										"SCREENSAVER", False);	m_atomScreenSaverVersion    = XInternAtom(m_display,										"_SCREENSAVER_VERSION", False);	m_atomScreenSaverActivate   = XInternAtom(m_display,										"ACTIVATE", False);	m_atomScreenSaverDeactivate = XInternAtom(m_display,										"DEACTIVATE", False);	m_atomSynergyScreenSaver    = XInternAtom(m_display,										"SYNERGY_SCREENSAVER", False);	// create dummy window to receive xscreensaver responses.  this	// shouldn't be necessary (we should be able to send responses	// to None) but it doesn't hurt.	XSetWindowAttributes attr;	attr.event_mask            = 0;//PropertyChangeMask;	attr.do_not_propagate_mask = 0;	attr.override_redirect     = True;	m_xscreensaverSink = XCreateWindow(m_display,								DefaultRootWindow(m_display),								0, 0, 1, 1, 0, 0,								InputOnly, CopyFromParent,								CWDontPropagate | CWEventMask |								CWOverrideRedirect,								&attr);	LOG((CLOG_DEBUG "xscreensaver sink window is 0x%08x", m_xscreensaverSink));	// watch top-level windows for changes	{		bool error = false;		CXWindowsUtil::CErrorLock lock(m_display, &error);		Window root = DefaultRootWindow(m_display);		XWindowAttributes attr;		XGetWindowAttributes(m_display, root, &attr);		m_rootEventMask = attr.your_event_mask;		XSelectInput(m_display, root, m_rootEventMask | SubstructureNotifyMask);		if (error) {			LOG((CLOG_DEBUG "didn't set root event mask"));			m_rootEventMask = 0;		}	}	// get the xscreensaver window, if any	if (!findXScreenSaver()) {		setXScreenSaver(None);	}	// get the built-in settings	XGetScreenSaver(m_display, &m_timeout, &m_interval,								&m_preferBlanking, &m_allowExposures);}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:67,


示例4: setstatus

voidsetstatus(Display *dpy, char *str) {	XStoreName(dpy, DefaultRootWindow(dpy), str);	XSync(dpy, False);}
开发者ID:Theta91,项目名称:dwmst,代码行数:5,


示例5: X11_Init

intX11_Init(void){    char buf[512];    char *displayname;    XGCValues gcvalues;    /* grrr, Xtk forced contortions */    char *argv[2];    int argc = 2;    if (cp_getvar("display", VT_STRING, buf)) {      displayname = buf;    } else if (!(displayname = getenv("DISPLAY"))) {      internalerror("Can't open X display.");      return (1);    }#  ifdef DEBUG    _Xdebug = 1;#  endif    argv[0] = "ngspice";    argv[1] = displayname;/*    argv[2] = "-geometry";    argv[3] = "=1x1+2+2";*/    /* initialize X toolkit */    toplevel = XtInitialize("ngspice", "Nutmeg", NULL, 0, &argc, argv);    display = XtDisplay(toplevel);    X11_Open = 1;    /* "invert" works better than "xor" for B&W */    /* xor gc should be a function of the pixels that are written on */    /* gcvalues.function = GXxor; */    /* this patch makes lines visible on true color displays    Guenther Roehrich 22-Jan-99 */    gcvalues.function = GXinvert;    gcvalues.line_width = 1;    gcvalues.foreground = 1;    gcvalues.background = 0;    xorgc = XCreateGC(display, DefaultRootWindow(display),	    GCLineWidth | GCFunction | GCForeground | GCBackground,	    &gcvalues);    /* set correct information */    dispdev->numlinestyles = NUMLINESTYLES;    dispdev->numcolors = NUMCOLORS;    dispdev->width = DisplayWidth(display, DefaultScreen(display));    dispdev->height = DisplayHeight(display, DefaultScreen(display));    /* we don't want non-fatal X errors to call exit */    XSetErrorHandler(errorhandler);    numdispplanes = DisplayPlanes(display, DefaultScreen(display));    return (0);}
开发者ID:aesop972,项目名称:ngspice-gss,代码行数:68,


示例6: XInternAtom

bool CWinSystemX11::HasWindowManager(){  Window wm_check;  unsigned char *data;  int status, real_format;  Atom real_type, prop;  unsigned long items_read, items_left;  prop = XInternAtom(m_dpy, "_NET_SUPPORTING_WM_CHECK", True);  if (prop == None)    return false;  status = XGetWindowProperty(m_dpy, DefaultRootWindow(m_dpy), prop,                      0L, 1L, False, XA_WINDOW, &real_type, &real_format,                      &items_read, &items_left, &data);  if(status != Success || ! items_read)  {    if(status == Success)      XFree(data);    return false;  }  wm_check = ((Window*)data)[0];  XFree(data);  status = XGetWindowProperty(m_dpy, wm_check, prop,                      0L, 1L, False, XA_WINDOW, &real_type, &real_format,                      &items_read, &items_left, &data);  if(status != Success || !items_read)  {    if(status == Success)      XFree(data);    return false;  }  if(wm_check != ((Window*)data)[0])  {    XFree(data);    return false;  }  XFree(data);  prop = XInternAtom(m_dpy, "_NET_WM_NAME", True);  if (prop == None)  {    CLog::Log(LOGDEBUG,"Window Manager Name: ");    return true;  }  status = XGetWindowProperty(m_dpy, wm_check, prop,                        0L, (~0L), False, AnyPropertyType, &real_type, &real_format,                        &items_read, &items_left, &data);  if(status == Success && items_read)  {    CLog::Log(LOGDEBUG,"Window Manager Name: %s", data);  }  else    CLog::Log(LOGDEBUG,"Window Manager Name: ");  if(status == Success)    XFree(data);  return true;}
开发者ID:Karlson2k,项目名称:xbmc,代码行数:66,


示例7: _cairo_boilerplate_gl_create_window_db

static cairo_surface_t *_cairo_boilerplate_gl_create_window_db (const char		  *name,					cairo_content_t 	   content,					double			   width,					double			   height,					double			   max_width,					double			   max_height,					cairo_boilerplate_mode_t   mode,					int			   id,					void			 **closure){    int rgba_attribs[] = { GLX_RGBA,			   GLX_RED_SIZE, 1,			   GLX_GREEN_SIZE, 1,			   GLX_BLUE_SIZE, 1,			   GLX_ALPHA_SIZE, 1,			   GLX_DOUBLEBUFFER,			   None };    XVisualInfo *vi;    GLXContext ctx;    gl_target_closure_t *gltc;    cairo_surface_t *surface;    Display *dpy;    XSetWindowAttributes attr;    cairo_status_t status;    gltc = calloc (1, sizeof (gl_target_closure_t));    *closure = gltc;    if (width == 0)	width = 1;    if (height == 0)	height = 1;    dpy = XOpenDisplay (NULL);    gltc->dpy = dpy;    if (!gltc->dpy) {	fprintf (stderr, "Failed to open display: %s/n", XDisplayName(0));	free (gltc);	return NULL;    }    if (mode == CAIRO_BOILERPLATE_MODE_TEST)	XSynchronize (gltc->dpy, 1);    vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs);    if (vi == NULL) {	fprintf (stderr, "Failed to create RGBA, double-buffered visual/n");	XCloseDisplay (dpy);	free (gltc);	return NULL;    }    attr.colormap = XCreateColormap (dpy,				     RootWindow (dpy, vi->screen),				     vi->visual,				     AllocNone);    attr.border_pixel = 0;    attr.override_redirect = True;    gltc->drawable = XCreateWindow (dpy, DefaultRootWindow (dpy), 0, 0,				    width, height, 0, vi->depth,				    InputOutput, vi->visual,				    CWOverrideRedirect | CWBorderPixel | CWColormap,				    &attr);    XMapWindow (dpy, gltc->drawable);    ctx = glXCreateContext (dpy, vi, NULL, True);    XFree (vi);    gltc->ctx = ctx;    gltc->device = cairo_glx_device_create (dpy, ctx);    gltc->surface = cairo_gl_surface_create_for_window (gltc->device,							gltc->drawable,							ceil (width),							ceil (height));    surface = cairo_surface_create_similar (gltc->surface, content, width, height);    status = cairo_surface_set_user_data (surface, &gl_closure_key, gltc, NULL);    if (status == CAIRO_STATUS_SUCCESS)	return surface;    cairo_surface_destroy (surface);    _cairo_boilerplate_gl_cleanup (gltc);    return cairo_boilerplate_surface_create_in_error (status);}
开发者ID:499940913,项目名称:moon,代码行数:85,


示例8: preinit

static int preinit(struct vo *vo){    XvPortID xv_p;    int busy_ports = 0;    unsigned int i;    struct xvctx *ctx = vo->priv;    int xv_adaptor = ctx->cfg_xv_adaptor;    if (!vo_x11_init(vo))        return -1;    if (!vo_x11_create_vo_window(vo, NULL, "xv"))        goto error;    struct vo_x11_state *x11 = vo->x11;    /* check for Xvideo extension */    unsigned int ver, rel, req, ev, err;    if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) {        MP_ERR(vo, "Xv not supported by this X11 version/driver/n");        goto error;    }    /* check for Xvideo support */    if (Success !=        XvQueryAdaptors(x11->display, DefaultRootWindow(x11->display),                        &ctx->adaptors, &ctx->ai)) {        MP_ERR(vo, "XvQueryAdaptors failed./n");        goto error;    }    /* check adaptors */    if (ctx->xv_port) {        int port_found;        for (port_found = 0, i = 0; !port_found && i < ctx->adaptors; i++) {            if ((ctx->ai[i].type & XvInputMask)                && (ctx->ai[i].type & XvImageMask)) {                for (xv_p = ctx->ai[i].base_id;                     xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports;                     ++xv_p) {                    if (xv_p == ctx->xv_port) {                        port_found = 1;                        break;                    }                }            }        }        if (port_found) {            if (XvGrabPort(x11->display, ctx->xv_port, CurrentTime))                ctx->xv_port = 0;        } else {            MP_WARN(vo, "Invalid port parameter, overriding with port 0./n");            ctx->xv_port = 0;        }    }    for (i = 0; i < ctx->adaptors && ctx->xv_port == 0; i++) {        /* check if adaptor number has been specified */        if (xv_adaptor != -1 && xv_adaptor != i)            continue;        if ((ctx->ai[i].type & XvInputMask) && (ctx->ai[i].type & XvImageMask)) {            for (xv_p = ctx->ai[i].base_id;                 xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports; ++xv_p)                if (!XvGrabPort(x11->display, xv_p, CurrentTime)) {                    ctx->xv_port = xv_p;                    MP_VERBOSE(vo, "Using Xv Adapter #%d (%s)/n",                               i, ctx->ai[i].name);                    break;                } else {                    MP_WARN(vo, "Could not grab port %i./n", (int) xv_p);                    ++busy_ports;                }        }    }    if (!ctx->xv_port) {        if (busy_ports)            MP_ERR(vo, "Xvideo ports busy./n");        else            MP_ERR(vo, "No Xvideo support found./n");        goto error;    }    if (!xv_init_colorkey(vo)) {        goto error;             // bail out, colorkey setup failed    }    xv_enable_vsync(vo);    xv_get_max_img_dim(vo, &ctx->max_width, &ctx->max_height);    ctx->fo = XvListImageFormats(x11->display, ctx->xv_port,                                 (int *) &ctx->formats);    MP_WARN(vo, "Warning: this legacy VO has bad quality and performance, "                "and will in particular result in blurry OSD and subtitles. "                "You should fix your graphic drivers, or not force the xv VO./n");    return 0;  error:    uninit(vo);                 // free resources//.........这里部分代码省略.........
开发者ID:2ion,项目名称:mpv,代码行数:101,


示例9: _x11_clip_filter

static int _x11_clip_filter(const SDL_Event *ev){        XSelectionRequestEvent *req;        XEvent sevent;        Atom seln_type;        int seln_format;        unsigned long nbytes;        unsigned long overflow;        unsigned char *seln_data;        unsigned char *src;        if (ev->type != SDL_SYSWMEVENT) return 1;        if (ev->syswm.msg->event.xevent.type == SelectionNotify) {                sevent = ev->syswm.msg->event.xevent;                if (sevent.xselection.requestor == SDL_Window) {                        lock_display();                        src = NULL;                        if (XGetWindowProperty(SDL_Display, SDL_Window, atom_sel,                                                0, 9000, False, XA_STRING,                                                (Atom *)&seln_type,                                                (int *)&seln_format,                                                (unsigned long *)&nbytes,                                                (unsigned long *)&overflow,                                                (unsigned char **)&src) == Success) {                                if (seln_type == XA_STRING) {                                        if (_current_selection != _current_clipboard) {                                                free(_current_clipboard);                                        }                                        _current_clipboard = mem_alloc(nbytes+1);                                        memcpy(_current_clipboard, (char*)src, nbytes);                                        _current_clipboard[nbytes] = 0;                                        _string_paste(CLIPPY_BUFFER, _current_clipboard);                                        _widget_owner[CLIPPY_BUFFER]                                                        = _widget_owner[CLIPPY_SELECT];                                }                                XFree(src);                        }                        unlock_display();                }                return 1;        } else if (ev->syswm.msg->event.xevent.type == PropertyNotify) {                sevent = ev->syswm.msg->event.xevent;                return 1;        } else if (ev->syswm.msg->event.xevent.type != SelectionRequest) {                return 1;        }        req = &ev->syswm.msg->event.xevent.xselectionrequest;        sevent.xselection.type = SelectionNotify;        sevent.xselection.display = req->display;        sevent.xselection.selection = req->selection;        sevent.xselection.target = None;        sevent.xselection.property = None;        sevent.xselection.requestor = req->requestor;        sevent.xselection.time = req->time;        if (XGetWindowProperty(SDL_Display, DefaultRootWindow(SDL_Display),                        XA_CUT_BUFFER0, 0, 9000, False, req->target,                        &sevent.xselection.target, &seln_format,                        &nbytes, &overflow, &seln_data) == Success) {                if (sevent.xselection.target == req->target) {                        if (sevent.xselection.target == XA_STRING) {                                if (nbytes && seln_data[nbytes-1] == '/0')                                        nbytes--;                        }                        XChangeProperty(SDL_Display, req->requestor, req->property,                                sevent.xselection.target, seln_format, PropModeReplace,                                seln_data, nbytes);                        sevent.xselection.property = req->property;                }                XFree(seln_data);        }        XSendEvent(SDL_Display,req->requestor,False,0,&sevent);        XSync(SDL_Display, False);        return 1;}
开发者ID:CharlesLio,项目名称:schismtracker,代码行数:76,


示例10: _clippy_copy_to_sys

static void _clippy_copy_to_sys(int do_sel){        int j;        char *dst;        char *freeme;#if defined(__QNXNTO__)        PhClipboardHdr clheader = {Ph_CLIPBOARD_TYPE_TEXT, 0, NULL};        char *tmp;        int *cldata;        int status;#endif        freeme = NULL;        if (!_current_selection) {                dst = NULL;                j = 0;        } else#if defined(WIN32)        j = strlen(_current_selection);#else        if (has_sys_clip) {                int i;                /* convert to local */                freeme = dst = malloc(strlen(_current_selection)+4);                if (!dst) return;                for (i = j = 0; _current_selection[i]; i++) {                        dst[j] = _current_selection[i];                        if (dst[j] != '/r') j++;                }                dst[j] = '/0';        } else {                dst = NULL;                j = 0;        }#endif#if defined(USE_X11)        if (has_sys_clip) {                lock_display();                if (!dst) dst = (char *) ""; /* blah */                if (j < 0) j = 0;                if (do_sel) {                        if (XGetSelectionOwner(SDL_Display, XA_PRIMARY) != SDL_Window) {                                XSetSelectionOwner(SDL_Display, XA_PRIMARY, SDL_Window, CurrentTime);                        }                        XChangeProperty(SDL_Display,                                DefaultRootWindow(SDL_Display),                                XA_CUT_BUFFER1, XA_STRING, 8,                                PropModeReplace, (unsigned char *)dst, j);                } else {                        if (XGetSelectionOwner(SDL_Display, atom_clip) != SDL_Window) {                                XSetSelectionOwner(SDL_Display, atom_clip, SDL_Window, CurrentTime);                        }                        XChangeProperty(SDL_Display,                                DefaultRootWindow(SDL_Display),                                XA_CUT_BUFFER0, XA_STRING, 8,                                PropModeReplace, (unsigned char *)dst, j);                        XChangeProperty(SDL_Display,                                DefaultRootWindow(SDL_Display),                                XA_CUT_BUFFER1, XA_STRING, 8,                                PropModeReplace, (unsigned char *)dst, j);                }                unlock_display();        }#elif defined(WIN32)        if (!do_sel && OpenClipboard(SDL_Window)) {                _hmem = GlobalAlloc((GMEM_MOVEABLE|GMEM_DDESHARE), j+1);                if (_hmem) {                        dst = (char *)GlobalLock(_hmem);                        if (dst) {                                /* this seems wrong, but msdn does this */                                memcpy(dst, _current_selection, j);                                dst[j] = '/0';                                GlobalUnlock(_hmem);                                EmptyClipboard();                                SetClipboardData(CF_TEXT, _hmem);                        }                }                CloseClipboard();                _hmem = NULL;                dst = 0;        }#elif defined(__QNXNTO__)        if (!do_sel) {                tmp = (char *)malloc(j+4);                if (!tmp) {                        cldata=(int*)tmp;                        *cldata = Ph_CL_TEXT;                        if (dst) memcpy(tmp+4, dst, j);                        clheader.data = tmp;#if (NTO_VERSION < 620)                        if (clheader.length > 65535) clheader.length=65535;#endif                        clheader.length = j + 4;#if (NTO_VERSION < 620)                        PhClipboardCopy(inputgroup, 1, &clheader);#else                        PhClipboardWrite(inputgroup, 1, &clheader);#endif                        free(tmp);                }//.........这里部分代码省略.........
开发者ID:CharlesLio,项目名称:schismtracker,代码行数:101,


示例11: GetIdleTime

int GetIdleTime(Display *dpy, XScreenSaverInfo *info){    XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info);    return (int)info->idle;}
开发者ID:slaweksiluk,项目名称:BlueAuth,代码行数:4,


示例12: main

/*ARGSUSED*/intmain(int argc, char *argv[]) {    XEvent ev;    XGCValues gv;    XSetWindowAttributes attr;        (void) argc;    argv0 = argv[0];        /* Open a connection to the X server. */    dpy = XOpenDisplay("");    if (dpy == 0)        Panic("can't open display.");        get_resources();        /* Find the screen's dimensions. */    display_width = DisplayWidth(dpy, DefaultScreen(dpy));    display_height = DisplayHeight(dpy, DefaultScreen(dpy));        /* Set up an error handler. */    XSetErrorHandler(ErrorHandler);        /* Get the pixel values of the only two colours we use. */    black = BlackPixel(dpy, DefaultScreen(dpy));    white = WhitePixel(dpy, DefaultScreen(dpy));        /* Get font. */    font = XLoadQueryFont(dpy, font_name);    if (font == 0)        font = XLoadQueryFont(dpy, "fixed");    if (font == 0)        Panic("can't find a font.");        /* Get a cursor. */    initCursor();        /* Create the window. */    root = DefaultRootWindow(dpy);    attr.override_redirect = True;    attr.background_pixel = white;    attr.border_pixel = black;    attr.cursor = mouse_cursor;    attr.event_mask = ExposureMask | VisibilityChangeMask |        ButtonMotionMask | PointerMotionHintMask |        ButtonPressMask | ButtonReleaseMask | StructureNotifyMask |        EnterWindowMask | LeaveWindowMask;    window = XCreateWindow(dpy, root,        0, 0,        display_width, 1.2 * (font->ascent + font->descent),        0, CopyFromParent, InputOutput, CopyFromParent,        CWOverrideRedirect | CWBackPixel | CWBorderPixel |        CWCursor | CWEventMask,        &attr);        /* Create GC. */    gv.foreground = black;    gv.background = white;    gv.font = font->fid;    gc = XCreateGC(dpy, window, GCForeground | GCBackground | GCFont,        &gv);        /* Create the menu items. */    readMenu();        /* Bring up the window. */    XMapRaised(dpy, window);        /* Make sure all our communication to the server got through. */    XSync(dpy, False);        /* The main event loop. */    for (;;) {        getEvent(&ev);        dispatch(&ev);    }}
开发者ID:007durgesh219,项目名称:jessies,代码行数:78,


示例13: _DtGetHourGlassCursor

/*************************************<->************************************* * *  Cursor _DtGetHourGlassCursor () * * *  Description: *  ----------- *  Builds and returns the appropriate Hourglass cursor * * *  Inputs: *  ------ *  dpy	= display *  *  Outputs: *  ------- *  Return = cursor. * *  Comments: *  -------- *  None. (None doesn't count as a comment) *  *************************************<->***********************************/Cursor _DtGetHourGlassCursor(        Display *dpy ){    unsigned char *bits;    unsigned char *maskBits;    unsigned int width;    unsigned int height;    unsigned int xHotspot;    unsigned int yHotspot;    Pixmap       pixmap;    Pixmap       maskPixmap;    XColor       xcolors[2];    int          scr;    unsigned int cWidth;    unsigned int cHeight;    int		 useLargeCursors = 0;    static Cursor waitCursor=0;    _DtSvcProcessLock();    if (waitCursor != 0) {      _DtSvcProcessUnlock();      return(waitCursor);    }    if (XQueryBestCursor (dpy, DefaultRootWindow(dpy), 	32, 32, &cWidth, &cHeight))    {	if ((cWidth >= 32) && (cHeight >= 32))	{	    useLargeCursors = 1;	}    }    if (useLargeCursors)    {	width = time32_width;	height = time32_height;	bits = time32_bits;	maskBits = time32m_bits;	xHotspot = time32_x_hot;	yHotspot = time32_y_hot;    }    else    {	width = time16_width;	height = time16_height;	bits = time16_bits;	maskBits = time16m_bits;	xHotspot = time16_x_hot;	yHotspot = time16_y_hot;    }    pixmap = XCreateBitmapFromData (dpy, 		     DefaultRootWindow(dpy), (char*) bits, 		     width, height);      maskPixmap = XCreateBitmapFromData (dpy, 		     DefaultRootWindow(dpy), (char*) maskBits, 		     width, height);    xcolors[0].pixel = BlackPixelOfScreen(DefaultScreenOfDisplay(dpy));    xcolors[1].pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(dpy));    XQueryColors (dpy, 		  DefaultColormapOfScreen(DefaultScreenOfDisplay					  (dpy)), xcolors, 2);    waitCursor = XCreatePixmapCursor (dpy, pixmap, maskPixmap,				      &(xcolors[0]), &(xcolors[1]),				      xHotspot, yHotspot);    XFreePixmap (dpy, pixmap);    XFreePixmap (dpy, maskPixmap);    _DtSvcProcessUnlock();    return (waitCursor);//.........这里部分代码省略.........
开发者ID:idunham,项目名称:cdesktop,代码行数:101,


示例14: wxASSERT_MSG

bool wxTopLevelWindowGTK::Show( bool show ){    wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );    bool deferShow = show && !m_isShown && m_deferShow;    if (deferShow)    {        deferShow = gs_requestFrameExtentsStatus != 2 &&            m_deferShowAllowed && !gtk_widget_get_realized(m_widget);        if (deferShow)        {            deferShow = g_signal_handler_find(m_widget,                GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA),                g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET),                0, NULL, NULL, this) != 0;        }        GdkScreen* screen = NULL;        if (deferShow)        {#ifdef GDK_WINDOWING_X11            screen = gtk_widget_get_screen(m_widget);            GdkAtom atom = gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false);            deferShow = gdk_x11_screen_supports_net_wm_hint(screen, atom) != 0;#else            deferShow = false;#endif            // If _NET_REQUEST_FRAME_EXTENTS not supported, don't allow changes            // to m_decorSize, it breaks saving/restoring window size with            // GetSize()/SetSize() because it makes window bigger between each            // restore and save.            m_updateDecorSize = deferShow;        }        m_deferShow = deferShow;    }    if (deferShow)    {        // Initial show. If WM supports _NET_REQUEST_FRAME_EXTENTS, defer        // calling gtk_widget_show() until _NET_FRAME_EXTENTS property        // notification is received, so correct frame extents are known.        // This allows resizing m_widget to keep the overall size in sync with        // what wxWidgets expects it to be without an obvious change in the        // window size immediately after it becomes visible.        // Realize m_widget, so m_widget->window can be used. Realizing normally        // causes the widget tree to be size_allocated, which generates size        // events in the wrong order. However, the size_allocates will not be        // done if the allocation is not the default (1,1).        GtkAllocation alloc;        gtk_widget_get_allocation(m_widget, &alloc);        const int alloc_width = alloc.width;        if (alloc_width == 1)        {            alloc.width = 2;            gtk_widget_set_allocation(m_widget, &alloc);        }        gtk_widget_realize(m_widget);        if (alloc_width == 1)        {            alloc.width = 1;            gtk_widget_set_allocation(m_widget, &alloc);        }#ifdef GDK_WINDOWING_X11        // send _NET_REQUEST_FRAME_EXTENTS        XClientMessageEvent xevent;        memset(&xevent, 0, sizeof(xevent));        xevent.type = ClientMessage;        GdkWindow* window = gtk_widget_get_window(m_widget);        xevent.window = GDK_WINDOW_XID(window);        xevent.message_type = gdk_x11_atom_to_xatom_for_display(            gdk_window_get_display(window),            gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false));        xevent.format = 32;        Display* display = GDK_DISPLAY_XDISPLAY(gdk_window_get_display(window));        XSendEvent(display, DefaultRootWindow(display), false,            SubstructureNotifyMask | SubstructureRedirectMask,            (XEvent*)&xevent);#endif // GDK_WINDOWING_X11        if (gs_requestFrameExtentsStatus == 0)        {            // if WM does not respond to request within 1 second,            // we assume support for _NET_REQUEST_FRAME_EXTENTS is not working            m_netFrameExtentsTimerId =                g_timeout_add(1000, request_frame_extents_timeout, this);        }        // defer calling gtk_widget_show()        m_isShown = true;        return true;    }    if (show && !gtk_widget_get_realized(m_widget))    {        // size_allocate signals occur in reverse order (bottom to top).        // Things work better if the initial wxSizeEvents are sent (from the        // top down), before the initial size_allocate signals occur.        wxSizeEvent event(GetSize(), GetId());        event.SetEventObject(this);//.........这里部分代码省略.........
开发者ID:iokto,项目名称:newton-dynamics,代码行数:101,


示例15: main

//.........这里部分代码省略.........    opt_tab[2].argKind = XrmoptionSepArg;    opt_tab[2].value = (XPointer) NULL;    /* filter option entry */    opt_tab[3].option = xcstrdup("-filter");    opt_tab[3].specifier = xcstrdup(".filter");    opt_tab[3].argKind = XrmoptionNoArg;    opt_tab[3].value = (XPointer) xcstrdup(ST);    /* in option entry */    opt_tab[4].option = xcstrdup("-in");    opt_tab[4].specifier = xcstrdup(".direction");    opt_tab[4].argKind = XrmoptionNoArg;    opt_tab[4].value = (XPointer) xcstrdup("I");    /* out option entry */    opt_tab[5].option = xcstrdup("-out");    opt_tab[5].specifier = xcstrdup(".direction");    opt_tab[5].argKind = XrmoptionNoArg;    opt_tab[5].value = (XPointer) xcstrdup("O");    /* version option entry */    opt_tab[6].option = xcstrdup("-version");    opt_tab[6].specifier = xcstrdup(".print");    opt_tab[6].argKind = XrmoptionNoArg;    opt_tab[6].value = (XPointer) xcstrdup("V");    /* help option entry */    opt_tab[7].option = xcstrdup("-help");    opt_tab[7].specifier = xcstrdup(".print");    opt_tab[7].argKind = XrmoptionNoArg;    opt_tab[7].value = (XPointer) xcstrdup("H");    /* silent option entry */    opt_tab[8].option = xcstrdup("-silent");    opt_tab[8].specifier = xcstrdup(".olevel");    opt_tab[8].argKind = XrmoptionNoArg;    opt_tab[8].value = (XPointer) xcstrdup("S");    /* quiet option entry */    opt_tab[9].option = xcstrdup("-quiet");    opt_tab[9].specifier = xcstrdup(".olevel");    opt_tab[9].argKind = XrmoptionNoArg;    opt_tab[9].value = (XPointer) xcstrdup("Q");    /* verbose option entry */    opt_tab[10].option = xcstrdup("-verbose");    opt_tab[10].specifier = xcstrdup(".olevel");    opt_tab[10].argKind = XrmoptionNoArg;    opt_tab[10].value = (XPointer) xcstrdup("V");    /* utf8 option entry */    opt_tab[11].option = xcstrdup("-noutf8");    opt_tab[11].specifier = xcstrdup(".noutf8");    opt_tab[11].argKind = XrmoptionNoArg;    opt_tab[11].value = (XPointer) xcstrdup("N");    /* target option entry */    opt_tab[12].option = xcstrdup("-target");    opt_tab[12].specifier = xcstrdup(".target");    opt_tab[12].argKind = XrmoptionSepArg;    opt_tab[12].value = (XPointer) NULL;    /* parse command line options */    doOptMain(argc, argv);    /* Connect to the X server. */    if ((dpy = XOpenDisplay(sdisp))) {	/* successful */	if (fverb == OVERBOSE)	    fprintf(stderr, "Connected to X server./n");    }    else {	/* couldn't connect to X server. Print error and exit */	errxdisplay(sdisp);    }    /* parse selection command line option */    doOptSel();    /* parse noutf8 and target command line options */    doOptTarget();    /* Create a window to trap events */    win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0);    /* get events about property changes */    XSelectInput(dpy, win, PropertyChangeMask);    if (fdiri)	exit_code = doIn(win, argv[0]);    else	exit_code = doOut(win);    /* Disconnect from the X server */    XCloseDisplay(dpy);    /* exit */    return exit_code;}
开发者ID:codingsnippets,项目名称:xclip,代码行数:101,


示例16: vdpDeviceCreateX11

VdpStatusvdpDeviceCreateX11(Display *display_orig, int screen, VdpDevice *device,                   VdpGetProcAddress **get_proc_address){    if (!display_orig || !device)        return VDP_STATUS_INVALID_POINTER;    // Let's get own connection to the X server    Display *display = handle_xdpy_ref(display_orig);    if (NULL == display)        return VDP_STATUS_ERROR;    if (global.quirks.buggy_XCloseDisplay) {        // XCloseDisplay could segfault on fglrx. To avoid calling XCloseDisplay,        // make one more reference to xdpy copy.        handle_xdpy_ref(display_orig);    }    VdpDeviceData *data = calloc(1, sizeof(VdpDeviceData));    if (NULL == data)        return VDP_STATUS_RESOURCES;    glx_ctx_lock(); // use glx lock to serialize X calls    data->type = HANDLETYPE_DEVICE;    data->display = display;    data->display_orig = display_orig;   // save supplied pointer too    data->screen = screen;    data->refcount = 0;    pthread_mutex_init(&data->refcount_mutex, NULL);    data->root = DefaultRootWindow(display);    XWindowAttributes wnd_attrs;    XGetWindowAttributes(display, data->root, &wnd_attrs);    data->color_depth = wnd_attrs.depth;    data->fn.glXBindTexImageEXT =        (PFNGLXBINDTEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *)"glXBindTexImageEXT");    data->fn.glXReleaseTexImageEXT =        (PFNGLXRELEASETEXIMAGEEXTPROC)glXGetProcAddress((GLubyte *)"glXReleaseTexImageEXT");    glx_ctx_unlock();    if (!data->fn.glXBindTexImageEXT || !data->fn.glXReleaseTexImageEXT) {        traceError("error (%s): can't get glXBindTexImageEXT address/n");        free(data);        return VDP_STATUS_RESOURCES;    }    // create master GLX context to share data between further created ones    glx_ctx_ref_glc_hash_table(display, screen);    data->root_glc = glx_ctx_get_root_context();    glx_ctx_push_thread_local(data);    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();    // initialize VAAPI    if (global.quirks.avoid_va) {        // pretend there is no VA-API available        data->va_available = 0;    } else {        data->va_dpy = vaGetDisplay(display);        data->va_available = 0;        VAStatus status = vaInitialize(data->va_dpy, &data->va_version_major,                                       &data->va_version_minor);        if (VA_STATUS_SUCCESS == status) {            data->va_available = 1;            traceInfo("libva (version %d.%d) library initialized/n",                      data->va_version_major, data->va_version_minor);        } else {            data->va_available = 0;            traceInfo("warning: failed to initialize libva. "                      "No video decode acceleration available./n");        }    }    compile_shaders(data);    glGenTextures(1, &data->watermark_tex_id);    glBindTexture(GL_TEXTURE_2D, data->watermark_tex_id);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, watermark_width, watermark_height, 0, GL_BGRA,                 GL_UNSIGNED_BYTE, watermark_data);    glFinish();    *device = handle_insert(data);    if (get_proc_address)        *get_proc_address = &vdpGetProcAddress;//.........这里部分代码省略.........
开发者ID:extinctpotato,项目名称:libvdpau-va-gl,代码行数:101,


示例17: update_outputs

static voidupdate_outputs (CoglRenderer *renderer,                gboolean notify){  CoglXlibRenderer *xlib_renderer =    _cogl_xlib_renderer_get_data (renderer);  XRRScreenResources *resources;  CoglXlibTrapState state;  gboolean error = FALSE;  GList *new_outputs = NULL;  GList *l, *m;  gboolean changed = FALSE;  int i;  xlib_renderer->outputs_update_serial = XNextRequest (xlib_renderer->xdpy);  resources = XRRGetScreenResources (xlib_renderer->xdpy,                                     DefaultRootWindow (xlib_renderer->xdpy));  _cogl_xlib_renderer_trap_errors (renderer, &state);  for (i = 0; resources && i < resources->ncrtc && !error; i++)    {      XRRCrtcInfo *crtc_info = NULL;      XRROutputInfo *output_info = NULL;      CoglOutput *output;      float refresh_rate = 0;      int j;      crtc_info = XRRGetCrtcInfo (xlib_renderer->xdpy,                                  resources, resources->crtcs[i]);      if (crtc_info == NULL)        {          error = TRUE;          goto next;        }      if (crtc_info->mode == None)        goto next;      for (j = 0; j < resources->nmode; j++)        {          if (resources->modes[j].id == crtc_info->mode)            refresh_rate = (resources->modes[j].dotClock /                            ((float)resources->modes[j].hTotal *                             resources->modes[j].vTotal));        }      output_info = XRRGetOutputInfo (xlib_renderer->xdpy,                                      resources,                                      crtc_info->outputs[0]);      if (output_info == NULL)        {          error = TRUE;          goto next;        }      output = _cogl_output_new (output_info->name);      output->x = crtc_info->x;      output->y = crtc_info->y;      output->width = crtc_info->width;      output->height = crtc_info->height;      if ((crtc_info->rotation & (RR_Rotate_90 | RR_Rotate_270)) != 0)        {          output->mm_width = output_info->mm_height;          output->mm_height = output_info->mm_width;        }      else        {          output->mm_width = output_info->mm_width;          output->mm_height = output_info->mm_height;        }      output->refresh_rate = refresh_rate;      switch (output_info->subpixel_order)        {        case SubPixelUnknown:        default:          output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;          break;        case SubPixelNone:          output->subpixel_order = COGL_SUBPIXEL_ORDER_NONE;          break;        case SubPixelHorizontalRGB:          output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB;          break;        case SubPixelHorizontalBGR:          output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_BGR;          break;        case SubPixelVerticalRGB:          output->subpixel_order = COGL_SUBPIXEL_ORDER_VERTICAL_RGB;          break;        case SubPixelVerticalBGR:          output->subpixel_order = COGL_SUBPIXEL_ORDER_VERTICAL_BGR;          break;        }      output->subpixel_order = COGL_SUBPIXEL_ORDER_HORIZONTAL_RGB;//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:mutter,代码行数:101,


示例18: main

int main(int argc, char *argv[]){	XTextItem textItem;	int whiteColor, blackColor, color;	int speed = 5;	char opt;	textItem.delta = 0;	textItem.font = None;	display = XOpenDisplay(NULL);		if(display == NULL){		fprintf(stderr, "Failed to open display./n");		exit(EXIT_FAILURE);	}	width = DisplayWidth(display, DefaultScreen(display));	height = DisplayHeight(display, DefaultScreen(display));	whiteColor = WhitePixel(display, DefaultScreen(display));	blackColor = BlackPixel(display, DefaultScreen(display));	color = whiteColor;	while((opt = getopt(argc, argv, "wbs:")) != -1){		switch(opt){		case 'w':			color = whiteColor;			break;		case 'b':			color = blackColor;			break;		case 's':			speed = atoi(optarg);			break;		default:			fprintf(stderr, "Unrecognized option: %c", opt);			XCloseDisplay(display);			exit(EXIT_FAILURE);		}	}	if(optind >= argc){		fprintf(stderr, "Usage: %s [options] command/n", argv[0]);		XCloseDisplay(display);		exit(EXIT_FAILURE);	}	window = DefaultRootWindow(display);	signal(SIGINT, cleanup);		gc = XCreateGC(display, window, 0, NULL);		XSetForeground(display, gc, color);	x = 0;	y = height / 2;	for(;;){ 		clearScreen();				textItem.chars = argv[optind];		textItem.nchars = strlen(argv[optind]);		XDrawText(display, window, gc, x, y, &textItem, 1);		x += speed;		if(x > width) x = 0;				XFlush(display);		usleep(10000); 	}	cleanup(SIGINT);	return 0;}
开发者ID:zhemao,项目名称:hodgepodge,代码行数:77,


示例19: main

//.........这里部分代码省略.........	/* quiet option entry */	opt_tab[9].option	=	xcstrdup("-quiet");	opt_tab[9].specifier	=	xcstrdup(".olevel");	opt_tab[9].argKind	=	XrmoptionNoArg;	opt_tab[9].value	=	(XPointer) xcstrdup("Q");			/* verbose option entry */	opt_tab[10].option	=	xcstrdup("-verbose");	opt_tab[10].specifier	=	xcstrdup(".olevel");	opt_tab[10].argKind	=	XrmoptionNoArg;	opt_tab[10].value	=	(XPointer) xcstrdup("V");	/* parse command line options */	doOptMain(argc, argv);   	/* Connect to the X server. */	if ( (dpy = XOpenDisplay(sdisp)) )	{		/* successful */		if (fverb == OVERBOSE)			fprintf(stderr, "Connected to X server./n");	} else	{		/* couldn't connect to X server. Print error and exit */		errxdisplay(sdisp);	}	/* parse selection command line option */	doOptSel();  	/* Create a window to trap events */	win = XCreateSimpleWindow(		dpy,		DefaultRootWindow(dpy),		0,		0,		1,		1,		0,		0,		0	);	/* get events about property changes */	XSelectInput(dpy, win, PropertyChangeMask);  	if (fdiri)	{		/* in mode */		sel_all = 16;		/* Reasonable ballpark figure */		sel_buf = xcmalloc(sel_all * sizeof(char));		/* Put chars into inc from stdin or files until we hit EOF */		do {			if (fil_number == 0)			{				/* read from stdin if no files specified */				fil_handle = stdin;			} else			{				if (					(fil_handle = fopen(						fil_names[fil_current],						"r"					)) == NULL				)
开发者ID:svn2github,项目名称:foo,代码行数:67,


示例20: FcitxTabletCreate

// Creates the event addonvoid* FcitxTabletCreate(FcitxInstance* instance) {	FcitxTablet* tablet = fcitx_utils_new(FcitxTablet);	FcitxTabletLoadConfig(&tablet->config);	// TODO select driver from config, currently using lxbi	{ // Initialise the driver		switch(tablet->config.Driver) {		case DRIVER_LXBI:			tablet->driverInstance = &lxbi;		break;		// add other drivers here		}		tablet->driverData = tablet->driverInstance->Create();		tablet->driverPacket = (char*) malloc(tablet->driverInstance->packet_size);	}	{ // Initialise the X display		if(NULL == (tablet->xDisplay = FcitxX11GetDisplay(instance)))  {			FcitxLog(ERROR, "Unable to open X display");			return NULL;		}		// get dimensions		int screen = DefaultScreen(tablet->xDisplay);		tablet->xWidth = tablet->config.Width;		tablet->xHeight = tablet->config.Height;		int x = tablet->config.XPos > 0 ? tablet->config.XPos : XDisplayWidth(tablet->xDisplay, screen) - tablet->xWidth + tablet->config.XPos;		int y = tablet->config.YPos > 0 ? tablet->config.YPos : XDisplayHeight(tablet->xDisplay, screen) - tablet->xHeight + tablet->config.YPos;		// create colours		XColor back;		XColor fore;		{			char colourString[32];			{				int r = (255*tablet->config.BackgroundColour.r);				int g = (255*tablet->config.BackgroundColour.g);				int b = (255*tablet->config.BackgroundColour.b);				sprintf(colourString,"rgb:%x/%x/%x",r,g,b);			}			Colormap defaultCMap = DefaultColormap(tablet->xDisplay, screen);			XParseColor(tablet->xDisplay, defaultCMap, colourString, &back);			XAllocColor(tablet->xDisplay, defaultCMap, &back);			{				int r = (255*tablet->config.StrokeColour.r);				int g = (255*tablet->config.StrokeColour.g);				int b = (255*tablet->config.StrokeColour.b);				sprintf(colourString,"rgb:%x/%x/%x",r,g,b);			}			XParseColor(tablet->xDisplay, defaultCMap, colourString, &fore);			XAllocColor(tablet->xDisplay, defaultCMap, &fore);		}		// set window attributes and create window		XSetWindowAttributes attrs;		attrs.override_redirect = True;		attrs.background_pixel = back.pixel;		tablet->xWindow = XCreateWindow(tablet->xDisplay, DefaultRootWindow(tablet->xDisplay),			 x, y, tablet->xWidth, tablet->xHeight, tablet->config.BorderWidth, CopyFromParent,			 InputOutput, CopyFromParent, CWBackPixel | CWOverrideRedirect, &attrs);		// set up the foreground line (stroke) style		XGCValues gcv;		gcv.function = GXcopy;		gcv.subwindow_mode = IncludeInferiors;		gcv.line_width = 3;		gcv.cap_style = CapRound;		gcv.join_style = JoinRound;		tablet->xGC = XCreateGC(tablet->xDisplay, tablet->xWindow, GCFunction | GCSubwindowMode | GCLineWidth | GCCapStyle | GCJoinStyle, &gcv);		XSetForeground(tablet->xDisplay, tablet->xGC, fore.pixel);		// prevent the window from getting focus or input		XRectangle rect = {0,0,0,0};		XserverRegion region = XFixesCreateRegion(tablet->xDisplay,&rect, 1);		XFixesSetWindowShapeRegion(tablet->xDisplay, tablet->xWindow, ShapeInput, 0, 0, region);		XFixesDestroyRegion(tablet->xDisplay, region);	}	{ // Initialise the stroke buffer		tablet->strokesBufferSize = 2048; // should be heaps. Will get automatically enlarged if required		tablet->strokesBuffer = (pt_t*) malloc(sizeof(pt_t) * tablet->strokesBufferSize);		tablet->strokesPtr = tablet->strokesBuffer;	}	{ // instantiate the engine		switch(tablet->config.Engine) {		case ENGINE_ZINNIA:			tablet->engineInstance = &engZinnia;			break;		case ENGINE_FORK:			tablet->engineInstance = &engFork;			break;		// add other engines here		}		tablet->engineData = tablet->engineInstance->Create(&tablet->config);	}	{ // set up the timerfd		tablet->timeoutFd = timerfd_create(CLOCK_MONOTONIC, 0);		tablet->delay.it_interval.tv_sec = 0;		tablet->delay.it_interval.tv_nsec = 0;		tablet->delay.it_value.tv_sec = tablet->config.CommitCharMs / 1000;		tablet->delay.it_value.tv_nsec = (tablet->config.CommitCharMs % 1000) * 1000000;		tablet->timeoutCommitPending = 0;//.........这里部分代码省略.........
开发者ID:kingctan,项目名称:fcitx-tablet,代码行数:101,


示例21: post_mouse_button_event

static inline void post_mouse_button_event(uiohook_event * const event) {	#ifdef USE_XTEST	Window ret_root;	Window ret_child;	int root_x;	int root_y;	int win_x;	int win_y;	unsigned int mask;	Window win_root = XDefaultRootWindow(properties_disp);	Bool query_status = XQueryPointer(properties_disp, win_root, &ret_root, &ret_child, &root_x, &root_y, &win_x, &win_y, &mask);	if (query_status) {		if (event->data.mouse.x != root_x || event->data.mouse.y != root_y) {			// Move the pointer to the specified position.			XTestFakeMotionEvent(properties_disp, -1, event->data.mouse.x, event->data.mouse.y, 0);		}		else {			query_status = False;		}	}	if (event->type == EVENT_MOUSE_WHEEL) {		// Wheel events should be the same as click events on X11.		// type, amount and rotation		if (event->data.wheel.rotation < 0) {			XTestFakeButtonEvent(properties_disp, WheelUp, True, 0);			XTestFakeButtonEvent(properties_disp, WheelUp, False, 0);		}		else {			XTestFakeButtonEvent(properties_disp, WheelDown, True, 0);			XTestFakeButtonEvent(properties_disp, WheelDown, False, 0);		}	}	else if (event->type == EVENT_MOUSE_PRESSED) {		XTestFakeButtonEvent(properties_disp, event->data.mouse.button, True, 0);	}	else if (event->type == EVENT_MOUSE_RELEASED) {		XTestFakeButtonEvent(properties_disp, event->data.mouse.button, False, 0);	}	else if (event->type == EVENT_MOUSE_CLICKED) {		XTestFakeButtonEvent(properties_disp, event->data.mouse.button, True, 0);		XTestFakeButtonEvent(properties_disp, event->data.mouse.button, False, 0);	}	if (query_status) {		// Move the pointer back to the original position.		XTestFakeMotionEvent(properties_disp, -1, root_x, root_y, 0);	}	#else	XButtonEvent btn_event;	btn_event.serial = 0x00;	btn_event.send_event = False;	btn_event.display = properties_disp;	btn_event.time = CurrentTime;	btn_event.same_screen = True;	btn_event.root = DefaultRootWindow(properties_disp);	btn_event.window = btn_event.root;	btn_event.subwindow = None;	btn_event.type = 0x00;	btn_event.state = 0x00;	btn_event.x_root = 0;	btn_event.y_root = 0;	btn_event.x = 0;	btn_event.y = 0;	btn_event.button = 0x00;	btn_event.state = convert_to_native_mask(event->mask);	btn_event.x = event->data.mouse.x;	btn_event.y = event->data.mouse.y;	#if defined(USE_XINERAMA) || defined(USE_XRANDR)	uint8_t screen_count;	screen_data *screens = hook_create_screen_info(&screen_count);	if (screen_count > 1) {		btn_event.x += screens[0].x;		btn_event.y += screens[0].y;	}	if (screens != NULL) {		free(screens);	}	#endif	// These are the same because Window == Root Window.	btn_event.x_root = btn_event.x;	btn_event.y_root = btn_event.y;	if (event->type == EVENT_MOUSE_WHEEL) {		// type, amount and rotation		if (event->data.wheel.rotation < 0) {			btn_event.button = WheelUp;		}		else {			btn_event.button = WheelDown;		}//.........这里部分代码省略.........
开发者ID:InspectorWidget,项目名称:libuiohook,代码行数:101,


示例22: CloneInitDisplay

/****	X11 initialize.*/global void CloneInitDisplay(void){    int i;    Window window;    XGCValues gcvalue;    XSizeHints hints;    XWMHints wmhints;    XClassHint classhint;    XSetWindowAttributes attributes;    int shm_major,shm_minor;    Bool pixmap_support;    XShmSegmentInfo shminfo;    XVisualInfo xvi;    XPixmapFormatValues *xpfv;    if( !(TheDisplay=XOpenDisplay(NULL)) ) {	fprintf(stderr,"Cannot connect to X-Server./n");	exit(-1);    }    TheScreen=DefaultScreen(TheDisplay);    //	I need shared memory pixmap extension.    if( !XShmQueryVersion(TheDisplay,&shm_major,&shm_minor,&pixmap_support) ) {	fprintf(stderr,"SHM-Extensions required./n");	exit(-1);    }    if( !pixmap_support ) {	fprintf(stderr,"SHM-Extensions with pixmap supported required./n");	exit(-1);    }    //  Look for a nice visual#ifdef USE_HICOLOR    if(XMatchVisualInfo(TheDisplay, TheScreen, 16, TrueColor, &xvi))	goto foundvisual;    if(XMatchVisualInfo(TheDisplay, TheScreen, 15, TrueColor, &xvi))	goto foundvisual;    fprintf(stderr,"Sorry, this version is for 15/16-bit displays only./n");#else    if(XMatchVisualInfo(TheDisplay, TheScreen, 8, PseudoColor, &xvi))	goto foundvisual;    fprintf(stderr,"Sorry, this version is for 8-bit displays only./n");#endif#if 0    if(XMatchVisualInfo(TheDisplay, TheScreen, 24, TrueColor, &xvi))	goto foundvisual;#endif    exit(-1);foundvisual:    xpfv=XListPixmapFormats(TheDisplay, &i);    for(i--;i>=0;i--)  if(xpfv[i].depth==xvi.depth) break;    if(i<0)  {	fprintf(stderr,"No Pixmap format for visual depth?/n");	exit(-1);    }    VideoDepth=xvi.depth;    VideoWidth = 640;    VideoHeight = 480;    MapWidth = 14;			// FIXME: Not the correct way    MapHeight = 14;    shminfo.shmid=shmget(IPC_PRIVATE,	(VideoWidth*xpfv[i].bits_per_pixel+xpfv[i].scanline_pad-1) /	xpfv[i].scanline_pad * xpfv[i].scanline_pad * VideoHeight / 8,	IPC_CREAT|0777);    XFree(xpfv);    if( !shminfo.shmid==-1 ) {	fprintf(stderr,"shmget failed./n");	exit(-1);    }    VideoMemory=(VMemType*)shminfo.shmaddr=shmat(shminfo.shmid,0,0);    if( shminfo.shmaddr==(void*)-1 ) {	shmctl(shminfo.shmid,IPC_RMID,0);	fprintf(stderr,"shmat failed./n");	exit(-1);    }    shminfo.readOnly=False;    if( !XShmAttach(TheDisplay,&shminfo) ) {	shmctl(shminfo.shmid,IPC_RMID,0);	fprintf(stderr,"XShmAttach failed./n");	exit(-1);    }    // Mark segment as deleted as soon as both clone and the X server have    // attached to it.  The POSIX spec says that a segment marked as deleted    // can no longer have addition processes attach to it, but Linux will let    // them anyway.    shmctl(shminfo.shmid,IPC_RMID,0);    TheMainDrawable=attributes.background_pixmap=	    XShmCreatePixmap(TheDisplay,DefaultRootWindow(TheDisplay)		,shminfo.shmaddr,&shminfo//.........这里部分代码省略.........
开发者ID:saniv,项目名称:freecraft-ale-clone,代码行数:101,


示例23: post_mouse_motion_event

static inline void post_mouse_motion_event(uiohook_event * const event) {    #ifdef USE_XTEST	XTestFakeMotionEvent(properties_disp, -1, event->data.mouse.x, event->data.mouse.y, 0);    #else	XMotionEvent mov_event;	mov_event.serial = MotionNotify;	mov_event.send_event = False;	mov_event.display = properties_disp;	mov_event.time = CurrentTime;	mov_event.same_screen = True;	mov_event.is_hint = NotifyNormal,	mov_event.root = DefaultRootWindow(properties_disp);	mov_event.window = mov_event.root;	mov_event.subwindow = None;	mov_event.type = 0x00;	mov_event.state = 0x00;	mov_event.x_root = 0;	mov_event.y_root = 0;	mov_event.x = 0;	mov_event.y = 0;	mov_event.state = convert_to_native_mask(event->mask);	mov_event.x = event->data.mouse.x;	mov_event.y = event->data.mouse.y;	#if defined(USE_XINERAMA) || defined(USE_XRANDR)	uint8_t screen_count;	screen_data *screens = hook_create_screen_info(&screen_count);	if (screen_count > 1) {		mov_event.x += screens[0].x;		mov_event.y += screens[0].y;	}	if (screens != NULL) {		free(screens);	}	#endif	// These are the same because Window == Root Window.	mov_event.x_root = mov_event.x;	mov_event.y_root = mov_event.y;	long int event_mask = NoEventMask;	if (event->type == EVENT_MOUSE_DRAGGED) {		#if Button1Mask == Button1MotionMask && /			Button2Mask == Button2MotionMask && /			Button3Mask == Button3MotionMask && /			Button4Mask == Button4MotionMask && /			Button5Mask == Button5MotionMask		// This little trick only works if Button#MotionMasks align with		// the Button#Masks.		event_mask = mov_event.state &				(Button1MotionMask | Button2MotionMask |				Button2MotionMask | Button3MotionMask | Button5MotionMask);		#else		// Fallback to some slightly larger...		if (event->state & Button1Mask) {			event_mask |= Button1MotionMask;		}		if (event->state & Button2Mask) {			event_mask |= Button2MotionMask;		}		if (event->state & Button3Mask) {			event_mask |= Button3MotionMask;		}		if (event->state & Button4Mask) {			event_mask |= Button4MotionMask;		}		if (event->state & Button5Mask) {			event_mask |= Button5MotionMask;		}		#endif	}	// NOTE x_mask = NoEventMask.	XSendEvent(properties_disp, InputFocus, False, event_mask, (XEvent *) &mov_event);    #endif}
开发者ID:InspectorWidget,项目名称:libuiohook,代码行数:85,


示例24: XWarpPointer

void Injector::injectMotionAbsolute(int x, int y){	XWarpPointer(m_display, None, DefaultRootWindow(m_display), 0, 0, 0, 0, x, y);}
开发者ID:xqms,项目名称:unity,代码行数:4,


示例25: WinCreate

/////  WinCreate()////      This function initialized the native X11 display and window for EGL//EGLBoolean WinCreate(ESContext *esContext, const char *title){    Window root;    XSetWindowAttributes swa;    XSetWindowAttributes  xattr;    Atom wm_state;    XWMHints hints;    XEvent xev;    Window win;    /*     * X11 native display initialization     */    x_display = XOpenDisplay(NULL);    if ( x_display == NULL )    {        return EGL_FALSE;    }    root = DefaultRootWindow(x_display);    swa.event_mask  =  ExposureMask | PointerMotionMask | KeyPressMask;    win = XCreateWindow(              x_display, root,              0, 0, esContext->width, esContext->height, 0,              CopyFromParent, InputOutput,              CopyFromParent, CWEventMask,              &swa );    xattr.override_redirect = FALSE;    XChangeWindowAttributes ( x_display, win, CWOverrideRedirect, &xattr );    hints.input = TRUE;    hints.flags = InputHint;    XSetWMHints(x_display, win, &hints);    // make the window visible on the screen    XMapWindow (x_display, win);    XStoreName (x_display, win, title);    // get identifiers for the provided atom name strings    wm_state = XInternAtom (x_display, "_NET_WM_STATE", FALSE);    memset ( &xev, 0, sizeof(xev) );    xev.type                 = ClientMessage;    xev.xclient.window       = win;    xev.xclient.message_type = wm_state;    xev.xclient.format       = 32;    xev.xclient.data.l[0]    = 1;    xev.xclient.data.l[1]    = FALSE;    XSendEvent (        x_display,        DefaultRootWindow ( x_display ),        FALSE,        SubstructureNotifyMask,        &xev );    esContext->hWnd = (EGLNativeWindowType) win;    return EGL_TRUE;}
开发者ID:cscott,项目名称:v8-gl,代码行数:66,


示例26: make_selection_window

static Window make_selection_window(Display*dpy){  Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0);  XSelectInput(dpy, win, PropertyChangeMask);  return win;}
开发者ID:ld-test,项目名称:xctrl,代码行数:6,


示例27: make_window

/* * Create an RGB, double-buffered window. * Return the window and context handles. */static void make_window(Display * dpy, Screen * scr, EGLDisplay eglDisplay,			EGLSurface * winRet, EGLContext * ctxRet){	EGLSurface eglSurface = EGL_NO_SURFACE;	EGLContext eglContext;	EGLConfig configs[MAX_NUM_CONFIGS];	EGLint config_count;	XWindowAttributes WinAttr;	int XResult = BadImplementation;	int blackColour = BlackPixel(dpy, DefaultScreen(dpy));	EGLint cfg_attribs[] = {		EGL_NATIVE_VISUAL_TYPE, 0,		/* RGB565 */		EGL_BUFFER_SIZE, 16,		EGL_RED_SIZE, 5,		EGL_GREEN_SIZE, 6,		EGL_BLUE_SIZE, 5,		EGL_DEPTH_SIZE, 8,		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,		EGL_NONE	};	EGLint i;	win =	    XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0,				blackColour, blackColour);	XStoreName(dpy, win, WINDOW_CLASS_NAME);	XSelectInput(dpy, win, X_MASK);	if (!(XResult = XGetWindowAttributes(dpy, win, &WinAttr)))		GLimp_HandleError();	GLimp_DisableComposition();	XMapWindow(dpy, win);	GLimp_DisableComposition();	XFlush(dpy);	if (!eglGetConfigs(eglDisplay, configs, MAX_NUM_CONFIGS, &config_count))		GLimp_HandleError();	if (!eglChooseConfig	    (eglDisplay, cfg_attribs, configs, MAX_NUM_CONFIGS, &config_count))		GLimp_HandleError();	for (i = 0; i < config_count; i++) {		if ((eglSurface =		     eglCreateWindowSurface(eglDisplay, configs[i],					    (NativeWindowType) win,					    NULL)) != EGL_NO_SURFACE)			break;	}	if (eglSurface == EGL_NO_SURFACE)		GLimp_HandleError();	if ((eglContext =	     eglCreateContext(eglDisplay, configs[i], EGL_NO_CONTEXT,			      NULL)) == EGL_NO_CONTEXT)		GLimp_HandleError();	if (!eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext))		GLimp_HandleError();	*winRet = eglSurface;	*ctxRet = eglContext;}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:76,


示例28: mGLDisplay

	//-------------------------------------------------------------------------------------------------//	GLXGLSupport::GLXGLSupport() : mGLDisplay(0), mXDisplay(0)	{		// A connection that might be shared with the application for GL rendering:		mGLDisplay = getGLDisplay();				// A connection that is NOT shared to enable independent event processing:		mXDisplay  = getXDisplay();				int dummy;				if (XQueryExtension(mXDisplay, "RANDR", &dummy, &dummy, &dummy))		{			XRRScreenConfiguration *screenConfig;						screenConfig = XRRGetScreenInfo(mXDisplay, DefaultRootWindow(mXDisplay));						if (screenConfig) 			{				XRRScreenSize *screenSizes;				int nSizes = 0;				Rotation currentRotation;				int currentSizeID = XRRConfigCurrentConfiguration(screenConfig, &currentRotation);								screenSizes = XRRConfigSizes(screenConfig, &nSizes);								mCurrentMode.first.first = screenSizes[currentSizeID].width;				mCurrentMode.first.second = screenSizes[currentSizeID].height;				mCurrentMode.second = XRRConfigCurrentRate(screenConfig);								mOriginalMode = mCurrentMode;								for(int sizeID = 0; sizeID < nSizes; sizeID++) 				{					short *rates;					int nRates = 0;										rates = XRRConfigRates(screenConfig, sizeID, &nRates);										for (int rate = 0; rate < nRates; rate++)					{						VideoMode mode;												mode.first.first = screenSizes[sizeID].width;						mode.first.second = screenSizes[sizeID].height;						mode.second = rates[rate];												mVideoModes.push_back(mode);					}				}				XRRFreeScreenConfigInfo(screenConfig);			}		}		else		{			mCurrentMode.first.first = DisplayWidth(mXDisplay, DefaultScreen(mXDisplay));			mCurrentMode.first.second = DisplayHeight(mXDisplay, DefaultScreen(mXDisplay));			mCurrentMode.second = 0;						mOriginalMode = mCurrentMode;						mVideoModes.push_back(mCurrentMode);		}				GLXFBConfig *fbConfigs;		int config, nConfigs = 0;				fbConfigs = chooseFBConfig(NULL, &nConfigs);				for (config = 0; config < nConfigs; config++)		{			int caveat, samples;						getFBConfigAttrib (fbConfigs[config], GLX_CONFIG_CAVEAT, &caveat);						if (caveat != GLX_SLOW_CONFIG)			{				getFBConfigAttrib (fbConfigs[config], GLX_SAMPLES, &samples);				mSampleLevels.push_back(StringConverter::toString(samples));			}		}				XFree (fbConfigs);				remove_duplicates(mSampleLevels);	}
开发者ID:albmarvil,项目名称:The-Eternal-Sorrow,代码行数:86,



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


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