diff options
author | jsorg71 <jsorg71> | 2005-01-21 03:55:16 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2005-01-21 03:55:16 +0000 |
commit | f0c7bdb304846829259edaab25454f81ab5a4c36 (patch) | |
tree | ba94a6f4a45f29c741490e06bf89deca50041874 /xrdp/xrdp_cache.c | |
parent | b2741d1ed23982d0bfd3016d998c4cbfb3c4ab8e (diff) | |
download | xrdp-proprietary-f0c7bdb304846829259edaab25454f81ab5a4c36.tar.gz xrdp-proprietary-f0c7bdb304846829259edaab25454f81ab5a4c36.zip |
added pointer cache, some debug messages and some other fixes
Diffstat (limited to 'xrdp/xrdp_cache.c')
-rw-r--r-- | xrdp/xrdp_cache.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c index 031563f6..7c315526 100644 --- a/xrdp/xrdp_cache.c +++ b/xrdp/xrdp_cache.c @@ -39,6 +39,7 @@ struct xrdp_cache* xrdp_cache_create(struct xrdp_wm* owner, self->cache2_size = client_info->cache2_size; self->cache3_entries = client_info->cache3_entries; self->cache3_size = client_info->cache3_size; + self->pointer_cache_entries = client_info->pointer_cache_entries; return self; } @@ -320,3 +321,63 @@ int xrdp_cache_add_char(struct xrdp_cache* self, xrdp_orders_send_font(self->orders, fi, f, c); return MAKELONG(f, c); } + +/*****************************************************************************/ +/* added the pointer to the cache and send it to client, it also sets the + client if it finds it + returns the index in the cache + does not take ownership of pointer_item */ +int xrdp_cache_add_pointer(struct xrdp_cache* self, + struct xrdp_pointer_item* pointer_item) +{ + int i; + int oldest; + int index; + + if (self == 0) + { + return 0; + } + self->pointer_stamp++; + /* look for match */ + for (i = 0; i < self->pointer_cache_entries; i++) + { + if (self->pointer_items[i].x == pointer_item->x && + self->pointer_items[i].y == pointer_item->y && + g_memcmp(self->pointer_items[i].data, + pointer_item->data, 32 * 32 * 3) == 0 && + g_memcmp(self->pointer_items[i].mask, + pointer_item->mask, 32 * 32 / 8) == 0) + { + self->pointer_items[i].stamp = self->pointer_stamp; + xrdp_wm_set_pointer(self->wm, i); + DEBUG(("found pointer at %d\n\r", i)); + return i; + } + } + /* look for oldest */ + index = 0; + oldest = 0x7fffffff; + for (i = 0; i < self->pointer_cache_entries; i++) + { + if (self->pointer_items[i].stamp < oldest) + { + oldest = self->pointer_items[i].stamp; + index = i; + } + } + self->pointer_items[index].x = pointer_item->x; + self->pointer_items[index].y = pointer_item->y; + g_memcpy(self->pointer_items[index].data, + pointer_item->data, 32 * 32 * 3); + g_memcpy(self->pointer_items[index].mask, + pointer_item->mask, 32 * 32 / 8); + self->pointer_items[index].stamp = self->pointer_stamp; + xrdp_wm_send_pointer(self->wm, index, + self->pointer_items[index].data, + self->pointer_items[index].mask, + self->pointer_items[index].x, + self->pointer_items[index].y); + DEBUG(("adding pointer at %d\n\r", index)); + return index; +} |