mirror of https://github.com/FreeRDP/FreeRDP
Add event_class in event object.
This commit is contained in:
parent
e5a3355099
commit
d7e502dbe1
|
@ -25,6 +25,7 @@
|
|||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
|
||||
#include "cliprdr_constants.h"
|
||||
#include "cliprdr_main.h"
|
||||
|
@ -82,7 +83,8 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* data_in, uint32
|
|||
int supported;
|
||||
int i;
|
||||
|
||||
cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR,
|
||||
FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
num_formats = dataLen / 36;
|
||||
cb_event->formats = (uint32*)xmalloc(sizeof(uint32) * num_formats);
|
||||
cb_event->num_formats = 0;
|
||||
|
@ -137,7 +139,8 @@ void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, STREAM* data_in
|
|||
{
|
||||
FRDP_CB_DATA_REQUEST_EVENT* cb_event;
|
||||
|
||||
cb_event = (FRDP_CB_DATA_REQUEST_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL);
|
||||
cb_event = (FRDP_CB_DATA_REQUEST_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR,
|
||||
FRDP_EVENT_TYPE_CB_DATA_REQUEST, NULL, NULL);
|
||||
stream_read_uint32(data_in, cb_event->format);
|
||||
svc_plugin_send_event((rdpSvcPlugin*)cliprdr, (FRDP_EVENT*)cb_event);
|
||||
}
|
||||
|
@ -164,7 +167,8 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* data_i
|
|||
{
|
||||
FRDP_CB_DATA_RESPONSE_EVENT* cb_event;
|
||||
|
||||
cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL);
|
||||
cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR,
|
||||
FRDP_EVENT_TYPE_CB_DATA_RESPONSE, NULL, NULL);
|
||||
cb_event->size = dataLen;
|
||||
cb_event->data = (uint8*)xmalloc(dataLen);
|
||||
memcpy(cb_event->data, stream_get_tail(data_in), dataLen);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
|
||||
#include "cliprdr_constants.h"
|
||||
#include "cliprdr_main.h"
|
||||
|
@ -92,7 +93,7 @@ static void cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr)
|
|||
|
||||
cliprdr_send_clip_caps(cliprdr);
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_SYNC, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_SYNC, NULL, NULL);
|
||||
svc_plugin_send_event((rdpSvcPlugin*)cliprdr, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static void rail_plugin_send_vchannel_event(void* rail_plugin_object, RAIL_VCHAN
|
|||
memset(payload, 0, sizeof(RAIL_VCHANNEL_EVENT));
|
||||
memcpy(payload, event, sizeof(RAIL_VCHANNEL_EVENT));
|
||||
|
||||
out_event = freerdp_event_new(FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI, on_free_rail_vchannel_event, payload);
|
||||
out_event = freerdp_event_new(FRDP_EVENT_CLASS_RAIL, FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI, on_free_rail_vchannel_event, payload);
|
||||
|
||||
svc_plugin_send_event((rdpSvcPlugin*) plugin, out_event);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static void rdpdbg_process_event(rdpSvcPlugin* plugin, FRDP_EVENT* event)
|
|||
DEBUG_WARN("event_type %d", event->event_type);
|
||||
freerdp_event_free(event);
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_DEBUG, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
|
||||
svc_plugin_send_event(plugin, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <freerdp/utils/semaphore.h>
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
|
||||
#include "df_event.h"
|
||||
|
||||
|
@ -212,7 +213,7 @@ df_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
|
|||
FRDP_EVENT* event;
|
||||
FRDP_CB_FORMAT_LIST_EVENT* format_list_event;
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
|
||||
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
format_list_event->num_formats = 0;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <freerdp/utils/semaphore.h>
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
#include <freerdp/rail.h>
|
||||
|
||||
#include "xf_event.h"
|
||||
|
||||
|
@ -337,7 +339,7 @@ void xf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
|
|||
FRDP_EVENT* event;
|
||||
FRDP_CB_FORMAT_LIST_EVENT* format_list_event;
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
|
||||
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
format_list_event->num_formats = 0;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/chanman.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
|
||||
#define SET_TFI(_instance, _tfi) (_instance)->param1 = _tfi
|
||||
#define GET_TFI(_instance) ((tfInfo*) ((_instance)->param1))
|
||||
|
@ -92,7 +93,7 @@ void tf_process_cb_sync_event(rdpChanMan* chanman, freerdp* instance)
|
|||
FRDP_EVENT* event;
|
||||
FRDP_CB_FORMAT_LIST_EVENT* format_list_event;
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
|
||||
|
||||
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
format_list_event->num_formats = 0;
|
||||
|
|
|
@ -76,7 +76,7 @@ void test_chanman(void)
|
|||
freerdp_chanman_data(&instance, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10);
|
||||
freerdp_chanman_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11);
|
||||
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_DEBUG, NULL, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
|
||||
freerdp_chanman_send_event(chan_man, "rdpdbg", event);
|
||||
|
||||
while ((event = freerdp_chanman_pop_event(chan_man)) == NULL)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
|
||||
#include "test_cliprdr.h"
|
||||
|
||||
|
@ -139,7 +140,7 @@ void test_cliprdr(void)
|
|||
freerdp_event_free(event);
|
||||
|
||||
/* UI sends format_list event to cliprdr */
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL);
|
||||
format_list_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
format_list_event->num_formats = 2;
|
||||
format_list_event->formats = (uint32*)xmalloc(sizeof(uint32) * 2);
|
||||
|
@ -196,7 +197,7 @@ void test_cliprdr(void)
|
|||
freerdp_event_free(event);
|
||||
|
||||
/* UI sends data response event to cliprdr */
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL);
|
||||
data_response_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event;
|
||||
data_response_event->data = (uint8*)xmalloc(6);
|
||||
strcpy((char*)data_response_event->data, "hello");
|
||||
|
@ -211,7 +212,7 @@ void test_cliprdr(void)
|
|||
}
|
||||
|
||||
/* UI sends data request event to cliprdr */
|
||||
event = freerdp_event_new(FRDP_EVENT_TYPE_CB_DATA_REQUEST, event_process_callback, NULL);
|
||||
event = freerdp_event_new(FRDP_EVENT_CLASS_CLIPRDR, FRDP_EVENT_TYPE_CB_DATA_REQUEST, event_process_callback, NULL);
|
||||
data_request_event = (FRDP_CB_DATA_REQUEST_EVENT*)event;
|
||||
data_request_event->format = CB_FORMAT_UNICODETEXT;
|
||||
event_processed = 0;
|
||||
|
|
|
@ -77,38 +77,6 @@ enum RDP_SVC_CHANNEL_EVENT
|
|||
CHANNEL_EVENT_USER = 1000
|
||||
};
|
||||
|
||||
/**
|
||||
* FreeRDP Event Types
|
||||
*/
|
||||
enum FRDP_EVENT_TYPE
|
||||
{
|
||||
FRDP_EVENT_TYPE_DEBUG = 0,
|
||||
FRDP_EVENT_TYPE_VIDEO_FRAME = 1,
|
||||
FRDP_EVENT_TYPE_REDRAW = 2,
|
||||
FRDP_EVENT_TYPE_CB_SYNC = 3,
|
||||
FRDP_EVENT_TYPE_CB_FORMAT_LIST = 4,
|
||||
FRDP_EVENT_TYPE_CB_DATA_REQUEST = 5,
|
||||
FRDP_EVENT_TYPE_CB_DATA_RESPONSE = 6,
|
||||
|
||||
FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL = 100,
|
||||
FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI = 101
|
||||
};
|
||||
|
||||
/**
|
||||
* Clipboard Formats
|
||||
*/
|
||||
enum FRDP_CB_FORMAT
|
||||
{
|
||||
CB_FORMAT_RAW = 0,
|
||||
CB_FORMAT_TEXT = 1,
|
||||
CB_FORMAT_DIB = 8,
|
||||
CB_FORMAT_UNICODETEXT = 13,
|
||||
CB_FORMAT_HTML = 0xD010,
|
||||
CB_FORMAT_PNG = 0xD011,
|
||||
CB_FORMAT_JPEG = 0xD012,
|
||||
CB_FORMAT_GIF = 0xD013
|
||||
};
|
||||
|
||||
/**
|
||||
* Virtual Channel Constants
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Clipboard Virtual Channel Types
|
||||
*
|
||||
* Copyright 2011 Vic Lee
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __CLIPRDR_PLUGIN
|
||||
#define __CLIPRDR_PLUGIN
|
||||
|
||||
/**
|
||||
* Event Types
|
||||
*/
|
||||
enum FRDP_EVENT_TYPE_CB
|
||||
{
|
||||
FRDP_EVENT_TYPE_CB_SYNC = 1,
|
||||
FRDP_EVENT_TYPE_CB_FORMAT_LIST,
|
||||
FRDP_EVENT_TYPE_CB_DATA_REQUEST,
|
||||
FRDP_EVENT_TYPE_CB_DATA_RESPONSE
|
||||
};
|
||||
|
||||
/**
|
||||
* Clipboard Formats
|
||||
*/
|
||||
enum FRDP_CB_FORMAT
|
||||
{
|
||||
CB_FORMAT_RAW = 0,
|
||||
CB_FORMAT_TEXT = 1,
|
||||
CB_FORMAT_DIB = 8,
|
||||
CB_FORMAT_UNICODETEXT = 13,
|
||||
CB_FORMAT_HTML = 0xD010,
|
||||
CB_FORMAT_PNG = 0xD011,
|
||||
CB_FORMAT_JPEG = 0xD012,
|
||||
CB_FORMAT_GIF = 0xD013
|
||||
};
|
||||
|
||||
/**
|
||||
* Clipboard Events
|
||||
*/
|
||||
typedef FRDP_EVENT FRDP_CB_SYNC_EVENT;
|
||||
|
||||
struct _FRDP_CB_FORMAT_LIST_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint32* formats;
|
||||
uint16 num_formats;
|
||||
};
|
||||
typedef struct _FRDP_CB_FORMAT_LIST_EVENT FRDP_CB_FORMAT_LIST_EVENT;
|
||||
|
||||
struct _FRDP_CB_DATA_REQUEST_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint32 format;
|
||||
};
|
||||
typedef struct _FRDP_CB_DATA_REQUEST_EVENT FRDP_CB_DATA_REQUEST_EVENT;
|
||||
|
||||
struct _FRDP_CB_DATA_RESPONSE_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint8* data;
|
||||
uint32 size;
|
||||
};
|
||||
typedef struct _FRDP_CB_DATA_RESPONSE_EVENT FRDP_CB_DATA_RESPONSE_EVENT;
|
||||
|
||||
#endif /* __CLIPRDR_PLUGIN */
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Multimedia Redirection Virtual Channel Types
|
||||
*
|
||||
* Copyright 2011 Vic Lee
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __TSMF_PLUGIN
|
||||
#define __TSMF_PLUGIN
|
||||
|
||||
/**
|
||||
* Event Types
|
||||
*/
|
||||
enum FRDP_EVENT_TYPE_TSMF
|
||||
{
|
||||
FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME = 1,
|
||||
FRDP_EVENT_TYPE_TSMF_REDRAW
|
||||
};
|
||||
|
||||
struct _FRDP_VIDEO_FRAME_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint8* frame_data;
|
||||
uint32 frame_size;
|
||||
uint32 frame_pixfmt;
|
||||
sint16 frame_width;
|
||||
sint16 frame_height;
|
||||
sint16 x;
|
||||
sint16 y;
|
||||
sint16 width;
|
||||
sint16 height;
|
||||
uint16 num_visible_rects;
|
||||
FRDP_RECT* visible_rects;
|
||||
};
|
||||
typedef struct _FRDP_VIDEO_FRAME_EVENT FRDP_VIDEO_FRAME_EVENT;
|
||||
|
||||
struct _FRDP_REDRAW_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
sint16 x;
|
||||
sint16 y;
|
||||
sint16 width;
|
||||
sint16 height;
|
||||
};
|
||||
typedef struct _FRDP_REDRAW_EVENT FRDP_REDRAW_EVENT;
|
||||
|
||||
#endif /* __TSMF_PLUGIN */
|
|
@ -300,6 +300,12 @@ enum RDP_RAIL_PDU_TYPE
|
|||
RDP_RAIL_ORDER_GET_APPID_RESP = 0x000F
|
||||
};
|
||||
|
||||
enum FRDP_EVENT_TYPE_RAIL
|
||||
{
|
||||
FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL = 1,
|
||||
FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI
|
||||
};
|
||||
|
||||
/* RAIL Common structures */
|
||||
|
||||
// Events from 'rail' vchannel plugin to UI
|
||||
|
|
|
@ -126,68 +126,26 @@ typedef struct _FRDP_RECT
|
|||
}
|
||||
FRDP_RECT;
|
||||
|
||||
/* Plugin events */
|
||||
typedef struct _FRDP_EVENT FRDP_EVENT;
|
||||
|
||||
typedef void (*FRDP_EVENT_CALLBACK) (FRDP_EVENT* event);
|
||||
|
||||
struct _FRDP_EVENT
|
||||
{
|
||||
uint16 event_class;
|
||||
uint16 event_type;
|
||||
FRDP_EVENT_CALLBACK on_event_free_callback;
|
||||
void* user_data;
|
||||
};
|
||||
|
||||
struct _FRDP_VIDEO_FRAME_EVENT
|
||||
enum FRDP_EVENT_CLASS
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint8* frame_data;
|
||||
uint32 frame_size;
|
||||
uint32 frame_pixfmt;
|
||||
sint16 frame_width;
|
||||
sint16 frame_height;
|
||||
sint16 x;
|
||||
sint16 y;
|
||||
sint16 width;
|
||||
sint16 height;
|
||||
uint16 num_visible_rects;
|
||||
FRDP_RECT* visible_rects;
|
||||
FRDP_EVENT_CLASS_DEBUG = 0,
|
||||
FRDP_EVENT_CLASS_CLIPRDR,
|
||||
FRDP_EVENT_CLASS_TSMF,
|
||||
FRDP_EVENT_CLASS_RAIL
|
||||
};
|
||||
typedef struct _FRDP_VIDEO_FRAME_EVENT FRDP_VIDEO_FRAME_EVENT;
|
||||
|
||||
struct _FRDP_REDRAW_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
sint16 x;
|
||||
sint16 y;
|
||||
sint16 width;
|
||||
sint16 height;
|
||||
};
|
||||
typedef struct _FRDP_REDRAW_EVENT FRDP_REDRAW_EVENT;
|
||||
|
||||
typedef FRDP_EVENT FRDP_CB_SYNC_EVENT;
|
||||
|
||||
struct _FRDP_CB_FORMAT_LIST_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint32* formats;
|
||||
uint16 num_formats;
|
||||
};
|
||||
typedef struct _FRDP_CB_FORMAT_LIST_EVENT FRDP_CB_FORMAT_LIST_EVENT;
|
||||
|
||||
struct _FRDP_CB_DATA_REQUEST_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint32 format;
|
||||
};
|
||||
typedef struct _FRDP_CB_DATA_REQUEST_EVENT FRDP_CB_DATA_REQUEST_EVENT;
|
||||
|
||||
struct _FRDP_CB_DATA_RESPONSE_EVENT
|
||||
{
|
||||
FRDP_EVENT event;
|
||||
uint8* data;
|
||||
uint32 size;
|
||||
};
|
||||
typedef struct _FRDP_CB_DATA_RESPONSE_EVENT FRDP_CB_DATA_RESPONSE_EVENT;
|
||||
|
||||
typedef struct rdp_inst rdpInst;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#define __EVENT_UTILS_H
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
|
||||
FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data);
|
||||
FRDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type,
|
||||
FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data);
|
||||
void freerdp_event_free(FRDP_EVENT* event);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,22 +22,16 @@
|
|||
#include <string.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/plugins/cliprdr.h>
|
||||
#include <freerdp/plugins/tsmf.h>
|
||||
#include <freerdp/plugins/rail.h>
|
||||
|
||||
FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data)
|
||||
static FRDP_EVENT* freerdp_cliprdr_event_new(uint16 event_type)
|
||||
{
|
||||
FRDP_EVENT* event = NULL;
|
||||
|
||||
switch (event_type)
|
||||
{
|
||||
case FRDP_EVENT_TYPE_DEBUG:
|
||||
event = xnew(FRDP_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_VIDEO_FRAME:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_VIDEO_FRAME_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_REDRAW:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_REDRAW_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_CB_SYNC:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_CB_SYNC_EVENT);
|
||||
break;
|
||||
|
@ -50,13 +44,56 @@ FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_fr
|
|||
case FRDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_CB_DATA_RESPONSE_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL:
|
||||
case FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI:
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static FRDP_EVENT* freerdp_tsmf_event_new(uint16 event_type)
|
||||
{
|
||||
FRDP_EVENT* event = NULL;
|
||||
|
||||
switch (event_type)
|
||||
{
|
||||
case FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_VIDEO_FRAME_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_TSMF_REDRAW:
|
||||
event = (FRDP_EVENT*)xnew(FRDP_REDRAW_EVENT);
|
||||
break;
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static FRDP_EVENT* freerdp_rail_event_new(uint16 event_type)
|
||||
{
|
||||
return xnew(FRDP_EVENT);
|
||||
}
|
||||
|
||||
FRDP_EVENT* freerdp_event_new(uint16 event_class, uint16 event_type,
|
||||
FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data)
|
||||
{
|
||||
FRDP_EVENT* event = NULL;
|
||||
|
||||
switch (event_class)
|
||||
{
|
||||
case FRDP_EVENT_CLASS_DEBUG:
|
||||
event = xnew(FRDP_EVENT);
|
||||
break;
|
||||
case FRDP_EVENT_CLASS_CLIPRDR:
|
||||
event = freerdp_cliprdr_event_new(event_type);
|
||||
break;
|
||||
case FRDP_EVENT_CLASS_TSMF:
|
||||
event = freerdp_tsmf_event_new(event_type);
|
||||
break;
|
||||
case FRDP_EVENT_CLASS_RAIL:
|
||||
event = freerdp_rail_event_new(event_type);
|
||||
break;
|
||||
}
|
||||
if (event != NULL)
|
||||
{
|
||||
event->event_class = event_class;
|
||||
event->event_type = event_type;
|
||||
event->on_event_free_callback = on_event_free_callback;
|
||||
event->user_data = user_data;
|
||||
|
@ -65,6 +102,43 @@ FRDP_EVENT* freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_fr
|
|||
return event;
|
||||
}
|
||||
|
||||
static void freerdp_cliprdr_event_free(FRDP_EVENT* event)
|
||||
{
|
||||
switch (event->event_type)
|
||||
{
|
||||
case FRDP_EVENT_TYPE_CB_FORMAT_LIST:
|
||||
{
|
||||
FRDP_CB_FORMAT_LIST_EVENT* cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
xfree(cb_event->formats);
|
||||
}
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
||||
{
|
||||
FRDP_CB_DATA_RESPONSE_EVENT* cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event;
|
||||
xfree(cb_event->data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void freerdp_tsmf_event_free(FRDP_EVENT* event)
|
||||
{
|
||||
switch (event->event_type)
|
||||
{
|
||||
case FRDP_EVENT_TYPE_TSMF_VIDEO_FRAME:
|
||||
{
|
||||
FRDP_VIDEO_FRAME_EVENT* vevent = (FRDP_VIDEO_FRAME_EVENT*)event;
|
||||
xfree(vevent->frame_data);
|
||||
xfree(vevent->visible_rects);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void freerdp_rail_event_free(FRDP_EVENT* event)
|
||||
{
|
||||
}
|
||||
|
||||
void freerdp_event_free(FRDP_EVENT* event)
|
||||
{
|
||||
if (event != NULL)
|
||||
|
@ -72,29 +146,16 @@ void freerdp_event_free(FRDP_EVENT* event)
|
|||
if (event->on_event_free_callback != NULL)
|
||||
event->on_event_free_callback(event);
|
||||
|
||||
switch (event->event_type)
|
||||
switch (event->event_class)
|
||||
{
|
||||
case FRDP_EVENT_TYPE_VIDEO_FRAME:
|
||||
{
|
||||
FRDP_VIDEO_FRAME_EVENT* vevent = (FRDP_VIDEO_FRAME_EVENT*)event;
|
||||
|
||||
xfree(vevent->frame_data);
|
||||
xfree(vevent->visible_rects);
|
||||
}
|
||||
case FRDP_EVENT_CLASS_CLIPRDR:
|
||||
freerdp_cliprdr_event_free(event);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_CB_FORMAT_LIST:
|
||||
{
|
||||
FRDP_CB_FORMAT_LIST_EVENT* cb_event = (FRDP_CB_FORMAT_LIST_EVENT*)event;
|
||||
|
||||
xfree(cb_event->formats);
|
||||
}
|
||||
case FRDP_EVENT_CLASS_TSMF:
|
||||
freerdp_tsmf_event_free(event);
|
||||
break;
|
||||
case FRDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
||||
{
|
||||
FRDP_CB_DATA_RESPONSE_EVENT* cb_event = (FRDP_CB_DATA_RESPONSE_EVENT*)event;
|
||||
|
||||
xfree(cb_event->data);
|
||||
}
|
||||
case FRDP_EVENT_CLASS_RAIL:
|
||||
freerdp_rail_event_free(event);
|
||||
break;
|
||||
}
|
||||
xfree(event);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
|
||||
#include <freerdp/utils/rail.h>
|
||||
|
|
Loading…
Reference in New Issue