4#include "ConnectFreeRDP.h"
5#include <freerdp/gdi/gdi.h>
7CCursorFreeRDP::CCursorFreeRDP(
CConnectFreeRDP *parent) : QObject(parent),
9 m_Logger(
"FreeRDP.Cursor")
12int CCursorFreeRDP::RegisterPointer(rdpGraphics *graphics)
14 rdpPointer* pointer = NULL;
15 if (!(pointer = (rdpPointer*)calloc(1,
sizeof(rdpPointer))))
18 pointer->size =
sizeof(_Pointer);
19 pointer->New = cb_Pointer_New;
20 pointer->Free = cb_Pointer_Free;
21 pointer->Set = cb_Pointer_Set;
22 pointer->SetNull = cb_Pointer_SetNull;
23 pointer->SetDefault = cb_Pointer_SetDefault;
24 pointer->SetPosition = cb_Pointer_SetPosition;
25 graphics_register_pointer(graphics, pointer);
31BOOL CCursorFreeRDP::cb_Pointer_New(rdpContext *context, rdpPointer *pointer)
35 return pThis->m_Cursor.
onNew(context, pointer);
38void CCursorFreeRDP::cb_Pointer_Free(rdpContext* context, rdpPointer* pointer)
42 pThis->m_Cursor.onFree(context, pointer);
45BOOL CCursorFreeRDP::cb_Pointer_Set(rdpContext *context,
46 #
if FreeRDP_VERSION_MAJOR >= 3
49 const rdpPointer *pointer
55 return pThis->m_Cursor.
onSet(context, pointer);
58BOOL CCursorFreeRDP::cb_Pointer_SetNull(rdpContext *context)
62 return pThis->m_Cursor.onSetNull(context);
65BOOL CCursorFreeRDP::cb_Pointer_SetDefault(rdpContext *context)
69 return pThis->m_Cursor.onSetDefault(context);
73BOOL CCursorFreeRDP::cb_Pointer_SetPosition(rdpContext *context, UINT32 x, UINT32 y)
77 return pThis->m_Cursor.onSetPosition(context, x, y);
85 QImage cursor(pointer->width, pointer->height, QImage::Format_ARGB32);
93 bRet = freerdp_image_copy_from_pointer_data(cursor.bits(),
94 CConnectFreeRDP::GetImageFormat(cursor.format()),
96 0, 0, cursor.width(), cursor.height(),
98 pointer->lengthXorMask,
100 pointer->lengthAndMask,
102 &context->gdi->palette);
106 emit m_pConnect->sigUpdateCursor(QCursor(QPixmap::fromImage(m_Cursor),
107 pointer->xPos, pointer->yPos));
112void CCursorFreeRDP::onFree(rdpContext* context, rdpPointer* pointer)
118 QImage cursor(pointer->width, pointer->height, QImage::Format_ARGB32);
126 bRet = freerdp_image_copy_from_pointer_data(cursor.bits(),
127 CConnectFreeRDP::GetImageFormat(cursor.format()),
129 0, 0, cursor.width(), cursor.height(),
130 pointer->xorMaskData,
131 pointer->lengthXorMask,
132 pointer->andMaskData,
133 pointer->lengthAndMask,
135 &context->gdi->palette);
139 emit m_pConnect->sigUpdateCursor(QCursor(QPixmap::fromImage(m_Cursor),
140 pointer->xPos, pointer->yPos));
145BOOL CCursorFreeRDP::onSetDefault(rdpContext *context)
148 emit m_pConnect->sigUpdateCursor(QCursor());
152BOOL CCursorFreeRDP::onSetNull(rdpContext *context)
155 emit m_pConnect->sigUpdateCursor(QCursor(Qt::BlankCursor));
159BOOL CCursorFreeRDP::onSetPosition(rdpContext *context, UINT32 x, UINT32 y)
161 emit m_pConnect->sigUpdateCursor(QCursor(QPixmap::fromImage(m_Cursor),
BOOL onNew(rdpContext *context, rdpPointer *pointer)
BOOL onSet(rdpContext *context, const rdpPointer *pointer)