summaryrefslogtreecommitdiffstats
path: root/xrdp
diff options
context:
space:
mode:
Diffstat (limited to 'xrdp')
-rw-r--r--xrdp/Makefile.am15
-rw-r--r--xrdp/xrdp.h31
-rw-r--r--xrdp/xrdp_cache.c30
-rw-r--r--xrdp/xrdp_mm.c385
-rw-r--r--xrdp/xrdp_painter.c82
-rw-r--r--xrdp/xrdp_types.h27
-rw-r--r--xrdp/xrdp_wm.c65
7 files changed, 613 insertions, 22 deletions
diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am
index ac3b7fe0..83d04a6c 100644
--- a/xrdp/Makefile.am
+++ b/xrdp/Makefile.am
@@ -1,11 +1,20 @@
EXTRA_DIST = xrdp.ini ad24b.bmp ad256.bmp xrdp24b.bmp xrdp256.bmp sans-10.fv1 cursor0.cur cursor1.cur xrdp.h xrdp_types.h
+EXTRA_INCLUDES =
+EXTRA_LIBS =
+EXTRA_FLAGS =
+
if XRDP_DEBUG
EXTRA_DEFINES = -DXRDP_DEBUG
else
EXTRA_DEFINES = -DXRDP_NODEBUG
endif
+if GOT_PREFIX
+EXTRA_INCLUDES += -I$(prefix)/include
+EXTRA_FLAGS += -L$(prefix)/lib -Wl,-rpath -Wl,$(prefix)/lib
+endif
+
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
@@ -17,7 +26,8 @@ AM_CFLAGS = \
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir)/common \
- -I$(top_srcdir)/libxrdp
+ -I$(top_srcdir)/libxrdp \
+ $(EXTRA_INCLUDES)
sbin_PROGRAMS = \
xrdp
@@ -41,6 +51,9 @@ xrdp_LDADD = \
$(top_builddir)/common/libcommon.la \
$(top_builddir)/libxrdp/libxrdp.la
+xrdp_LDFLAGS = \
+ $(EXTRA_FLAGS)
+
xrdpsysconfdir=$(sysconfdir)/xrdp
xrdpsysconf_DATA = \
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index 6adf17f0..172d417a 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -283,6 +283,20 @@ xrdp_painter_copy(struct xrdp_painter* self,
int x, int y, int cx, int cy,
int srcx, int srcy);
int APP_CC
+xrdp_painter_composite(struct xrdp_painter* self,
+ struct xrdp_bitmap* src,
+ int srcformat,
+ int srcwidth,
+ int srcrepeat,
+ struct xrdp_bitmap* dst,
+ int* srctransform,
+ int mskflags,
+ struct xrdp_bitmap* msk,
+ int mskformat, int mskwidth, int mskrepeat, int op,
+ int srcx, int srcy, int mskx, int msky,
+ int dstx, int dsty, int width, int height,
+ int dstformat);
+int APP_CC
xrdp_painter_line(struct xrdp_painter* self,
struct xrdp_bitmap* bitmap,
int x1, int y1, int x2, int y2);
@@ -374,6 +388,16 @@ int DEFAULT_CC
server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
char* data, int width, int height, int srcx, int srcy);
int DEFAULT_CC
+server_paint_rect_bpp(struct xrdp_mod* mod, int x, int y, int cx, int cy,
+ char* data, int width, int height, int srcx, int srcy,
+ int bpp);
+int DEFAULT_CC
+server_composite(struct xrdp_mod* mod, int srcidx, int srcformat, int srcwidth,
+ int srcrepeat, int* srctransform, int mskflags, int mskidx,
+ int mskformat, int mskwidth, int mskrepeat, int op,
+ int srcx, int srcy, int mskx, int msky,
+ int dstx, int dsty, int width, int height, int dstformat);
+int DEFAULT_CC
server_set_pointer(struct xrdp_mod* mod, int x, int y,
char* data, char* mask);
int DEFAULT_CC
@@ -434,6 +458,9 @@ int DEFAULT_CC
server_create_os_surface(struct xrdp_mod* mod, int id,
int width, int height);
int DEFAULT_CC
+server_create_os_surface_bpp(struct xrdp_mod* mod, int id,
+ int width, int height, int bpp);
+int DEFAULT_CC
server_switch_os_surface(struct xrdp_mod* mod, int id);
int DEFAULT_CC
server_delete_os_surface(struct xrdp_mod* mod, int id);
@@ -468,3 +495,7 @@ int DEFAULT_CC
server_monitored_desktop(struct xrdp_mod* mod,
struct rail_monitored_desktop_order* mdo,
int flags);
+int DEFAULT_CC
+server_add_char_alpha(struct xrdp_mod* mod, int font, int charactor,
+ int offset, int baseline,
+ int width, int height, char* data);
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index b5787763..a93f73c4 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -21,6 +21,18 @@
#include "xrdp.h"
#include "log.h"
+#define LLOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do \
+ { \
+ if (_level < LLOG_LEVEL) \
+ { \
+ g_write("xrdp:xrdp_cache [%10.10u]: ", g_time3()); \
+ g_writeln _args ; \
+ } \
+ } \
+ while (0)
+
/*****************************************************************************/
struct xrdp_cache *APP_CC
xrdp_cache_create(struct xrdp_wm *owner,
@@ -53,7 +65,8 @@ xrdp_cache_create(struct xrdp_wm *owner,
self->bitmap_cache_version = client_info->bitmap_cache_version;
self->pointer_cache_entries = client_info->pointer_cache_entries;
self->xrdp_os_del_list = list_create();
-
+ LLOGLN(10, ("xrdp_cache_create: 0 %d 1 %d 2 %d",
+ self->cache1_entries, self->cache2_entries, self->cache3_entries));
return self;
}
@@ -72,7 +85,7 @@ xrdp_cache_delete(struct xrdp_cache *self)
/* free all the cached bitmaps */
for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2000; j++)
+ for (j = 0; j < XRDP_BITMAP_CACHE_ENTRIES; j++)
{
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
}
@@ -111,7 +124,7 @@ xrdp_cache_reset(struct xrdp_cache *self,
/* free all the cached bitmaps */
for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2000; j++)
+ for (j = 0; j < XRDP_BITMAP_CACHE_ENTRIES; j++)
{
xrdp_bitmap_delete(self->bitmap_items[i][j].bitmap);
}
@@ -192,7 +205,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -211,7 +224,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -230,7 +243,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
#endif
{
self->bitmap_items[i][j].stamp = self->bitmap_stamp;
- DEBUG(("found bitmap at %d %d", i, j));
+ LLOGLN(10, ("found bitmap at %d %d", i, j));
xrdp_bitmap_delete(bitmap);
return MAKELONG(j, i);
}
@@ -238,7 +251,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
}
else
{
- log_message(LOG_LEVEL_ERROR,"error in xrdp_cache_add_bitmap, too big(%d)", bmp_size);
+ log_message(LOG_LEVEL_ERROR,"error in xrdp_cache_add_bitmap, too big(%d) bpp %d", bmp_size, bitmap->bpp);
}
/* look for oldest */
@@ -289,7 +302,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
}
}
- DEBUG(("adding bitmap at %d %d", cache_id, cache_idx));
+ LLOGLN(10, ("adding bitmap at %d %d ptr %p", cache_id, cache_idx,
+ self->bitmap_items[cache_id][cache_idx].bitmap));
/* set, send bitmap and return */
xrdp_bitmap_delete(self->bitmap_items[cache_id][cache_idx].bitmap);
self->bitmap_items[cache_id][cache_idx].bitmap = bitmap;
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index 51a2de85..560ebedb 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -413,6 +413,10 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
self->mod->server_notify_new_update = server_notify_new_update;
self->mod->server_notify_delete = server_notify_delete;
self->mod->server_monitored_desktop = server_monitored_desktop;
+ self->mod->server_add_char_alpha = server_add_char_alpha;
+ self->mod->server_create_os_surface_bpp = server_create_os_surface_bpp;
+ self->mod->server_paint_rect_bpp = server_paint_rect_bpp;
+ self->mod->server_composite = server_composite;
}
}
@@ -677,6 +681,265 @@ xrdp_mm_trans_process_channel_data(struct xrdp_mm *self, struct trans *trans)
/*****************************************************************************/
/* returns error
+ process rail create window order */
+static int APP_CC
+xrdp_mm_process_rail_create_window(struct xrdp_mm* self, struct stream* s)
+{
+ int flags;
+ int window_id;
+ int title_bytes;
+ int index;
+ int bytes;
+ int rv;
+ struct rail_window_state_order rwso;
+
+ g_memset(&rwso, 0, sizeof(rwso));
+ in_uint32_le(s, window_id);
+
+ g_writeln("xrdp_mm_process_rail_create_window: 0x%8.8x", window_id);
+
+ in_uint32_le(s, rwso.owner_window_id);
+ in_uint32_le(s, rwso.style);
+ in_uint32_le(s, rwso.extended_style);
+ in_uint32_le(s, rwso.show_state);
+ in_uint16_le(s, title_bytes);
+ if (title_bytes > 0)
+ {
+ rwso.title_info = g_malloc(title_bytes + 1, 0);
+ in_uint8a(s, rwso.title_info, title_bytes);
+ rwso.title_info[title_bytes] = 0;
+ }
+ in_uint32_le(s, rwso.client_offset_x);
+ in_uint32_le(s, rwso.client_offset_y);
+ in_uint32_le(s, rwso.client_area_width);
+ in_uint32_le(s, rwso.client_area_height);
+ in_uint32_le(s, rwso.rp_content);
+ in_uint32_le(s, rwso.root_parent_handle);
+ in_uint32_le(s, rwso.window_offset_x);
+ in_uint32_le(s, rwso.window_offset_y);
+ in_uint32_le(s, rwso.window_client_delta_x);
+ in_uint32_le(s, rwso.window_client_delta_y);
+ in_uint32_le(s, rwso.window_width);
+ in_uint32_le(s, rwso.window_height);
+ in_uint16_le(s, rwso.num_window_rects);
+ if (rwso.num_window_rects > 0)
+ {
+ bytes = sizeof(struct rail_window_rect) * rwso.num_window_rects;
+ rwso.window_rects = (struct rail_window_rect*)g_malloc(bytes, 0);
+ for (index = 0; index < rwso.num_window_rects; index++)
+ {
+ in_uint16_le(s, rwso.window_rects[index].left);
+ in_uint16_le(s, rwso.window_rects[index].top);
+ in_uint16_le(s, rwso.window_rects[index].right);
+ in_uint16_le(s, rwso.window_rects[index].bottom);
+ }
+ }
+ in_uint32_le(s, rwso.visible_offset_x);
+ in_uint32_le(s, rwso.visible_offset_y);
+ in_uint16_le(s, rwso.num_visibility_rects);
+ if (rwso.num_visibility_rects > 0)
+ {
+ bytes = sizeof(struct rail_window_rect) * rwso.num_visibility_rects;
+ rwso.visibility_rects = (struct rail_window_rect*)g_malloc(bytes, 0);
+ for (index = 0; index < rwso.num_visibility_rects; index++)
+ {
+ in_uint16_le(s, rwso.visibility_rects[index].left);
+ in_uint16_le(s, rwso.visibility_rects[index].top);
+ in_uint16_le(s, rwso.visibility_rects[index].right);
+ in_uint16_le(s, rwso.visibility_rects[index].bottom);
+ }
+ }
+ in_uint32_le(s, flags);
+ rv = libxrdp_orders_init(self->wm->session);
+ rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags);
+ rv = libxrdp_orders_send(self->wm->session);
+ g_free(rwso.title_info);
+ g_free(rwso.window_rects);
+ g_free(rwso.visibility_rects);
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
+ process rail configure window order */
+static int APP_CC
+xrdp_mm_process_rail_configure_window(struct xrdp_mm* self, struct stream* s)
+{
+ int flags;
+ int window_id;
+ int index;
+ int bytes;
+ int rv;
+ struct rail_window_state_order rwso;
+
+ g_memset(&rwso, 0, sizeof(rwso));
+ in_uint32_le(s, window_id);
+
+ g_writeln("xrdp_mm_process_rail_configure_window: 0x%8.8x", window_id);
+
+ in_uint32_le(s, rwso.client_offset_x);
+ in_uint32_le(s, rwso.client_offset_y);
+ in_uint32_le(s, rwso.client_area_width);
+ in_uint32_le(s, rwso.client_area_height);
+ in_uint32_le(s, rwso.rp_content);
+ in_uint32_le(s, rwso.root_parent_handle);
+ in_uint32_le(s, rwso.window_offset_x);
+ in_uint32_le(s, rwso.window_offset_y);
+ in_uint32_le(s, rwso.window_client_delta_x);
+ in_uint32_le(s, rwso.window_client_delta_y);
+ in_uint32_le(s, rwso.window_width);
+ in_uint32_le(s, rwso.window_height);
+ in_uint16_le(s, rwso.num_window_rects);
+ if (rwso.num_window_rects > 0)
+ {
+ bytes = sizeof(struct rail_window_rect) * rwso.num_window_rects;
+ rwso.window_rects = (struct rail_window_rect*)g_malloc(bytes, 0);
+ for (index = 0; index < rwso.num_window_rects; index++)
+ {
+ in_uint16_le(s, rwso.window_rects[index].left);
+ in_uint16_le(s, rwso.window_rects[index].top);
+ in_uint16_le(s, rwso.window_rects[index].right);
+ in_uint16_le(s, rwso.window_rects[index].bottom);
+ }
+ }
+ in_uint32_le(s, rwso.visible_offset_x);
+ in_uint32_le(s, rwso.visible_offset_y);
+ in_uint16_le(s, rwso.num_visibility_rects);
+ if (rwso.num_visibility_rects > 0)
+ {
+ bytes = sizeof(struct rail_window_rect) * rwso.num_visibility_rects;
+ rwso.visibility_rects = (struct rail_window_rect*)g_malloc(bytes, 0);
+ for (index = 0; index < rwso.num_visibility_rects; index++)
+ {
+ in_uint16_le(s, rwso.visibility_rects[index].left);
+ in_uint16_le(s, rwso.visibility_rects[index].top);
+ in_uint16_le(s, rwso.visibility_rects[index].right);
+ in_uint16_le(s, rwso.visibility_rects[index].bottom);
+ }
+ }
+ in_uint32_le(s, flags);
+ rv = libxrdp_orders_init(self->wm->session);
+ rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags);
+ rv = libxrdp_orders_send(self->wm->session);
+ g_free(rwso.window_rects);
+ g_free(rwso.visibility_rects);
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
+ process rail destroy window order */
+static int APP_CC
+xrdp_mm_process_rail_destroy_window(struct xrdp_mm* self, struct stream* s)
+{
+ int window_id;
+ int rv;
+
+ in_uint32_le(s, window_id);
+ g_writeln("xrdp_mm_process_rail_destroy_window 0x%8.8x", window_id);
+ rv = libxrdp_orders_init(self->wm->session);
+ rv = libxrdp_window_delete(self->wm->session, window_id);
+ rv = libxrdp_orders_send(self->wm->session);
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
+ process rail update window (show state) order */
+static int APP_CC
+xrdp_mm_process_rail_show_window(struct xrdp_mm* self, struct stream* s)
+{
+ int window_id;
+ int rv;
+ int flags;
+ struct rail_window_state_order rwso;
+
+ g_memset(&rwso, 0, sizeof(rwso));
+ in_uint32_le(s, window_id);
+ in_uint32_le(s, flags);
+ in_uint32_le(s, rwso.show_state);
+ g_writeln("xrdp_mm_process_rail_show_window 0x%8.8x %x", window_id,
+ rwso.show_state);
+ rv = libxrdp_orders_init(self->wm->session);
+ rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags);
+ rv = libxrdp_orders_send(self->wm->session);
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
+ process rail update window (title) order */
+static int APP_CC
+xrdp_mm_process_rail_update_window_text(struct xrdp_mm* self, struct stream* s)
+{
+ int size;
+ int flags;
+ int rv = 0;
+ int window_id;
+ struct rail_window_state_order rwso;
+
+ g_writeln("xrdp_mm_process_rail_update_window_text:");
+
+ in_uint32_le(s, window_id);
+ in_uint32_le(s, flags);
+ g_writeln(" update window title info: 0x%8.8x", window_id);
+
+ g_memset(&rwso, 0, sizeof(rwso));
+ in_uint32_le(s, size); /* title size */
+ rwso.title_info = g_malloc(size + 1, 0);
+ in_uint8a(s, rwso.title_info, size);
+ rwso.title_info[size] = 0;
+ g_writeln(" set window title %s size %d 0x%8.8x", rwso.title_info, size, flags);
+ rv = libxrdp_orders_init(self->wm->session);
+ rv = libxrdp_window_new_update(self->wm->session, window_id, &rwso, flags);
+ rv = libxrdp_orders_send(self->wm->session);
+ g_writeln(" set window title %s %d", rwso.title_info, rv);
+
+ g_free(rwso.title_info);
+
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
+ process alternate secondary drawing orders for rail channel */
+static int APP_CC
+xrdp_mm_process_rail_drawing_orders(struct xrdp_mm* self, struct trans* trans)
+{
+ struct stream* s;
+ int order_type;
+ int rv = 0;
+
+ s = trans_get_in_s(trans);
+ if (s == 0)
+ {
+ return 1;
+ }
+ in_uint32_le(s, order_type);
+
+ switch(order_type)
+ {
+ case 2: /* create_window */
+ xrdp_mm_process_rail_create_window(self, s);
+ break;
+ case 4: /* destroy_window */
+ xrdp_mm_process_rail_destroy_window(self, s);
+ break;
+ case 6: /* show_window */
+ rv = xrdp_mm_process_rail_show_window(self, s);
+ break;
+ case 8: /* update title info */
+ rv = xrdp_mm_process_rail_update_window_text(self, s);
+ break;
+ default:
+ break;
+ }
+
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error
process a message for the channel handler */
static int APP_CC
xrdp_mm_chan_process_msg(struct xrdp_mm *self, struct trans *trans,
@@ -708,6 +971,9 @@ xrdp_mm_chan_process_msg(struct xrdp_mm *self, struct trans *trans,
case 8: /* channel data */
rv = xrdp_mm_trans_process_channel_data(self, trans);
break;
+ case 10: /* rail alternate secondary drawing orders */
+ rv = xrdp_mm_process_rail_drawing_orders(self, trans);
+ break;
default:
log_message(LOG_LEVEL_ERROR,"xrdp_mm_chan_process_msg: unknown id %d", id);
break;
@@ -793,7 +1059,7 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port)
self->usechansrv = 1;
/* connect channel redir */
- if ((ip == 0) || (g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0))
+ if ((g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0))
{
/* unix socket */
self->chan_trans = trans_create(TRANS_MODE_UNIX, 8192, 8192);
@@ -1799,6 +2065,79 @@ server_paint_rect(struct xrdp_mod *mod, int x, int y, int cx, int cy,
/*****************************************************************************/
int DEFAULT_CC
+server_paint_rect_bpp(struct xrdp_mod* mod, int x, int y, int cx, int cy,
+ char* data, int width, int height, int srcx, int srcy,
+ int bpp)
+{
+ struct xrdp_wm* wm;
+ struct xrdp_bitmap* b;
+ struct xrdp_painter* p;
+
+ p = (struct xrdp_painter*)(mod->painter);
+ if (p == 0)
+ {
+ return 0;
+ }
+ wm = (struct xrdp_wm*)(mod->wm);
+ b = xrdp_bitmap_create_with_data(width, height, bpp, data, wm);
+ xrdp_painter_copy(p, b, wm->target_surface, x, y, cx, cy, srcx, srcy);
+ xrdp_bitmap_delete(b);
+ return 0;
+}
+
+/*****************************************************************************/
+int DEFAULT_CC
+server_composite(struct xrdp_mod* mod, int srcidx, int srcformat,
+ int srcwidth, int srcrepeat, int* srctransform,
+ int mskflags, int mskidx, int mskformat, int mskwidth,
+ int mskrepeat, int op, int srcx, int srcy,
+ int mskx, int msky, int dstx, int dsty,
+ int width, int height, int dstformat)
+{
+ struct xrdp_wm* wm;
+ struct xrdp_bitmap* b;
+ struct xrdp_bitmap* msk;
+ struct xrdp_painter* p;
+ struct xrdp_os_bitmap_item* bi;
+
+ p = (struct xrdp_painter*)(mod->painter);
+ if (p == 0)
+ {
+ return 0;
+ }
+ wm = (struct xrdp_wm*)(mod->wm);
+ b = 0;
+ msk = 0;
+ bi = xrdp_cache_get_os_bitmap(wm->cache, srcidx);
+ if (bi != 0)
+ {
+ b = bi->bitmap;
+ }
+ if (mskflags & 1)
+ {
+ bi = xrdp_cache_get_os_bitmap(wm->cache, mskidx);
+ if (bi != 0)
+ {
+ msk = bi->bitmap;
+ }
+ }
+ if (b != 0)
+ {
+ xrdp_painter_composite(p, b, srcformat, srcwidth, srcrepeat,
+ wm->target_surface, srctransform,
+ mskflags, msk, mskformat, mskwidth, mskrepeat,
+ op, srcx, srcy, mskx, msky, dstx, dsty,
+ width, height, dstformat);
+ }
+ else
+ {
+ g_writeln("server_composite: error finding id %d or %d", srcidx, mskidx);
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+int DEFAULT_CC
server_set_pointer(struct xrdp_mod *mod, int x, int y,
char *data, char *mask)
{
@@ -2033,6 +2372,7 @@ server_add_char(struct xrdp_mod *mod, int font, int charactor,
fi.height = height;
fi.incby = 0;
fi.data = data;
+ fi.bpp = 1;
return libxrdp_orders_send_font(((struct xrdp_wm *)mod->wm)->session,
&fi, font, charactor);
}
@@ -2413,6 +2753,29 @@ server_create_os_surface(struct xrdp_mod *mod, int rdpindex,
/*****************************************************************************/
int DEFAULT_CC
+server_create_os_surface_bpp(struct xrdp_mod* mod, int rdpindex,
+ int width, int height, int bpp)
+{
+ struct xrdp_wm* wm;
+ struct xrdp_bitmap* bitmap;
+ int error;
+
+ wm = (struct xrdp_wm*)(mod->wm);
+ bitmap = xrdp_bitmap_create(width, height, bpp,
+ WND_TYPE_OFFSCREEN, wm);
+ error = xrdp_cache_add_os_bitmap(wm->cache, bitmap, rdpindex);
+ if (error != 0)
+ {
+ g_writeln("server_create_os_surface_bpp: xrdp_cache_add_os_bitmap failed");
+ return 1;
+ }
+ bitmap->item_index = rdpindex;
+ bitmap->id = rdpindex;
+ return 0;
+}
+
+/*****************************************************************************/
+int DEFAULT_CC
server_switch_os_surface(struct xrdp_mod *mod, int rdpindex)
{
struct xrdp_wm *wm;
@@ -2630,3 +2993,23 @@ server_monitored_desktop(struct xrdp_mod *mod,
wm = (struct xrdp_wm *)(mod->wm);
return libxrdp_monitored_desktop(wm->session, mdo, flags);
}
+
+/*****************************************************************************/
+int DEFAULT_CC
+server_add_char_alpha(struct xrdp_mod* mod, int font, int charactor,
+ int offset, int baseline,
+ int width, int height, char* data)
+{
+ struct xrdp_font_char fi;
+
+ fi.offset = offset;
+ fi.baseline = baseline;
+ fi.width = width;
+ fi.height = height;
+ fi.incby = 0;
+ fi.data = data;
+ fi.bpp = 8;
+ return libxrdp_orders_send_font(((struct xrdp_wm*)mod->wm)->session,
+ &fi, font, charactor);
+}
+
diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c
index 4457fee8..b9d1da16 100644
--- a/xrdp/xrdp_painter.c
+++ b/xrdp/xrdp_painter.c
@@ -849,7 +849,7 @@ xrdp_painter_copy(struct xrdp_painter *self,
{
w = MIN(64, ((srcx + cx) - i));
h = MIN(64, ((srcy + cy) - j));
- b = xrdp_bitmap_create(w, h, self->wm->screen->bpp, 0, self->wm);
+ b = xrdp_bitmap_create(w, h, src->bpp, 0, self->wm);
xrdp_bitmap_copy_box_with_crc(src, b, i, j, w, h);
bitmap_id = xrdp_cache_add_bitmap(self->wm->cache, b, self->wm->hints);
cache_id = HIWORD(bitmap_id);
@@ -889,6 +889,86 @@ xrdp_painter_copy(struct xrdp_painter *self,
/*****************************************************************************/
int APP_CC
+xrdp_painter_composite(struct xrdp_painter* self,
+ struct xrdp_bitmap* src,
+ int srcformat,
+ int srcwidth,
+ int srcrepeat,
+ struct xrdp_bitmap* dst,
+ int* srctransform,
+ int mskflags,
+ struct xrdp_bitmap* msk,
+ int mskformat, int mskwidth, int mskrepeat, int op,
+ int srcx, int srcy, int mskx, int msky,
+ int dstx, int dsty, int width, int height, int dstformat)
+{
+ struct xrdp_rect clip_rect;
+ struct xrdp_rect draw_rect;
+ struct xrdp_rect rect1;
+ struct xrdp_rect rect2;
+ struct xrdp_region* region;
+ int k;
+ int dx;
+ int dy;
+ int palette_id;
+ int cache_srcidx;
+ int cache_mskidx;
+
+ if (self == 0 || src == 0 || dst == 0)
+ {
+ return 0;
+ }
+
+ /* todo data */
+
+ if (dst->type == WND_TYPE_BITMAP)
+ {
+ return 0;
+ }
+
+ if (src->type == WND_TYPE_OFFSCREEN)
+ {
+ xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
+ region = xrdp_region_create(self->wm);
+ xrdp_region_add_rect(region, &clip_rect);
+ dstx += dx;
+ dsty += dy;
+
+ palette_id = 0;
+ cache_srcidx = src->item_index;
+ cache_mskidx = -1;
+ if (mskflags & 1)
+ {
+ if (msk != 0)
+ {
+ cache_mskidx = msk->item_index; // todo
+ }
+ }
+
+ k = 0;
+ while (xrdp_region_get_rect(region, k, &rect1) == 0)
+ {
+ if (rect_intersect(&rect1, &clip_rect, &rect2))
+ {
+ MAKERECT(rect1, dstx, dsty, width, height);
+ if (rect_intersect(&rect2, &rect1, &draw_rect))
+ {
+ libxrdp_orders_composite_blt(self->session, cache_srcidx, srcformat, srcwidth,
+ srcrepeat, srctransform, mskflags, cache_mskidx,
+ mskformat, mskwidth, mskrepeat, op, srcx, srcy,
+ mskx, msky, dstx, dsty, width, height, dstformat,
+ &draw_rect);
+ }
+ }
+ k++;
+ }
+ xrdp_region_delete(region);
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
xrdp_painter_line(struct xrdp_painter *self,
struct xrdp_bitmap *dst,
int x1, int y1, int x2, int y2)
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index 5a43d9a9..cd71c342 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -22,6 +22,7 @@
#define LOG_WINDOW_CHAR_PER_LINE 60
#include "xrdp_rail.h"
+#include "xrdp_constants.h"
#define MAX_NR_CHANNELS 16
#define MAX_CHANNEL_NAME 16
@@ -51,8 +52,10 @@ struct xrdp_mod
int (*server_screen_blt)(struct xrdp_mod* v, int x, int y, int cx, int cy,
int srcx, int srcy);
int (*server_paint_rect)(struct xrdp_mod* v, int x, int y, int cx, int cy,
- char* data, int width, int height, int srcx, int srcy);
- int (*server_set_pointer)(struct xrdp_mod* v, int x, int y, char* data, char* mask);
+ char* data, int width, int height,
+ int srcx, int srcy);
+ int (*server_set_pointer)(struct xrdp_mod* v, int x, int y,
+ char* data, char* mask);
int (*server_palette)(struct xrdp_mod* v, int* palette);
int (*server_msg)(struct xrdp_mod* v, char* msg, int code);
int (*server_is_term)(struct xrdp_mod* v);
@@ -117,8 +120,23 @@ struct xrdp_mod
int flags);
int (*server_set_pointer_ex)(struct xrdp_mod* v, int x, int y, char* data,
char* mask, int bpp);
+ int (*server_add_char_alpha)(struct xrdp_mod* mod, int font, int charactor,
+ int offset, int baseline,
+ int width, int height, char* data);
- long server_dumby[100 - 38]; /* align, 100 minus the number of server
+ int (*server_create_os_surface_bpp)(struct xrdp_mod* v, int rdpindex,
+ int width, int height, int bpp);
+ int (*server_paint_rect_bpp)(struct xrdp_mod* v, int x, int y, int cx, int cy,
+ char* data, int width, int height,
+ int srcx, int srcy, int bpp);
+ int (*server_composite)(struct xrdp_mod* v, int srcidx, int srcformat,
+ int srcwidth, int srcrepeat, int* srctransform,
+ int mskflags, int mskidx, int mskformat,
+ int mskwidth, int mskrepeat, int op,
+ int srcx, int srcy, int mskx, int msky,
+ int dstx, int dsty, int width, int height,
+ int dstformat);
+ long server_dumby[100 - 42]; /* align, 100 minus the number of server
functions above */
/* common */
long handle; /* pointer to self as int */
@@ -185,6 +203,9 @@ struct xrdp_brush_item
char pattern[8];
};
+/* moved to xrdp_constants.h
+#define XRDP_BITMAP_CACHE_ENTRIES 2048 */
+
/* differnce caches */
struct xrdp_cache
{
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 9dfbb06b..bba25c34 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -401,7 +401,7 @@ xrdp_wm_load_static_colors_plus(struct xrdp_wm *self, char *autorun_name)
if (g_strcasecmp(val, "black") == 0)
{
val = (char *)list_get_item(values, index);
- self->black = HCOLOR(self->screen->bpp, xrdp_wm_htoi(val));
+ self->black = HCOLOR(self->screen->bpp,xrdp_wm_htoi(val));
}
else if (g_strcasecmp(val, "grey") == 0)
{
@@ -1221,6 +1221,22 @@ xrdp_wm_mouse_click(struct xrdp_wm *self, int x, int y, int but, int down)
self->mm->mod->mod_event(self->mm->mod, WM_BUTTON5UP,
self->mouse_x, self->mouse_y, 0, 0);
}
+ if (but == 6 && down)
+ {
+ self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6DOWN, x, y, 0, 0);
+ }
+ else if (but == 6 && !down)
+ {
+ self->mm->mod->mod_event(self->mm->mod, WM_BUTTON6UP, x, y, 0, 0);
+ }
+ if (but == 7 && down)
+ {
+ self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7DOWN, x, y, 0, 0);
+ }
+ else if (but == 7 && !down)
+ {
+ self->mm->mod->mod_event(self->mm->mod, WM_BUTTON7UP, x, y, 0, 0);
+ }
}
}
}
@@ -1528,18 +1544,48 @@ xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags,
}
}
- if (device_flags == MOUSE_FLAG_BUTTON4 || /* 0x0280 */
- device_flags == 0x0278)
+ if (device_flags & 0x200) /* PTRFLAGS_WHEEL */
{
- xrdp_wm_mouse_click(self, 0, 0, 4, 0);
+ if (device_flags & 0x100) /* PTRFLAGS_WHEEL_NEGATIVE */
+ {
+ xrdp_wm_mouse_click(self, 0, 0, 5, 0);
+ }
+ else
+ {
+ xrdp_wm_mouse_click(self, 0, 0, 4, 0);
+ }
}
- if (device_flags == MOUSE_FLAG_BUTTON5 || /* 0x0380 */
- device_flags == 0x0388)
+ return 0;
+}
+
+/*****************************************************************************/
+static int APP_CC
+xrdp_wm_process_input_mousex(struct xrdp_wm* self, int device_flags,
+ int x, int y)
+{
+ if (device_flags & 0x8000) /* PTRXFLAGS_DOWN */
{
- xrdp_wm_mouse_click(self, 0, 0, 5, 0);
+ if (device_flags & 0x0001) /* PTRXFLAGS_BUTTON1 */
+ {
+ xrdp_wm_mouse_click(self, x, y, 6, 1);
+ }
+ else if (device_flags & 0x0002) /* PTRXFLAGS_BUTTON2 */
+ {
+ xrdp_wm_mouse_click(self, x, y, 7, 1);
+ }
+ }
+ else
+ {
+ if (device_flags & 0x0001) /* PTRXFLAGS_BUTTON1 */
+ {
+ xrdp_wm_mouse_click(self, x, y, 6, 0);
+ }
+ else if (device_flags & 0x0002) /* PTRXFLAGS_BUTTON2 */
+ {
+ xrdp_wm_mouse_click(self, x, y, 7, 0);
+ }
}
-
return 0;
}
@@ -1616,6 +1662,9 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
case 0x8001: /* RDP_INPUT_MOUSE */
rv = xrdp_wm_process_input_mouse(wm, param3, param1, param2);
break;
+ case 0x8002: /* RDP_INPUT_MOUSEX (INPUT_EVENT_MOUSEX) */
+ rv = xrdp_wm_process_input_mousex(wm, param3, param1, param2);
+ break;
case 0x4444: /* invalidate, this is not from RDP_DATA_PDU_INPUT */
/* like the rest, its from RDP_PDU_DATA with code 33 */
/* its the rdp client asking for a screen update */