コード例 #1
0
ファイル: xf_event.c プロジェクト: VeeamSoftware/FreeRDP
static BOOL xf_event_KeyPress(xfContext* xfc, XEvent* event, BOOL app)
{
	KeySym keysym;
	char str[256];

	XLookupString((XKeyEvent*) event, str, sizeof(str), &keysym, NULL);

	xf_kbd_set_keypress(xfc, event->xkey.keycode, keysym);

	if (keysym == XK_Insert 
			&& ((xf_kbd_key_pressed(xfc, XK_Alt_L) || xf_kbd_key_pressed(xfc, XK_Alt_R))
			&& (xf_kbd_key_pressed(xfc, XK_Control_L) || xf_kbd_key_pressed(xfc, XK_Control_R)))
		)
		{
			// Ctrl-Alt-Insert: translate to Ctrl-Alt-Delete 
			xf_kbd_send_key(xfc, TRUE, (BYTE)0x77);
			return TRUE;
		}

	if (xfc->fullscreen_toggle && xf_kbd_handle_special_keys(xfc, keysym))
		return TRUE;

	xf_kbd_send_key(xfc, TRUE, event->xkey.keycode);

	return TRUE;
}
コード例 #2
0
ファイル: xf_keyboard.c プロジェクト: pevik/debian-freerdp
BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
{
	if (keysym == XK_Return)
	{
		if ((xf_kbd_key_pressed(xfc, XK_Alt_L) || xf_kbd_key_pressed(xfc, XK_Alt_R))
		    && (xf_kbd_key_pressed(xfc, XK_Control_L) || xf_kbd_key_pressed(xfc, XK_Control_R)))
		{
			/* Ctrl-Alt-Enter: toggle full screen */
			xf_toggle_fullscreen(xfc);
			return TRUE;
		}
	}

	return FALSE;
}
コード例 #3
0
ファイル: xf_keyboard.c プロジェクト: BillTheBest/FreeRDP
boolean xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
{
	if (keysym == XK_Return)
	{
		if ((xf_kbd_key_pressed(xfi, XK_Alt_L) || xf_kbd_key_pressed(xfi, XK_Alt_R))
		    && (xf_kbd_key_pressed(xfi, XK_Control_L) || xf_kbd_key_pressed(xfi, XK_Control_R)))
		{
			/* Ctrl-Alt-Enter: toggle full screen */
			xf_toggle_fullscreen(xfi);
			return true;
		}
	}

	return false;
}
コード例 #4
0
ファイル: xf_keyboard.c プロジェクト: BillTheBest/FreeRDP
void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode)
{
	uint16 flags;
	uint8 scancode;
	boolean extended;
	rdpInput* input;

	input = xfi->instance->input;
	scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode, &extended);

	if (scancode == 0)
	{
		/* unknown key */
	}
	else if ((scancode == 0x46) && extended &&
			!xf_kbd_key_pressed(xfi, XK_Control_L) && !xf_kbd_key_pressed(xfi, XK_Control_R))
	{
		/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
		if (down)
		{
			input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x1D); /* Ctrl down */
			input->KeyboardEvent(input, KBD_FLAGS_DOWN, 0x45); /* NumLock down */
			input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x1D); /* Ctrl up */
			input->KeyboardEvent(input, KBD_FLAGS_RELEASE, 0x45); /* NumLock up */
		}
	}
	else
	{
		flags = (extended) ? KBD_FLAGS_EXTENDED : 0;
		flags |= (down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;

		input->KeyboardEvent(input, flags, scancode);

		if ((scancode == 0x3A) && (down == false)) /* caps lock was released */
		{
			uint32 syncFlags;
			syncFlags = xf_kbd_get_toggle_keys_state(xfi);
			input->SynchronizeEvent(input, syncFlags);
		}
	}
}
コード例 #5
0
ファイル: xf_keyboard.c プロジェクト: pevik/debian-freerdp
void xf_kbd_send_key(xfContext* xfc, BOOL down, BYTE keycode)
{
	DWORD rdp_scancode;
	rdpInput* input;

	input = xfc->instance->input;
	rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);

	if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
	{
		fprintf(stderr, "Unknown key with X keycode 0x%02x\n", keycode);
	}
	else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
			!xf_kbd_key_pressed(xfc, XK_Control_L) && !xf_kbd_key_pressed(xfc, XK_Control_R))
	{
		/* Pause without Ctrl has to be sent as a series of keycodes
		 * in a single input PDU.  Pause only happens on "press";
		 * no code is sent on "release".
		 */
		if (down)
		{
			freerdp_input_send_keyboard_pause_event(input);
		}
	}
	else
	{
		freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);

		if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE))
		{
			UINT32 syncFlags;
			syncFlags = xf_kbd_get_toggle_keys_state(xfc);
			input->SynchronizeEvent(input, syncFlags);
		}
	}
}
コード例 #6
0
ファイル: xf_keyboard.c プロジェクト: KimDongChun/FreeRDP
void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode)
{
	DWORD rdp_scancode;
	rdpInput* input;

	input = xfi->instance->input;
	rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);

	if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
	{
		fprintf(stderr, "Unknown key with X keycode 0x%02x\n", keycode);
	}
	else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
			!xf_kbd_key_pressed(xfi, XK_Control_L) && !xf_kbd_key_pressed(xfi, XK_Control_R))
	{
		/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
		if (down)
		{
			freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_LCONTROL);
			freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_NUMLOCK);
			freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_LCONTROL);
			freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_NUMLOCK);
		}
	}
	else
	{
		freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);

		if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE))
		{
			UINT32 syncFlags;
			syncFlags = xf_kbd_get_toggle_keys_state(xfi);
			input->SynchronizeEvent(input, syncFlags);
		}
	}
}
コード例 #7
0
ファイル: xf_keyboard.c プロジェクト: ArvidNorr/FreeRDP
void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode)
{
	RDP_SCANCODE rdp_scancode;
	rdpInput* input;

	input = xfi->instance->input;
	rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);

	if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
	{
		printf("Unknown key with X keycode 0x%02x\n", keycode);
	}
	else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
			!xf_kbd_key_pressed(xfi, XK_Control_L) && !xf_kbd_key_pressed(xfi, XK_Control_R))
	{
		/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
		if (down)
		{
			freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_LCONTROL);
			freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_NUMLOCK);
			freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_LCONTROL);
			freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_NUMLOCK);
		}
	}
	else
	{
		freerdp_input_send_keyboard_event_2(input, down, rdp_scancode);

		if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == false))
		{
			uint32 syncFlags;
			syncFlags = xf_kbd_get_toggle_keys_state(xfi);
			input->SynchronizeEvent(input, syncFlags);
		}
	}
}