{
printf("----------------- stream_equal_dump -----------------\n");
printf("Stream and dump have different length (%d != %d)\n",
- sizeS, size);
+ (int) sizeS, (int) size);
printf("Stream hexdump:\n");
freerdp_hexdump(dataS, sizeS);
if (((uint8*)dataS)[i] != ((uint8*)data)[i])
{
printf("----------------- stream_equal_dump -----------------\n");
- printf("Stream and dump have different content from %d offset.\n", i);
+ printf("Stream and dump have different content from %d offset.\n", (int) i);
printf("Stream hexdump:\n");
freerdp_hexdump(dataS, sizeS);
#include <freerdp/cache/glyph.h>
#include <freerdp/cache/brush.h>
+#include <freerdp/cache/pointer.h>
#include <freerdp/cache/bitmap_v2.h>
#include <freerdp/cache/offscreen.h>
#include <freerdp/cache/color_table.h>
rdpGlyph* glyph;
rdpBrush* brush;
+ rdpPointer* pointer;
rdpBitmapV2* bitmap_v2;
rdpOffscreen* offscreen;
rdpColorTable* color_table;
--- /dev/null
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * Pointer Cache
+ *
+ * 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 __POINTER_CACHE_H
+#define __POINTER_CACHE_H
+
+#include <freerdp/api.h>
+#include <freerdp/types.h>
+#include <freerdp/utils/stream.h>
+
+struct _POINTER_CACHE_ENTRY
+{
+ void* entry;
+ void* extra;
+};
+typedef struct _POINTER_CACHE_ENTRY POINTER_CACHE_ENTRY;
+
+struct rdp_pointer
+{
+ uint16 cacheSize;
+ rdpSettings* settings;
+ POINTER_CACHE_ENTRY* entries;
+};
+typedef struct rdp_pointer rdpPointer;
+
+FREERDP_API void* pointer_get(rdpPointer* pointer, uint16 index, void** extra);
+FREERDP_API void pointer_put(rdpPointer* pointer, uint16 index, void* entry, void* extra);
+
+FREERDP_API rdpPointer* pointer_new(rdpSettings* settings);
+FREERDP_API void pointer_free(rdpPointer* pointer);
+
+#endif /* __POINTER_CACHE_H */
uint8 received_caps[32];
uint8 order_support[32];
- boolean color_pointer;
boolean sound_beeps;
+ boolean color_pointer;
+ uint16 pointer_cache_size;
boolean fastpath_input;
boolean fastpath_output;
set(FREERDP_CACHE_SRCS
brush.c
+ pointer.c
bitmap_v2.c
offscreen.c
color_table.c
cache->settings = settings;
cache->glyph = glyph_new(settings);
cache->brush = brush_new(settings);
+ cache->pointer = pointer_new(settings);
cache->bitmap_v2 = bitmap_v2_new(settings);
cache->offscreen = offscreen_new(settings);
cache->color_table = color_table_new(settings);
{
if (cache != NULL)
{
+ glyph_free(cache->glyph);
brush_free(cache->brush);
+ pointer_free(cache->pointer);
bitmap_v2_free(cache->bitmap_v2);
offscreen_free(cache->offscreen);
color_table_free(cache->color_table);
--- /dev/null
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * Glyph Cache
+ *
+ * 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/utils/stream.h>
+#include <freerdp/utils/memory.h>
+
+#include <freerdp/cache/pointer.h>
+
+void* pointer_get(rdpPointer* pointer, uint16 index, void** extra)
+{
+ void* entry;
+
+ if (index >= pointer->cacheSize)
+ {
+ printf("invalid pointer index:%d\n", index);
+ return NULL;
+ }
+
+ entry = pointer->entries[index].entry;
+
+ if (extra != NULL)
+ extra = pointer->entries[index].extra;
+
+ return entry;
+}
+
+void pointer_put(rdpPointer* pointer, uint16 index, void* entry, void* extra)
+{
+ if (index >= pointer->cacheSize)
+ {
+ printf("invalid pointer index:%d\n", index);
+ return;
+ }
+
+ pointer->entries[index].entry = entry;
+ pointer->entries[index].extra = extra;
+}
+
+rdpPointer* pointer_new(rdpSettings* settings)
+{
+ rdpPointer* pointer;
+
+ pointer = (rdpPointer*) xzalloc(sizeof(rdpPointer));
+
+ if (pointer != NULL)
+ {
+ pointer->settings = settings;
+ pointer->cacheSize = settings->pointer_cache_size;
+ pointer->entries = xzalloc(sizeof(POINTER_CACHE_ENTRY) * pointer->cacheSize);
+ }
+
+ return pointer;
+}
+
+void pointer_free(rdpPointer* pointer)
+{
+ if (pointer != NULL)
+ {
+ int i;
+
+ for (i = 0; i < pointer->cacheSize; i++)
+ {
+ if (pointer->entries[i].entry != NULL)
+ xfree(pointer->entries[i].entry);
+
+ if (pointer->entries[i].extra != NULL)
+ xfree(pointer->entries[i].extra);
+ }
+
+ xfree(pointer->entries);
+ xfree(pointer);
+ }
+}
colorPointerFlag = (settings->color_pointer) ? True : False;
stream_write_uint16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */
- stream_write_uint16(s, 20); /* colorPointerCacheSize (2 bytes) */
- stream_write_uint16(s, 20); /* pointerCacheSize (2 bytes) */
+ stream_write_uint16(s, settings->pointer_cache_size); /* colorPointerCacheSize (2 bytes) */
+ stream_write_uint16(s, settings->pointer_cache_size); /* pointerCacheSize (2 bytes) */
rdp_capability_set_finish(s, header, CAPSET_TYPE_POINTER);
}
settings->color_pointer = True;
settings->large_pointer = True;
+ settings->pointer_cache_size = 32;
settings->draw_gdi_plus = False;