当前位置: 首页>>代码示例>>C++>>正文


C++ queue_event函数代码示例

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


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

示例1: queue_event

void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y, bool p_use_as_mouse) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {

		Ref<InputEventScreenDrag> ev;
		ev.instance();
		ev->set_index(p_idx);
		ev->set_position(Vector2(p_x, p_y));
		ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
		queue_event(ev);
	};

	if (p_use_as_mouse) {
		Ref<InputEventMouseMotion> ev;
		ev.instance();

		ev->set_position(Vector2(p_x, p_y));
		ev->set_global_position(Vector2(p_x, p_y));
		ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));

		input->set_mouse_position(ev->get_position());
		ev->set_speed(input->get_last_mouse_speed());
		ev->set_button_mask(BUTTON_LEFT); // pressed

		queue_event(ev);
	};
};
开发者ID:arcanis,项目名称:godot,代码行数:27,代码来源:os_iphone.cpp

示例2: create_player

/** Attempt to create a new player object.
 * \param d DESC the creation attempt is being made on (if from connect screen)
 * \param executor dbref of the object attempting to create a player (if
 * \@pcreate)
 * \param name name of player to create.
 * \param password initial password of created player.
 * \param host host from which creation is attempted.
 * \param ip ip address from which creation is attempted.
 * \return dbref of created player, NOTHING if invalid name, AMBIGUOUS if taken
 *  name, or HOME for a bad password
 *  password.
 */
dbref
create_player(DESC *d, dbref executor, const char *name, const char *password,
              const char *host, const char *ip)
{
  if (!ok_player_name(name, executor, NOTHING)) {
    do_log(LT_CONN, 0, 0, "Failed creation (bad name) from %s", host);
    if (d) {
      queue_event(SYSEVENT, "SOCKET`CREATEFAIL", "%d,%s,%d,%s,%s",
                  d->descriptor, ip, mark_failed(ip), "create: bad name", name);
    }
    return (lookup_player(name) == NOTHING ? NOTHING : AMBIGUOUS);
  }
  if (!ok_password(password)) {
    do_log(LT_CONN, 0, 0, "Failed creation (bad password) from %s", host);
    if (d) {
      queue_event(SYSEVENT, "SOCKET`CREATEFAIL", "%d,%s,%d,%s,%s",
                  d->descriptor, ip, mark_failed(ip), "create: bad password",
                  name);
    }
    return HOME;
  }
  if (DBTOP_MAX && (db_top >= DBTOP_MAX + 1) && (first_free == NOTHING)) {
    /* Oops, out of db space! */
    do_log(LT_CONN, 0, 0, "Failed creation (no db space) from %s", host);
    if (d) {
      queue_event(SYSEVENT, "SOCKET`CREATEFAIL", "%d,%s,%d,%s,%s",
                  d->descriptor, ip, mark_failed(ip),
                  "create: no db space left to create!", name);
    }
    return NOTHING;
  }
  /* else he doesn't already exist, create him */
  return make_player(name, password, host, ip);
}
开发者ID:captdeaf,项目名称:pennmush,代码行数:46,代码来源:player.c

示例3: queue_event

void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {

	InputEvent ev;
	ev.type = InputEvent::SCREEN_TOUCH;
	ev.ID = ++last_event_id;
	ev.screen_touch.index=p_idx;
	ev.screen_touch.pressed=p_pressed;
	ev.screen_touch.x=p_x;
	ev.screen_touch.y=p_y;
	queue_event(ev);

	if (p_use_as_mouse) {

		InputEvent ev;
		ev.type = InputEvent::MOUSE_BUTTON;
		ev.device = 0;
		ev.mouse_button.pointer_index = p_idx;
		ev.ID = ++last_event_id;

		// swaped it for tilted screen
		//ev.mouse_button.x = ev.mouse_button.global_x = video_mode.height - p_y;
		//ev.mouse_button.y = ev.mouse_button.global_y = p_x;
		ev.mouse_button.x = ev.mouse_button.global_x = p_x;
		ev.mouse_button.y = ev.mouse_button.global_y = p_y;

		ev.mouse_button.button_index = BUTTON_LEFT;
		ev.mouse_button.doubleclick = p_doubleclick;
		ev.mouse_button.pressed = p_pressed;

		mouse_list.pressed[p_idx] = p_pressed;

		queue_event(ev);
	};
};
开发者ID:19Staceys,项目名称:godot,代码行数:34,代码来源:os_iphone.cpp

示例4: complete_transaction

static void complete_transaction(struct fw_card *card, int rcode,
				 void *payload, size_t length, void *data)
{
	struct outbound_transaction_event *e = data;
	struct fw_cdev_event_response *rsp = &e->response;
	struct client *client = e->client;
	unsigned long flags;

	if (length < rsp->length)
		rsp->length = length;
	if (rcode == RCODE_COMPLETE)
		memcpy(rsp->data, payload, rsp->length);

	spin_lock_irqsave(&client->lock, flags);
	/*
	 * 1. If called while in shutdown, the idr tree must be left untouched.
	 *    The idr handle will be removed and the client reference will be
	 *    dropped later.
	 * 2. If the call chain was release_client_resource ->
	 *    release_transaction -> complete_transaction (instead of a normal
	 *    conclusion of the transaction), i.e. if this resource was already
	 *    unregistered from the idr, the client reference will be dropped
	 *    by release_client_resource and we must not drop it here.
	 */
	if (!client->in_shutdown &&
	    idr_find(&client->resource_idr, e->r.resource.handle)) {
		idr_remove(&client->resource_idr, e->r.resource.handle);
		/* Drop the idr's reference */
		client_put(client);
	}
	spin_unlock_irqrestore(&client->lock, flags);

	rsp->type = FW_CDEV_EVENT_RESPONSE;
	rsp->rcode = rcode;

	/*
	 * In the case that sizeof(*rsp) doesn't align with the position of the
	 * data, and the read is short, preserve an extra copy of the data
	 * to stay compatible with a pre-2.6.27 bug.  Since the bug is harmless
	 * for short reads and some apps depended on it, this is both safe
	 * and prudent for compatibility.
	 */
	if (rsp->length <= sizeof(*rsp) - offsetof(typeof(*rsp), data))
		queue_event(client, &e->event, rsp, sizeof(*rsp),
			    rsp->data, rsp->length);
	else
		queue_event(client, &e->event, rsp, sizeof(*rsp) + rsp->length,
			    NULL, 0);

	/* Drop the transaction callback's reference */
	client_put(client);
}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:52,代码来源:core-cdev.c

示例5: apm_notify_sleep

static int apm_notify_sleep(struct pmu_sleep_notifier *self, int when)
{
	switch(when) {
		case PBOOK_SLEEP_REQUEST:
			queue_event(APM_SYS_SUSPEND, NULL);
			if (!wait_all_suspend())
				return PBOOK_SLEEP_REFUSE;
			break;
		case PBOOK_SLEEP_REJECT:
		case PBOOK_WAKE:
			queue_event(APM_NORMAL_RESUME, NULL);
			break;
	}
	return PBOOK_SLEEP_OK;
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:15,代码来源:apm_emu.c

示例6: ds_open

static int ds_open(struct inode *inode, struct file *file)
{
    socket_t i = iminor(inode);
    struct pcmcia_bus_socket *s;
    user_info_t *user;

    ds_dbg(0, "ds_open(socket %d)\n", i);

    s = pcmcia_get_bus_socket(i);
    if (!s)
        return -ENODEV;

    if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
        if (s->state & DS_SOCKET_BUSY)
            return -EBUSY;
        else
            s->state |= DS_SOCKET_BUSY;
    }

    user = kmalloc(sizeof(user_info_t), GFP_KERNEL);
    if (!user) return -ENOMEM;
    user->event_tail = user->event_head = 0;
    user->next = s->user;
    user->user_magic = USER_MAGIC;
    user->socket = s;
    s->user = user;
    file->private_data = user;

    if (s->state & DS_SOCKET_PRESENT)
        queue_event(user, CS_EVENT_CARD_INSERTION);
    return 0;
} /* ds_open */
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:32,代码来源:ds.c

示例7: ds_open

static int ds_open(struct inode *inode, struct file *file)
{
    socket_t i = MINOR(inode->i_rdev);
    socket_info_t *s;
    user_info_t *user;

    DEBUG(0, "ds_open(socket %d)\n", i);
    if ((i >= sockets) || (sockets == 0))
	return -ENODEV;
    s = &socket_table[i];
    if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
	if (s->state & SOCKET_BUSY)
	    return -EBUSY;
	else
	    s->state |= SOCKET_BUSY;
    }
    
    MOD_INC_USE_COUNT;
    user = kmalloc(sizeof(user_info_t), GFP_KERNEL);
    if (!user) {
	MOD_DEC_USE_COUNT;
	return -ENOMEM;
    }
    user->event_tail = user->event_head = 0;
    user->next = s->user;
    user->user_magic = USER_MAGIC;
    s->user = user;
    file->private_data = user;
    
    if (s->state & SOCKET_PRESENT)
	queue_event(user, CS_EVENT_CARD_INSERTION);
    return 0;
} /* ds_open */
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:33,代码来源:ds.c

示例8: obex_readstream

static void obex_readstream(obex_t *handle, obex_object_t *object)
{
	obex_context_t *context = OBEX_GetUserData(handle);
	const uint8_t *buf;
	int actual, free_space;

	if (context->counter == 0)
		get_target_size_and_time(handle, object, context);

	actual = OBEX_ObjectReadStream(handle, object, &buf);
	if (actual <= 0) {
		debug("Error or no data on OBEX stream");
		return;
	}

	context->counter += actual;

	debug("obex_readstream: got %d bytes (%d in total)", actual, context->counter);

	free_space = sizeof(context->buf) - (context->data_start + context->data_length);
	if (actual > free_space) {
		/* This should never happen */
		debug("Out of buffer space: actual=%d, free=%d", actual, free_space);
		return;
	}

	memcpy(&context->buf[context->data_start], buf, actual);
	context->data_length += actual;

	debug("OBEX_SuspendRequest");
	OBEX_SuspendRequest(handle, object);

	queue_event(context, OBEX_EV_STREAMAVAIL);
}
开发者ID:Ignazio87,项目名称:openobex,代码行数:34,代码来源:obex-lowlevel.c

示例9: clutter_seat_evdev_notify_relative_motion

void
clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev   *seat,
                                           ClutterInputDevice *input_device,
                                           uint64_t            time_us,
                                           float               dx,
                                           float               dy,
                                           float               dx_unaccel,
                                           float               dy_unaccel)
{
  gfloat new_x, new_y;
  ClutterEvent *event;

  /* We can drop the event on the floor if no stage has been
   * associated with the device yet. */
  if (!_clutter_input_device_get_stage (input_device))
    return;

  _clutter_device_manager_evdev_filter_relative_motion (seat->manager_evdev,
                                                        input_device,
                                                        seat->pointer_x,
                                                        seat->pointer_y,
                                                        &dx,
                                                        &dy);

  new_x = seat->pointer_x + dx;
  new_y = seat->pointer_y + dy;
  event = new_absolute_motion_event (seat, input_device,
                                     time_us, new_x, new_y, NULL);

  _clutter_evdev_event_set_relative_motion (event,
                                            dx, dy,
                                            dx_unaccel, dy_unaccel);

  queue_event (event);
}
开发者ID:GNOME,项目名称:mutter,代码行数:35,代码来源:clutter-seat-evdev.c

示例10: handle_event

static void handle_event(socket_info_t *s, event_t event)
{
    user_info_t *user;
    for (user = s->user; user; user = user->next)
	queue_event(user, event);
    wake_up_interruptible(&s->queue);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:7,代码来源:ds.c

示例11: Lucent_handle_dle

static int Lucent_handle_dle(char data)
     {

     switch (data)
          {

	  /*
	   * It appears that Lucent modems have just a single
	   * silence detection notification, that always reports
	   * as "<DLE>-s".  This report indicates that silence
	   * exceeding the duration of the interval set with AT+VSD
	   * has been detected, regardless of whether there was
	   * previously good data or not.
	   *
	   * So here we override the IS_101 mapping of DLE-s to
	   * "NO_VOICE_ENERGY", and change it to "SILENCE_DETECTED".
	   *
	   * Caveat: this will break vgetty's heuristic "if <DLE>s
	   *  was seen, there is nobody at the calling end, so let's try
	   *  data/fax mode".  So if you have a Lucent modem and want to
	   *  do voice and data/fax on the same line, you need calling
	   *  modems that send a CNG tone, or have the caller dial up,
	   *  wait for a few seconds, and then send another DTMF tone
	   *  (which will trigger data/fax mode).
	   *
	   * Patch by Paul Fox <[email protected]>
	   */
          case 's':
               return(queue_event(create_event(SILENCE_DETECTED)));

          }

     return(IS_101_handle_dle(data));
     }
开发者ID:OPSF,项目名称:uClinux,代码行数:34,代码来源:Lucent.c

示例12: rmt_leave_actions

/*
 * leave the ring
 */
static void rmt_leave_actions(struct s_smc *smc)
{
	queue_event(smc,EVENT_ECM,EC_DISCONNECT) ;
	/*
	 * Note: Do NOT try again later. (with please reconnect)
	 * The station must be left from the ring!
	 */
}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:11,代码来源:rmt.c

示例13: cem_priv_state

static void cem_priv_state(struct s_smc *smc, int event)
/* State machine for private PORT states: used to optimize dual homing */
{
	int	np;	/* Number of the port */
	int	i;

	/* Do this only in a DAS */
	if (smc->s.sas != SMT_DAS )
		return ;

	np = event - CF_JOIN;

	if (np != PA && np != PB) {
		return ;
	}
	/* Change the port state according to the event (portnumber) */
	if (smc->y[np].cf_join) {
		smc->y[np].cem_pst = CEM_PST_UP ;
	} else if (!smc->y[np].wc_flag) {
		/* set the port to done only if it is not withheld */
		smc->y[np].cem_pst = CEM_PST_DOWN ;
	}

	/* Don't set an hold port to down */

	/* Check all ports of restart conditions */
	for (i = 0 ; i < 2 ; i ++ ) {
		/* Check all port for PORT is on hold and no withhold is done */
		if ( smc->y[i].cem_pst == CEM_PST_HOLD && !smc->y[i].wc_flag ) {
			smc->y[i].cem_pst = CEM_PST_DOWN;
			queue_event(smc,(int)(EVENT_PCM+i),PC_START) ;
		}
		if ( smc->y[i].cem_pst == CEM_PST_UP && smc->y[i].wc_flag ) {
			smc->y[i].cem_pst = CEM_PST_HOLD;
			queue_event(smc,(int)(EVENT_PCM+i),PC_START) ;
		}
		if ( smc->y[i].cem_pst == CEM_PST_DOWN && smc->y[i].wc_flag ) {
			/*
			 * The port must be restarted when the wc_flag
			 * will be reset. So set the port on hold.
			 */
			smc->y[i].cem_pst = CEM_PST_HOLD;
		}
	}
	return ;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:46,代码来源:cfm.c

示例14: prop_actions

static void prop_actions(struct s_smc *smc)
{
	int	port_in = 0 ;
	int	port_out = 0 ;

	RS_SET(smc,RS_EVENT) ;
	switch (smc->s.sas) {
	case SMT_SAS :
		port_in = port_out = pcm_get_s_port(smc) ;
		break ;
	case SMT_DAS :
		port_in = cfm_get_mac_input(smc) ;	
		port_out = cfm_get_mac_output(smc) ;	
		break ;
	case SMT_NAC :
		SMT_PANIC(smc,SMT_E0108, SMT_E0108_MSG) ;
		return ;
	}

	DB_ECM("ECM : prop_actions - trace_prop %d\n", smc->e.trace_prop,0) ;
	DB_ECM("ECM : prop_actions - in %d out %d\n", port_in,port_out) ;

	if (smc->e.trace_prop & ENTITY_BIT(ENTITY_MAC)) {
		
		DB_ECM("ECM : initiate TRACE on PHY %c\n",'A'+port_in-PA,0) ;
		queue_event(smc,EVENT_PCM+port_in,PC_TRACE) ;
	}
	else if ((smc->e.trace_prop & ENTITY_BIT(ENTITY_PHY(PA))) &&
		port_out != PA) {
		
		DB_ECM("ECM : propagate TRACE on PHY B\n",0,0) ;
		queue_event(smc,EVENT_PCMB,PC_TRACE) ;
	}
	else if ((smc->e.trace_prop & ENTITY_BIT(ENTITY_PHY(PB))) &&
		port_out != PB) {
		
		DB_ECM("ECM : propagate TRACE on PHY A\n",0,0) ;
		queue_event(smc,EVENT_PCMA,PC_TRACE) ;
	}
	else {
		
		DB_ECM("ECM : TRACE terminated\n",0,0) ;
		smc->e.path_test = PT_PENDING ;
	}
	smc->e.trace_prop = 0 ;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:46,代码来源:ecm.c

示例15: ISDN4Linux_play_file

int ISDN4Linux_play_file(FILE *fd, int bps)
     {

     if (!is_voicecall)
          return(queue_event(create_event(DATA_CALLING_TONE)));

     return(IS_101_play_file(fd, bps));
     }
开发者ID:OPSF,项目名称:uClinux,代码行数:8,代码来源:ISDN4Linux.c


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