summaryrefslogtreecommitdiffstats
path: root/xrdp
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-05-19 19:25:08 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-05-19 19:25:08 -0700
commitaa3fad894db4e9b02999b229eb7e63fd8e91bdf6 (patch)
tree409c10184c95a2305edc6b7d04e6116aaa30a936 /xrdp
parentcc3754a2bdd6801179751d45f1df3b5816e189fc (diff)
downloadxrdp-proprietary-aa3fad894db4e9b02999b229eb7e63fd8e91bdf6.tar.gz
xrdp-proprietary-aa3fad894db4e9b02999b229eb7e63fd8e91bdf6.zip
xorg: work on offscreen bitmaps
Diffstat (limited to 'xrdp')
-rw-r--r--xrdp/xrdp.h8
-rw-r--r--xrdp/xrdp_cache.c67
-rw-r--r--xrdp/xrdp_mm.c54
-rw-r--r--xrdp/xrdp_painter.c29
-rw-r--r--xrdp/xrdp_types.h8
5 files changed, 83 insertions, 83 deletions
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index e295408c..bc22a935 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -83,11 +83,11 @@ xrdp_cache_add_brush(struct xrdp_cache* self,
char* brush_item_data);
int APP_CC
xrdp_cache_add_os_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap,
- int id);
+ int rdpindex);
int APP_CC
-xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int id);
+xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int rdpindex);
struct xrdp_os_bitmap_item* APP_CC
-xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int id);
+xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int rdpindex);
/* xrdp_wm.c */
struct xrdp_wm* APP_CC
@@ -240,6 +240,8 @@ xrdp_painter_create(struct xrdp_wm* wm, struct xrdp_session* session);
void APP_CC
xrdp_painter_delete(struct xrdp_painter* self);
int APP_CC
+wm_painter_set_target(struct xrdp_painter* self);
+int APP_CC
xrdp_painter_begin_update(struct xrdp_painter* self);
int APP_CC
xrdp_painter_end_update(struct xrdp_painter* self);
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index a63a8210..59c7c98b 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -541,76 +541,49 @@ xrdp_cache_add_brush(struct xrdp_cache* self,
}
/*****************************************************************************/
-/* returns index */
+/* returns error */
int APP_CC
xrdp_cache_add_os_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap,
- int id)
+ int rdpindex)
{
- int index;
struct xrdp_os_bitmap_item* bi;
- if (id < 1)
+ if ((rdpindex < 0) || (rdpindex >= 2000))
{
- return -1;
+ return 1;
}
- index = 0;
- for (index = 0; index < 2000; index++)
- {
- bi = self->os_bitmap_items + index;
- if (bi->bitmap == 0)
- {
- bi->id = id;
- bi->bitmap = bitmap;
- //g_writeln("xrdp_cache_add_os_bitmap: bitmap id 0x%x added at index %d", id, index);
- return index;
- }
- }
- g_writeln("xrdp_cache_add_os_bitmap: bitmap id 0x%x not added, full", id);
- return -1;
+ bi = self->os_bitmap_items + rdpindex;
+ bi->bitmap = bitmap;
+ return 0;
}
/*****************************************************************************/
-/* returns index */
+/* returns error */
int APP_CC
-xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int id)
+xrdp_cache_remove_os_bitmap(struct xrdp_cache* self, int rdpindex)
{
- int index;
struct xrdp_os_bitmap_item* bi;
- if (id < 1)
- {
- return -1;
- }
- for (index = 0; index < 2000; index++)
+ if ((rdpindex < 0) || (rdpindex >= 2000))
{
- bi = self->os_bitmap_items + index;
- if (bi->id == id)
- {
- xrdp_bitmap_delete(bi->bitmap);
- g_memset(bi, 0, sizeof(struct xrdp_os_bitmap_item));
- //g_writeln("xrdp_cache_remove_os_bitmap: bitmap id 0x%x removed from index %d", id, index);
- return index;
- }
+ return 1;
}
- return -1;
+ bi = self->os_bitmap_items + rdpindex;
+ xrdp_bitmap_delete(bi->bitmap);
+ g_memset(bi, 0, sizeof(struct xrdp_os_bitmap_item));
+ return 0;
}
/*****************************************************************************/
struct xrdp_os_bitmap_item* APP_CC
-xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int id)
+xrdp_cache_get_os_bitmap(struct xrdp_cache* self, int rdpindex)
{
- int index;
struct xrdp_os_bitmap_item* bi;
- for (index = 0; index < 2000; index++)
+ if ((rdpindex < 0) || (rdpindex >= 2000))
{
- bi = self->os_bitmap_items + index;
- if (bi->id == id)
- {
- //g_writeln("xrdp_cache_get_os_bitmap: bitmap id 0x%x found at index %d", id, index);
- return bi;
- }
+ return 0;
}
- g_writeln("xrdp_cache_get_os_bitmap: bitmap id 0x%x not found", id);
- return 0;
+ bi = self->os_bitmap_items + rdpindex;
+ return bi;
}
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index f0ecc249..223b128b 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -1594,81 +1594,99 @@ server_send_to_channel(struct xrdp_mod* mod, int channel_id,
/*****************************************************************************/
int DEFAULT_CC
-server_create_os_surface(struct xrdp_mod* mod, int id,
+server_create_os_surface(struct xrdp_mod* mod, int rdpindex,
int width, int height)
{
struct xrdp_wm* wm;
struct xrdp_bitmap* bitmap;
- int index;
+ int error;
- //g_writeln("server_create_os_surface: id 0x%x, width %d height %d",
- // id, width, height);
wm = (struct xrdp_wm*)(mod->wm);
bitmap = xrdp_bitmap_create(width, height, wm->screen->bpp,
WND_TYPE_OFFSCREEN, wm);
- bitmap->id = id;
- index = xrdp_cache_add_os_bitmap(wm->cache, bitmap, id);
- if (index < 0)
+ error = xrdp_cache_add_os_bitmap(wm->cache, bitmap, rdpindex);
+ if (error != 0)
{
g_writeln("server_create_os_surface: xrdp_cache_add_os_bitmap failed");
return 1;
}
- bitmap->item_index = index;
+ bitmap->item_index = rdpindex;
+ bitmap->id = rdpindex;
return 0;
}
/*****************************************************************************/
int DEFAULT_CC
-server_switch_os_surface(struct xrdp_mod* mod, int id)
+server_switch_os_surface(struct xrdp_mod* mod, int rdpindex)
{
struct xrdp_wm* wm;
struct xrdp_os_bitmap_item* bi;
+ struct xrdp_painter* p;
//g_writeln("server_switch_os_surface: id 0x%x", id);
wm = (struct xrdp_wm*)(mod->wm);
- if (id == -1)
+ if (rdpindex == -1)
{
//g_writeln("server_switch_os_surface: setting target_surface to screen");
wm->target_surface = wm->screen;
+ p = (struct xrdp_painter*)(mod->painter);
+ if (p != 0)
+ {
+ //g_writeln("setting target");
+ wm_painter_set_target(p);
+ }
return 0;
}
- bi = xrdp_cache_get_os_bitmap(wm->cache, id);
+ bi = xrdp_cache_get_os_bitmap(wm->cache, rdpindex);
if (bi != 0)
{
//g_writeln("server_switch_os_surface: setting target_surface to rdpid %d", id);
wm->target_surface = bi->bitmap;
+ p = (struct xrdp_painter*)(mod->painter);
+ if (p != 0)
+ {
+ //g_writeln("setting target");
+ wm_painter_set_target(p);
+ }
}
else
{
- g_writeln("server_switch_os_surface: error finding id 0x%x", id);
+ g_writeln("server_switch_os_surface: error finding id %d", rdpindex);
}
return 0;
}
/*****************************************************************************/
int DEFAULT_CC
-server_delete_os_surface(struct xrdp_mod* mod, int id)
+server_delete_os_surface(struct xrdp_mod* mod, int rdpindex)
{
struct xrdp_wm* wm;
+ struct xrdp_painter* p;
//g_writeln("server_delete_os_surface: id 0x%x", id);
wm = (struct xrdp_wm*)(mod->wm);
if (wm->target_surface->type == WND_TYPE_OFFSCREEN)
{
- if (wm->target_surface->id == id)
+ if (wm->target_surface->id == rdpindex)
{
g_writeln("server_delete_os_surface: setting target_surface to screen");
wm->target_surface = wm->screen;
+ p = (struct xrdp_painter*)(mod->painter);
+ if (p != 0)
+ {
+ //g_writeln("setting target");
+ wm_painter_set_target(p);
+ }
}
}
- xrdp_cache_remove_os_bitmap(wm->cache, id);
+ xrdp_cache_remove_os_bitmap(wm->cache, rdpindex);
return 0;
}
/*****************************************************************************/
int DEFAULT_CC
server_paint_rect_os(struct xrdp_mod* mod, int x, int y, int cx, int cy,
- int id, int srcx, int srcy)
+ int rdpindex, int srcx, int srcy)
{
struct xrdp_wm* wm;
struct xrdp_bitmap* b;
@@ -1681,7 +1699,7 @@ server_paint_rect_os(struct xrdp_mod* mod, int x, int y, int cx, int cy,
return 0;
}
wm = (struct xrdp_wm*)(mod->wm);
- bi = xrdp_cache_get_os_bitmap(wm->cache, id);
+ bi = xrdp_cache_get_os_bitmap(wm->cache, rdpindex);
if (bi != 0)
{
b = bi->bitmap;
@@ -1689,7 +1707,7 @@ server_paint_rect_os(struct xrdp_mod* mod, int x, int y, int cx, int cy,
}
else
{
- g_writeln("server_paint_rect_os: error finding id 0x%x", id);
+ g_writeln("server_paint_rect_os: error finding id %d", rdpindex);
}
return 0;
}
diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c
index 117d68a4..9cf9438d 100644
--- a/xrdp/xrdp_painter.c
+++ b/xrdp/xrdp_painter.c
@@ -49,16 +49,10 @@ xrdp_painter_delete(struct xrdp_painter* self)
/*****************************************************************************/
int APP_CC
-xrdp_painter_begin_update(struct xrdp_painter* self)
+wm_painter_set_target(struct xrdp_painter* self)
{
int surface_index;
- if (self == 0)
- {
- return 0;
- }
- libxrdp_orders_init(self->session);
-
if (self->wm->target_surface->type == WND_TYPE_SCREEN)
{
if (self->wm->current_surface_index != 0xffff)
@@ -75,8 +69,8 @@ xrdp_painter_begin_update(struct xrdp_painter* self)
if (self->wm->target_surface->tab_stop == 0) /* tab_stop is hack */
{
libxrdp_orders_send_create_os_surface(self->session, surface_index,
- self->wm->target_surface->width,
- self->wm->target_surface->height);
+ self->wm->target_surface->width,
+ self->wm->target_surface->height);
self->wm->target_surface->tab_stop = 1;
}
libxrdp_orders_send_switch_os_surface(self->session, surface_index);
@@ -92,6 +86,19 @@ xrdp_painter_begin_update(struct xrdp_painter* self)
/*****************************************************************************/
int APP_CC
+xrdp_painter_begin_update(struct xrdp_painter* self)
+{
+ if (self == 0)
+ {
+ return 0;
+ }
+ libxrdp_orders_init(self->session);
+ wm_painter_set_target(self);
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
xrdp_painter_end_update(struct xrdp_painter* self)
{
if (self == 0)
@@ -667,13 +674,13 @@ xrdp_painter_copy(struct xrdp_painter* self,
region = xrdp_region_create(self->wm);
if (dst->type != WND_TYPE_OFFSCREEN)
{
- g_writeln("off screen to screen");
+ //g_writeln("off screen to screen");
xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy,
region, self->clip_children);
}
else
{
- g_writeln("off screen to off screen");
+ //g_writeln("off screen to off screen");
xrdp_region_add_rect(region, &clip_rect);
}
x += dx;
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index 73bb066c..a54fd85c 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -80,13 +80,13 @@ struct xrdp_mod
char* data, int data_len,
int total_data_len, int flags);
int (*server_bell_trigger)(struct xrdp_mod* v);
- int (*server_create_os_surface)(struct xrdp_mod* v, int id,
+ int (*server_create_os_surface)(struct xrdp_mod* v, int rdpindex,
int width, int height);
- int (*server_switch_os_surface)(struct xrdp_mod* v, int id);
- int (*server_delete_os_surface)(struct xrdp_mod* v, int id);
+ int (*server_switch_os_surface)(struct xrdp_mod* v, int rdpindex);
+ int (*server_delete_os_surface)(struct xrdp_mod* v, int rdpindex);
int (*server_paint_rect_os)(struct xrdp_mod* mod, int x, int y,
int cx, int cy,
- int id, int srcx, int srcy);
+ int rdpindex, int srcx, int srcy);
int (*server_set_hints)(struct xrdp_mod* mod, int hints, int mask);
long server_dumby[100 - 30]; /* align, 100 minus the number of server
functions above */