libfreerdp-core: add support for Refresh Rect and Suppress Output PDUs

This commit is contained in:
Marc-André Moreau 2011-11-11 14:02:59 -05:00
parent b2644901f4
commit 0e95675da3
12 changed files with 168 additions and 17 deletions

View File

@ -249,15 +249,15 @@ void rail_write_client_sysparam_order(STREAM* s, RAIL_SYSPARAM_ORDER* sysparam)
break;
case SPI_SET_WORK_AREA:
rail_write_rectangle_16(s, &sysparam->workArea);
freerdp_write_rectangle_16(s, &sysparam->workArea);
break;
case SPI_DISPLAY_CHANGE:
rail_write_rectangle_16(s, &sysparam->displayChange);
freerdp_write_rectangle_16(s, &sysparam->displayChange);
break;
case SPI_TASKBAR_POS:
rail_write_rectangle_16(s, &sysparam->taskbarPos);
freerdp_write_rectangle_16(s, &sysparam->taskbarPos);
break;
case SPI_SET_HIGH_CONTRAST:

View File

@ -157,15 +157,6 @@ struct _UNICODE_STRING
};
typedef struct _UNICODE_STRING UNICODE_STRING;
struct _RECTANGLE_16
{
uint16 left;
uint16 top;
uint16 right;
uint16 bottom;
};
typedef struct _RECTANGLE_16 RECTANGLE_16;
struct _HIGH_CONTRAST
{
uint32 flags;

View File

@ -81,6 +81,15 @@ struct _RDP_RECT
};
typedef struct _RDP_RECT RDP_RECT;
struct _RECTANGLE_16
{
uint16 left;
uint16 top;
uint16 right;
uint16 bottom;
};
typedef struct _RECTANGLE_16 RECTANGLE_16;
/* Plugin events */
typedef struct _RDP_EVENT RDP_EVENT;

View File

@ -1132,6 +1132,9 @@ typedef void (*pNotifyIconDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInf
typedef void (*pMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
typedef void (*pNonMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
typedef void (*pRefreshRect)(rdpUpdate* update, uint8 count, RECTANGLE_16* areas);
typedef void (*pSuppressOutput)(rdpUpdate* update, uint8 allow, RECTANGLE_16* area);
typedef void (*pSurfaceBits)(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command);
typedef void (*pSurfaceCommand)(rdpUpdate* update, STREAM* s);
@ -1208,6 +1211,9 @@ struct rdp_update
pMonitoredDesktop MonitoredDesktop;
pNonMonitoredDesktop NonMonitoredDesktop;
pRefreshRect RefreshRect;
pSuppressOutput SuppressOutput;
pSurfaceBits SurfaceBits;
pSurfaceCommand SurfaceCommand;

View File

@ -22,6 +22,7 @@
#include <freerdp/api.h>
#include <freerdp/rail.h>
#include <freerdp/utils/rect.h>
#include <freerdp/utils/stream.h>
#define RAIL_ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
@ -31,8 +32,6 @@ FREERDP_API void rail_unicode_string_free(UNICODE_STRING* unicode_string);
FREERDP_API void rail_read_unicode_string(STREAM* s, UNICODE_STRING* unicode_string);
FREERDP_API void rail_write_unicode_string(STREAM* s, UNICODE_STRING* unicode_string);
FREERDP_API void rail_write_unicode_string_value(STREAM* s, UNICODE_STRING* unicode_string);
FREERDP_API void rail_read_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16);
FREERDP_API void rail_write_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16);
FREERDP_API void* rail_clone_order(uint32 event_type, void* order);
FREERDP_API void rail_free_cloned_order(uint32 event_type, void* order);

View File

@ -0,0 +1,33 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Rectangle Utils
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 __RECT_UTILS_H
#define __RECT_UTILS_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/utils/stream.h>
FREERDP_API void freerdp_read_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16);
FREERDP_API void freerdp_write_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16);
FREERDP_API RECTANGLE_16* freerdp_rectangle_16_new(uint16 left, uint16 top, uint16 right, uint16 bottom);
FREERDP_API void freerdp_rectangle_16_free(RECTANGLE_16* rectangle_16);
#endif /* __RECT_UTILS_H */

View File

@ -146,6 +146,13 @@ void rdp_write_general_capability_set(STREAM* s, rdpSettings* settings)
if (settings->fastpath_output)
extraFlags |= FASTPATH_OUTPUT_SUPPORTED;
if (settings->server_mode)
{
/* not yet supported server-side */
settings->refresh_rect = False;
settings->suppress_output = False;
}
stream_write_uint16(s, 0); /* osMajorType (2 bytes) */
stream_write_uint16(s, 0); /* osMinorType (2 bytes) */
stream_write_uint16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */

View File

@ -107,6 +107,9 @@ rdpSettings* settings_new(void* instance)
settings->bitmap_cache = True;
settings->persistent_bitmap_cache = False;
settings->refresh_rect = True;
settings->suppress_output = True;
settings->glyphSupportLevel = GLYPH_SUPPORT_NONE;
settings->glyphCache[0].cacheEntries = 254;
settings->glyphCache[0].cacheMaximumCellSize = 4;

View File

@ -19,6 +19,7 @@
#include "update.h"
#include "surface.h"
#include <freerdp/utils/rect.h>
#include <freerdp/codec/bitmap.h>
uint8 UPDATE_TYPE_STRINGS[][32] =
@ -332,6 +333,49 @@ static void update_begin_paint(rdpUpdate* update)
static void update_end_paint(rdpUpdate* update)
{
}
static void update_write_refresh_rect(STREAM* s, uint8 count, RECTANGLE_16* areas)
{
int i;
stream_write_uint8(s, count); /* numberOfAreas (1 byte) */
stream_seek(s, 3); /* pad3Octets (3 bytes) */
for (i = 0; i < count; i++)
freerdp_write_rectangle_16(s, &areas[i]);
}
static void update_send_refresh_rect(rdpUpdate* update, uint8 count, RECTANGLE_16* areas)
{
STREAM* s;
rdpRdp* rdp = update->context->rdp;
s = rdp_data_pdu_init(rdp);
update_write_refresh_rect(s, count, areas);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_REFRESH_RECT, rdp->mcs->user_id);
}
static void update_write_suppress_output(STREAM* s, uint8 allow, RECTANGLE_16* area)
{
stream_write_uint8(s, allow); /* allowDisplayUpdates (1 byte) */
stream_seek(s, 3); /* pad3Octets (3 bytes) */
if (allow > 0)
freerdp_write_rectangle_16(s, area);
}
static void update_send_suppress_output(rdpUpdate* update, uint8 allow, RECTANGLE_16* area)
{
STREAM* s;
rdpRdp* rdp = update->context->rdp;
s = rdp_data_pdu_init(rdp);
update_write_suppress_output(s, allow, area);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SUPPRESS_OUTPUT, rdp->mcs->user_id);
}
static void update_send_surface_command(rdpUpdate* update, STREAM* s)
@ -386,6 +430,8 @@ void update_register_server_callbacks(rdpUpdate* update)
update->Synchronize = update_send_synchronize;
update->DesktopResize = update_send_desktop_resize;
update->PointerSystem = update_send_pointer_system;
update->RefreshRect = update_send_refresh_rect;
update->SuppressOutput = update_send_suppress_output;
update->SurfaceBits = update_send_surface_bits;
update->SurfaceCommand = update_send_surface_command;
}

View File

@ -142,7 +142,7 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN
/* windowRects */
for (i = 0; i < window_state->numWindowRects; i++)
{
rail_read_rectangle_16(s, &window_state->windowRects[i]);
freerdp_read_rectangle_16(s, &window_state->windowRects[i]);
}
}
@ -162,7 +162,7 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN
/* visibilityRects */
for (i = 0; i < window_state->numVisibilityRects; i++)
{
rail_read_rectangle_16(s, &window_state->visibilityRects[i]);
freerdp_read_rectangle_16(s, &window_state->visibilityRects[i]);
}
}
}

View File

@ -36,6 +36,7 @@ set(FREERDP_UTILS_SRCS
pcap.c
profiler.c
rail.c
rect.c
registry.c
certstore.c
semaphore.c

56
libfreerdp-utils/rect.c Normal file
View File

@ -0,0 +1,56 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Rectangle Utils
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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.
*/
#include <freerdp/types.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/rect.h>
void freerdp_read_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16)
{
stream_read_uint16(s, rectangle_16->left); /* left (2 bytes) */
stream_read_uint16(s, rectangle_16->top); /* top (2 bytes) */
stream_read_uint16(s, rectangle_16->right); /* right (2 bytes) */
stream_read_uint16(s, rectangle_16->bottom); /* bottom (2 bytes) */
}
void freerdp_write_rectangle_16(STREAM* s, RECTANGLE_16* rectangle_16)
{
stream_write_uint16(s, rectangle_16->left); /* left (2 bytes) */
stream_write_uint16(s, rectangle_16->top); /* top (2 bytes) */
stream_write_uint16(s, rectangle_16->right); /* right (2 bytes) */
stream_write_uint16(s, rectangle_16->bottom); /* bottom (2 bytes) */
}
RECTANGLE_16* freerdp_rectangle_16_new(uint16 left, uint16 top, uint16 right, uint16 bottom)
{
RECTANGLE_16* rectangle_16 = xnew(RECTANGLE_16);
rectangle_16->left = left;
rectangle_16->top = top;
rectangle_16->right = right;
rectangle_16->bottom = bottom;
return rectangle_16;
}
void freerdp_rectangle_16_free(RECTANGLE_16* rectangle_16)
{
xfree(rectangle_16);
}