示例#1
0
BOOL freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
	if (!input)
		return FALSE;

	return IFCALLRESULT(TRUE, input->ExtendedMouseEvent, input, flags, x, y);
}
示例#2
0
BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags)
{
	if (!input)
		return FALSE;

	return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, flags);
}
示例#3
0
BOOL freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
	if (!input)
		return FALSE;

	return IFCALLRESULT(TRUE, input->UnicodeKeyboardEvent, input, flags, code);
}
示例#4
0
static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s)
{
	UINT16 keyboardFlags, keyCode;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
	Stream_Read_UINT16(s, keyCode); /* keyCode (2 bytes) */
	Stream_Seek(s, 2); /* pad2Octets (2 bytes) */

	/**
	 * Note: A lot of code in FreeRDP and in dependent projects checks the
	 * KBDFLAGS_DOWN flag in order to detect a key press.
	 * According to the specs only the absence of the slow-path
	 * KBDFLAGS_RELEASE flag indicates a key-down event.
	 * The slow-path KBDFLAGS_DOWN flag merely indicates that the key was
	 * down prior to this event.
	 * The checks for KBDFLAGS_DOWN only work successfully because the code
	 * handling the fast-path keyboard input sets the KBDFLAGS_DOWN flag if
	 * the FASTPATH_INPUT_KBDFLAGS_RELEASE flag is missing.
	 * Since the same input callback is used for slow- and fast-path events
	 * we have to follow that "convention" here.
	 */

	if (keyboardFlags & KBD_FLAGS_RELEASE)
		keyboardFlags &= ~KBD_FLAGS_DOWN;
	else
		keyboardFlags |= KBD_FLAGS_DOWN;

	return IFCALLRESULT(TRUE, input->KeyboardEvent, input, keyboardFlags, keyCode);
}
示例#5
0
文件: client.c 项目: mfleisz/FreeRDP
int freerdp_client_stop(rdpContext* context)
{
	RDP_CLIENT_ENTRY_POINTS* pEntryPoints;

	if (!context || !context->instance || !context->instance->pClientEntryPoints)
		return ERROR_BAD_ARGUMENTS;

	pEntryPoints = context->instance->pClientEntryPoints;
	return IFCALLRESULT(CHANNEL_RC_OK, pEntryPoints->ClientStop, context);
}
示例#6
0
文件: input.c 项目: BUGgs/FreeRDP
static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
{
	UINT32 toggleFlags;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
	Stream_Read_UINT32(s, toggleFlags); /* toggleFlags (4 bytes) */

	return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, toggleFlags);
}
示例#7
0
文件: input.c 项目: BUGgs/FreeRDP
static BOOL input_recv_extended_mouse_event(rdpInput* input, wStream* s)
{
	UINT16 pointerFlags, xPos, yPos;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
	Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
	Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */

	return IFCALLRESULT(TRUE, input->ExtendedMouseEvent, input, pointerFlags, xPos, yPos);
}
示例#8
0
static void dvcman_channel_free(void* arg)
{
	DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*) arg;
	UINT error = CHANNEL_RC_OK;

	if (channel)
	{
		if (channel->channel_callback)
		{
			IFCALL(channel->channel_callback->OnClose,
			       channel->channel_callback);
		}

		if (channel->status == CHANNEL_RC_OK)
		{
			IWTSVirtualChannel* ichannel = (IWTSVirtualChannel*) channel;

			if (channel->dvcman && channel->dvcman->drdynvc)
			{
				DrdynvcClientContext* context = channel->dvcman->drdynvc->context;

				if (context)
				{
					IFCALLRET(context->OnChannelDisconnected, error,
					          context, channel->channel_name,
					          channel->pInterface);
				}
			}

			error = IFCALLRESULT(CHANNEL_RC_OK, ichannel->Close, ichannel);

			if (error != CHANNEL_RC_OK)
				WLog_ERR(TAG, "Close failed with error %"PRIu32"!", error);
		}

		if (channel->dvc_data)
			Stream_Release(channel->dvc_data);

		DeleteCriticalSection(&(channel->lock));
		free(channel->channel_name);
	}

	free(channel);
}
示例#9
0
文件: bitmap.c 项目: dcatonR1/FreeRDP
static BOOL update_gdi_memblt(rdpContext* context,
			      MEMBLT_ORDER* memblt)
{
	rdpBitmap* bitmap;
	rdpCache* cache = context->cache;

	if (memblt->cacheId == 0xFF)
		bitmap = offscreen_cache_get(cache->offscreen, memblt->cacheIndex);
	else
		bitmap = bitmap_cache_get(cache->bitmap, (BYTE) memblt->cacheId,
					  memblt->cacheIndex);

	/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
	if (bitmap == NULL)
		return TRUE;

	memblt->bitmap = bitmap;
	return IFCALLRESULT(TRUE, cache->bitmap->MemBlt, context, memblt);
}
示例#10
0
文件: input.c 项目: BUGgs/FreeRDP
static BOOL input_recv_unicode_keyboard_event(rdpInput* input, wStream* s)
{
	UINT16 keyboardFlags, unicodeCode;

	if (Stream_GetRemainingLength(s) < 6)
		return FALSE;

	Stream_Read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
	Stream_Read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */
	Stream_Seek(s, 2); /* pad2Octets (2 bytes) */

	/* "fix" keyboardFlags - see comment in input_recv_keyboard_event() */

	if (keyboardFlags & KBD_FLAGS_RELEASE)
		keyboardFlags &= ~KBD_FLAGS_DOWN;
	else
		keyboardFlags |= KBD_FLAGS_DOWN;

	return IFCALLRESULT(TRUE, input->UnicodeKeyboardEvent, input, keyboardFlags, unicodeCode);
}
示例#11
0
文件: client.c 项目: mfleisz/FreeRDP
static BOOL freerdp_client_common_new(freerdp* instance, rdpContext* context)
{
	RDP_CLIENT_ENTRY_POINTS* pEntryPoints = instance->pClientEntryPoints;
	return IFCALLRESULT(TRUE, pEntryPoints->ClientNew, instance, context);
}
示例#12
0
文件: input.c 项目: BUGgs/FreeRDP
BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input)
{
	return IFCALLRESULT(TRUE, input->KeyboardPauseEvent, input);
}
示例#13
0
文件: input.c 项目: BUGgs/FreeRDP
BOOL freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates)
{
	return IFCALLRESULT(TRUE, input->FocusInEvent, input, toggleStates);
}
示例#14
0
文件: input.c 项目: BUGgs/FreeRDP
BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
	return IFCALLRESULT(TRUE, input->KeyboardEvent, input, flags, code);
}
示例#15
0
文件: brush.c 项目: dcatonR1/FreeRDP
static BOOL update_gdi_polygon_sc(rdpContext* context,
				  const POLYGON_SC_ORDER* polygon_sc)
{
	rdpCache* cache = context->cache;
	return IFCALLRESULT(TRUE, cache->brush->PolygonSC, context, polygon_sc);
}
示例#16
0
static BOOL update_process_glyph_fragments(rdpContext* context,
        const BYTE* data,
        UINT32 length, UINT32 cacheId,
        UINT32 ulCharInc, UINT32 flAccel,
        UINT32 bgcolor, UINT32 fgcolor,
        INT32 x, INT32 y,
        INT32 bkX, INT32 bkY,
        INT32 bkWidth, INT32 bkHeight,
        INT32 opX, INT32 opY,
        INT32 opWidth, INT32 opHeight,
        BOOL fOpRedundant)
{
	UINT32 n;
	UINT32 id;
	UINT32 size;
	UINT32 index = 0;
	BYTE* fragments;
	rdpGraphics* graphics;
	rdpGlyphCache* glyph_cache;
	rdpGlyph* glyph;
	RDP_RECT bound;

	if (!context || !data || !context->graphics || !context->cache
	    || !context->cache->glyph)
		return FALSE;

	graphics = context->graphics;
	glyph_cache = context->cache->glyph;
	glyph = graphics->Glyph_Prototype;

	if (!glyph)
		return FALSE;

	/* Limit op rectangle to vislble screen. */
	if (opX < 0)
	{
		opWidth += opX;
		opX = 0;
	}

	if (opY < 0)
	{
		opHeight += opY;
		opY = 0;
	}

	if (opWidth < 0)
		opWidth = 0;

	if (opHeight < 0)
		opHeight = 0;

	/* Limit bk rectangle to vislble screen. */
	if (bkX < 0)
	{
		bkWidth += bkX;
		bkX = 0;
	}

	if (bkY < 0)
	{
		bkHeight += bkY;
		bkY = 0;
	}

	if (bkWidth < 0)
		bkWidth = 0;

	if (bkHeight < 0)
		bkHeight = 0;

	if (opX + opWidth > context->settings->DesktopWidth)
	{
		/**
		 * Some Microsoft servers send erroneous high values close to the
		 * sint16 maximum in the OpRight field of the GlyphIndex, FastIndex and
		 * FastGlyph drawing orders, probably a result of applications trying to
		 * clear the text line to the very right end.
		 * One example where this can be seen is typing in notepad.exe within
		 * a RDP session to Windows XP Professional SP3.
		 * This workaround prevents resulting problems in the UI callbacks.
		 */
		opWidth = context->settings->DesktopWidth - opX;
	}

	if (bkX + bkWidth > context->settings->DesktopWidth)
	{
		/**
		 * Some Microsoft servers send erroneous high values close to the
		 * sint16 maximum in the OpRight field of the GlyphIndex, FastIndex and
		 * FastGlyph drawing orders, probably a result of applications trying to
		 * clear the text line to the very right end.
		 * One example where this can be seen is typing in notepad.exe within
		 * a RDP session to Windows XP Professional SP3.
		 * This workaround prevents resulting problems in the UI callbacks.
		 */
		bkWidth = context->settings->DesktopWidth - bkX;
	}

	bound.x = bkX;
	bound.y = bkY;
	bound.width = bkWidth;
	bound.height = bkHeight;

	if (!glyph->BeginDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor,
	                      fOpRedundant))
		return FALSE;

	if (!IFCALLRESULT(TRUE, glyph->SetBounds, context, bkX, bkY, bkWidth, bkHeight))
		return FALSE;

	while (index < length)
	{
		const UINT32 op = data[index++];

		switch (op)
		{
			case GLYPH_FRAGMENT_USE:
				if (index + 1 > length)
					return FALSE;

				id = data[index++];
				fragments = (BYTE*) glyph_cache_fragment_get(glyph_cache, id, &size);

				if (fragments == NULL)
					return FALSE;

				for (n = 0; n < size;)
				{
					const UINT32 fop = fragments[n++];
					n = update_glyph_offset(fragments, n, &x, &y, ulCharInc, flAccel);

					if (!update_process_glyph(context, fragments, fop, &x, &y, cacheId,
					                          flAccel, fOpRedundant, &bound))
						return FALSE;
				}

				break;

			case GLYPH_FRAGMENT_ADD:
				if (index + 2 > length)
					return FALSE;

				id = data[index++];
				size = data[index++];
				glyph_cache_fragment_put(glyph_cache, id, size, data);
				break;

			default:
				index = update_glyph_offset(data, index, &x, &y, ulCharInc, flAccel);

				if (!update_process_glyph(context, data, op, &x, &y, cacheId, flAccel,
				                          fOpRedundant, &bound))
					return FALSE;

				break;
		}
	}

	return glyph->EndDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
}
示例#17
0
文件: input.c 项目: BUGgs/FreeRDP
BOOL freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
	return IFCALLRESULT(TRUE, input->MouseEvent, input, flags, x, y);
}