rem: Input.handleInput(m_state); 
add: Input.handleInput(m_state.clone()); 
context:   Input.poll=function(){    var events,i,event;    function assert(f) {      if (!f()) throw Error("assertion "+f.toSource()+" failed\n");    }    function debug(msg) {      stderr.write(msg+"\n"+"stack: "+util.getStack());    }    function handleDevKey(e, keyDev)    {      var dev,m_state,old,pressed,k;      // map keyboard dev no to real dev no      assert(function(){return ((keyDev>=0)&&(keyDev<2));});      dev=Input.keyDevMap[keyDev];      assert(function(){return typeof Input.devState != "undefined";});      assert(function(){return ((dev>=0)&&(dev<Input.devState.length));});        m_state=Input.devState[dev];      old=m_state.xxx();      pressed=e.state;      k=e.sym;      if (k==Input.keys[keyDev][0]) {	// up	if (pressed) m_state.y=1;	else if (m_state.y==1) m_state.y=0;      }else if (k==Input.keys[keyDev][1]) {	// down	if (pressed) m_state.y=-1;	else if (m_state.y==-1) m_state.y=0;      }else if (k==Input.keys[keyDev][2]) {	// left 	if (pressed) m_state.x=-1;	else if (m_state.x==-1) m_state.x=0;      }else if (k==Input.keys[keyDev][3]) {	// right	if (pressed) m_state.x=1;	else if (m_state.x==1) m_state.x=0;      }else if (k==Input.keys[keyDev][4]) {	// button 1	if (pressed) m_state.buttons|=1;	else m_state.buttons&=~1;      }else if (k==Input.keys[keyDev][5]) {	// button 1	if (pressed) m_state.buttons|=2;	else m_state.buttons&=~2;      }      if ((m_state.x!=old.x)||(m_state.y!=old.y)||(m_state.buttons!=old.buttons)) {	Input.handleInput(m_state);	return true;      }      return false;    }    function handleSpecialKey(e)    {      if (!e.state) return false;      switch (e.sym){      case Input.KEY_g:	if (e.mod & Input.KMOD_CTRL) {	  toggleGrab();	  return true;	}	break;      case Input.KEY_z:    	if (e.mod & Input.KMOD_CTRL) {	  Input.iconifyHandler();	  return true;	}	break;      case Input.KEY_ESCAPE:	ejs.exit(true);      case Input.KEY_RETURN:	if (e.mod & Input.KMOD_ALT){	  Video.toggleFullscreen();	  return true;	}	break;      default:	return false;      }      return false;    }    //! handle key in character mode    function handleKey(e)    {      if (!e.state) return false;      Input.handleChar(String.fromCharCode(e.unicode));      return true;    }    events=Input.getEvents();    for (i=0;i<events.length;++i) {      event=events[i];      switch (event.type) {      case Input.QUIT:	ejs.exit(true);      case Input.KEYDOWN:      case Input.KEYUP:	if (!Input.enableUnicode(-1)) {	  if (!handleDevKey(event,0))	    if (!handleDevKey(event,1))	      handleSpecialKey(event);	}else{	  if (!handleSpecialKey(event)) {	    handleKey(event);	  }	}	break;      case Input.JOYAXISMOTION:	handleJoyMotion(event);	break;      case Input.JOYBUTTONDOWN:      case Input.JOYBUTTONUP:	handleJoyButton(event);	break;      case Input.VIDEORESIZE:	Input.handleResize(event);	break;      }    }  }
meta: 8182	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8182/ab1549e88031263baef0d6911b4f19a93176370d/input.js/buggy/egachine/src/modules/input/input.js