public ButtonState GetButtonState(String context_name,String action_name) {
		InputContextKey k = getInputContextKey(context_name,action_name);

		// order of importance (from least to most): OFF,RELEASED,PRESSED,ON
		// so if two buttons do the same thing, releasing one and holding the other
		// will only produce the one ON message.  This may cause rare glitches.  Hello, future debugger!
		ButtonState state=Input.ButtonState.OFF;
		int i;
		for(i=0;i<k.ids.size();++i) {
			int input_id = k.ids.get(i);
			if( input_id == Input.FIRST_KB_BUTTON+KeyEvent.VK_SPACE) {
				assert(false);
			}
			ButtonState x=getInputState(input_id);
		    if(x==Input.ButtonState.ON) {
		    	//System.out.println(context_name+" "+action_name+" ON");
		    	return Input.ButtonState.ON;
		    }
		    
		    if(state==ButtonState.OFF) {
		        if(x==ButtonState.RELEASED) {
			    	//System.out.println(context_name+" "+action_name+" RELEASED");
			    	state=ButtonState.RELEASED;
		        }
		        else if(x==ButtonState.PRESSED) {
			    	//System.out.println(context_name+" "+action_name+" PRESSED");
			    	state=ButtonState.PRESSED;
		        }
		    }/*
		    if(state==Input.ButtonState.RELEASED && x==Input.ButtonState.PRESSED) {
		    	System.out.println(context_name+" "+action_name+" RELEASED");
		    	state=Input.ButtonState.RELEASED;
		    }
		    if(state==Input.ButtonState.OFF && x==Input.ButtonState.RELEASED) {
		    	System.out.println(context_name+" "+action_name+" PRESSED");
		    	state=Input.ButtonState.PRESSED;
		    }*/
		}

		return state;
	}