Merge branch 'master' of github.com:FreeRDP/xrdp

This commit is contained in:
Laxmikant Rashinkar 2013-03-24 12:11:23 -07:00
commit cab868a3a9
10 changed files with 169 additions and 42 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2005-2012 Jay Sorg Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
@ -500,6 +500,8 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h);
int int
rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask); rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask);
int int
rdpup_set_cursor_ex(short x, short y, char *cur_data, char *cur_mask, int bpp);
int
rdpup_create_os_surface(int rdpindexd, int width, int height); rdpup_create_os_surface(int rdpindexd, int width, int height);
int int
rdpup_switch_os_surface(int rdpindex); rdpup_switch_os_surface(int rdpindex);

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2005-2012 Jay Sorg Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
@ -47,6 +47,7 @@ keyboard and mouse stuff
extern ScreenPtr g_pScreen; /* in rdpmain.c */ extern ScreenPtr g_pScreen; /* in rdpmain.c */
extern DeviceIntPtr g_pointer; /* in rdpmain.c */ extern DeviceIntPtr g_pointer; /* in rdpmain.c */
extern DeviceIntPtr g_keyboard; /* in rdpmain.c */ extern DeviceIntPtr g_keyboard; /* in rdpmain.c */
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
static int g_old_button_mask = 0; static int g_old_button_mask = 0;
static int g_pause_spe = 0; static int g_pause_spe = 0;
@ -519,6 +520,7 @@ get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
int start; int start;
int shift; int shift;
int c; int c;
unsigned int *src32;
if (x < 0) if (x < 0)
{ {
@ -552,6 +554,11 @@ get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
return (c & (0x80 >> shift)) != 0; return (c & (0x80 >> shift)) != 0;
#endif #endif
} }
else if (bpp == 32)
{
src32 = (unsigned int*)data;
return src32[y * width + x];
}
return 0; return 0;
} }
@ -563,6 +570,7 @@ set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
{ {
int start; int start;
int shift; int shift;
unsigned int *dst32;
if (x < 0) if (x < 0)
{ {
@ -605,6 +613,11 @@ set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
*(data + (3 * (y * width + x)) + 1) = pixel >> 8; *(data + (3 * (y * width + x)) + 1) = pixel >> 8;
*(data + (3 * (y * width + x)) + 2) = pixel >> 16; *(data + (3 * (y * width + x)) + 2) = pixel >> 16;
} }
else if (bpp == 32)
{
dst32 = (unsigned int*)data;
dst32[y * width + x] = pixel;
}
} }
/******************************************************************************/ /******************************************************************************/
@ -612,7 +625,7 @@ void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs, rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y) int x, int y)
{ {
char cur_data[32 * (32 * 3)]; char cur_data[32 * (32 * 4)];
char cur_mask[32 * (32 / 8)]; char cur_mask[32 * (32 / 8)];
char *mask; char *mask;
char *data; char *data;
@ -626,6 +639,7 @@ rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int paddedRowBytes; int paddedRowBytes;
int fgcolor; int fgcolor;
int bgcolor; int bgcolor;
int bpp;
if (pCurs == 0) if (pCurs == 0)
{ {
@ -639,10 +653,32 @@ rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
w = pCurs->bits->width; w = pCurs->bits->width;
h = pCurs->bits->height; h = pCurs->bits->height;
if ((pCurs->bits->argb != 0) &&
(g_rdpScreen.client_info.pointer_flags & 1))
{
bpp = 32;
paddedRowBytes = PixmapBytePad(w, 32);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->argb);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(data, i, j, paddedRowBytes / 4, h, 32);
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 32, p);
}
}
}
else
{
bpp = 0;
paddedRowBytes = PixmapBytePad(w, 1); paddedRowBytes = PixmapBytePad(w, 1);
xhot = pCurs->bits->xhot; xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot; yhot = pCurs->bits->yhot;
/* ErrorF("xhot %d yhot %d\n", xhot, yhot); */
data = (char *)(pCurs->bits->source); data = (char *)(pCurs->bits->source);
mask = (char *)(pCurs->bits->mask); mask = (char *)(pCurs->bits->mask);
fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) | fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
@ -669,9 +705,10 @@ rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
} }
} }
} }
}
rdpup_begin_update(); rdpup_begin_update();
rdpup_set_cursor(xhot, yhot, cur_data, cur_mask); rdpup_set_cursor_ex(xhot, yhot, cur_data, cur_mask, bpp);
rdpup_end_update(); rdpup_end_update();
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2005-2012 Jay Sorg Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose is hereby granted without fee, provided that
@ -1365,6 +1365,36 @@ rdpup_set_cursor(short x, short y, char *cur_data, char *cur_mask)
return 0; return 0;
} }
/******************************************************************************/
int
rdpup_set_cursor_ex(short x, short y, char *cur_data, char *cur_mask, int bpp)
{
int size;
int Bpp;
if (g_connected)
{
LLOGLN(10, (" rdpup_set_cursor_ex"));
Bpp = (bpp == 0) ? 3 : (bpp + 7) / 8;
size = 10 + 32 * (32 * Bpp) + 32 * (32 / 8);
rdpup_pre_check(size);
out_uint16_le(g_out_s, 51); /* set cursor ex */
out_uint16_le(g_out_s, size); /* size */
g_count++;
x = MAX(0, x);
x = MIN(31, x);
y = MAX(0, y);
y = MIN(31, y);
out_uint16_le(g_out_s, x);
out_uint16_le(g_out_s, y);
out_uint16_le(g_out_s, bpp);
out_uint8a(g_out_s, cur_data, 32 * (32 * Bpp));
out_uint8a(g_out_s, cur_mask, 32 * (32 / 8));
}
return 0;
}
/******************************************************************************/ /******************************************************************************/
int int
rdpup_create_os_surface(int rdpindex, int width, int height) rdpup_create_os_surface(int rdpindex, int width, int height)

View File

@ -128,7 +128,8 @@ int APP_CC
xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx, xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
char* data, char* mask, int x, int y, int bpp); char* data, char* mask, int x, int y, int bpp);
int APP_CC int APP_CC
xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y); xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y,
int bpp);
int int
callback(long id, int msg, long param1, long param2, long param3, long param4); callback(long id, int msg, long param1, long param2, long param3, long param4);
int APP_CC int APP_CC
@ -376,6 +377,9 @@ int DEFAULT_CC
server_set_pointer(struct xrdp_mod* mod, int x, int y, server_set_pointer(struct xrdp_mod* mod, int x, int y,
char* data, char* mask); char* data, char* mask);
int DEFAULT_CC int DEFAULT_CC
server_set_pointer_ex(struct xrdp_mod* mod, int x, int y,
char* data, char* mask, int bpp);
int DEFAULT_CC
server_palette(struct xrdp_mod* mod, int* palette); server_palette(struct xrdp_mod* mod, int* palette);
int DEFAULT_CC int DEFAULT_CC
server_msg(struct xrdp_mod* mod, char* msg, int code); server_msg(struct xrdp_mod* mod, char* msg, int code);

View File

@ -504,10 +504,11 @@ xrdp_cache_add_pointer(struct xrdp_cache *self,
self->pointer_items[index].x = pointer_item->x; self->pointer_items[index].x = pointer_item->x;
self->pointer_items[index].y = pointer_item->y; self->pointer_items[index].y = pointer_item->y;
g_memcpy(self->pointer_items[index].data, g_memcpy(self->pointer_items[index].data,
pointer_item->data, 32 * 32 * 3); pointer_item->data, 32 * 32 * 4);
g_memcpy(self->pointer_items[index].mask, g_memcpy(self->pointer_items[index].mask,
pointer_item->mask, 32 * 32 / 8); pointer_item->mask, 32 * 32 / 8);
self->pointer_items[index].stamp = self->pointer_stamp; self->pointer_items[index].stamp = self->pointer_stamp;
self->pointer_items[index].bpp = pointer_item->bpp;
xrdp_wm_send_pointer(self->wm, index, xrdp_wm_send_pointer(self->wm, index,
self->pointer_items[index].data, self->pointer_items[index].data,
self->pointer_items[index].mask, self->pointer_items[index].mask,
@ -535,10 +536,11 @@ xrdp_cache_add_pointer_static(struct xrdp_cache *self,
self->pointer_items[index].x = pointer_item->x; self->pointer_items[index].x = pointer_item->x;
self->pointer_items[index].y = pointer_item->y; self->pointer_items[index].y = pointer_item->y;
g_memcpy(self->pointer_items[index].data, g_memcpy(self->pointer_items[index].data,
pointer_item->data, 32 * 32 * 3); pointer_item->data, 32 * 32 * 4);
g_memcpy(self->pointer_items[index].mask, g_memcpy(self->pointer_items[index].mask,
pointer_item->mask, 32 * 32 / 8); pointer_item->mask, 32 * 32 / 8);
self->pointer_items[index].stamp = self->pointer_stamp; self->pointer_items[index].stamp = self->pointer_stamp;
self->pointer_items[index].bpp = pointer_item->bpp;
xrdp_wm_send_pointer(self->wm, index, xrdp_wm_send_pointer(self->wm, index,
self->pointer_items[index].data, self->pointer_items[index].data,
self->pointer_items[index].mask, self->pointer_items[index].mask,

View File

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2013
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -383,6 +383,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
self->mod->server_screen_blt = server_screen_blt; self->mod->server_screen_blt = server_screen_blt;
self->mod->server_paint_rect = server_paint_rect; self->mod->server_paint_rect = server_paint_rect;
self->mod->server_set_pointer = server_set_pointer; self->mod->server_set_pointer = server_set_pointer;
self->mod->server_set_pointer_ex = server_set_pointer_ex;
self->mod->server_palette = server_palette; self->mod->server_palette = server_palette;
self->mod->server_msg = server_msg; self->mod->server_msg = server_msg;
self->mod->server_is_term = server_is_term; self->mod->server_is_term = server_is_term;
@ -1802,7 +1803,19 @@ server_set_pointer(struct xrdp_mod *mod, int x, int y,
struct xrdp_wm *wm; struct xrdp_wm *wm;
wm = (struct xrdp_wm *)(mod->wm); wm = (struct xrdp_wm *)(mod->wm);
xrdp_wm_pointer(wm, data, mask, x, y); xrdp_wm_pointer(wm, data, mask, x, y, 0);
return 0;
}
/*****************************************************************************/
int DEFAULT_CC
server_set_pointer_ex(struct xrdp_mod *mod, int x, int y,
char *data, char *mask, int bpp)
{
struct xrdp_wm *wm;
wm = (struct xrdp_wm *)(mod->wm);
xrdp_wm_pointer(wm, data, mask, x, y, bpp);
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2013
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -115,8 +115,10 @@ struct xrdp_mod
int (*server_monitored_desktop)(struct xrdp_mod* mod, int (*server_monitored_desktop)(struct xrdp_mod* mod,
struct rail_monitored_desktop_order* mdo, struct rail_monitored_desktop_order* mdo,
int flags); int flags);
int (*server_set_pointer_ex)(struct xrdp_mod* v, int x, int y, char* data,
char* mask, int bpp);
long server_dumby[100 - 37]; /* align, 100 minus the number of server long server_dumby[100 - 38]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */
long handle; /* pointer to self as int */ long handle; /* pointer to self as int */

View File

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2013
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -180,14 +180,22 @@ xrdp_wm_get_pixel(char *data, int x, int y, int width, int bpp)
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
xrdp_wm_pointer(struct xrdp_wm *self, char *data, char *mask, int x, int y) xrdp_wm_pointer(struct xrdp_wm *self, char *data, char *mask, int x, int y,
int bpp)
{ {
int bytes;
struct xrdp_pointer_item pointer_item; struct xrdp_pointer_item pointer_item;
if (bpp == 0)
{
bpp = 24;
}
bytes = ((bpp + 7) / 8) * 32 * 32;
g_memset(&pointer_item, 0, sizeof(struct xrdp_pointer_item)); g_memset(&pointer_item, 0, sizeof(struct xrdp_pointer_item));
pointer_item.x = x; pointer_item.x = x;
pointer_item.y = y; pointer_item.y = y;
g_memcpy(pointer_item.data, data, 32 * 32 * 3); pointer_item.bpp = bpp;
g_memcpy(pointer_item.data, data, bytes);
g_memcpy(pointer_item.mask, mask, 32 * 32 / 8); g_memcpy(pointer_item.mask, mask, 32 * 32 / 8);
self->screen->pointer = xrdp_cache_add_pointer(self->cache, &pointer_item); self->screen->pointer = xrdp_cache_add_pointer(self->cache, &pointer_item);
return 0; return 0;

View File

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2013
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -487,6 +487,29 @@ process_server_window_delete(struct mod *mod, struct stream *s)
return rv; return rv;
} }
/******************************************************************************/
/* return error */
static int APP_CC
process_server_set_pointer_ex(struct mod *mod, struct stream *s)
{
int rv;
int x;
int y;
int bpp;
int Bpp;
char cur_data[32 * (32 * 4)];
char cur_mask[32 * (32 / 8)];
in_sint16_le(s, x);
in_sint16_le(s, y);
in_uint16_le(s, bpp);
Bpp = (bpp == 0) ? 3 : (bpp + 7) / 8;
in_uint8a(s, cur_data, 32 * (32 * Bpp));
in_uint8a(s, cur_mask, 32 * (32 / 8));
rv = mod->server_set_cursor_ex(mod, x, y, cur_data, cur_mask, bpp);
return rv;
}
/******************************************************************************/ /******************************************************************************/
/* return error */ /* return error */
static int static int
@ -630,6 +653,9 @@ lib_mod_process_orders(struct mod *mod, int type, struct stream *s)
case 26: /* server_window_delete */ case 26: /* server_window_delete */
rv = process_server_window_delete(mod, s); rv = process_server_window_delete(mod, s);
break; break;
case 51: /* server_set_pointer_ex */
rv = process_server_set_pointer_ex(mod, s);
break;
default: default:
g_writeln("lib_mod_process_orders: unknown order type %d", type); g_writeln("lib_mod_process_orders: unknown order type %d", type);
rv = 0; rv = 0;

View File

@ -1,7 +1,7 @@
/** /**
* xrdp: A Remote Desktop Protocol server. * xrdp: A Remote Desktop Protocol server.
* *
* Copyright (C) Jay Sorg 2004-2012 * Copyright (C) Jay Sorg 2004-2013
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -117,7 +117,10 @@ struct mod
int (*server_monitored_desktop)(struct mod* v, int (*server_monitored_desktop)(struct mod* v,
struct rail_monitored_desktop_order* mdo, struct rail_monitored_desktop_order* mdo,
int flags); int flags);
tbus server_dumby[100 - 37]; /* align, 100 minus the number of server int (*server_set_cursor_ex)(struct mod* v, int x, int y, char* data,
char* mask, int bpp);
tbus server_dumby[100 - 38]; /* align, 100 minus the number of server
functions above */ functions above */
/* common */ /* common */
tbus handle; /* pointer to self as long */ tbus handle; /* pointer to self as long */