Esempio n. 1
0
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);
	};
};
Esempio n. 2
0
void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {
		Ref<InputEventScreenTouch> ev;
		ev.instance();

		ev->set_index(p_idx);
		ev->set_pressed(p_pressed);
		ev->set_position(Vector2(p_x, p_y));
		queue_event(ev);
	};

	mouse_list.pressed[p_idx] = p_pressed;

	if (p_use_as_mouse) {

		Ref<InputEventMouseButton> ev;
		ev.instance();

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

		//mouse_list.pressed[p_idx] = p_pressed;

		input->set_mouse_position(ev->get_position());
		ev->set_button_index(BUTTON_LEFT);
		ev->set_doubleclick(p_doubleclick);
		ev->set_pressed(p_pressed);

		queue_event(ev);
	};
};
Esempio n. 3
0
/** 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);
}
Esempio n. 4
0
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);
	};
};
Esempio n. 5
0
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);
}
Esempio n. 6
0
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;
}
Esempio n. 7
0
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 */
Esempio n. 8
0
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 */
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
}
Esempio n. 11
0
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);
}
Esempio n. 12
0
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 <*****@*****.**>
	   */
          case 's':
               return(queue_event(create_event(SILENCE_DETECTED)));

          }

     return(IS_101_handle_dle(data));
     }
/*
 * 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!
	 */
}
Esempio n. 14
0
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 ;
}
Esempio n. 15
0
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 ;
}
Esempio n. 16
0
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));
     }
Esempio n. 17
0
int ISDN4Linux_handle_dle(char data)
     {
     switch (data)
        {
        case DC4:
             lprintf(L_WARN, "%s: <DLE> <DC4> received", program_name);
             voice_stop_current_action();
             
             switch (voice_command("", "OK|VCON|NO CARRIER"))
                  {
                  case VMA_USER_3:
                       queue_event(create_event(NO_CARRIER));
                       break;
                  case VMA_USER_1:
                  case VMA_USER_2:
                       break;
                  default:
                       return FAIL;
                  }
             
             got_DLE_DC4 = TRUE;
             return (OK);

        case ETX:
             lprintf(L_WARN, "%s: <DLE> <ETX> received", program_name);
             voice_stop_current_action();
             
             switch (voice_command("", "OK|VCON|NO CARRIER"))
                  {
                  case VMA_USER_3:
                       queue_event(create_event(NO_CARRIER));
                       break;
                  case VMA_USER_1:
                  case VMA_USER_2:
                       break;
                  default:
                       return FAIL;
                  }
             
             return (OK);
             
        default:
             return(IS_101_handle_dle(data));
        }
     }
Esempio n. 18
0
int ISDN4Linux_start_play_file(void)
     {
     voice_modem_state = PLAYING;

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

     return(IS_101_start_play_file());
     }
Esempio n. 19
0
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)) {

		InputEvent ev;
		ev.type = InputEvent::SCREEN_DRAG;
		ev.ID = ++last_event_id;
		ev.screen_drag.index = p_idx;
		ev.screen_drag.x = p_x;
		ev.screen_drag.y = p_y;
		ev.screen_drag.relative_x = p_x - p_prev_x;
		ev.screen_drag.relative_y = p_y - p_prev_y;
		queue_event(ev);
	};

	if (p_use_as_mouse) {
		InputEvent ev;
		ev.type = InputEvent::MOUSE_MOTION;
		ev.device = 0;
		ev.mouse_motion.pointer_index = p_idx;
		ev.ID = ++last_event_id;

		if (true) { // vertical

			ev.mouse_motion.x = ev.mouse_button.global_x = p_x;
			ev.mouse_motion.y = ev.mouse_button.global_y = p_y;
			ev.mouse_motion.relative_x = ev.mouse_motion.x - p_prev_x;
			ev.mouse_motion.relative_y = ev.mouse_motion.y - p_prev_y;

		} else { // horizontal?
			ev.mouse_motion.x = ev.mouse_button.global_x = video_mode.height - p_y;
			ev.mouse_motion.y = ev.mouse_button.global_y = p_x;
			ev.mouse_motion.relative_x = ev.mouse_motion.x - (video_mode.height - p_prev_x);
			ev.mouse_motion.relative_y = ev.mouse_motion.y - p_prev_x;
		};

		input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
		ev.mouse_motion.speed_x = input->get_mouse_speed().x;
		ev.mouse_motion.speed_y = input->get_mouse_speed().y;
		ev.mouse_motion.button_mask = 1; // pressed

		queue_event(ev);
	};
};
Esempio n. 20
0
void queue_mouse_event(int x, int y, int relx, int rely)
{
	SDL_Event ev;
	ev.type = SDL_MOUSEMOTION;
	ev.motion.x = (Uint16)x;
	ev.motion.y = (Uint16)y;
	ev.motion.xrel = (Sint16)relx;
	ev.motion.yrel = (Sint16)rely;
	queue_event(ev);
}
Esempio n. 21
0
void OSIPhone::key(uint32_t p_key, bool p_pressed) {

	Ref<InputEventKey> ev;
	ev.instance();
	ev->set_echo(false);
	ev->set_pressed(p_pressed);
	ev->set_scancode(p_key);
	ev->set_unicode(p_key);
	queue_event(ev);
};
Esempio n. 22
0
static int ISDN4Linux_set_device(int device)
     {
     int result;
     reset_watchdog();

     switch (device)
          {
          case NO_DEVICE:
               voice_write("AT+VLS=0");
               result = voice_command("", "OK|NO CARRIER|AT+VLS=0");

               if (result == VMA_USER_3)
                    result = voice_command("", "OK|NO CARRIER");

               switch(result)
                    {
                    case VMA_USER_2:
                         queue_event(create_event(NO_CARRIER));
                         /* Fall through */
                    case VMA_USER_1:
                         return (OK);
                    }

               return(FAIL);
          case DIALUP_LINE:

               switch (voice_command("AT+VLS=2", "VCON|OK|NO CARRIER"))
                    {
                    case VMA_USER_3:
                         queue_event(create_event(NO_CARRIER));
                         /* Fall through */
                    case VMA_USER_1:
                    case VMA_USER_2:
                         return(OK);
                    }

               return(FAIL);
          }

     lprintf(L_WARN, "ISDN4Linux handle event: Unknown output device (%d)",
      device);
     return(FAIL);
     }
Esempio n. 23
0
void queue_button_event(int button, int state, int x, int y)
{
	SDL_Event ev;
	ev.type = Uint8((state == SDL_PRESSED)? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP);
	ev.button.button = (uint8_t)button;
	ev.button.state  = (uint8_t)state;
	ev.button.x = (Uint16)x;
	ev.button.y = (Uint16)y;
	queue_event(ev);
}
Esempio n. 24
0
void OSIPhone::key(uint32_t p_key, bool p_pressed) {

	InputEvent ev;
	ev.type = InputEvent::KEY;
	ev.ID = ++last_event_id;
	ev.key.echo = false;
	ev.key.pressed = p_pressed;
	ev.key.scancode = p_key;
	ev.key.unicode = p_key;
	queue_event(ev);
};
Esempio n. 25
0
static inline void queue_active_event(SdlActivationType type, size_t changed_app_state)
{
	// SDL says this event is not generated when the window is created,
	// but skipping the first event may confuse things.

	SDL_Event ev;
	ev.type = SDL_ACTIVEEVENT;
	ev.active.state = (uint8_t)changed_app_state;
	ev.active.gain  = (uint8_t)((type == GAIN)? 1 : 0);
	queue_event(ev);
}
Esempio n. 26
0
void OSIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y) {

	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);
	};
};
Esempio n. 27
0
/* Clone an object. The new object is owned by the cloning player */
static dbref
clone_object(dbref player, dbref thing, const char *newname, int preserve)
{
  dbref clone;

  clone = new_object();

  Owner(clone) = Owner(player);
  Name(clone) = NULL;
  if (newname && *newname)
    set_name(clone, newname);
  else
    set_name(clone, Name(thing));
  s_Pennies(clone, Pennies(thing));
  AttrCount(clone) = 0;
  List(clone) = NULL;
  Locks(clone) = NULL;
  clone_locks(player, thing, clone);
  Zone(clone) = Zone(thing);
  Parent(clone) = Parent(thing);
  Flags(clone) = clone_flag_bitmask("FLAG", Flags(thing));
  if (!preserve) {
    clear_flag_internal(clone, "WIZARD");
    clear_flag_internal(clone, "ROYALTY");
    Warnings(clone) = 0;        /* zap warnings */
    Powers(clone) = new_flag_bitmask("POWER");  /* zap powers */
  } else {
    Powers(clone) = clone_flag_bitmask("POWER", Powers(thing));
    Warnings(clone) = Warnings(thing);
    if (Wizard(clone) || Royalty(clone) || Warnings(clone) ||
        !null_flagmask("POWER", Powers(clone)))
      notify(player,
             T
             ("Warning: @CLONE/PRESERVE on an object with WIZ, ROY, @powers, or @warnings."));
  }
  /* We give the clone the same modification time that its
   * other clone has, but update the creation time */
  ModTime(clone) = ModTime(thing);
  CreTime(clone) = mudtime;
  Type(clone) = Type(thing);

  Contents(clone) = Location(clone) = Next(clone) = NOTHING;
  if (IsRoom(thing))
    Exits(clone) = NOTHING;
  else
    Home(clone) = Home(thing);
  atr_cpy(clone, thing);

  queue_event(player, "OBJECT`CREATE", "%s,%s",
              unparse_objid(clone), unparse_objid(thing));
  return clone;

}
Esempio n. 28
0
void clutter_seat_evdev_notify_absolute_motion (ClutterSeatEvdev   *seat,
                                                ClutterInputDevice *input_device,
                                                uint64_t            time_us,
                                                float               x,
                                                float               y,
                                                double             *axes)
{
  ClutterEvent *event;

  event = new_absolute_motion_event (seat, input_device, time_us, x, y, axes);

  queue_event (event);
}
Esempio n. 29
0
static void
notify_scroll (ClutterInputDevice       *input_device,
               guint64                   time_us,
               gdouble                   dx,
               gdouble                   dy,
               ClutterScrollSource       scroll_source,
               ClutterScrollFinishFlags  flags,
               gboolean                  emulated)
{
  ClutterInputDeviceEvdev *device_evdev;
  ClutterSeatEvdev *seat;
  ClutterStage *stage;
  ClutterEvent *event = NULL;
  gdouble scroll_factor;

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

  device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (input_device);
  seat = _clutter_input_device_evdev_get_seat (device_evdev);

  event = clutter_event_new (CLUTTER_SCROLL);

  _clutter_evdev_event_set_time_usec (event, time_us);
  event->scroll.time = us2ms (time_us);
  event->scroll.stage = CLUTTER_STAGE (stage);
  _clutter_xkb_translate_state (event, seat->xkb, seat->button_state);

  /* libinput pointer axis events are in pointer motion coordinate space.
   * To convert to Xi2 discrete step coordinate space, multiply the factor
   * 1/10. */
  event->scroll.direction = CLUTTER_SCROLL_SMOOTH;
  scroll_factor = 1.0 / DISCRETE_SCROLL_STEP;
  clutter_event_set_scroll_delta (event,
                                  scroll_factor * dx,
                                  scroll_factor * dy);

  event->scroll.x = seat->pointer_x;
  event->scroll.y = seat->pointer_y;
  clutter_event_set_device (event, seat->core_pointer);
  clutter_event_set_source_device (event, input_device);
  event->scroll.scroll_source = scroll_source;
  event->scroll.finish_flags = flags;

  _clutter_event_set_pointer_emulated (event, emulated);

  queue_event (event);
}
Esempio n. 30
0
void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) {

	if (!GLOBAL_DEF("debug/disable_touch", false)) {
		Ref<InputEventScreenTouch> ev;
		ev.instance();

		ev->set_index(p_idx);
		ev->set_pressed(p_pressed);
		ev->set_position(Vector2(p_x, p_y));
		queue_event(ev);
	};

	touch_list.pressed[p_idx] = p_pressed;
};