Ejemplo n.º 1
0
def handle_key_event(session, msg):
	key_event = msg["key_event"]
	if type(key_event) is int and keyboard.is_mouse_event(key_event):
		handle_mouse_drag(session, key_event)
	if type(key_event) is int:
		key_event = [key_event]
	keyboard.execute_sequence(key_event)
Ejemplo n.º 2
0
def client_msg_handler(session, msg):
	if "key_event" in msg:
		handle_key_event(session, msg)
	elif "close" in msg:
		session_id = msg["session_id"]
		delete_session(session_id)
	elif "gesture" in msg:
		action = None
		gesture_id = msg["gesture"]
		print "client_msg_handler", "gesture_id:", repr(gesture_id)
		with session["lock"]:
			window_title, process_name = get_active_window_data()
			active_app = find_in_list(session["apps"], application_finder(window_title, process_name))
		if active_app is not None:
			for gesture in active_app["gestures"]:
				if gesture["id"] == gesture_id:
					action = gesture["action"]
					break
		print action
		if action is not None:
			keyboard.execute_sequence(action)
Ejemplo n.º 3
0
def handle_keyboard_key(session, key_event):
	keyboard.execute_sequence([key_event])