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

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

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

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

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

示例1: R_gtk_setEventHandler

voidR_gtk_setEventHandler(){#ifndef WIN32  static InputHandler *h = NULL;  if(!h)    {      if (!GDK_DISPLAY())        error("GDK display not found - please make sure X11 is running");      h = addInputHandler(R_InputHandlers, ConnectionNumber(GDK_DISPLAY()),                          R_gtk_eventHandler, -1);    }#else  /* Create a dummy window for receiving messages */  LPCTSTR class = "cairoDevice";  HINSTANCE instance = GetModuleHandle(NULL);  WNDCLASS wndclass = { 0, DefWindowProc, 0, 0, instance, NULL, 0, 0, NULL,                        class };  RegisterClass(&wndclass);  HWND win = CreateWindow(class, NULL, 0, 1, 1, 1, 1, HWND_MESSAGE,                          NULL, instance, NULL);  SetTimer(win, CD_TIMER_ID, CD_TIMER_DELAY, (TIMERPROC)R_gtk_timer_proc);#endif}
开发者ID:yixuan,项目名称:Layer,代码行数:25,


示例2: X11_PendingInput

/** * XPending() actually performs a blocking read  *  if no events available. From Fakk2, by way of *  Heretic2, by way of SDL, original idea GGI project. * The benefit of this approach over the quite *  badly behaved XAutoRepeatOn/Off is that you get *  focus handling for free, which is a major win *  with debug and windowed mode. It rests on the *  assumption that the X server will use the *  same timestamp on press/release event pairs  *  for key repeats.  */static qboolean X11_PendingInput(void) {  assert(dpy != NULL);  // Flush the display connection  //  and look to see if events are queued  XFlush( dpy );  if ( XEventsQueued( dpy, QueuedAlready) ) {    return qtrue;  }  // More drastic measures are required -- see if X is ready to talk  {    static struct timeval zero_time;    int x11_fd;    fd_set fdset;    x11_fd = ConnectionNumber( dpy );    FD_ZERO(&fdset);    FD_SET(x11_fd, &fdset);    if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) {      return(XPending(dpy));    }  }    // Oh well, nothing is ready ..  return qfalse;}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:40,


示例3: _clutter_x11_event_source_new

GSource *_clutter_x11_event_source_new (ClutterBackendX11 *backend_x11){  ClutterEventSource *event_source;  int connection_number;  GSource *source;  gchar *name;  connection_number = ConnectionNumber (backend_x11->xdpy);  CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number);  source = g_source_new (&event_funcs, sizeof (ClutterEventSource));  event_source = (ClutterEventSource *) source;  name = g_strdup_printf ("Clutter X11 Event (connection: %d)",                          connection_number);  g_source_set_name (source, name);  g_free (name);  event_source->backend = backend_x11;  event_source->event_poll_fd.fd = connection_number;  event_source->event_poll_fd.events = G_IO_IN;  g_source_add_poll (source, &event_source->event_poll_fd);  g_source_set_can_recurse (source, TRUE);  return source;}
开发者ID:Distrotech,项目名称:clutter,代码行数:28,


示例4: main

int main(int argc, char **argv){  if(argc == 2)    text = argv[1];  else {    printf("give an argument./n");    exit(1);  }  LOG_MESSAGE("starting xnotify/n");  initX();  signal(SIGHUP, sighup_handler);  signal(SIGINT, sigint_handler);    display_window();  init_and_start_ev_loop(ConnectionNumber(X.display));  cleanup();  return 0;}
开发者ID:masutu,项目名称:xnotify,代码行数:25,


示例5: spnav_fd

static int spnav_fd(void){    if(dpy) {        return ConnectionNumber(dpy);    }    return -1;}
开发者ID:harfangeek,项目名称:MeshEditor,代码行数:7,


示例6: XOpenDisplay

// Ping X in @pingInterval miliseconds.XServerPinger::XServerPinger(int pingInterval){    Display *dpy;    sigset_t sigs;    // Open a separate connection to X.    dpy = XOpenDisplay(NULL);    xcb = XGetXCBConnection(dpy);    connect(new QSocketNotifier(ConnectionNumber(dpy), QSocketNotifier::Read),            SIGNAL(activated(int)), SLOT(xInput(int)));    // XGetInputFocus() is our ping request.    request = xcb_get_input_focus(xcb);    xcb_flush(xcb);    timer = new QTimer();    connect(timer, SIGNAL(timeout()), SLOT(tick()));    timer->start(pingInterval);    // die() if we get SIGINT or SIGTERM.    sigemptyset(&sigs);    sigaddset(&sigs, SIGINT);    sigaddset(&sigs, SIGTERM);    connect(new QSocketNotifier(signalfd(-1, &sigs, 0),                                QSocketNotifier::Read),            SIGNAL(activated(int)), SLOT(die(int)));    sigprocmask(SIG_BLOCK, &sigs, NULL);}
开发者ID:siraj,项目名称:mcompositor,代码行数:29,


示例7: RunCommand

/** Execute an external program. */void RunCommand(const char *command) {   const char *displayString;   char *str;   if(JUNLIKELY(!command)) {      return;   }   displayString = DisplayString(display);   if(!fork()) {      close(ConnectionNumber(display));      if(displayString && displayString[0]) {         str = malloc(strlen(displayString) + 9);         sprintf(str, "DISPLAY=%s", displayString);         putenv(str);      }      setsid();      execl(SHELL_NAME, SHELL_NAME, "-c", command, NULL);      Warning(_("exec failed: (%s) %s"), SHELL_NAME, command);      exit(EXIT_SUCCESS);   }}
开发者ID:bbidulock,项目名称:jwmtools,代码行数:26,


示例8: glwtEventHandle

int glwtEventHandle(int wait){    int handled = 0;    do    {        XFlush(glwt.x11.display);        handled = xlib_handle_event();        if(handled < 0)            return -1;        if(wait && handled == 0)        {            int fd;            fd_set fds;            fd = ConnectionNumber(glwt.x11.display);            FD_ZERO(&fds);            FD_SET(fd, &fds);            int val = select(fd + 1, &fds, NULL, NULL, NULL);            if(val == -1)            {                glwtErrorPrintf("select failed: %s", strerror(errno));                return -1;            } else if(val == 0)                return 0;        }    } while(handled == 0 && wait);    return 0;}
开发者ID:jannek,项目名称:glwt,代码行数:33,


示例9: ftk_source_x11_create

FtkSource* ftk_source_x11_create(FtkDisplay* display, FtkOnEvent on_event, void* ctx){	FtkSource* thiz = NULL;		return_val_if_fail(display != NULL && on_event != NULL, NULL);	thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource) + sizeof(PrivInfo));	if(thiz != NULL)	{		DECL_PRIV(thiz, priv);		thiz->get_fd   = ftk_source_x11_get_fd;		thiz->check	   = ftk_source_x11_check;		thiz->dispatch = ftk_source_x11_dispatch;		thiz->destroy  = ftk_source_x11_destroy;		thiz->ref = 1;		priv->ctx = ctx;		priv->on_event = on_event;		priv->display = display;		priv->fd  = ConnectionNumber(ftk_display_x11_get_xdisplay(display));		priv->win = (Window)ftk_display_x11_get_xwindow(display);		XSetErrorHandler(on_x11_error);	}	return thiz;}
开发者ID:htbegin,项目名称:pyftk,代码行数:28,


示例10: getEvent

static void getEvent(XEvent * ev) {    int fd;    fd_set readfds;    struct timeval tv;        /* Is there a message waiting? */    if (QLength(dpy) > 0) {        XNextEvent(dpy, ev);        return;    }        /* Beg... */    XFlush(dpy);        /* Wait one second to see if a message arrives. */    fd = ConnectionNumber(dpy);    FD_ZERO(&readfds);    FD_SET(fd, &readfds);    tv.tv_sec = 1;    tv.tv_usec = 0;    if (select(fd + 1, &readfds, 0, 0, &tv) == 1) {        XNextEvent(dpy, ev);        return;    }        /* No message, so we have a null event. */    ev->type = NullEvent;}
开发者ID:007durgesh219,项目名称:jessies,代码行数:28,


示例11: main

int main(){        Display *display_name;        int depth,screen,connection;        /*Opening display and setting defaults*/        display_name = XOpenDisplay(NULL);        screen = DefaultScreen(display_name);        depth = DefaultDepth(display_name,screen);        connection = ConnectionNumber(display_name);        /*Displaying the info gathered*/        printf("The display is::%s/n",XDisplayName((char*)display_name));        printf("Width::%d/tHeight::%d/n",                                DisplayWidth(display_name,screen),                                DisplayHeight(display_name,screen));        printf("Connection number is %d/n",connection);        if(depth == 1)                printf("You live in prehistoric times/n");        else                printf("You've got a coloured monitor with depth of %d/n",                        depth);        /*Closing the display*/        XCloseDisplay(display_name);}
开发者ID:AMANINOUN,项目名称:nsy103,代码行数:30,


示例12: _cogl_xlib_renderer_connect

gboolean_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error){  CoglXlibRenderer *xlib_renderer =    _cogl_xlib_renderer_get_data (renderer);  CoglX11Renderer *x11_renderer =    (CoglX11Renderer *) xlib_renderer;  int damage_error;  if (!assert_xlib_display (renderer, error))    return FALSE;  if (getenv ("COGL_X11_SYNC"))    XSynchronize (xlib_renderer->xdpy, TRUE);  /* Check whether damage events are supported on this display */  if (!XDamageQueryExtension (xlib_renderer->xdpy,                              &x11_renderer->damage_base,                              &damage_error))    x11_renderer->damage_base = -1;  xlib_renderer->trap_state = NULL;  xlib_renderer->poll_fd.fd = ConnectionNumber (xlib_renderer->xdpy);  xlib_renderer->poll_fd.events = COGL_POLL_FD_EVENT_IN;  register_xlib_renderer (renderer);  return TRUE;}
开发者ID:collects,项目名称:cogl,代码行数:30,


示例13: shell

/*ARGSUSED*/extern voidshell(ScreenInfo * screen, int button, int x, int y) {    char * command = NULL;    char * sh;    /* Get the command we're to execute. Give up if there isn't one. */    if (button == Button1)        command = btn1_command;    if (button == Button2)        command = btn2_command;    if (command == NULL)        return;    sh = getenv("SHELL");    if (sh == 0)        sh = "/bin/sh";    switch (fork()) {    case 0:		/* Child. */        close(ConnectionNumber(dpy));        if (screen && screen->display_spec != 0)            putenv(screen->display_spec);        execl(sh, sh, "-c", command, NULL);        fprintf(stderr, "%s: can't exec /"%s -c %s/"/n", argv0, sh,                command);        execlp("xterm", "xterm", NULL);        exit(EXIT_FAILURE);    case -1:	/* Error. */        fprintf(stderr, "%s: couldn't fork/n", argv0);        break;    }}
开发者ID:jamesfcarter,项目名称:lwm,代码行数:33,


示例14: X11_Open

/* * Open up the mouse device. * Returns the fd if successful, or negative if unsuccessful. */static int X11_Open(MOUSEDEVICE *pmd){    if (x11_setup_display() < 0)	return -1;    /* return the x11 file descriptor for select */    return ConnectionNumber(x11_dpy);  }
开发者ID:allanshin,项目名称:DirectFB_Microwindows,代码行数:11,


示例15: spawn

// spawn() heavily inspired by dwm.cint spawn(int argc, char** argv) {    if (argc < 2) {        return HERBST_NEED_MORE_ARGS;    }    if (fork() == 0) {        // only look in child        if (g_display) {            close(ConnectionNumber(g_display));        }        // shift all args in argv by 1 to the front        // so that we have space for a NULL entry at the end for execvp        char** execargs = argv_duplicate(argc, argv);        free(execargs[0]);        int i;        for (i = 0; i < argc-1; i++) {            execargs[i] = execargs[i+1];        }        execargs[i] = NULL;        // do actual exec        setsid();        execvp(execargs[0], execargs);        fprintf(stderr, "herbstluftwm: execvp /"%s/"", argv[1]);        perror(" failed");        exit(0);    }    return 0;}
开发者ID:xiaq,项目名称:hlwm,代码行数:28,


示例16: MyXNextEventWithDelay

static bool MyXNextEventWithDelay(Display* dsp, XEvent* evt) {    // Check for pending events before entering the select loop. There might    // be events in the in-memory queue but not processed yet.    if (XPending(dsp)) {        XNextEvent(dsp, evt);        return true;    }    SkMSec ms = gTimerDelay;    if (ms > 0) {        int x11_fd = ConnectionNumber(dsp);        fd_set input_fds;        FD_ZERO(&input_fds);        FD_SET(x11_fd, &input_fds);        timeval tv;        tv.tv_sec = ms / 1000;              // seconds        tv.tv_usec = (ms % 1000) * 1000;    // microseconds        if (!select(x11_fd + 1, &input_fds, NULL, NULL, &tv)) {            if (!XPending(dsp)) {                return false;            }        }    }    XNextEvent(dsp, evt);    return true;}
开发者ID:435420057,项目名称:soui,代码行数:28,


示例17: exec

int exec(char *type, char *device, char *status, char *name){	pid_t pid;	syslog(LOG_DEBUG, "Calling %s %s %s %s %s", cmd, type, device, status, name ? name : "");	pid = fork();	if (!pid) {		char *args[] = {			cmd,			type,			device,			status,			name ? name : "",			NULL		};		setsid();		if (display)			close(ConnectionNumber(display));		execv(args[0], args);		syslog(LOG_ERR, "Failed calling %s: %s", cmd, strerror(errno));		exit(0);	}	syslog(LOG_DEBUG, "Started %s as PID %d", cmd, pid);	return 0;}
开发者ID:troglobit,项目名称:xplugd,代码行数:30,


示例18: get_next_x11_event

static int get_next_x11_event(XEvent *xev){    int available = 0;    pXFlush(display);    if (pXEventsQueued(display, QueuedAlready))        available = 1;    else    {        /* XPending() blocks if there's no data, so select() first. */        struct timeval nowait;        const int fd = ConnectionNumber(display);        fd_set fdset;        FD_ZERO(&fdset);        FD_SET(fd, &fdset);        memset(&nowait, '/0', sizeof (nowait));        if (select(fd+1, &fdset, NULL, NULL, &nowait) == 1)            available = pXPending(display);    } /* else */    if (available)    {        memset(xev, '/0', sizeof (*xev));        pXNextEvent(display, xev);        return 1;    } /* if */    return 0;} /* get_next_x11_event */
开发者ID:ath88,项目名称:MMSFML,代码行数:29,


示例19: x11_shadow_subsystem_base_init

int x11_shadow_subsystem_base_init(x11ShadowSubsystem* subsystem){	if (subsystem->display)		return 1; /* initialize once */	if (!getenv("DISPLAY"))		setenv("DISPLAY", ":0", 1);	if (!XInitThreads())		return -1;	subsystem->display = XOpenDisplay(NULL);	if (!subsystem->display)	{		WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));		return -1;	}	subsystem->xfds = ConnectionNumber(subsystem->display);	subsystem->number = DefaultScreen(subsystem->display);	subsystem->screen = ScreenOfDisplay(subsystem->display, subsystem->number);	subsystem->depth = DefaultDepthOfScreen(subsystem->screen);	subsystem->width = WidthOfScreen(subsystem->screen);	subsystem->height = HeightOfScreen(subsystem->screen);	subsystem->root_window = RootWindow(subsystem->display, subsystem->number);	return 1;}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:29,


示例20: _clutter_backend_x11_events_init

void_clutter_backend_x11_events_init (ClutterBackend *backend){  ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);  GSource *source;  ClutterEventSource *event_source;  int connection_number;  gchar *name;  connection_number = ConnectionNumber (backend_x11->xdpy);  CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number);  source = backend_x11->event_source = clutter_event_source_new (backend);  event_source = (ClutterEventSource *) source;  g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);  name = g_strdup_printf ("Clutter X11 Event (connection: %d)",                          connection_number);  g_source_set_name (source, name);  g_free (name);  event_source->event_poll_fd.fd = connection_number;  event_source->event_poll_fd.events = G_IO_IN;  event_sources = g_list_prepend (event_sources, event_source);  g_source_add_poll (source, &event_source->event_poll_fd);  g_source_set_can_recurse (source, TRUE);  g_source_attach (source, NULL);}
开发者ID:nobled,项目名称:clutter,代码行数:30,


示例21: X11_Pending

//----------------------------------------------------------------------------------------------------------------------// X11_Pending - from SDL//----------------------------------------------------------------------------------------------------------------------static int X11_Pending(Display *display){   VOGL_FUNC_TRACER   /* Flush the display connection and look to see if events are queued */   XFlush(display);   if (XEventsQueued(display, QueuedAlready))   {      return(1);   }   /* More drastic measures are required -- see if X is ready to talk */   {      static struct timeval zero_time;	/* static == 0 */      int x11_fd;      fd_set fdset;      x11_fd = ConnectionNumber(display);      FD_ZERO(&fdset);      FD_SET(x11_fd, &fdset);      if (select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1)      {         return(XPending(display));      }   }   /* Oh well, nothing is ready .. */   return(0);}
开发者ID:Kelbirk,项目名称:vogl,代码行数:32,


示例22: FD_ZERO

bool xorg::testing::XServer::WaitForEvent(::Display *display, time_t timeout){    fd_set fds;    FD_ZERO(&fds);    int display_fd = ConnectionNumber(display);    XSync(display, False);    if (XPending(display))        return true;    else {        FD_SET(display_fd, &fds);        struct timeval timeval = {            static_cast<time_t>(timeout / 1000),            static_cast<time_t>(timeout % 1000) * 1000,        };        int ret;        if (timeout)            ret = select(display_fd + 1, &fds, NULL, NULL, &timeval);        else            ret = select(display_fd + 1, &fds, NULL, NULL, NULL);        if (ret < 0)            throw std::runtime_error("Failed to select on X fd");        if (ret == 0)            return false;        return XPending(display);    }}
开发者ID:cyphermox,项目名称:xorg-gtest,代码行数:34,


示例23: Delay

void Delay (int DTime){   fd_set f;   struct timeval timeout;   int cn;   XEvent xe;   if (key>=0) return;   if (XCheckMaskEvent(dpy,KeyPressMask,&xe)) {      process_event(&xe);      if (key>=0) return;   }   if (drawcounter>0) {      XClearWindow(dpy,w);      XFlush(dpy);      drawcounter=0;   }   timeout.tv_sec=DTime/1000;   timeout.tv_usec=1000*(DTime%1000);   FD_ZERO(&f);   cn=ConnectionNumber(dpy);   FD_SET(cn, &f);   select(cn+1, &f, 0, 0, &timeout);      /* note: the above implements a delay that is interrupted as      soon as an X event occurs, a keypress/release in all practical      cases. Interrupting the waiting upon keypress/release gives      much smoother behaviour with puff.   */}
开发者ID:trayres,项目名称:PUFF,代码行数:32,


示例24: signalHandler

extern "C" void signalHandler(int signal){#ifdef Q_WS_X11    // Kill window since it's frozen anyway.    if (QX11Info::display())        close(ConnectionNumber(QX11Info::display()));#endif    pid_t pid = fork();    switch (pid) {    case -1: // error        break;    case 0: // child        if (disableRestartOptionC) {            execl(crashHandlerPathC, crashHandlerPathC, strsignal(signal), appNameC,                  disableRestartOptionC, (char *) 0);        } else {            execl(crashHandlerPathC, crashHandlerPathC, strsignal(signal), appNameC, (char *) 0);        }        _exit(EXIT_FAILURE);    default: // parent        prctl(PR_SET_PTRACER, pid, 0, 0, 0);        waitpid(pid, 0, 0);        _exit(EXIT_FAILURE);        break;    }}
开发者ID:choenig,项目名称:qt-creator,代码行数:26,


示例25: spawn

void spawn(Display * disp, const char** com){    if (fork()) return;    if (disp) close(ConnectionNumber(disp));    setsid();    execvp((char*)com[0], (char**)com);}
开发者ID:DebianJoe,项目名称:nullWM,代码行数:7,


示例26: serverWait

/* * Enter a loop processing X events & polling chars until we see a result */static void serverWait(VimRemotingClient *client, Window w, VimRemotingClient_EndCond endCond, void *endData, int seconds){    time_t            start;    time_t            now;    time_t            lastChk = 0;    XEvent            event;    XPropertyEvent *e = (XPropertyEvent *)&event;    int fd = ConnectionNumber(client->dpy);    time(&start);    while (!endCond(endData)) {        time(&now);        /* Just look out for the answer without calling back into Vim */        pollFor(fd, ((start + seconds) - now) * 1000);        if (!isWindowValid(client, w))            break;        while (XEventsQueued(client->dpy, QueuedAfterReading) > 0) {            XNextEvent(client->dpy, &event);            if (event.type == PropertyNotify &&                    e->window == client->window) {                serverEventProc(client, &event);            }        }    }}
开发者ID:moriyoshi,项目名称:mod_vim,代码行数:28,


示例27: meta_event_queue_new

LOCAL_SYMBOL MetaEventQueue*meta_event_queue_new (Display *display, MetaEventQueueFunc func, gpointer data){  GSource *source;  MetaEventQueue *eq;  source = g_source_new (&eq_funcs, sizeof (MetaEventQueue));  eq = (MetaEventQueue*) source;    eq->connection_fd = ConnectionNumber (display);  eq->poll_fd.fd = eq->connection_fd;  eq->poll_fd.events = G_IO_IN;  eq->events = g_queue_new ();  eq->display = display;    g_source_set_priority (source, G_PRIORITY_DEFAULT);  g_source_add_poll (source, &eq->poll_fd);  g_source_set_can_recurse (source, TRUE);  g_source_set_callback (source, (GSourceFunc) func, data, NULL);    g_source_attach (source, NULL);  g_source_unref (source);  return eq;}
开发者ID:3dfxmadscientist,项目名称:muffin,代码行数:28,


示例28: while

	bool DisplayMessageQueue_X11::process(int timeout_ms)	{		auto end_time = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeout_ms);		while (true)		{			process_message();			process_queued_events(); // What is this? If its related to Event then it should be removed			process_window_sockets(); // Same for this thing			if (end_time <= std::chrono::steady_clock::now())				break;			int x11_handle = ConnectionNumber(display);			struct timeval tv;			if (timeout_ms > 0)			{				tv.tv_sec = timeout_ms / 1000;				tv.tv_usec = (timeout_ms % 1000) * 1000;			}			else if (timeout_ms == 0)			{				tv.tv_sec = 0;				tv.tv_usec = 0;			}			else			{				tv.tv_sec = 0x7FFFFFFF;				tv.tv_usec = 0;			}			fd_set rfds;			FD_ZERO(&rfds);			FD_SET(x11_handle, &rfds);			FD_SET(async_work_event.read_fd(), &rfds);			FD_SET(exit_event.read_fd(), &rfds);			int result = select(std::max(std::max(async_work_event.read_fd(), x11_handle), exit_event.read_fd()) + 1, &rfds, nullptr, nullptr, &tv);			if (result > 0)			{				if (FD_ISSET(async_work_event.read_fd(), &rfds))				{					async_work_event.reset();					process_async_work();				}				if (FD_ISSET(exit_event.read_fd(), &rfds))				{					exit_event.reset();					return false;				}			}			else			{				break;			}		}		return true;	}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:60,


示例29: spawn

voidspawn(ScreenInfo *s, void (*fn)()){    /*     * ugly dance to cause sweeping for terminals.     * the very next window created will require sweeping.     * hope it's created by the program we're about to     * exec!     */    isNew = 1;    /*     * ugly dance to avoid leaving zombies. Could use SIGCHLD,     * but it's not very portable.     */    if(fork() == 0) {        if(fork() == 0) {            close(ConnectionNumber(dpy));            if(s->display[0] != '/0')                putenv(s->display);            signal(SIGINT, SIG_DFL);            signal(SIGTERM, SIG_DFL);            signal(SIGHUP, SIG_DFL);            fn();            exit(1);        }        exit(0);    }    wait((int *) 0);}
开发者ID:tiago4orion,项目名称:plan9port,代码行数:29,


示例30: DOUT

    void Application::run(int argc, char *argv[])    {      DOUT("Application::run()");      ApplicationEventPtr applicationEvent = ApplicationEvent::create(ApplicationEvent::RUN());      eventDispatcher->dispatchEvent(applicationEvent);      XEvent event;            int fd = ConnectionNumber(hiddenMembers->display);      while(running) {        XFlush(hiddenMembers->display);        struct timeval tv;        fd_set rfds;        FD_ZERO(&rfds);        FD_SET(fd,&rfds);        memset(&tv,0,sizeof(tv));        tv.tv_usec = 100000; /* delay in microseconds = 100 milliseconds */        if (select(fd+1,&rfds,0,0,&tv) > 0) {          XSync(hiddenMembers->display, False);                  while(XEventsQueued(hiddenMembers->display, QueuedAlready) > 0) {            XNextEvent(hiddenMembers->display, &event);            switch (event.type) {                            case ClientMessage:                if (event.xclient.data.l[0] == hiddenMembers->WM_WAKEUP) {                  DOUT("wakeup!");                  break;                }                              default:                if (event.xclient.window) {                  linux_::WindowHandler* windowHandler = NULL;                  if (xWindows.find(event.xclient.window) != xWindows.end()) {                    windowHandler = xWindows[event.xclient.window];                  }                                    if (windowHandler != NULL) {                    windowHandler->handleEvent(event);                  }                }                break;                            }            XFlush(hiddenMembers->display);          }        }        eventDispatcher->processEvents();      }    }
开发者ID:Wednesnight,项目名称:lostengine,代码行数:59,



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


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