コード例 #1
0
ファイル: xf_keyboard.c プロジェクト: mccart/FreeRDP
void xf_keyboard_focus_in(xfContext* xfc)
{
	rdpInput* input;
	UINT32 syncFlags, state;
	Window w;
	int d, x, y;

	if (!xfc->display || !xfc->window)
		return;

	input = xfc->instance->input;
	syncFlags = xf_keyboard_get_toggle_keys_state(xfc);

	input->FocusInEvent(input, syncFlags);

	/* finish with a mouse pointer position like mstsc.exe if required */

	if (xfc->remote_app)
		return;

	if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state))
	{
		if (x >= 0 && x < xfc->window->width && y >= 0 && y < xfc->window->height)
		{
			xf_event_adjust_coordinates(xfc, &x, &y);
			input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
		}
	}
}
コード例 #2
0
ファイル: xf_keyboard.c プロジェクト: Tarnyko/FreeRDP-1
void xf_keyboard_focus_in(xfContext* xfc)
{
	rdpInput* input;
	UINT32 syncFlags = 0;
	int dummy, mouseX = 0, mouseY = 0;
	Window wdummy;
	UINT32 state = 0;

	if (xfc->display && xfc->window)
	{
		input = xfc->instance->input;
		syncFlags = xf_keyboard_get_toggle_keys_state(xfc);

		if (!xfc->remote_app)
		{
			XQueryPointer(xfc->display, xfc->window->handle, &wdummy, &wdummy,
					&mouseX, &mouseY, &dummy, &dummy, &state);
		}
		else
		{
			XQueryPointer(xfc->display, DefaultRootWindow(xfc->display),
				&wdummy, &wdummy, &dummy, &dummy, &dummy, &dummy, &state);
		}

		input->FocusInEvent(input, syncFlags, mouseX, mouseY);
	}
}
コード例 #3
0
ファイル: xf_keyboard.c プロジェクト: mccart/FreeRDP
void xf_keyboard_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)
	{
		WLog_ERR(TAG,  "Unknown key with X keycode 0x%02x", keycode);
	}
	else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
			!xf_keyboard_key_pressed(xfc, XK_Control_L) && !xf_keyboard_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_keyboard_get_toggle_keys_state(xfc);
			input->SynchronizeEvent(input, syncFlags);
		}
	}
}