summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsorg71 <jay.sorg@gmail.com>2013-08-16 12:13:52 -0700
committerjsorg71 <jay.sorg@gmail.com>2013-08-16 12:13:52 -0700
commitb8388a65a2d561c23cc08613d1c4d7cf5dbb96d0 (patch)
tree6d606a46f9d52dd7945b88566818704e226e013a
parent759d508635a742690aebcf07d4d9dfa2c08beda9 (diff)
parentfa40106a697611a35b57459c9403cc440a0cc865 (diff)
downloadxrdp-proprietary-b8388a65a2d561c23cc08613d1c4d7cf5dbb96d0.tar.gz
xrdp-proprietary-b8388a65a2d561c23cc08613d1c4d7cf5dbb96d0.zip
Merge pull request #90 from neutrinolabs/master
xorg driver, smart card, etc
-rw-r--r--common/parse.h25
-rw-r--r--common/xrdp_client_info.h1
-rw-r--r--libxrdp/xrdp_rdp.c4
-rw-r--r--libxrdp/xrdp_sec.c2
-rw-r--r--sesman/chansrv/Makefile.am1
-rw-r--r--sesman/chansrv/chansrv.h2
-rw-r--r--sesman/chansrv/chansrv_fuse.c585
-rw-r--r--sesman/chansrv/chansrv_fuse.h1
-rw-r--r--sesman/chansrv/clipboard.c483
-rw-r--r--sesman/chansrv/clipboard.h17
-rw-r--r--sesman/chansrv/clipboard_common.h8
-rw-r--r--sesman/chansrv/clipboard_file.c142
-rw-r--r--sesman/chansrv/devredir.c106
-rw-r--r--sesman/chansrv/drdynvc.c9
-rw-r--r--sesman/chansrv/irp.h14
-rw-r--r--sesman/chansrv/smartcard.c73
-rw-r--r--sesman/chansrv/smartcard.h9
-rw-r--r--sesman/chansrv/smartcard_pcsc.c330
-rw-r--r--sesman/chansrv/smartcard_pcsc.h36
-rw-r--r--sesman/env.c1
-rwxr-xr-xxorg/X11R7.6/buildx.sh113
-rw-r--r--xorg/X11R7.6/rdp/rdp.h4
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyArea.c24
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyPlane.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpFillPolygon.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpImageGlyphBlt.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpImageText16.c6
-rw-r--r--xorg/X11R7.6/rdp/rdpImageText8.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyArc.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyFillArc.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyFillRect.c39
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyRectangle.c6
-rw-r--r--xorg/X11R7.6/rdp/rdpPolySegment.c2
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyText16.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyText8.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPolylines.c2
-rw-r--r--xorg/X11R7.6/rdp/rdpPushPixels.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpPutImage.c8
-rw-r--r--xorg/X11R7.6/rdp/rdpdraw.c99
-rw-r--r--xorg/X11R7.6/rdp/rdpmain.c6
-rw-r--r--xorg/X11R7.6/rdp/rdpup.c11
-rw-r--r--xorg/server/Makefile6
-rw-r--r--xorg/server/module/Makefile2
-rw-r--r--xorg/server/module/rdp.h41
-rw-r--r--xorg/server/module/rdpClientCon.c245
-rw-r--r--xorg/server/module/rdpClientCon.h44
-rw-r--r--xorg/server/module/rdpComposite.c13
-rw-r--r--xorg/server/module/rdpCopyArea.c14
-rw-r--r--xorg/server/module/rdpCopyPlane.c14
-rw-r--r--xorg/server/module/rdpCursor.c8
-rw-r--r--xorg/server/module/rdpDraw.c88
-rw-r--r--xorg/server/module/rdpDraw.h20
-rw-r--r--xorg/server/module/rdpFillPolygon.c14
-rw-r--r--xorg/server/module/rdpFillSpans.c16
-rw-r--r--xorg/server/module/rdpGC.c29
-rw-r--r--xorg/server/module/rdpGlyphs.c5
-rw-r--r--xorg/server/module/rdpImageGlyphBlt.c14
-rw-r--r--xorg/server/module/rdpImageText16.c14
-rw-r--r--xorg/server/module/rdpImageText8.c14
-rw-r--r--xorg/server/module/rdpInput.c121
-rw-r--r--xorg/server/module/rdpInput.h46
-rw-r--r--xorg/server/module/rdpMain.c39
-rw-r--r--xorg/server/module/rdpMain.h30
-rw-r--r--xorg/server/module/rdpMisc.h175
-rw-r--r--xorg/server/module/rdpPixmap.c94
-rw-r--r--xorg/server/module/rdpPixmap.h36
-rw-r--r--xorg/server/module/rdpPolyArc.c14
-rw-r--r--xorg/server/module/rdpPolyFillArc.c14
-rw-r--r--xorg/server/module/rdpPolyFillRect.c14
-rw-r--r--xorg/server/module/rdpPolyGlyphBlt.c14
-rw-r--r--xorg/server/module/rdpPolyPoint.c14
-rw-r--r--xorg/server/module/rdpPolyRectangle.c14
-rw-r--r--xorg/server/module/rdpPolySegment.c14
-rw-r--r--xorg/server/module/rdpPolyText16.c14
-rw-r--r--xorg/server/module/rdpPolyText8.c14
-rw-r--r--xorg/server/module/rdpPolylines.c14
-rw-r--r--xorg/server/module/rdpPushPixels.c14
-rw-r--r--xorg/server/module/rdpPutImage.c14
-rw-r--r--xorg/server/module/rdpRandR.c54
-rw-r--r--xorg/server/module/rdpReg.c1
-rw-r--r--xorg/server/module/rdpSetSpans.c14
-rw-r--r--xorg/server/readme.txt3
-rw-r--r--xorg/server/xrdpdev/xrdpdev.c41
-rw-r--r--xorg/server/xrdpkeyb/rdpKeyboard.c335
-rw-r--r--xorg/server/xrdpmouse/rdpMouse.c144
-rw-r--r--xrdp/xrdp.ini4
87 files changed, 3056 insertions, 1059 deletions
diff --git a/common/parse.h b/common/parse.h
index 226e246b..f92e76de 100644
--- a/common/parse.h
+++ b/common/parse.h
@@ -184,6 +184,31 @@ struct stream
#endif
/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define in_uint64_le(s, v) do \
+{ \
+ (v) = (tui64) \
+ ( \
+ (((tui64)(*((unsigned char*)((s)->p + 0)))) << 0) | \
+ (((tui64)(*((unsigned char*)((s)->p + 1)))) << 8) | \
+ (((tui64)(*((unsigned char*)((s)->p + 2)))) << 16) | \
+ (((tui64)(*((unsigned char*)((s)->p + 3)))) << 24) | \
+ (((tui64)(*((unsigned char*)((s)->p + 4)))) << 32) | \
+ (((tui64)(*((unsigned char*)((s)->p + 5)))) << 40) | \
+ (((tui64)(*((unsigned char*)((s)->p + 6)))) << 48) | \
+ (((tui64)(*((unsigned char*)((s)->p + 7)))) << 56) \
+ ); \
+ (s)->p += 8; \
+} while (0)
+#else
+#define in_uint64_le(s, v) do \
+{ \
+ (v) = *((tui64*)((s)->p)); \
+ (s)->p += 8; \
+} while (0)
+#endif
+
+/******************************************************************************/
#define in_uint32_be(s, v) do \
{ \
(v) = *((unsigned char*)((s)->p)); \
diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h
index aefc7119..43ff3f82 100644
--- a/common/xrdp_client_info.h
+++ b/common/xrdp_client_info.h
@@ -92,6 +92,7 @@ struct xrdp_client_info
int use_bulk_comp;
int pointer_flags; /* 0 color, 1 new, 2 no new */
int use_fast_path;
+ int require_credentials; /* when true, credentials *must* be passed on cmd line */
};
#endif
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 82ccdea0..93219968 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -135,6 +135,10 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
{
client_info->pointer_flags = text2bool(value) == 0 ? 2 : 0;
}
+ else if (g_strcasecmp(item, "require_credentials") == 0)
+ {
+ client_info->require_credentials = text2bool(value);
+ }
}
list_delete(items);
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index 54d5d0de..726fcde4 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -451,6 +451,8 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
else
{
in_uint8s(s, len_password + 2);
+ if (self->rdp_layer->client_info.require_credentials)
+ return 1; /* credentials on cmd line is mandatory */
}
unicode_in(s, len_program, self->rdp_layer->client_info.program, 255);
diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am
index 89753430..7cecdb1e 100644
--- a/sesman/chansrv/Makefile.am
+++ b/sesman/chansrv/Makefile.am
@@ -46,6 +46,7 @@ xrdp_chansrv_SOURCES = \
clipboard_file.c \
devredir.c \
smartcard.c \
+ smartcard_pcsc.c \
rail.c \
xcommon.c \
drdynvc.c \
diff --git a/sesman/chansrv/chansrv.h b/sesman/chansrv/chansrv.h
index a6b88a35..bca30ca4 100644
--- a/sesman/chansrv/chansrv.h
+++ b/sesman/chansrv/chansrv.h
@@ -57,7 +57,7 @@ struct xrdp_api_data
int APP_CC send_channel_data(int chan_id, char *data, int size);
int APP_CC main_cleanup(void);
int APP_CC find_empty_slot_in_dvc_channels();
-struct xrdp_api_data *APP_CC struct_from_dvc_chan_id(tui32 dvc_chan_id);
+struct xrdp_api_data * APP_CC struct_from_dvc_chan_id(tui32 dvc_chan_id);
int remove_struct_with_chan_id(tui32 dvc_chan_id);
#define LOG_LEVEL 5
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 661d0bca..572679eb 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -125,6 +125,13 @@ void xfuse_devredir_cb_file_close(void *vp) {}
g_writeln (_params); \
}
+#define log_always(_params...) \
+{ \
+ g_write("[%10.10u]: FUSE %s: %d : ALWAYS: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
#define log_info(_params...) \
{ \
if (LOG_INFO <= LOG_LEVEL) \
@@ -210,6 +217,12 @@ struct req_list_item
int size;
};
+struct dir_info
+{
+ /* last index accessed in g_xrdp_fs.inode_table[] */
+ int index;
+};
+
static struct list *g_req_list = 0;
static struct xrdp_fs g_xrdp_fs; /* an inst of xrdp file system */
static char *g_mount_point = 0; /* our FUSE mount point */
@@ -249,6 +262,7 @@ static int xfuse_does_file_exist(int parent, char *name);
static int xfuse_delete_file(int parent, char *name);
static int xfuse_delete_file_with_xinode(XRDP_INODE *xinode);
static int xfuse_delete_dir_with_xinode(XRDP_INODE *xinode);
+static int xfuse_recursive_delete_dir_with_xinode(XRDP_INODE *xinode);
static void xfuse_update_xrdpfs_size();
static void xfuse_enum_dir(fuse_req_t req, fuse_ino_t ino, size_t size,
off_t off, struct fuse_file_info *fi);
@@ -331,6 +345,16 @@ int clipboard_request_file_data(int stream_id, int lindex, int offset,
static void xfuse_cb_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
int to_set, struct fuse_file_info *fi);
+static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
+ struct fuse_file_info *fi);
+
+static void xfuse_cb_releasedir(fuse_req_t req, fuse_ino_t ino,
+ struct fuse_file_info *fi);
+
+/* misc calls */
+static void xfuse_mark_as_stale(int pinode);
+static void xfuse_delete_stale_entries(int pinode);
+
/*****************************************************************************
** **
** public functions - can be called from any code path **
@@ -381,20 +405,22 @@ int xfuse_init()
/* setup FUSE callbacks */
g_memset(&g_xfuse_ops, 0, sizeof(g_xfuse_ops));
- g_xfuse_ops.lookup = xfuse_cb_lookup;
- g_xfuse_ops.readdir = xfuse_cb_readdir;
- g_xfuse_ops.mkdir = xfuse_cb_mkdir;
- g_xfuse_ops.rmdir = xfuse_cb_rmdir;
- g_xfuse_ops.unlink = xfuse_cb_unlink;
- g_xfuse_ops.rename = xfuse_cb_rename;
- g_xfuse_ops.open = xfuse_cb_open;
- g_xfuse_ops.release = xfuse_cb_release;
- g_xfuse_ops.read = xfuse_cb_read;
- g_xfuse_ops.write = xfuse_cb_write;
- g_xfuse_ops.create = xfuse_cb_create;
+ g_xfuse_ops.lookup = xfuse_cb_lookup;
+ g_xfuse_ops.readdir = xfuse_cb_readdir;
+ g_xfuse_ops.mkdir = xfuse_cb_mkdir;
+ g_xfuse_ops.rmdir = xfuse_cb_rmdir;
+ g_xfuse_ops.unlink = xfuse_cb_unlink;
+ g_xfuse_ops.rename = xfuse_cb_rename;
+ g_xfuse_ops.open = xfuse_cb_open;
+ g_xfuse_ops.release = xfuse_cb_release;
+ g_xfuse_ops.read = xfuse_cb_read;
+ g_xfuse_ops.write = xfuse_cb_write;
+ g_xfuse_ops.create = xfuse_cb_create;
//g_xfuse_ops.fsync = xfuse_cb_fsync; /* LK_TODO delete this */
- g_xfuse_ops.getattr = xfuse_cb_getattr;
- g_xfuse_ops.setattr = xfuse_cb_setattr;
+ g_xfuse_ops.getattr = xfuse_cb_getattr;
+ g_xfuse_ops.setattr = xfuse_cb_setattr;
+ g_xfuse_ops.opendir = xfuse_cb_opendir;
+ g_xfuse_ops.releasedir = xfuse_cb_releasedir;
fuse_opt_add_arg(&args, "xrdp-chansrv");
fuse_opt_add_arg(&args, g_fuse_root_path);
@@ -1160,9 +1186,6 @@ static struct xrdp_inode * xfuse_create_file_in_xrdp_fs(tui32 device_id,
log_debug("incremented nentries; parent=%d nentries=%d",
pinode, xinodep->nentries);
- /* LK_TODO */
- xfuse_dump_fs();
-
return xinode;
}
@@ -1245,6 +1268,52 @@ static int xfuse_delete_dir_with_xinode(XRDP_INODE *xinode)
return 0;
}
+/**
+ * Recursively delete dir with specified inode
+ *****************************************************************************/
+
+static int xfuse_recursive_delete_dir_with_xinode(XRDP_INODE *xinode)
+{
+ XRDP_INODE *xip;
+ int i;
+
+ /* make sure it is not a file */
+ if ((xinode == NULL) || (xinode->mode & S_IFREG))
+ return -1;
+
+ for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; i++)
+ {
+ if ((xip = g_xrdp_fs.inode_table[i]) == NULL)
+ continue;
+
+ /* look for child inodes */
+ if (xip->parent_inode == xinode->inode)
+ {
+ /* got one */
+ if (xip->mode & S_IFREG)
+ {
+ /* regular file */
+ g_xrdp_fs.inode_table[xip->parent_inode]->nentries--;
+ g_xrdp_fs.inode_table[xip->inode] = NULL;
+ free(xip);
+ }
+ else
+ {
+ /* got another dir */
+ xfuse_recursive_delete_dir_with_xinode(xip);
+ }
+ }
+ }
+
+ /* our parent will have one less dir */
+ g_xrdp_fs.inode_table[xinode->parent_inode]->nentries--;
+
+ g_xrdp_fs.inode_table[xinode->inode] = NULL;
+ free(xinode);
+
+ return 0;
+}
+
static void xfuse_update_xrdpfs_size()
{
void *vp;
@@ -1273,6 +1342,8 @@ static void xfuse_update_xrdpfs_size()
g_xrdp_fs.inode_table = vp;
}
+/* LK_TODO do we still need this function */
+#if 0
static void xfuse_enum_dir(fuse_req_t req, fuse_ino_t ino, size_t size,
off_t off, struct fuse_file_info *fi)
{
@@ -1323,6 +1394,7 @@ static void xfuse_enum_dir(fuse_req_t req, fuse_ino_t ino, size_t size,
if (b.p)
free(b.p);
}
+#endif
/******************************************************************************
** **
@@ -1336,8 +1408,8 @@ static void xfuse_enum_dir(fuse_req_t req, fuse_ino_t ino, size_t size,
void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
{
- XFUSE_INFO *fip = (XFUSE_INFO *) vp;
- XRDP_INODE *xip = NULL;
+ XFUSE_INFO *fip = (XFUSE_INFO *) vp;
+ XRDP_INODE *xip = NULL;
if ((fip == NULL) || (xinode == NULL))
{
@@ -1345,14 +1417,14 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
return;
}
- log_debug("fip->req=%p", fip->req);
-
if (!xfuse_is_inode_valid(fip->inode))
{
log_error("inode %d is not valid", fip->inode);
return;
}
+ log_debug("parent_inode=%d name=%s", fip->inode, xinode->name);
+
/* if filename is . or .. don't add it */
if ((strcmp(xinode->name, ".") == 0) || (strcmp(xinode->name, "..") == 0))
{
@@ -1360,12 +1432,14 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
return;
}
+ xfuse_dump_fs();
+
if ((xip = xfuse_get_inode_from_pinode_name(fip->inode, xinode->name)) != NULL)
{
log_debug("inode=%d name=%s already exists in xrdp_fs; not adding it",
fip->inode, xinode->name);
free(xinode);
- xinode = xip;
+ xip->stale = 0;
return;
}
@@ -1379,8 +1453,10 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
/* insert it in xrdp fs and update lookup count */
g_xrdp_fs.inode_table[xinode->inode] = xinode;
- g_xrdp_fs.inode_table[fip->inode]->nentries++; /* this was missing */
+ g_xrdp_fs.inode_table[fip->inode]->nentries++;
xfuse_update_xrdpfs_size();
+
+ xfuse_dump_fs();
}
/**
@@ -1388,27 +1464,18 @@ void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus)
{
- log_debug(">>>>>> vp=%p IoStatus=0x%x", vp, IoStatus);
+ XFUSE_INFO *fip;
+ struct dir_info *di;
- if (vp == NULL)
- return;
-
- XRDP_INODE *xinode;
- XRDP_INODE *ti;
- struct dirbuf1 b;
- int i;
- int first_time = 1;
-
- XFUSE_INFO *fip = (XFUSE_INFO *) vp;
+ log_debug("vp=%p IoStatus=0x%x", vp, IoStatus);
+ fip = (XFUSE_INFO *) vp;
if (fip == NULL)
{
log_debug("fip is NULL");
- goto done;
+ return;
}
- log_debug("fip->req=%p", fip->req);
-
if (IoStatus != 0)
{
/* command failed */
@@ -1425,168 +1492,22 @@ void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus)
fuse_reply_err(fip->req, EBADF);
goto done;
}
-#if 0
- memset(&b, 0, sizeof(struct dirbuf));
-#else
- b.bytes_in_buf = 0;
-#endif
- for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; i++)
- {
- if ((xinode = g_xrdp_fs.inode_table[i]) == NULL)
- continue;
- /* match parent inode */
- if (xinode->parent_inode != fip->inode)
- continue;
+ xfuse_delete_stale_entries(fip->inode);
- xinode->is_synced = 1;
+ /* this will be used by xfuse_cb_readdir() */
+ di = calloc(1, sizeof(struct dir_info));
+ di->index = FIRST_INODE;
+ fip->fi->fh = (long) di;
- if (first_time)
- {
- first_time = 0;
- ti = g_xrdp_fs.inode_table[fip->inode];
-#if 0
- xfuse_dirbuf_add(fip->req, &b, ".", fip->inode);
- xfuse_dirbuf_add(fip->req, &b, "..", ti->parent_inode);
-#else
- xfuse_dirbuf_add1(fip->req, &b, ".", fip->inode);
- xfuse_dirbuf_add1(fip->req, &b, "..", ti->parent_inode);
-#endif
- }
-#if 0
- xfuse_dirbuf_add(fip->req, &b, xinode->name, xinode->inode);
-#else
- xfuse_dirbuf_add1(fip->req, &b, xinode->name, xinode->inode);
-#endif
- }
-
- if ((first_time == 0) && (fip->invoke_fuse))
- {
- if (fip->off < b.bytes_in_buf)
- {
-#if 0
- fuse_reply_buf(fip->req, b.p + fip->off,
- min(b.size - fip->off, fip->size));
-#else
- log_debug("calling fuse_reply_buf() with data...");
- fuse_reply_buf(fip->req, b.buf, b.bytes_in_buf);
- log_debug("calling fuse_reply_buf() with data...done");
-#endif
- }
- else
- {
- log_debug("calling fuse_reply_buf() with NULL...");
- fuse_reply_buf(fip->req, NULL, 0);
- log_debug("calling fuse_reply_buf() with NULL...done");
- }
- }
- else
- {
- log_debug("calling fuse_reply_err()...");
- fuse_reply_err(fip->req, ENOENT);
- log_debug("calling fuse_reply_err()...done");
- }
+ fuse_reply_open(fip->req, fip->fi);
done:
-#if 0
- if (b.p)
- free(b.p);
-#endif
-
- if (!fip)
- printf("###### %s : %s : %d: fip is NULL\n", __FILE__, __func__, __LINE__);
-
if (fip)
free(fip);
}
-void xfuse_devredir_cb_enum_dir_done_TODO(void *vp, tui32 IoStatus)
-{
- struct xrdp_inode *xinode;
- struct fuse_entry_param e;
- int i;
-
- XFUSE_INFO *fip = (XFUSE_INFO *) vp;
-
- printf("--------- xfuse_devredir_cb_enum_dir_done() entered\n");
-
- xfuse_dump_fs();
-
- if (fip == NULL)
- {
- log_debug("fip is NULL");
- goto done;
- }
-
- if (IoStatus != 0)
- {
- /* command failed */
- if (fip->invoke_fuse)
- fuse_reply_err(fip->req, ENOENT);
- goto done;
- }
-
- /* do we have a valid inode? */
- if (!xfuse_is_inode_valid(fip->inode))
- {
- log_error("inode %d is not valid", fip->inode);
- if (fip->invoke_fuse)
- fuse_reply_err(fip->req, EBADF);
- goto done;
- }
-
- log_debug("looking for parent_inode=%d name=%s", fip->inode, fip->name);
-
- for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; i++)
- {
- if ((xinode = g_xrdp_fs.inode_table[i]) == NULL)
- continue;
-
- /* match parent inode */
- if (xinode->parent_inode != fip->inode)
- continue;
-
- /* match name */
- if (strcmp(xinode->name, fip->name) != 0)
- continue;
-
- memset(&e, 0, sizeof(e));
- e.ino = xinode->inode;
- e.attr_timeout = XFUSE_ATTR_TIMEOUT;
- e.entry_timeout = XFUSE_ENTRY_TIMEOUT;
- e.attr.st_ino = xinode->inode;
- e.attr.st_mode = xinode->mode;
- e.attr.st_nlink = xinode->nlink;
- e.attr.st_uid = xinode->uid;
- e.attr.st_gid = xinode->gid;
- e.attr.st_size = xinode->size;
- e.attr.st_atime = xinode->atime;
- e.attr.st_mtime = xinode->mtime;
- e.attr.st_ctime = xinode->ctime;
- e.generation = 1;
-
- xinode->is_synced = 1;
-
- if (fip->invoke_fuse)
- fuse_reply_entry(fip->req, &e);
-
- break;
- }
-
- if (i == g_xrdp_fs.num_entries)
- {
- /* requested entry not found */
- log_debug("did NOT find entry");
- if (fip->invoke_fuse)
- fuse_reply_err(fip->req, ENOENT);
- }
-
-done:
-
- free(fip);
-}
-
void xfuse_devredir_cb_open_file(void *vp, tui32 IoStatus, tui32 DeviceId,
tui32 FileId)
{
@@ -1652,7 +1573,7 @@ void xfuse_devredir_cb_open_file(void *vp, tui32 IoStatus, tui32 DeviceId,
{
if (fip->reply_type == RT_FUSE_REPLY_OPEN)
{
- log_debug("LK_TODO sending fuse_reply_open(); "
+ log_debug("sending fuse_reply_open(); "
"DeviceId=%d FileId=%d req=%p fi=%p",
fh->DeviceId, fh->FileId, fip->req, fip->fi);
@@ -1984,7 +1905,7 @@ static void xfuse_cb_getattr(fuse_req_t req, fuse_ino_t ino,
xino = g_xrdp_fs.inode_table[ino];
memset(&stbuf, 0, sizeof(stbuf));
- stbuf.st_ino = ino;
+ stbuf.st_ino = ino;
stbuf.st_mode = xino->mode;
stbuf.st_nlink = xino->nlink;
stbuf.st_size = xino->size;
@@ -2049,14 +1970,17 @@ static int xfuse_dirbuf_add1(fuse_req_t req, struct dirbuf1 *b,
static void xfuse_cb_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
off_t off, struct fuse_file_info *fi)
{
- XRDP_INODE *xinode;
- XFUSE_INFO *fip;
- tui32 device_id;
- char full_path[4096];
- char *cptr;
+ XRDP_INODE *xinode;
+ XRDP_INODE *ti;
+ struct dir_info *di;
+ struct dirbuf1 b;
+ int i;
+ int first_time;
- log_debug("req=%p inode=%d size=%d offset=%d", req, ino, size, off);
+ log_debug("req=%p inode=%d name=%s size=%d offset=%d", req, ino,
+ g_xrdp_fs.inode_table[ino]->name, size, off);
+ /* do we have a valid inode? */
if (!xfuse_is_inode_valid(ino))
{
log_error("inode %d is not valid", ino);
@@ -2064,80 +1988,44 @@ static void xfuse_cb_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
return;
}
- if (ino == 1)
+ di = (struct dir_info *) fi->fh;
+ if (di == NULL)
{
- /* special case; enumerate top level dir */
- log_debug("enumerating top level dir");
- xfuse_enum_dir(req, ino, size, off, fi);
+ /* something seriously wrong somewhere! */
+ fuse_reply_buf(req, 0, 0);
return;
}
- xinode = g_xrdp_fs.inode_table[ino];
- if (xinode->is_loc_resource)
- {
- /* enumerate local resources */
- xfuse_enum_dir(req, ino, size, off, fi);
- return;
- }
-
- /* enumerate resources on a remote device */
-
-#ifdef USE_SYNC_FLAG
- if (xinode->is_synced)
- {
- xfuse_enum_dir(req, ino, size, off, fi);
- return;
- }
- else
- {
- goto do_remote_lookup;
- }
-#endif
-
-do_remote_lookup:
-
- log_debug("did not find entry; redirecting call to dev_redir");
- device_id = xfuse_get_device_id_for_inode((tui32) ino, full_path);
- log_debug("dev_id=%d ino=%d full_path=%s", device_id, ino, full_path);
+ b.bytes_in_buf = 0;
+ first_time = (di->index == FIRST_INODE) ? 1 : 0;
- if ((fip = calloc(1, sizeof(XFUSE_INFO))) == NULL)
+ for (i = di->index; i < g_xrdp_fs.num_entries; i++, di->index++)
{
- log_error("system out of memory");
- fuse_reply_err(req, ENOMEM);
- return;
- }
-
- fip->req = req;
- fip->inode = ino;
- fip->size = size;
- fip->off = off;
- fip->fi = fi;
- fip->dirbuf1.first_time = 1;
- fip->dirbuf1.bytes_in_buf = 0;
+ if ((xinode = g_xrdp_fs.inode_table[i]) == NULL)
+ continue;
- fip->invoke_fuse = 1;
- fip->device_id = device_id;
+ /* match parent inode */
+ if (xinode->parent_inode != ino)
+ continue;
- log_debug("fip->req=%p", fip->req);
+ xinode->is_synced = 1;
- /* we want path minus 'root node of the share' */
- if ((cptr = strchr(full_path, '/')) == NULL)
- {
- /* enumerate root dir */
- if (dev_redir_get_dir_listing((void *) fip, device_id, "\\"))
+ if (first_time)
{
- log_error("failed to send dev_redir_get_dir_listing() cmd");
- fuse_reply_buf(req, NULL, 0);
+ first_time = 0;
+ ti = g_xrdp_fs.inode_table[ino];
+ xfuse_dirbuf_add1(req, &b, ".", ino);
+ xfuse_dirbuf_add1(req, &b, "..", ti->parent_inode);
}
+
+ if (xfuse_dirbuf_add1(req, &b, xinode->name, xinode->inode))
+ break; /* buffer is full */
}
+
+ if (b.bytes_in_buf)
+ fuse_reply_buf(req, b.buf, b.bytes_in_buf);
else
- {
- if (dev_redir_get_dir_listing((void *) fip, device_id, cptr))
- {
- log_error("failed to send dev_redir_get_dir_listing() cmd");
- fuse_reply_buf(req, NULL, 0);
- }
- }
+ fuse_reply_buf(req, NULL, 0);
}
/**
@@ -2681,7 +2569,7 @@ static void xfuse_cb_release(fuse_req_t req, fuse_ino_t ino, struct
FileId = handle->FileId;
free(handle);
- fip->fi->fh = NULL;
+ fip->fi->fh = 0;
xinode->close_in_progress = 1;
if (devredir_file_close((void *) fip, fip->device_id, handle->FileId))
@@ -2925,4 +2813,185 @@ static void xfuse_cb_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
fuse_reply_attr(req, &st, 1.0); /* LK_TODO just faking for now */
}
+static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
+ struct fuse_file_info *fi)
+{
+ struct dir_info *di;
+ XRDP_INODE *xinode;
+ XFUSE_INFO *fip;
+ tui32 device_id;
+ char full_path[4096];
+ char *cptr;
+
+ log_debug("inode=%d name=%s", ino, g_xrdp_fs.inode_table[ino]->name);
+
+ if (!xfuse_is_inode_valid(ino))
+ {
+ log_error("inode %d is not valid", ino);
+ fuse_reply_err(req, EBADF);
+ return;
+ }
+
+ if (ino == 1)
+ goto done; /* special case; enumerate top level dir */
+
+ xinode = g_xrdp_fs.inode_table[ino];
+
+ if (xinode->is_loc_resource)
+ goto done;
+
+ /* enumerate resources on a remote device */
+
+#ifdef USE_SYNC_FLAG
+ if (xinode->is_synced)
+ {
+ xfuse_enum_dir(req, ino, size, off, fi);
+ return;
+ }
+ else
+ {
+ goto do_remote_lookup;
+ }
+#endif
+
+do_remote_lookup:
+
+ xfuse_mark_as_stale((int) ino);
+
+ log_debug("did not find entry; redirecting call to dev_redir");
+ device_id = xfuse_get_device_id_for_inode((tui32) ino, full_path);
+
+ log_debug("dev_id=%d ino=%d full_path=%s", device_id, ino, full_path);
+
+ if ((fip = calloc(1, sizeof(XFUSE_INFO))) == NULL)
+ {
+ log_error("system out of memory");
+ fuse_reply_err(req, ENOMEM);
+ return;
+ }
+
+ fip->req = req;
+ fip->inode = ino;
+ fip->size = 0;
+ fip->off = 0;
+ fip->fi = fi;
+ fip->dirbuf1.first_time = 1;
+ fip->dirbuf1.bytes_in_buf = 0;
+
+ fip->invoke_fuse = 1;
+ fip->device_id = device_id;
+
+ /* we want path minus 'root node of the share' */
+ if ((cptr = strchr(full_path, '/')) == NULL)
+ {
+ /* enumerate root dir */
+ if (dev_redir_get_dir_listing((void *) fip, device_id, "\\"))
+ {
+ log_error("failed to send dev_redir_get_dir_listing() cmd");
+ fuse_reply_buf(req, NULL, 0);
+ }
+ }
+ else
+ {
+ if (dev_redir_get_dir_listing((void *) fip, device_id, cptr))
+ {
+ log_error("failed to send dev_redir_get_dir_listing() cmd");
+ fuse_reply_buf(req, NULL, 0);
+ }
+ }
+
+ return;
+
+done:
+
+ di = calloc(1, sizeof(struct dir_info));
+ di->index = FIRST_INODE;
+ fi->fh = (long) di;
+ fuse_reply_open(req, fi);
+}
+
+/**
+ *****************************************************************************/
+
+static void xfuse_cb_releasedir(fuse_req_t req, fuse_ino_t ino,
+ struct fuse_file_info *fi)
+{
+ struct dir_info *di;
+
+ di = (struct dir_info *) (tintptr) fi->fh;
+ if (di)
+ free(di);
+
+ fuse_reply_err(req, 0);
+}
+
+/******************************************************************************
+ * miscellaneous functions
+ *****************************************************************************/
+
+/**
+ * Mark all files with matching parent inode as stale
+ *
+ * @param pinode the parent inode
+ *****************************************************************************/
+
+static void
+xfuse_mark_as_stale(int pinode)
+{
+ int i;
+ XRDP_INODE *xinode;
+
+ if ((pinode < FIRST_INODE) || (pinode >= g_xrdp_fs.num_entries))
+ return;
+
+ for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; i++)
+ {
+ if ((xinode = g_xrdp_fs.inode_table[i]) == NULL)
+ continue;
+
+ /* match parent inode */
+ if (xinode->parent_inode != pinode)
+ continue;
+
+ /* got a match */
+ xinode->stale = 1;
+ }
+}
+
+/**
+ * Delete all files with matching parent inode that are marked as stale
+ *
+ * @param pinode the parent inode
+ *****************************************************************************/
+
+static void
+xfuse_delete_stale_entries(int pinode)
+{
+ int i;
+ XRDP_INODE *xinode;
+
+ if ((pinode < FIRST_INODE) || (pinode >= g_xrdp_fs.num_entries))
+ return;
+
+ for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; i++)
+ {
+ if ((xinode = g_xrdp_fs.inode_table[i]) == NULL)
+ continue;
+
+ /* match parent inode */
+ if (xinode->parent_inode != pinode)
+ continue;
+
+ /* got a match, but is it stale? */
+ if (!xinode->stale)
+ continue;
+
+ /* ok to delete */
+ if (xinode->mode & S_IFREG)
+ xfuse_delete_file_with_xinode(xinode);
+ else
+ xfuse_recursive_delete_dir_with_xinode(xinode);
+ }
+}
+
#endif /* end else #ifndef XRDP_FUSE */
diff --git a/sesman/chansrv/chansrv_fuse.h b/sesman/chansrv/chansrv_fuse.h
index 364c1d94..09011452 100644
--- a/sesman/chansrv/chansrv_fuse.h
+++ b/sesman/chansrv/chansrv_fuse.h
@@ -41,6 +41,7 @@ struct xrdp_inode
int lindex; /* used in clipboard operations */
int is_loc_resource; /* this is not a redirected resource */
int close_in_progress; /* close cmd sent to client */
+ int stale; /* mark file as stale, ok to remove */
};
typedef struct xrdp_inode XRDP_INODE; // LK_TODO use this instead of using struct xrdp_inode
diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c
index 3aac8dbc..c2062605 100644
--- a/sesman/chansrv/clipboard.c
+++ b/sesman/chansrv/clipboard.c
@@ -172,17 +172,45 @@ x-special/gnome-copied-files
#include "xcommon.h"
#include "chansrv_fuse.h"
-#define LLOG_LEVEL 11
-#define LLOGLN(_level, _args) \
- do \
- { \
- if (_level < LLOG_LEVEL) \
- { \
- g_write("chansrv:clip [%10.10u]: ", g_time3()); \
- g_writeln _args ; \
- } \
- } \
- while (0)
+/* module based logging */
+#define LOG_ERROR 0
+#define LOG_INFO 1
+#define LOG_DEBUG 2
+#define LOG_LEVEL LOG_ERROR
+
+#define log_error(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ERROR: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_always(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ALWAYS: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_info(_params...) \
+{ \
+ if (LOG_INFO <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
+
+#define log_debug(_params...) \
+{ \
+ if (LOG_DEBUG <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
static char g_bmp_image_header[] =
{
@@ -302,7 +330,7 @@ clipboard_init(void)
int ver_min;
Status st;
- LOGM((LOG_LEVEL_DEBUG, "xrdp-chansrv: in clipboard_init"));
+ log_debug("xrdp-chansrv: in clipboard_init");
if (g_clip_up)
{
@@ -321,7 +349,7 @@ clipboard_init(void)
if (g_clipboard_atom == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: XInternAtom failed"));
+ log_error("clipboard_init: XInternAtom failed");
rv = 3;
}
}
@@ -330,18 +358,18 @@ clipboard_init(void)
{
if (!XFixesQueryExtension(g_display, &g_xfixes_event_base, &dummy))
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: no xfixes"));
+ log_error("clipboard_init: no xfixes");
rv = 5;
}
}
if (rv == 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: g_xfixes_event_base %d",
- g_xfixes_event_base));
+ log_debug("clipboard_init: g_xfixes_event_base %d",
+ g_xfixes_event_base);
st = XFixesQueryVersion(g_display, &ver_maj, &ver_min);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init st %d, maj %d min %d", st,
- ver_maj, ver_min));
+ log_debug("clipboard_init st %d, maj %d min %d", st,
+ ver_maj, ver_min);
g_clip_property_atom = XInternAtom(g_display, "XRDP_CLIP_PROPERTY_ATOM",
False);
g_get_time_atom = XInternAtom(g_display, "XRDP_GET_TIME_ATOM",
@@ -360,8 +388,8 @@ clipboard_init(void)
if (g_image_bmp_atom == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: g_image_bmp_atom was "
- "not allocated"));
+ log_error("clipboard_init: g_image_bmp_atom was "
+ "not allocated");
}
g_wnd = XCreateSimpleWindow(g_display, RootWindowOfScreen(g_screen),
@@ -395,13 +423,13 @@ clipboard_init(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: data out, sending "
- "CB_CLIP_CAPS (clip_msg_id = 1)"));
+ log_debug("clipboard_init: data out, sending "
+ "CB_CLIP_CAPS (clip_msg_id = 1)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: send_channel_data failed "
- "rv = %d", rv));
+ log_error("clipboard_init: send_channel_data failed "
+ "rv = %d", rv);
rv = 4;
}
}
@@ -416,13 +444,13 @@ clipboard_init(void)
out_uint32_le(s, 0); /* extra 4 bytes ? */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_init: data out, sending "
- "CB_MONITOR_READY (clip_msg_id = 1)"));
+ log_debug("clipboard_init: data out, sending "
+ "CB_MONITOR_READY (clip_msg_id = 1)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_init: send_channel_data failed "
- "rv = %d", rv));
+ log_error("clipboard_init: send_channel_data failed "
+ "rv = %d", rv);
rv = 4;
}
}
@@ -436,7 +464,7 @@ clipboard_init(void)
}
else
{
- LOGM((LOG_LEVEL_ERROR, "xrdp-chansrv: clipboard_init: error on exit"));
+ log_error("xrdp-chansrv: clipboard_init: error on exit");
}
return rv;
@@ -446,7 +474,7 @@ clipboard_init(void)
int APP_CC
clipboard_deinit(void)
{
- LLOGLN(10, ("clipboard_deinit:"));
+ log_debug("clipboard_deinit:");
if (g_wnd != 0)
{
XDestroyWindow(g_display, g_wnd);
@@ -474,8 +502,8 @@ clipboard_send_data_request(int format_id)
int size;
int rv;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_request:"));
- LLOGLN(0, ("clipboard_send_data_request: %d", format_id));
+ log_debug("clipboard_send_data_request:");
+ log_debug("clipboard_send_data_request: %d", format_id);
g_clip_c2s.in_request = 1;
make_stream(s);
init_stream(s, 8192);
@@ -486,8 +514,8 @@ clipboard_send_data_request(int format_id)
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_request: data out, sending "
- "CLIPRDR_DATA_REQUEST (clip_msg_id = 4)"));
+ log_debug("clipboard_send_data_request: data out, sending "
+ "CLIPRDR_DATA_REQUEST (clip_msg_id = 4)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -509,8 +537,8 @@ clipboard_send_format_ack(void)
out_uint32_le(s, 0); /* extra 4 bytes */
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_format_ack: data out, sending "
- "CLIPRDR_FORMAT_ACK (clip_msg_id = 3)"));
+ log_debug("clipboard_send_format_ack: data out, sending "
+ "CLIPRDR_FORMAT_ACK (clip_msg_id = 3)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -601,7 +629,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
int rv;
char *holdp;
- LLOGLN(10, ("clipboard_send_format_announce:"));
+ log_debug("clipboard_send_format_announce:");
make_stream(s);
init_stream(s, 8192);
out_uint16_le(s, CB_FORMAT_LIST); /* 2 CLIPRDR_FORMAT_ANNOUNCE */
@@ -613,7 +641,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
switch (xrdp_clip_type)
{
case XRDP_CB_FILE:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_FILE"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_FILE");
/* canned response for "file" */
out_uint32_le(s, 0x0000c0bc);
clipboard_out_unicode(s, "FileGroupDescriptorW", 21);
@@ -623,7 +651,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "DropEffect", 11);
break;
case XRDP_CB_BITMAP:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_BITMAP"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_BITMAP");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000c004);
clipboard_out_unicode(s, "Native", 7);
@@ -635,7 +663,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "", 1);
break;
case XRDP_CB_TEXT:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_TEXT"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_TEXT");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000000d);
clipboard_out_unicode(s, "", 1);
@@ -647,8 +675,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
clipboard_out_unicode(s, "", 1);
break;
default:
- LLOGLN(10, ("clipboard_send_format_announce: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_format_announce: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
break;
}
}
@@ -657,7 +685,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
switch (xrdp_clip_type)
{
case XRDP_CB_FILE:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_FILE"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_FILE");
/* canned response for "file" */
out_uint32_le(s, 0x0000c0bc);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -667,7 +695,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
case XRDP_CB_BITMAP:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_BITMAP"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_BITMAP");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000c004);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -679,7 +707,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
case XRDP_CB_TEXT:
- LLOGLN(10, ("clipboard_send_format_announce: XRDP_CB_TEXT"));
+ log_debug("clipboard_send_format_announce: XRDP_CB_TEXT");
/* canned response for "bitmap" */
out_uint32_le(s, 0x0000000d);
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
@@ -691,8 +719,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint8p(s, windows_native_format, sizeof(windows_native_format));
break;
default:
- LLOGLN(10, ("clipboard_send_format_announce: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_format_announce: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
break;
}
}
@@ -706,8 +734,8 @@ clipboard_send_format_announce(int xrdp_clip_type)
s_mark_end(s);
size = (int)(s->end - s->data);
//g_hexdump(s->data, size);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_format_announce: data out, sending "
- "CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)"));
+ log_debug("clipboard_send_format_announce: data out, sending "
+ "CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -721,8 +749,8 @@ clipboard_send_data_response_for_image(char* data, int data_size)
int size;
int rv;
- LLOGLN(10, ("clipboard_send_data_response_for_image: data_size %d",
- data_size));
+ log_debug("clipboard_send_data_response_for_image: data_size %d",
+ data_size);
make_stream(s);
init_stream(s, 64 + data_size);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -746,18 +774,18 @@ clipboard_send_data_response_for_text(char* data, int data_size)
int rv;
int num_chars;
- LLOGLN(10, ("clipboard_send_data_response_for_text: data_size %d",
- data_size));
+ log_debug("clipboard_send_data_response_for_text: data_size %d",
+ data_size);
//g_hexdump(data, data_size);
num_chars = g_mbstowcs(0, data, 0);
if (num_chars < 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_response_for_text: "
- "bad string"));
+ log_error("clipboard_send_data_response_for_text: "
+ "bad string");
num_chars = 0;
}
- LLOGLN(10, ("clipboard_send_data_response_for_text: data_size %d "
- "num_chars %d", data_size, num_chars));
+ log_debug("clipboard_send_data_response_for_text: data_size %d "
+ "num_chars %d", data_size, num_chars);
make_stream(s);
init_stream(s, 64 + num_chars * 2);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -765,16 +793,16 @@ clipboard_send_data_response_for_text(char* data, int data_size)
out_uint32_le(s, num_chars * 2 + 2); /* length */
if (clipboard_out_unicode(s, data, num_chars) != num_chars * 2)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_send_data_response_for_text: error "
- "clipboard_out_unicode didn't write right number of bytes"));
+ log_error("clipboard_send_data_response_for_text: error "
+ "clipboard_out_unicode didn't write right number of bytes");
}
out_uint16_le(s, 0); /* nil for string */
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
- LOGM((LOG_LEVEL_DEBUG, "clipboard_send_data_response_for_text: data out, "
+ log_debug("clipboard_send_data_response_for_text: data out, "
"sending CLIPRDR_DATA_RESPONSE (clip_msg_id = 5) size %d "
- "num_chars %d", size, num_chars));
+ "num_chars %d", size, num_chars);
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
return rv;
@@ -784,7 +812,7 @@ clipboard_send_data_response_for_text(char* data, int data_size)
static int APP_CC
clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
{
- LLOGLN(10, ("clipboard_send_data_response:"));
+ log_debug("clipboard_send_data_response:");
if (data != 0)
{
if (xrdp_clip_type == XRDP_CB_FILE)
@@ -801,13 +829,13 @@ clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
}
else
{
- LLOGLN(0, ("clipboard_send_data_response: unknown "
- "xrdp_clip_type %d", xrdp_clip_type));
+ log_debug("clipboard_send_data_response: unknown "
+ "xrdp_clip_type %d", xrdp_clip_type);
}
}
else
{
- LLOGLN(0, ("clipboard_send_data_response: data is nil"));
+ log_error("clipboard_send_data_response: data is nil");
}
return 0;
}
@@ -818,7 +846,7 @@ clipboard_set_selection_owner(void)
{
Window owner;
- LLOGLN(10, ("clipboard_set_selection_owner:"));
+ log_debug("clipboard_set_selection_owner:");
g_selection_time = clipboard_get_server_time();
XSetSelectionOwner(g_display, g_clipboard_atom, g_wnd, g_selection_time);
owner = XGetSelectionOwner(g_display, g_clipboard_atom);
@@ -840,8 +868,8 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
XEvent xev;
long val1[2];
- LLOGLN(10, ("clipboard_provide_selection_c2s: bytes %d",
- g_clip_c2s.total_bytes));
+ log_debug("clipboard_provide_selection_c2s: bytes %d",
+ g_clip_c2s.total_bytes);
if (g_clip_c2s.total_bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@@ -866,9 +894,9 @@ clipboard_provide_selection_c2s(XSelectionRequestEvent *req, Atom type)
g_clip_c2s.type = type;
g_clip_c2s.property = req->property;
g_clip_c2s.window = req->requestor;
- LLOGLN(10, ("clipboard_provide_selection_c2s: start INCR property %s "
+ log_debug("clipboard_provide_selection_c2s: start INCR property %s "
"type %s", XGetAtomName(g_display, req->property),
- XGetAtomName(g_display, type)));
+ XGetAtomName(g_display, type));
val1[0] = g_clip_c2s.total_bytes;
val1[1] = 0;
XChangeProperty(g_display, req->requestor, req->property,
@@ -899,7 +927,7 @@ clipboard_provide_selection(XSelectionRequestEvent *req, Atom type, int format,
bytes = FORMAT_TO_BYTES(format);
bytes *= length;
- LLOGLN(10, ("clipboard_provide_selection: bytes %d", bytes));
+ log_debug("clipboard_provide_selection: bytes %d", bytes);
if (bytes < g_incr_max_req_size)
{
XChangeProperty(g_display, req->requestor, req->property,
@@ -952,9 +980,9 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
char desc[256];
char *holdp;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_format_announce: "
- "CLIPRDR_FORMAT_ANNOUNCE"));
- LLOGLN(10, ("clipboard_process_format_announce %d", clip_msg_len));
+ log_debug("clipboard_process_format_announce: "
+ "CLIPRDR_FORMAT_ANNOUNCE");
+ log_debug("clipboard_process_format_announce %d", clip_msg_len);
clipboard_send_format_ack();
xfuse_clear_clip_dir();
@@ -984,14 +1012,14 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
desc[15] = 0;
clip_msg_len -= 32;
}
- LLOGLN(10, ("clipboard_process_format_announce: formatId 0x%8.8x "
+ log_debug("clipboard_process_format_announce: formatId 0x%8.8x "
"wszFormatName [%s] clip_msg_len %d", formatId, desc,
- clip_msg_len));
+ clip_msg_len);
g_formatIds[g_num_formatIds] = formatId;
g_num_formatIds++;
if (g_num_formatIds > 15)
{
- LLOGLN(10, ("clipboard_process_format_announce: max formats"));
+ log_debug("clipboard_process_format_announce: max formats");
}
/* format id for file copy copy seems to keep changing */
@@ -1008,8 +1036,8 @@ clipboard_process_format_announce(struct stream *s, int clip_msg_status,
{
if (clipboard_set_selection_owner() != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_process_format_announce: "
- "XSetSelectionOwner failed"));
+ log_error("clipboard_process_format_announce: "
+ "XSetSelectionOwner failed");
}
}
@@ -1023,8 +1051,8 @@ static int APP_CC
clipboard_prcoess_format_ack(struct stream *s, int clip_msg_status,
int clip_msg_len)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK"));
- LLOGLN(10, ("clipboard_prcoess_format_ack:"));
+ log_debug("clipboard_prcoess_format_ack: CLIPRDR_FORMAT_ACK");
+ log_debug("clipboard_prcoess_format_ack:");
return 0;
}
@@ -1036,7 +1064,7 @@ clipboard_send_data_response_failed(void)
int size;
int rv;
- LLOGLN(10, ("clipboard_send_data_response_failed:"));
+ log_error("clipboard_send_data_response_failed:");
make_stream(s);
init_stream(s, 64);
out_uint16_le(s, CB_FORMAT_DATA_RESPONSE); /* 5 CLIPRDR_DATA_RESPONSE */
@@ -1059,24 +1087,24 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
{
int requestedFormatId;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_request: "
- "CLIPRDR_DATA_REQUEST"));
- LLOGLN(10, ("clipboard_process_data_request:"));
- LLOGLN(10, (" %d", g_clip_s2c.xrdp_clip_type));
+ log_debug("clipboard_process_data_request: "
+ "CLIPRDR_DATA_REQUEST");
+ log_debug("clipboard_process_data_request:");
+ log_debug(" %d", g_clip_s2c.xrdp_clip_type);
in_uint32_le(s, requestedFormatId);
switch (requestedFormatId)
{
case CB_FORMAT_FILE: /* 0xC0BC */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_FILE) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_FILE");
clipboard_send_data_response(XRDP_CB_FILE, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE, "
- "calling XConvertSelection to g_utf8_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_FILE, "
+ "calling XConvertSelection to g_utf8_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_FILE;
XConvertSelection(g_display, g_clipboard_atom, g_clip_s2c.type,
g_clip_property_atom, g_wnd, CurrentTime);
@@ -1085,14 +1113,14 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
case CB_FORMAT_DIB: /* 0x0008 */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_BITMAP) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_DIB");
clipboard_send_data_response(XRDP_CB_BITMAP, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB, "
- "calling XConvertSelection to g_image_bmp_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_DIB, "
+ "calling XConvertSelection to g_image_bmp_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_BITMAP;
XConvertSelection(g_display, g_clipboard_atom, g_image_bmp_atom,
g_clip_property_atom, g_wnd, CurrentTime);
@@ -1101,22 +1129,22 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
case CB_FORMAT_UNICODETEXT: /* 0x000D */
if ((g_clip_s2c.xrdp_clip_type == XRDP_CB_TEXT) && g_clip_s2c.converted)
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_UNICODETEXT");
clipboard_send_data_response(XRDP_CB_TEXT, g_clip_s2c.data,
g_clip_s2c.total_bytes);
}
else
{
- LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
- "calling XConvertSelection to g_utf8_atom"));
+ log_debug("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
+ "calling XConvertSelection to g_utf8_atom");
g_clip_s2c.xrdp_clip_type = XRDP_CB_TEXT;
XConvertSelection(g_display, g_clipboard_atom, g_utf8_atom,
g_clip_property_atom, g_wnd, CurrentTime);
}
break;
default:
- LLOGLN(10, ("clipboard_process_data_request: unknown type %d",
- requestedFormatId));
+ log_debug("clipboard_process_data_request: unknown type %d",
+ requestedFormatId);
clipboard_send_data_response_failed();
break;
}
@@ -1137,8 +1165,8 @@ clipboard_process_data_response_for_image(struct stream *s,
XSelectionRequestEvent *lxev;
int len;
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_response_for_image: "
- "CLIPRDR_DATA_RESPONSE_FOR_IMAGE"));
+ log_debug("clipboard_process_data_response_for_image: "
+ "CLIPRDR_DATA_RESPONSE_FOR_IMAGE");
lxev = &g_saved_selection_req_event;
len = (int)(s->end - s->p);
if (len < 1)
@@ -1160,8 +1188,8 @@ clipboard_process_data_response_for_image(struct stream *s,
g_clip_c2s.read_bytes_done = g_clip_c2s.total_bytes;
g_memcpy(g_clip_c2s.data, g_bmp_image_header, 14);
in_uint8a(s, g_clip_c2s.data + 14, len);
- LLOGLN(10, ("clipboard_process_data_response_for_image: calling "
- "clipboard_provide_selection_c2s"));
+ log_debug("clipboard_process_data_response_for_image: calling "
+ "clipboard_provide_selection_c2s");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -1183,7 +1211,7 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
int len;
int index;
- LLOGLN(10, ("clipboard_process_data_response:"));
+ log_debug("clipboard_process_data_response:");
lxev = &g_saved_selection_req_event;
g_clip_c2s.in_request = 0;
if (g_clip_c2s.xrdp_clip_type == XRDP_CB_BITMAP)
@@ -1209,15 +1237,15 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
}
else
{
- LLOGLN(0, ("clipboard_process_data_response: error"));
+ log_error("clipboard_process_data_response: error");
}
g_clip_c2s.total_bytes = g_strlen(g_clip_c2s.data);
g_clip_c2s.read_bytes_done = g_clip_c2s.total_bytes;
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
- LOGM((LOG_LEVEL_DEBUG, "clipboard_process_data_response: "
- "CLIPRDR_DATA_RESPONSE"));
+ log_debug("clipboard_process_data_response: "
+ "CLIPRDR_DATA_RESPONSE");
len = (int)(s->end - s->p);
if (len < 1)
{
@@ -1277,7 +1305,7 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
int flags;
char *holdp;
- LLOGLN(10, ("clipboard_process_clip_caps:"));
+ log_debug("clipboard_process_clip_caps:");
//g_hexdump(s->p, s->end - s->p);
in_uint16_le(s, cCapabilitiesSets);
in_uint8s(s, 2); /* pad */
@@ -1291,11 +1319,11 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
case CB_CAPSTYPE_GENERAL:
in_uint32_le(s, version); /* version */
in_uint32_le(s, flags); /* generalFlags */
- LLOGLN(0, ("clipboard_process_clip_caps: "
+ log_debug("clipboard_process_clip_caps: "
"g_cliprdr_version %d version %d "
"g_cliprdr_flags 0x%x flags 0x%x",
g_cliprdr_version, version,
- g_cliprdr_flags, flags));
+ g_cliprdr_flags, flags);
if (version < g_cliprdr_version)
{
g_cliprdr_version = version;
@@ -1303,8 +1331,8 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
g_cliprdr_flags &= flags;
break;
default:
- LLOGLN(0, ("clipboard_process_clip_caps: unknown "
- "capabilitySetType %d", capabilitySetType));
+ log_debug("clipboard_process_clip_caps: unknown "
+ "capabilitySetType %d", capabilitySetType);
break;
}
s->p = holdp + lengthCapability;
@@ -1319,10 +1347,10 @@ ss_part(char *data, int data_bytes)
int index;
char *text;
- LLOGLN(10, ("ss_part: data_bytes %d read_bytes_done %d "
+ log_debug("ss_part: data_bytes %d read_bytes_done %d "
"incr_bytes_done %d", data_bytes,
g_clip_c2s.read_bytes_done,
- g_clip_c2s.incr_bytes_done));
+ g_clip_c2s.incr_bytes_done);
/* copy to buffer */
if (g_clip_c2s.type == g_utf8_atom)
{
@@ -1347,12 +1375,12 @@ ss_part(char *data, int data_bytes)
}
if (g_clip_c2s.incr_in_progress)
{
- LLOGLN(10, ("ss_part: incr_in_progress set"));
+ log_debug("ss_part: incr_in_progress set");
return 0;
}
if (g_clip_c2s.read_bytes_done <= g_clip_c2s.incr_bytes_done)
{
- LLOGLN(10, ("ss_part: read_bytes_done < incr_bytes_done"));
+ log_debug("ss_part: read_bytes_done < incr_bytes_done");
return 0;
}
data = g_clip_c2s.data + g_clip_c2s.incr_bytes_done;
@@ -1376,18 +1404,18 @@ ss_end(void)
char *data;
int data_bytes;
- LLOGLN(10, ("ss_end:"));
+ log_debug("ss_end:");
g_clip_c2s.doing_response_ss = 0;
g_clip_c2s.in_request = 0;
if (g_clip_c2s.incr_in_progress)
{
- LLOGLN(10, ("ss_end: incr_in_progress set"));
+ log_debug("ss_end: incr_in_progress set");
return 0;
}
if (g_clip_c2s.read_bytes_done <= g_clip_c2s.incr_bytes_done)
{
- LLOGLN(10, ("ss_end: read_bytes_done < incr_bytes_done"));
+ log_debug("ss_end: read_bytes_done < incr_bytes_done");
return 0;
}
data = g_clip_c2s.data + g_clip_c2s.incr_bytes_done;
@@ -1413,8 +1441,8 @@ ss_start(char *data, int data_bytes, int total_bytes)
long val1[2];
int incr_bytes;
- LLOGLN(10, ("ss_start: data_bytes %d total_bytes %d",
- data_bytes, total_bytes));
+ log_debug("ss_start: data_bytes %d total_bytes %d",
+ data_bytes, total_bytes);
req = &g_saved_selection_req_event;
incr_bytes = total_bytes;
@@ -1481,24 +1509,24 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
if (!g_clip_up)
{
- LOG(10, ("aborting clipboard_data_in - clipboard has not "
- "been initialized"));
+ log_error("aborting clipboard_data_in - clipboard has not "
+ "been initialized");
/* we return 0 here to indicate no protocol problem occured */
return 0;
}
- LLOGLN(10, ("clipboard_data_in: chan_id %d "
+ log_debug("clipboard_data_in: chan_id %d "
"chan_flags 0x%x length %d total_length %d "
"in_request %d g_ins->size %d",
chan_id, chan_flags, length, total_length,
- g_clip_c2s.in_request, g_ins->size));
+ g_clip_c2s.in_request, g_ins->size);
if (g_clip_c2s.doing_response_ss)
{
ss_part(s->p, length);
if ((chan_flags & 3) == 2)
{
- LLOGLN(10, ("clipboard_data_in: calling ss_end"));
+ log_debug("clipboard_data_in: calling ss_end");
ss_end();
}
return 0;
@@ -1550,12 +1578,12 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
in_uint16_le(ls, clip_msg_status);
in_uint32_le(ls, clip_msg_len);
- LOG(10, ("clipboard_data_in: clip_msg_id %d "
+ log_debug("clipboard_data_in: clip_msg_id %d "
"clip_msg_status %d clip_msg_len %d",
- clip_msg_id, clip_msg_status, clip_msg_len));
+ clip_msg_id, clip_msg_status, clip_msg_len);
rv = 0;
- LLOGLN(0, ("clipboard_data_in: %d", clip_msg_id));
+ log_debug("clipboard_data_in: %d", clip_msg_id);
switch (clip_msg_id)
{
/* sent by client or server when its local system clipboard is */
@@ -1599,9 +1627,9 @@ clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length,
clip_msg_len);
break;
default:
- LLOGLN(0, ("clipboard_data_in: unknown clip_msg_id %d", clip_msg_id));
- LOGM((LOG_LEVEL_ERROR, "clipboard_data_in: unknown clip_msg_id %d",
- clip_msg_id));
+ log_debug("clipboard_data_in: unknown clip_msg_id %d", clip_msg_id);
+ log_error("clipboard_data_in: unknown clip_msg_id %d",
+ clip_msg_id);
break;
}
@@ -1631,16 +1659,16 @@ clipboard_event_selection_owner_notify(XEvent *xevent)
XFixesSelectionNotifyEvent *lxevent;
lxevent = (XFixesSelectionNotifyEvent *)xevent;
- LLOGLN(10, ("clipboard_event_selection_owner_notify: %p", lxevent->owner));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: "
+ log_debug("clipboard_event_selection_owner_notify: %p", lxevent->owner);
+ log_debug("clipboard_event_selection_owner_notify: "
"window %d subtype %d owner %d g_wnd %d",
- lxevent->window, lxevent->subtype, lxevent->owner, g_wnd));
+ lxevent->window, lxevent->subtype, lxevent->owner, g_wnd);
if (lxevent->owner == g_wnd)
{
- LLOGLN(10, ("clipboard_event_selection_owner_notify: matches g_wnd"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_owner_notify: skipping, "
- "onwer == g_wnd"));
+ log_debug("clipboard_event_selection_owner_notify: matches g_wnd");
+ log_debug("clipboard_event_selection_owner_notify: skipping, "
+ "onwer == g_wnd");
g_got_selection = 1;
return 0;
}
@@ -1668,8 +1696,8 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt,
tui8 *lxdata;
Atom ltype;
- LLOGLN(10, ("clipboard_get_window_property:"));
- LLOGLN(10, (" prop %d name %s", prop, XGetAtomName(g_display, prop)));
+ log_debug("clipboard_get_window_property:");
+ log_debug(" prop %d name %s", prop, XGetAtomName(g_display, prop));
lxdata = 0;
ltype = 0;
XGetWindowProperty(g_display, wnd, prop, 0, 0, 0,
@@ -1784,8 +1812,7 @@ clipboard_event_selection_notify(XEvent *xevent)
Atom *atoms;
Atom type;
- LLOGLN(10, ("clipboard_event_selection_notify:"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify:"));
+ log_debug("clipboard_event_selection_notify:");
data_size = 0;
n_items = 0;
fmt = 0;
@@ -1801,23 +1828,23 @@ clipboard_event_selection_notify(XEvent *xevent)
if (lxevent->property == None)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: clip could "
- "not be converted"));
+ log_error("clipboard_event_selection_notify: clip could "
+ "not be converted");
rv = 1;
}
if (rv == 0)
{
- LLOGLN(10, ("clipboard_event_selection_notify: wnd %p prop %s",
+ log_debug("clipboard_event_selection_notify: wnd %p prop %s",
lxevent->requestor,
- XGetAtomName(g_display, lxevent->property)));
+ XGetAtomName(g_display, lxevent->property));
rv = clipboard_get_window_property(lxevent->requestor, lxevent->property,
&type, &fmt,
&n_items, &data, &data_size);
if (rv != 0)
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "clipboard_get_window_property failed error %d", rv));
+ log_error("clipboard_event_selection_notify: "
+ "clipboard_get_window_property failed error %d", rv);
return 0;
}
//g_hexdump(data, data_size);
@@ -1826,10 +1853,10 @@ clipboard_event_selection_notify(XEvent *xevent)
{
/* nothing more to do here, the data is comming in through
PropertyNotify */
- LLOGLN(10, ("clipboard_event_selection_notify: type is INCR "
+ log_debug("clipboard_event_selection_notify: type is INCR "
"data_size %d property name %s type %s", data_size,
XGetAtomName(g_display, lxevent->property),
- XGetAtomName(g_display, lxevent->type)));
+ XGetAtomName(g_display, lxevent->type));
g_clip_s2c.incr_in_progress = 1;
g_clip_s2c.property = lxevent->property;
g_clip_s2c.type = lxevent->target;
@@ -1855,10 +1882,10 @@ clipboard_event_selection_notify(XEvent *xevent)
for (index = 0; index < n_items; index++)
{
atom = atoms[index];
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d",
- atom, XGetAtomName(g_display, atom), XA_STRING));
- LLOGLN(10, ("clipboard_event_selection_notify: 0x%x %s",
- atom, XGetAtomName(g_display, atom)));
+ log_debug("clipboard_event_selection_notify: %d %s %d",
+ atom, XGetAtomName(g_display, atom), XA_STRING);
+ log_debug("clipboard_event_selection_notify: 0x%x %s",
+ atom, XGetAtomName(g_display, atom));
if (atom == g_utf8_atom)
{
got_utf8 = 1;
@@ -1873,28 +1900,28 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if ((atom == g_file_atom1) || (atom == g_file_atom2))
{
- LLOGLN(10, ("clipboard_event_selection_notify: file"));
+ log_debug("clipboard_event_selection_notify: file");
got_file_atom = atom;
}
else
{
- LLOGLN(10, ("clipboard_event_selection_notify: unknown atom 0x%x", atom));
+ log_error("clipboard_event_selection_notify: unknown atom 0x%x", atom);
}
}
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: error, "
+ log_error("clipboard_event_selection_notify: error, "
"target is 'TARGETS' and type[%d] or fmt[%d] not right, "
- "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32));
+ "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32);
}
}
else if (lxevent->target == g_utf8_atom)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: UTF8_STRING "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: UTF8_STRING "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: UTF8_STRING "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: UTF8_STRING "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1916,10 +1943,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == XA_STRING)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: XA_STRING "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: XA_STRING "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: XA_STRING "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: XA_STRING "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1933,10 +1960,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_image_bmp_atom)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: image/bmp "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: image/bmp "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: image/bmp "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: image/bmp "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 14))
{
g_free(g_clip_s2c.data);
@@ -1949,10 +1976,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_file_atom1)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1966,10 +1993,10 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else if (lxevent->target == g_file_atom2)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
- LLOGLN(10, ("clipboard_event_selection_notify: text/uri-list "
- "data_size %d", data_size));
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
+ log_debug("clipboard_event_selection_notify: text/uri-list "
+ "data_size %d", data_size);
if ((g_clip_s2c.incr_in_progress == 0) && (data_size > 0))
{
g_free(g_clip_s2c.data);
@@ -1983,14 +2010,14 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "unknown target"));
+ log_error("clipboard_event_selection_notify: "
+ "unknown target");
}
}
else
{
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_notify: "
- "unknown selection"));
+ log_error("clipboard_event_selection_notify: "
+ "unknown selection");
}
}
@@ -2074,26 +2101,26 @@ clipboard_event_selection_request(XEvent *xevent)
char *xdata;
lxev = (XSelectionRequestEvent *)xevent;
- LLOGLN(10, ("clipboard_event_selection_request: %p", lxev->property));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_wnd %d, "
+ log_debug("clipboard_event_selection_request: %p", lxev->property);
+ log_debug("clipboard_event_selection_request: g_wnd %d, "
".requestor %d .owner %d .selection %d '%s' .target %d .property %d",
g_wnd, lxev->requestor, lxev->owner, lxev->selection,
XGetAtomName(g_display, lxev->selection),
- lxev->target, lxev->property));
+ lxev->target, lxev->property);
if (lxev->property == None)
{
- LLOGLN(10, ("clipboard_event_selection_request: lxev->property "
- "is None"));
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "lxev->property is None"));
+ log_debug("clipboard_event_selection_request: lxev->property "
+ "is None");
+ log_debug("clipboard_event_selection_request: "
+ "lxev->property is None");
}
else if (lxev->target == g_targets_atom)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_targets_atom"));
+ log_debug("clipboard_event_selection_request: g_targets_atom");
/* requestor is asking what the selection can be converted to */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_targets_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_targets_atom");
atom_buf[0] = g_targets_atom;
atom_buf[1] = g_timestamp_atom;
atom_buf[2] = g_multiple_atom;
@@ -2102,29 +2129,29 @@ clipboard_event_selection_request(XEvent *xevent)
atom_count = 5;
if (clipboard_find_format_id(CB_FORMAT_DIB) >= 0)
{
- LLOGLN(10, (" reporting image/bmp"));
+ log_debug(" reporting image/bmp");
atom_buf[atom_count] = g_image_bmp_atom;
atom_count++;
}
if (clipboard_find_format_id(g_file_format_id) >= 0)
{
- LLOGLN(10, (" reporting text/uri-list"));
+ log_debug(" reporting text/uri-list");
atom_buf[atom_count] = g_file_atom1;
atom_count++;
- LLOGLN(10, (" reporting x-special/gnome-copied-files"));
+ log_debug(" reporting x-special/gnome-copied-files");
atom_buf[atom_count] = g_file_atom2;
atom_count++;
}
atom_buf[atom_count] = 0;
- LLOGLN(10, (" reporting %d formats", atom_count));
+ log_debug(" reporting %d formats", atom_count);
return clipboard_provide_selection(lxev, XA_ATOM, 32,
(char *)atom_buf, atom_count);
}
else if (lxev->target == g_timestamp_atom)
{
/* requestor is asking the time I got the selection */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_timestamp_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_timestamp_atom");
atom_buf[0] = g_selection_time;
atom_buf[1] = 0;
return clipboard_provide_selection(lxev, XA_INTEGER, 32,
@@ -2133,8 +2160,8 @@ clipboard_event_selection_request(XEvent *xevent)
else if (lxev->target == g_multiple_atom)
{
/* target, property pairs */
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: "
- "g_multiple_atom"));
+ log_debug("clipboard_event_selection_request: "
+ "g_multiple_atom");
xdata = 0;
if (clipboard_get_window_property(xev.xselection.requestor,
@@ -2142,8 +2169,8 @@ clipboard_event_selection_request(XEvent *xevent)
&type, &fmt, &n_items, &xdata,
&xdata_size) == 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_request: g_multiple_atom "
- "n_items %d", n_items));
+ log_debug("clipboard_event_selection_request: g_multiple_atom "
+ "n_items %d", n_items);
/* todo */
g_free(xdata);
}
@@ -2159,10 +2186,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_image_bmp_atom)
{
- LLOGLN(10, ("clipboard_event_selection_request: image/bmp"));
+ log_debug("clipboard_event_selection_request: image/bmp");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2175,10 +2202,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_file_atom1)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_file_atom1"));
+ log_debug("clipboard_event_selection_request: g_file_atom1");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2191,10 +2218,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else if (lxev->target == g_file_atom2)
{
- LLOGLN(10, ("clipboard_event_selection_request: g_file_atom2"));
+ log_debug("clipboard_event_selection_request: g_file_atom2");
if ((g_clip_c2s.type == lxev->target) && g_clip_c2s.converted)
{
- LLOGLN(10, ("clipboard_event_selection_request: -------------------------------------------"));
+ log_debug("clipboard_event_selection_request: -------------------------------------------");
clipboard_provide_selection_c2s(lxev, lxev->target);
return 0;
}
@@ -2207,10 +2234,10 @@ clipboard_event_selection_request(XEvent *xevent)
}
else
{
- LLOGLN(10, ("clipboard_event_selection_request: unknown "
- "target %s", XGetAtomName(g_display, lxev->target)));
- LOGM((LOG_LEVEL_ERROR, "clipboard_event_selection_request: unknown "
- "target %s", XGetAtomName(g_display, lxev->target)));
+ log_debug("clipboard_event_selection_request: unknown "
+ "target %s", XGetAtomName(g_display, lxev->target));
+ log_error("clipboard_event_selection_request: unknown "
+ "target %s", XGetAtomName(g_display, lxev->target));
}
clipboard_refuse_selection(lxev);
@@ -2232,7 +2259,7 @@ clipboard_event_selection_request(XEvent *xevent)
static int APP_CC
clipboard_event_selection_clear(XEvent *xevent)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_clear:"));
+ log_debug("clipboard_event_selection_clear:");
return 0;
}
@@ -2262,24 +2289,24 @@ clipboard_event_property_notify(XEvent *xevent)
int data_bytes;
char *cptr;
- LLOGLN(10, ("clipboard_event_property_notify:"));
- LLOGLN(10, ("clipboard_event_property_notify: PropertyNotify .window %d "
+ log_debug("clipboard_event_property_notify:");
+ log_debug("clipboard_event_property_notify: PropertyNotify .window %d "
".state %d .atom %d %s", xevent->xproperty.window,
xevent->xproperty.state, xevent->xproperty.atom,
- XGetAtomName(g_display, xevent->xproperty.atom)));
+ XGetAtomName(g_display, xevent->xproperty.atom));
if (g_clip_c2s.incr_in_progress &&
(xevent->xproperty.window == g_clip_c2s.window) &&
(xevent->xproperty.atom == g_clip_c2s.property) &&
(xevent->xproperty.state == PropertyDelete))
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyDelete"));
+ log_debug("clipboard_event_property_notify: INCR PropertyDelete");
/* this is used for when copying a large clipboard to the other app,
it will delete the property so we know to send the next one */
if ((g_clip_c2s.data == 0) || (g_clip_c2s.total_bytes < 1))
{
- LLOGLN(0, ("clipboard_event_property_notify: INCR error"));
+ log_debug("clipboard_event_property_notify: INCR error");
return 0;
}
data = (tui8 *)(g_clip_c2s.data + g_clip_c2s.incr_bytes_done);
@@ -2295,13 +2322,13 @@ clipboard_event_property_notify(XEvent *xevent)
data_bytes = g_incr_max_req_size;
}
g_clip_c2s.incr_bytes_done += data_bytes;
- LLOGLN(10, ("clipboard_event_property_notify: data_bytes %d", data_bytes));
+ log_debug("clipboard_event_property_notify: data_bytes %d", data_bytes);
XChangeProperty(xevent->xproperty.display, xevent->xproperty.window,
xevent->xproperty.atom, g_clip_c2s.type, 8,
PropModeReplace, data, data_bytes);
if (data_bytes < 1)
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR done"));
+ log_debug("clipboard_event_property_notify: INCR done");
g_clip_c2s.incr_in_progress = 0;
/* we no longer need property notify */
XSelectInput(xevent->xproperty.display, xevent->xproperty.window,
@@ -2314,7 +2341,7 @@ clipboard_event_property_notify(XEvent *xevent)
(xevent->xproperty.atom == g_clip_s2c.property) &&
(xevent->xproperty.state == PropertyNewValue))
{
- LLOGLN(10, ("clipboard_event_property_notify: INCR PropertyNewValue"));
+ log_debug("clipboard_event_property_notify: INCR PropertyNewValue");
rv = XGetWindowProperty(g_display, g_wnd, g_clip_s2c.property, 0, 0, 0,
AnyPropertyType, &actual_type_return, &actual_format_return,
&nitems_returned, &bytes_left, &data);
@@ -2327,7 +2354,7 @@ clipboard_event_property_notify(XEvent *xevent)
if (bytes_left <= 0)
{
- LOGM((LOG_LEVEL_DEBUG, "clipboard_event_property_notify: INCR done"));
+ log_debug("clipboard_event_property_notify: INCR done");
/* clipboard INCR cycle has completed */
g_clip_s2c.incr_in_progress = 0;
if (g_clip_s2c.type == g_image_bmp_atom)
@@ -2349,8 +2376,8 @@ clipboard_event_property_notify(XEvent *xevent)
}
else
{
- LLOGLN(0, ("clipboard_event_property_notify: error unknown type %d",
- g_clip_s2c.type));
+ log_error("clipboard_event_property_notify: error unknown type %d",
+ g_clip_s2c.type);
clipboard_send_data_response_failed();
}
@@ -2382,7 +2409,7 @@ clipboard_event_property_notify(XEvent *xevent)
return 0;
}
- LLOGLN(10, ("clipboard_event_property_notify: new_data_len %d", new_data_len));
+ log_debug("clipboard_event_property_notify: new_data_len %d", new_data_len);
g_clip_s2c.data = cptr;
g_memcpy(g_clip_s2c.data + g_clip_s2c.total_bytes, data, new_data_len);
g_clip_s2c.total_bytes += new_data_len;
@@ -2430,30 +2457,30 @@ clipboard_xevent(void *xevent)
clipboard_event_property_notify(lxevent);
break;
case UnmapNotify:
- LOG(0, ("chansrv::clipboard_xevent: got UnmapNotify"));
+ log_debug("chansrv::clipboard_xevent: got UnmapNotify");
break;
case ClientMessage:
- LOG(0, ("chansrv::clipboard_xevent: got ClientMessage"));
+ log_debug("chansrv::clipboard_xevent: got ClientMessage");
break;
default:
if (lxevent->type == g_xfixes_event_base +
XFixesSetSelectionOwnerNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSetSelectionOwnerNotify"));
+ log_debug("clipboard_xevent: got XFixesSetSelectionOwnerNotify");
clipboard_event_selection_owner_notify(lxevent);
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionWindowDestroyNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSelectionWindowDestroyNotify"));
+ log_debug("clipboard_xevent: got XFixesSelectionWindowDestroyNotify");
break;
}
if (lxevent->type == g_xfixes_event_base +
XFixesSelectionClientCloseNotify)
{
- LLOGLN(10, ("clipboard_xevent: got XFixesSelectionClientCloseNotify"));
+ log_debug("clipboard_xevent: got XFixesSelectionClientCloseNotify");
break;
}
diff --git a/sesman/chansrv/clipboard.h b/sesman/chansrv/clipboard.h
index 74919170..449899ba 100644
--- a/sesman/chansrv/clipboard.h
+++ b/sesman/chansrv/clipboard.h
@@ -1,8 +1,8 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
- * Copyright (C) Jay Sorg 2009-2012
- * Copyright (C) Laxmikant Rashinkar 2012
+ * Copyright (C) Jay Sorg 2009-2013
+ * Copyright (C) Laxmikant Rashinkar 2012-2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,14 +23,9 @@
#include "arch.h"
#include "parse.h"
-int APP_CC
-clipboard_init(void);
-int APP_CC
-clipboard_deinit(void);
-int APP_CC
-clipboard_data_in(struct stream* s, int chan_id, int chan_flags, int length,
- int total_length);
-int APP_CC
-clipboard_xevent(void* xevent);
+int APP_CC clipboard_init(void);
+int APP_CC clipboard_deinit(void);
+int APP_CC clipboard_data_in(struct stream *s, int chan_id, int chan_flags, int length, int total_length);
+int APP_CC clipboard_xevent(void *xevent);
#endif
diff --git a/sesman/chansrv/clipboard_common.h b/sesman/chansrv/clipboard_common.h
index b1d5d723..5a74de66 100644
--- a/sesman/chansrv/clipboard_common.h
+++ b/sesman/chansrv/clipboard_common.h
@@ -1,7 +1,7 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
- * Copyright (C) Jay Sorg 2012
+ * Copyright (C) Jay Sorg 2012-2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -127,9 +127,7 @@ struct clip_file_desc /* CLIPRDR_FILEDESCRIPTOR */
char cFileName[256];
};
-int APP_CC
-clipboard_out_unicode(struct stream *s, char *text, int num_chars);
-int APP_CC
-clipboard_in_unicode(struct stream *s, char *text, int *num_chars);
+int APP_CC clipboard_out_unicode(struct stream *s, char *text, int num_chars);
+int APP_CC clipboard_in_unicode(struct stream *s, char *text, int *num_chars);
#endif
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 42b5d4a3..96f1b0e8 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -36,17 +36,45 @@
#include "xcommon.h"
#include "chansrv_fuse.h"
-#define LLOG_LEVEL 1
-#define LLOGLN(_level, _args) \
- do \
- { \
- if (_level < LLOG_LEVEL) \
- { \
- g_write("chansrv:clip [%10.10u]: ", g_time3()); \
- g_writeln _args ; \
- } \
- } \
- while (0)
+/* module based logging */
+#define LOG_ERROR 0
+#define LOG_INFO 1
+#define LOG_DEBUG 2
+#define LOG_LVL LOG_ERROR
+
+#define log_error(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPFILE %s: %d : ERROR: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_always(_params...) \
+{ \
+ g_write("[%10.10u]: CLIPFILE %s: %d : ALWAYS: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_info(_params...) \
+{ \
+ if (LOG_INFO <= LOG_LVL) \
+ { \
+ g_write("[%10.10u]: CLIPFILE %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
+
+#define log_debug(_params...) \
+{ \
+ if (LOG_DEBUG <= LOG_LVL) \
+ { \
+ g_write("[%10.10u]: CLIPFILE %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
extern int g_cliprdr_chan_id; /* in chansrv.c */
@@ -117,7 +145,7 @@ clipboard_check_file(char *filename)
index++;
}
}
- LLOGLN(10, ("[%s] [%s]", filename, lfilename));
+ log_debug("[%s] [%s]", filename, lfilename);
g_strcpy(filename, lfilename);
return 0;
}
@@ -173,15 +201,15 @@ clipboard_get_file(char* file, int bytes)
g_snprintf(full_fn, 255, "%s/%s", pathname, filename);
if (g_directory_exist(full_fn))
{
- LLOGLN(0, ("clipboard_get_file: file [%s] is a directory, "
- "not supported", full_fn));
+ log_error("clipboard_get_file: file [%s] is a directory, "
+ "not supported", full_fn);
flags |= CB_FILE_ATTRIBUTE_DIRECTORY;
return 1;
}
if (!g_file_exist(full_fn))
{
- LLOGLN(0, ("clipboard_get_file: file [%s] does not exist",
- full_fn));
+ log_error("clipboard_get_file: file [%s] does not exist",
+ full_fn);
return 1;
}
else
@@ -193,8 +221,8 @@ clipboard_get_file(char* file, int bytes)
cfi->size = g_file_get_size(full_fn);
cfi->flags = flags;
cfi->time = (g_time1() + CB_EPOCH_DIFF) * 10000000LL;
- LLOGLN(10, ("ok filename [%s] pathname [%s] size [%d]",
- cfi->filename, cfi->pathname, cfi->size));
+ log_debug("ok filename [%s] pathname [%s] size [%d]",
+ cfi->filename, cfi->pathname, cfi->size);
}
return 0;
}
@@ -256,8 +284,8 @@ clipboard_send_data_response_for_file(char *data, int data_size)
char fn[256];
struct cb_file_info *cfi;
- LLOGLN(10, ("clipboard_send_data_response_for_file: data_size %d",
- data_size));
+ log_debug("clipboard_send_data_response_for_file: data_size %d",
+ data_size);
//g_hexdump(data, data_size);
if (g_files_list == 0)
{
@@ -319,18 +347,18 @@ clipboard_send_file_size(int streamId, int lindex)
if (g_files_list == 0)
{
- LLOGLN(10, ("clipboard_send_file_size: error g_files_list is nil"));
+ log_error("clipboard_send_file_size: error g_files_list is nil");
return 1;
}
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
if (cfi == 0)
{
- LLOGLN(10, ("clipboard_send_file_size: error cfi is nil"));
+ log_error("clipboard_send_file_size: error cfi is nil");
return 1;
}
file_size = cfi->size;
- LLOGLN(10, ("clipboard_send_file_size: streamId %d file_size %d",
- streamId, file_size));
+ log_debug("clipboard_send_file_size: streamId %d file_size %d",
+ streamId, file_size);
make_stream(s);
init_stream(s, 8192);
out_uint16_le(s, CB_FILECONTENTS_RESPONSE); /* 9 */
@@ -356,11 +384,11 @@ clipboard_request_file_size(int stream_id, int lindex)
int size;
int rv;
- LLOGLN(10, ("clipboard_request_file_size:"));
+ log_debug("clipboard_request_file_size:");
if (g_file_request_sent_type != 0)
{
- LLOGLN(0, ("clipboard_request_file_size: warning, still waiting "
- "for CB_FILECONTENTS_RESPONSE"));
+ log_error("clipboard_request_file_size: warning, still waiting "
+ "for CB_FILECONTENTS_RESPONSE");
}
make_stream(s);
init_stream(s, 8192);
@@ -398,24 +426,24 @@ clipboard_send_file_data(int streamId, int lindex,
if (g_files_list == 0)
{
- LLOGLN(10, ("clipboard_send_file_data: error g_files_list is nil"));
+ log_error("clipboard_send_file_data: error g_files_list is nil");
return 1;
}
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
if (cfi == 0)
{
- LLOGLN(10, ("clipboard_send_file_data: error cfi is nil"));
+ log_error("clipboard_send_file_data: error cfi is nil");
return 1;
}
- LLOGLN(10, ("clipboard_send_file_data: streamId %d lindex %d "
+ log_debug("clipboard_send_file_data: streamId %d lindex %d "
"nPositionLow %d cbRequested %d", streamId, lindex,
- nPositionLow, cbRequested));
+ nPositionLow, cbRequested);
g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
if (fd == -1)
{
- LLOGLN(0, ("clipboard_send_file_data: file open [%s] failed",
- full_fn));
+ log_error("clipboard_send_file_data: file open [%s] failed",
+ full_fn);
return 1;
}
g_file_seek(fd, nPositionLow);
@@ -424,8 +452,8 @@ clipboard_send_file_data(int streamId, int lindex,
size = g_file_read(fd, s->data + 12, cbRequested);
if (size < 1)
{
- LLOGLN(0, ("clipboard_send_file_data: read error, want %d got %d",
- cbRequested, size));
+ log_error("clipboard_send_file_data: read error, want %d got %d",
+ cbRequested, size);
free_stream(s);
g_file_close(fd);
return 1;
@@ -454,13 +482,13 @@ clipboard_request_file_data(int stream_id, int lindex, int offset,
int size;
int rv;
- LLOGLN(10, ("clipboard_request_file_data: stream_id=%d lindex=%d off=%d request_bytes=%d",
- stream_id, lindex, offset, request_bytes));
+ log_debug("clipboard_request_file_data: stream_id=%d lindex=%d off=%d request_bytes=%d",
+ stream_id, lindex, offset, request_bytes);
if (g_file_request_sent_type != 0)
{
- LLOGLN(0, ("clipboard_request_file_data: warning, still waiting "
- "for CB_FILECONTENTS_RESPONSE"));
+ log_error("clipboard_request_file_data: warning, still waiting "
+ "for CB_FILECONTENTS_RESPONSE");
}
make_stream(s);
init_stream(s, 8192);
@@ -498,7 +526,7 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status,
int cbRequested;
//int clipDataId;
- LLOGLN(10, ("clipboard_process_file_request:"));
+ log_debug("clipboard_process_file_request:");
//g_hexdump(s->p, clip_msg_len);
in_uint32_le(s, streamId);
in_uint32_le(s, lindex);
@@ -528,14 +556,14 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
int streamId;
int file_size;
- LLOGLN(10, ("clipboard_process_file_response:"));
+ log_debug("clipboard_process_file_response:");
if (g_file_request_sent_type == CB_FILECONTENTS_SIZE)
{
g_file_request_sent_type = 0;
in_uint32_le(s, streamId);
in_uint32_le(s, file_size);
- LLOGLN(10, ("clipboard_process_file_response: streamId %d "
- "file_size %d", streamId, file_size));
+ log_debug("clipboard_process_file_response: streamId %d "
+ "file_size %d", streamId, file_size);
xfuse_file_contents_size(streamId, file_size);
}
else if (g_file_request_sent_type == CB_FILECONTENTS_RANGE)
@@ -546,7 +574,7 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
}
else
{
- LLOGLN(0, ("clipboard_process_file_response: error"));
+ log_error("clipboard_process_file_response: error");
g_file_request_sent_type = 0;
}
return 0;
@@ -574,14 +602,14 @@ clipboard_c2s_in_file_info(struct stream *s, struct clip_file_desc *cfd)
ex_bytes -= 2;
in_uint8s(s, ex_bytes);
in_uint8s(s, 8); /* pad */
- LLOGLN(10, ("clipboard_c2s_in_file_info:"));
- LLOGLN(10, (" flags 0x%8.8x", cfd->flags));
- LLOGLN(10, (" fileAttributes 0x%8.8x", cfd->fileAttributes));
- LLOGLN(10, (" lastWriteTime 0x%8.8x%8.8x", cfd->lastWriteTimeHigh,
- cfd->lastWriteTimeLow));
- LLOGLN(10, (" fileSize 0x%8.8x%8.8x", cfd->fileSizeHigh,
- cfd->fileSizeLow));
- LLOGLN(10, (" num_chars %d cFileName [%s]", num_chars, cfd->cFileName));
+ log_debug("clipboard_c2s_in_file_info:");
+ log_debug(" flags 0x%8.8x", cfd->flags);
+ log_debug(" fileAttributes 0x%8.8x", cfd->fileAttributes);
+ log_debug(" lastWriteTime 0x%8.8x%8.8x", cfd->lastWriteTimeHigh,
+ cfd->lastWriteTimeLow);
+ log_debug(" fileSize 0x%8.8x%8.8x", cfd->fileSizeHigh,
+ cfd->fileSizeLow);
+ log_debug(" num_chars %d cFileName [%s]", num_chars, cfd->cFileName);
return 0;
}
@@ -597,17 +625,17 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
if (!s_check_rem(s, 4))
{
- LLOGLN(0, ("clipboard_c2s_in_files: parse error"));
+ log_error("clipboard_c2s_in_files: parse error");
return 1;
}
in_uint32_le(s, cItems);
if (cItems > 64 * 1024) /* sanity check */
{
- LLOGLN(0, ("clipboard_c2s_in_files: error cItems %d too big", cItems));
+ log_error("clipboard_c2s_in_files: error cItems %d too big", cItems);
return 1;
}
xfuse_clear_clip_dir();
- LLOGLN(10, ("clipboard_c2s_in_files: cItems %d", cItems));
+ log_debug("clipboard_c2s_in_files: cItems %d", cItems);
cfd = (struct clip_file_desc *)
g_malloc(sizeof(struct clip_file_desc), 0);
ptr = file_list;
@@ -618,8 +646,8 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
if ((g_pos(cfd->cFileName, "\\") >= 0) ||
(cfd->fileAttributes & CB_FILE_ATTRIBUTE_DIRECTORY))
{
- LLOGLN(0, ("clipboard_c2s_in_files: skipping directory not "
- "supported [%s]", cfd->cFileName));
+ log_error("clipboard_c2s_in_files: skipping directory not "
+ "supported [%s]", cfd->cFileName);
continue;
}
xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
diff --git a/sesman/chansrv/devredir.c b/sesman/chansrv/devredir.c
index 8de28e43..418c29e7 100644
--- a/sesman/chansrv/devredir.c
+++ b/sesman/chansrv/devredir.c
@@ -120,13 +120,15 @@ dev_redir_init(void)
/* get a random number that will act as a unique clientID */
if ((fd = open("/dev/urandom", O_RDONLY)))
{
- read(fd, u.buf, 4);
+ if (read(fd, u.buf, 4) != 4)
+ {
+ }
close(fd);
}
else
{
/* /dev/urandom did not work - use address of struct s */
- tui64 u64 = (tui64) &s;
+ tui64 u64 = (tui64) (tintptr) &s;
u.clientID = (tui32) u64;
}
@@ -152,6 +154,7 @@ dev_redir_init(void)
int APP_CC
dev_redir_deinit(void)
{
+ scard_deinit();
return 0;
}
@@ -282,6 +285,10 @@ done:
int APP_CC
dev_redir_get_wait_objs(tbus *objs, int *count, int *timeout)
{
+ if (g_is_smartcard_redir_supported)
+ {
+ return scard_get_wait_objs(objs, count, timeout);
+ }
return 0;
}
@@ -289,6 +296,10 @@ dev_redir_get_wait_objs(tbus *objs, int *count, int *timeout)
int APP_CC
dev_redir_check_wait_objs(void)
{
+ if (g_is_smartcard_redir_supported)
+ {
+ return scard_check_wait_objs();
+ }
return 0;
}
@@ -515,7 +526,9 @@ void dev_redir_send_drive_dir_request(IRP *irp, tui32 device_id,
if (InitialQuery)
{
if (Path == NULL)
+ {
return;
+ }
/* Path in unicode needs this much space */
path_len = ((g_mbstowcs(NULL, Path, 0) * sizeof(twchar)) / 2) + 2;
@@ -617,6 +630,7 @@ void dev_redir_proc_client_core_cap_resp(struct stream *s)
case CAP_SMARTCARD_TYPE:
log_debug("got CAP_SMARTCARD_TYPE");
g_is_smartcard_redir_supported = 1;
+ scard_init();
xstream_seek(s, cap_len);
break;
}
@@ -704,7 +718,8 @@ void devredir_proc_client_devlist_announce_req(struct stream *s)
}
}
-void dev_redir_proc_device_iocompletion(struct stream *s)
+void APP_CC
+dev_redir_proc_device_iocompletion(struct stream *s)
{
FUSE_DATA *fuse_data = NULL;
IRP *irp = NULL;
@@ -859,11 +874,12 @@ done:
log_debug("exiting");
}
-void dev_redir_proc_query_dir_response(IRP *irp,
- struct stream *s_in,
- tui32 DeviceId,
- tui32 CompletionId,
- tui32 IoStatus)
+void APP_CC
+dev_redir_proc_query_dir_response(IRP *irp,
+ struct stream *s_in,
+ tui32 DeviceId,
+ tui32 CompletionId,
+ tui32 IoStatus)
{
FUSE_DATA *fuse_data = NULL;
XRDP_INODE *xinode = NULL;
@@ -984,11 +1000,12 @@ void dev_redir_proc_query_dir_response(IRP *irp,
* @return 0 on success, -1 on failure
*****************************************************************************/
-int dev_redir_get_dir_listing(void *fusep, tui32 device_id, char *path)
+int APP_CC
+dev_redir_get_dir_listing(void *fusep, tui32 device_id, char *path)
{
tui32 DesiredAccess;
tui32 CreateOptions;
- tui32 CreateDisposition;
+ tui32 CreateDisposition;
int rval;
IRP *irp;
@@ -1028,8 +1045,9 @@ int dev_redir_get_dir_listing(void *fusep, tui32 device_id, char *path)
return rval;
}
-int dev_redir_file_open(void *fusep, tui32 device_id, char *path,
- int mode, int type, char *gen_buf)
+int APP_CC
+dev_redir_file_open(void *fusep, tui32 device_id, char *path,
+ int mode, int type, char *gen_buf)
{
tui32 DesiredAccess;
tui32 CreateOptions;
@@ -1140,7 +1158,8 @@ int devredir_file_close(void *fusep, tui32 device_id, tui32 FileId)
* Remove (delete) a directory or file
*****************************************************************************/
-int devredir_rmdir_or_file(void *fusep, tui32 device_id, char *path, int mode)
+int APP_CC
+devredir_rmdir_or_file(void *fusep, tui32 device_id, char *path, int mode)
{
tui32 DesiredAccess;
tui32 CreateOptions;
@@ -1181,8 +1200,9 @@ int devredir_rmdir_or_file(void *fusep, tui32 device_id, char *path, int mode)
* @return 0 on success, -1 on failure
*****************************************************************************/
-int devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
- tui32 Length, tui64 Offset)
+int APP_CC
+devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
+ tui32 Length, tui64 Offset)
{
struct stream *s;
IRP *irp;
@@ -1229,8 +1249,9 @@ int devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
return 0;
}
-int dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
- const char *buf, tui32 Length, tui64 Offset)
+int APP_CC
+dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
+ const char *buf, tui32 Length, tui64 Offset)
{
struct stream *s;
IRP *irp;
@@ -1293,7 +1314,8 @@ int dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
* @return FUSE_DATA on success, or NULL on failure
*****************************************************************************/
-void *devredir_fuse_data_peek(IRP *irp)
+void * APP_CC
+devredir_fuse_data_peek(IRP *irp)
{
log_debug("returning %p", irp->fd_head);
return irp->fd_head;
@@ -1305,7 +1327,8 @@ void *devredir_fuse_data_peek(IRP *irp)
* @return FUSE_DATA on success, NULL on failure
*****************************************************************************/
-void *devredir_fuse_data_dequeue(IRP *irp)
+void * APP_CC
+devredir_fuse_data_dequeue(IRP *irp)
{
FUSE_DATA *head;
@@ -1340,7 +1363,8 @@ void *devredir_fuse_data_dequeue(IRP *irp)
* @return 0 on success, -1 on failure
*****************************************************************************/
-int devredir_fuse_data_enqueue(IRP *irp, void *vp)
+int APP_CC
+devredir_fuse_data_enqueue(IRP *irp, void *vp)
{
FUSE_DATA *fd;
FUSE_DATA *tail;
@@ -1377,12 +1401,13 @@ int devredir_fuse_data_enqueue(IRP *irp, void *vp)
** miscellaneous stuff **
******************************************************************************/
-void devredir_insert_DeviceIoRequest(struct stream *s,
- tui32 DeviceId,
- tui32 FileId,
- tui32 CompletionId,
- tui32 MajorFunction,
- tui32 MinorFunction)
+void APP_CC
+devredir_insert_DeviceIoRequest(struct stream *s,
+ tui32 DeviceId,
+ tui32 FileId,
+ tui32 CompletionId,
+ tui32 MajorFunction,
+ tui32 MinorFunction)
{
/* setup DR_DEVICE_IOREQUEST header */
xstream_wr_u16_le(s, RDPDR_CTYP_CORE);
@@ -1398,7 +1423,8 @@ void devredir_insert_DeviceIoRequest(struct stream *s,
* Convert / to windows compatible \
*****************************************************************************/
-void devredir_cvt_slash(char *path)
+void APP_CC
+devredir_cvt_slash(char *path)
{
char *cptr = path;
@@ -1410,7 +1436,8 @@ void devredir_cvt_slash(char *path)
}
}
-void devredir_cvt_to_unicode(char *unicode, char *path)
+void APP_CC
+devredir_cvt_to_unicode(char *unicode, char *path)
{
char *dest;
char *src;
@@ -1435,7 +1462,8 @@ void devredir_cvt_to_unicode(char *unicode, char *path)
*dest++ = 0;
}
-void devredir_cvt_from_unicode_len(char *path, char *unicode, int len)
+void APP_CC
+devredir_cvt_from_unicode_len(char *path, char *unicode, int len)
{
char *dest;
char *dest_saved;
@@ -1472,7 +1500,8 @@ void devredir_cvt_from_unicode_len(char *path, char *unicode, int len)
g_free(dest_saved);
}
-int dev_redir_string_ends_with(char *string, char c)
+int APP_CC
+dev_redir_string_ends_with(char *string, char c)
{
int len;
@@ -1480,14 +1509,16 @@ int dev_redir_string_ends_with(char *string, char c)
return (string[len - 1] == c) ? 1 : 0;
}
-void devredir_insert_RDPDR_header(struct stream *s, tui16 Component,
- tui16 PacketId)
+void APP_CC
+devredir_insert_RDPDR_header(struct stream *s, tui16 Component,
+ tui16 PacketId)
{
xstream_wr_u16_le(s, Component);
xstream_wr_u16_le(s, PacketId);
}
-void devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
+void APP_CC
+devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
{
struct stream *s;
int bytes;
@@ -1523,7 +1554,8 @@ void devredir_proc_cid_rmdir_or_file(IRP *irp, tui32 IoStatus)
return;
}
-void devredir_proc_cid_rmdir_or_file_resp(IRP *irp, tui32 IoStatus)
+void APP_CC
+devredir_proc_cid_rmdir_or_file_resp(IRP *irp, tui32 IoStatus)
{
FUSE_DATA *fuse_data;
@@ -1549,7 +1581,8 @@ void devredir_proc_cid_rmdir_or_file_resp(IRP *irp, tui32 IoStatus)
IRP_MJ_CLOSE, 0, 32);
}
-void devredir_proc_cid_rename_file(IRP *irp, tui32 IoStatus)
+void APP_CC
+devredir_proc_cid_rename_file(IRP *irp, tui32 IoStatus)
{
struct stream *s;
int bytes;
@@ -1601,7 +1634,8 @@ void devredir_proc_cid_rename_file(IRP *irp, tui32 IoStatus)
return;
}
-void devredir_proc_cid_rename_file_resp(IRP *irp, tui32 IoStatus)
+void APP_CC
+devredir_proc_cid_rename_file_resp(IRP *irp, tui32 IoStatus)
{
FUSE_DATA *fuse_data;
diff --git a/sesman/chansrv/drdynvc.c b/sesman/chansrv/drdynvc.c
index af86ea57..eaad17cc 100644
--- a/sesman/chansrv/drdynvc.c
+++ b/sesman/chansrv/drdynvc.c
@@ -22,12 +22,9 @@ int g_drdynvc_chan_id;
int g_drdynvc_inited = 0;
static int APP_CC drdynvc_send_capability_request(uint16_t version);
-static int APP_CC drdynvc_process_capability_response(struct stream* s,
- unsigned char cmd);
-static int APP_CC drdynvc_process_open_channel_response(struct stream *s,
- unsigned char cmd);
-static int APP_CC drdynvc_process_close_channel_response(struct stream *s,
- unsigned char cmd);
+static int APP_CC drdynvc_process_capability_response(struct stream* s, unsigned char cmd);
+static int APP_CC drdynvc_process_open_channel_response(struct stream *s, unsigned char cmd);
+static int APP_CC drdynvc_process_close_channel_response(struct stream *s, unsigned char cmd);
static int APP_CC drdynvc_process_data_first(struct stream* s, unsigned char cmd);
static int APP_CC drdynvc_process_data(struct stream* s, unsigned char cmd);
static int APP_CC drdynvc_insert_uint_124(struct stream *s, uint32_t val);
diff --git a/sesman/chansrv/irp.h b/sesman/chansrv/irp.h
index 64cbac93..e1a65d83 100644
--- a/sesman/chansrv/irp.h
+++ b/sesman/chansrv/irp.h
@@ -54,12 +54,12 @@ struct irp
tui32 CompletionId, tui32 IoStatus);
};
-IRP * devredir_irp_new();
-IRP * devredir_irp_clone(IRP *irp);
-int devredir_irp_delete(IRP *irp);
-IRP * devredir_irp_find(tui32 completion_id);
-IRP * devredir_irp_find_by_fileid(tui32 FileId);
-IRP * devredir_irp_get_last();
-void devredir_irp_dump();
+IRP * APP_CC devredir_irp_new(void);
+IRP * APP_CC devredir_irp_clone(IRP *irp);
+int APP_CC devredir_irp_delete(IRP *irp);
+IRP * APP_CC devredir_irp_find(tui32 completion_id);
+IRP * APP_CC devredir_irp_find_by_fileid(tui32 FileId);
+IRP * APP_CC devredir_irp_get_last(void);
+void APP_CC devredir_irp_dump(void);
#endif /* end ifndef __IRP_H */
diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c
index 19650be1..c370479e 100644
--- a/sesman/chansrv/smartcard.c
+++ b/sesman/chansrv/smartcard.c
@@ -26,6 +26,7 @@
#include "log.h"
#include "irp.h"
#include "devredir.h"
+#include "smartcard_pcsc.h"
/*
* TODO
@@ -147,7 +148,8 @@ static void scard_release_resources(void);
** non static functions **
******************************************************************************/
-void scard_device_announce(tui32 device_id)
+void APP_CC
+scard_device_announce(tui32 device_id)
{
IRP *irp;
@@ -187,9 +189,10 @@ void scard_device_announce(tui32 device_id)
** callbacks into this module **
******************************************************************************/
-void scard_handle_EstablishContext_Return(struct stream *s, IRP *irp,
- tui32 DeviceId, tui32 CompletionId,
- tui32 IoStatus)
+void APP_CC
+scard_handle_EstablishContext_Return(struct stream *s, IRP *irp,
+ tui32 DeviceId, tui32 CompletionId,
+ tui32 IoStatus)
{
tui32 len;
int tmp;
@@ -243,9 +246,10 @@ void scard_handle_EstablishContext_Return(struct stream *s, IRP *irp,
log_debug("leaving");
}
-void scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
- tui32 DeviceId, tui32 CompletionId,
- tui32 IoStatus)
+void APP_CC
+scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
+ tui32 DeviceId, tui32 CompletionId,
+ tui32 IoStatus)
{
tui32 len;
@@ -283,7 +287,8 @@ void scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
*
*****************************************************************************/
-static void scard_send_EstablishContext(IRP *irp)
+static void APP_CC
+scard_send_EstablishContext(IRP *irp)
{
struct stream *s;
int bytes;
@@ -311,7 +316,8 @@ static void scard_send_EstablishContext(IRP *irp)
*
*****************************************************************************/
-static void scard_send_ListReaders(IRP *irp, int wide)
+static void APP_CC
+scard_send_ListReaders(IRP *irp, int wide)
{
/* see [MS-RDPESC] 2.2.2.4 */
@@ -405,7 +411,8 @@ static void scard_send_ListReaders(IRP *irp, int wide)
* @return stream with IOCTL inserted in it, NULL on error
*****************************************************************************/
-static struct stream *scard_make_new_ioctl(IRP *irp, tui32 ioctl)
+static struct stream * APP_CC
+scard_make_new_ioctl(IRP *irp, tui32 ioctl)
{
/*
* format of device control request
@@ -462,7 +469,8 @@ static struct stream *scard_make_new_ioctl(IRP *irp, tui32 ioctl)
* @return index into smartcards[] on success, -1 on failure
*****************************************************************************/
-static int scard_add_new_device(tui32 device_id)
+static int APP_CC
+scard_add_new_device(tui32 device_id)
{
int index;
SMARTCARD *sc;
@@ -485,10 +493,12 @@ static int scard_add_new_device(tui32 device_id)
/**
* Find first unused entry in smartcards
*
- * @return index of first unused entry in smartcards or -1 if smartcards is full
+ * @return index of first unused entry in smartcards or -1 if smartcards
+ * is full
*****************************************************************************/
-static int scard_get_free_slot(void)
+static int APP_CC
+scard_get_free_slot(void)
{
int i;
@@ -509,7 +519,8 @@ static int scard_get_free_slot(void)
* Release resources prior to shutting down
*****************************************************************************/
-static void scard_release_resources(void)
+static void APP_CC
+scard_release_resources(void)
{
int i;
@@ -526,3 +537,37 @@ static void scard_release_resources(void)
/**
*
*****************************************************************************/
+int APP_CC
+scard_get_wait_objs(tbus *objs, int *count, int *timeout)
+{
+ return scard_pcsc_get_wait_objs(objs, count, timeout);
+}
+
+/**
+ *
+ *****************************************************************************/
+int APP_CC
+scard_check_wait_objs(void)
+{
+ return scard_pcsc_check_wait_objs();
+}
+
+/**
+ *
+ *****************************************************************************/
+int APP_CC
+scard_init(void)
+{
+ log_debug("init")
+ return scard_pcsc_init();
+}
+
+/**
+ *
+ *****************************************************************************/
+int APP_CC
+scard_deinit(void)
+{
+ log_debug("deinit")
+ return scard_pcsc_deinit();
+}
diff --git a/sesman/chansrv/smartcard.h b/sesman/chansrv/smartcard.h
index 88f31369..a85b9f5f 100644
--- a/sesman/chansrv/smartcard.h
+++ b/sesman/chansrv/smartcard.h
@@ -39,4 +39,13 @@ void scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
tui32 DeviceId, tui32 CompletionId,
tui32 IoStatus);
+int APP_CC
+scard_get_wait_objs(tbus *objs, int *count, int *timeout);
+int APP_CC
+scard_check_wait_objs(void);
+int APP_CC
+scard_init(void);
+int APP_CC
+scard_deinit(void);
+
#endif /* end #ifndef _SMARTCARD_C */
diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c
new file mode 100644
index 00000000..a3a269d7
--- /dev/null
+++ b/sesman/chansrv/smartcard_pcsc.c
@@ -0,0 +1,330 @@
+/**
+ * xrdp: A Remote Desktop Protocol server.
+ *
+ * Copyright (C) Jay Sorg 2013 jay.sorg@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.
+ *
+ */
+
+/*
+ * smartcard redirection support, PCSC daemon standin
+ * this will act like pcsc daemon
+ */
+
+#define PCSC_STANDIN 1
+
+#include "os_calls.h"
+#include "smartcard.h"
+#include "log.h"
+#include "irp.h"
+#include "devredir.h"
+#include "trans.h"
+
+#if PCSC_STANDIN
+
+/* module based logging */
+#define LOG_ERROR 0
+#define LOG_INFO 1
+#define LOG_DEBUG 2
+#define LOG_LEVEL LOG_ERROR
+
+#define log_error(_params...) \
+{ \
+ g_write("[%10.10u]: PCSC %s: %d : ERROR: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_always(_params...) \
+{ \
+ g_write("[%10.10u]: PCSC %s: %d : ALWAYS: ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+}
+
+#define log_info(_params...) \
+{ \
+ if (LOG_INFO <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: PCSC %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
+
+#define log_debug(_params...) \
+{ \
+ if (LOG_DEBUG <= LOG_LEVEL) \
+ { \
+ g_write("[%10.10u]: PCSC %s: %d : ", \
+ g_time3(), __func__, __LINE__); \
+ g_writeln (_params); \
+ } \
+}
+
+#define PCSCLITE_MSG_KEY_LEN 16
+#define PCSCLITE_MAX_MESSAGE_SIZE 2048
+
+struct version_struct
+{
+ tsi32 major; /**< IPC major \ref PROTOCOL_VERSION_MAJOR */
+ tsi32 minor; /**< IPC minor \ref PROTOCOL_VERSION_MINOR */
+ tui32 rv;
+};
+typedef struct version_struct version_struct;
+
+struct rxSharedSegment
+{
+ tui32 mtype; /** one of the \c pcsc_adm_commands */
+ tui32 user_id;
+ tui32 group_id;
+ tui32 command; /** one of the \c pcsc_msg_commands */
+ tui64 date;
+ tui8 key[PCSCLITE_MSG_KEY_LEN]; /* 16 bytes */
+ union _u
+ {
+ tui8 data[PCSCLITE_MAX_MESSAGE_SIZE];
+ struct version_struct veStr;
+ } u;
+};
+typedef struct rxSharedSegment sharedSegmentMsg, *psharedSegmentMsg;
+
+#define RXSHAREDSEGMENT_BYTES 2088
+
+extern int g_display_num; /* in chansrv.c */
+
+/*****************************************************************************/
+struct pcsc_client
+{
+ struct trans *con;
+};
+
+static struct pcsc_client *g_head = 0;
+static struct pcsc_client *g_tail = 0;
+
+static struct trans *g_lis = 0;
+static struct trans *g_con = 0; /* todo, remove this */
+
+static char g_pcsc_directory[256] = "";
+
+/*****************************************************************************/
+int APP_CC
+scard_pcsc_get_wait_objs(tbus *objs, int *count, int *timeout)
+{
+ log_debug("scard_pcsc_get_wait_objs");
+
+ if (g_lis != 0)
+ {
+ trans_get_wait_objs(g_lis, objs, count);
+ }
+ if (g_con != 0)
+ {
+ trans_get_wait_objs(g_con, objs, count);
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
+scard_pcsc_check_wait_objs(void)
+{
+ log_debug("scard_pcsc_check_wait_objs");
+
+ if (g_lis != 0)
+ {
+ trans_check_wait_objs(g_lis);
+ }
+ if (g_con != 0)
+ {
+ trans_check_wait_objs(g_con);
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+scard_process_version(psharedSegmentMsg msg)
+{
+ return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+scard_process_msg(struct stream *s)
+{
+ sharedSegmentMsg msg;
+ int rv;
+
+ g_memset(&msg, 0, sizeof(msg));
+ in_uint32_le(s, msg.mtype);
+ in_uint32_le(s, msg.user_id);
+ in_uint32_le(s, msg.group_id);
+ in_uint32_le(s, msg.command);
+ in_uint64_le(s, msg.date);
+
+ log_debug("scard_process_msg: mtype 0x%2.2x command 0x%2.2x",
+ msg.mtype, msg.command);
+
+ rv = 0;
+ switch (msg.mtype)
+ {
+ case 0xF8: /* CMD_VERSION */
+ rv = scard_process_version(&msg);
+ break;
+ }
+ return rv;
+}
+
+/*****************************************************************************/
+/* returns error */
+int DEFAULT_CC
+my_pcsc_trans_data_in(struct trans *trans)
+{
+ struct stream *s;
+ int id;
+ int size;
+ int error;
+
+ log_debug("my_pcsc_trans_data_in:");
+
+ if (trans == 0)
+ {
+ return 0;
+ }
+
+ if (trans != g_con)
+ {
+ return 1;
+ }
+ s = trans_get_in_s(trans);
+ g_hexdump(s->p, 64);
+ error = scard_process_msg(s);
+ return error;
+}
+
+/*****************************************************************************/
+/* got a new connection from libpcsclite */
+int DEFAULT_CC
+my_pcsc_trans_conn_in(struct trans *trans, struct trans *new_trans)
+{
+ log_debug("my_pcsc_trans_conn_in:");
+
+ if (trans == 0)
+ {
+ return 1;
+ }
+
+ if (trans != g_lis)
+ {
+ return 1;
+ }
+
+ if (new_trans == 0)
+ {
+ return 1;
+ }
+
+ g_con = new_trans;
+ g_con->trans_data_in = my_pcsc_trans_data_in;
+ g_con->header_size = RXSHAREDSEGMENT_BYTES;
+
+ log_debug("my_pcsc_trans_conn_in: sizeof sharedSegmentMsg is %d",
+ sizeof(sharedSegmentMsg));
+
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
+scard_pcsc_init(void)
+{
+ char port[256];
+ int error;
+
+ log_debug("scard_pcsc_init:");
+
+ if (g_lis == 0)
+ {
+ g_lis = trans_create(2, 8192, 8192);
+ g_snprintf(g_pcsc_directory, 255, "/tmp/.xrdp/pcsc%d", g_display_num);
+ if (g_directory_exist(g_pcsc_directory))
+ {
+ if (g_remove_dir(g_pcsc_directory) != 0)
+ {
+ log_error("scard_pcsc_init: g_remove_dir failed");
+ }
+ }
+ if (g_create_dir(g_pcsc_directory) != 0)
+ {
+ log_error("scard_pcsc_init: g_create_dir failed");
+ }
+ g_chmod_hex(g_pcsc_directory, 0x1777);
+ g_snprintf(port, 255, "%s/pcscd.comm", g_pcsc_directory);
+ g_lis->trans_conn_in = my_pcsc_trans_conn_in;
+ error = trans_listen(g_lis, port);
+ if (error != 0)
+ {
+ log_error("scard_pcsc_init: trans_listen failed for port %s",
+ port);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+int APP_CC
+scard_pcsc_deinit(void)
+{
+ log_debug("scard_pcsc_deinit:");
+
+ if (g_lis != 0)
+ {
+ trans_delete(g_lis);
+ g_lis = 0;
+ if (g_remove_dir(g_pcsc_directory) != 0)
+ {
+ log_error("scard_pcsc_deinit: g_remove_dir failed");
+ }
+ g_pcsc_directory[0] = 0;
+ }
+ return 0;
+}
+
+#else
+
+int APP_CC
+scard_pcsc_get_wait_objs(tbus *objs, int *count, int *timeout)
+{
+ return 0;
+}
+int APP_CC
+scard_pcsc_check_wait_objs(void)
+{
+ return 0;
+}
+int APP_CC
+scard_pcsc_init(void)
+{
+ return 0;
+}
+int APP_CC
+scard_pcsc_deinit(void)
+{
+ return 0;
+}
+
+#endif
diff --git a/sesman/chansrv/smartcard_pcsc.h b/sesman/chansrv/smartcard_pcsc.h
new file mode 100644
index 00000000..a97a70d3
--- /dev/null
+++ b/sesman/chansrv/smartcard_pcsc.h
@@ -0,0 +1,36 @@
+/**
+ * xrdp: A Remote Desktop Protocol server.
+ *
+ * Copyright (C) Jay Sorg 2013 jay.sorg@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.
+ *
+ */
+
+/*
+ * smartcard redirection support, PCSC daemon standin
+ */
+
+#ifndef _SMARTCARD_PCSC_H
+#define _SMARTCARD_PCSC_H
+
+int APP_CC
+scard_pcsc_get_wait_objs(tbus *objs, int *count, int *timeout);
+int APP_CC
+scard_pcsc_check_wait_objs(void);
+int APP_CC
+scard_pcsc_init(void);
+int APP_CC
+scard_pcsc_deinit(void);
+
+#endif /* end #ifndef _SMARTCARD_PCSC_H */
diff --git a/sesman/env.c b/sesman/env.c
index 72a67642..b650d0b3 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -105,6 +105,7 @@ env_set_user(char *username, char *passwd_file, int display)
g_sprintf(text, ":%d.0", display);
g_setenv("DISPLAY", text, 1);
g_setenv("LANG", "en_US.UTF-8", 1);
+ g_setenv("XRDP_SESSION", "1", 1);
if (passwd_file != 0)
{
diff --git a/xorg/X11R7.6/buildx.sh b/xorg/X11R7.6/buildx.sh
index 18bbba46..74145e36 100755
--- a/xorg/X11R7.6/buildx.sh
+++ b/xorg/X11R7.6/buildx.sh
@@ -33,113 +33,14 @@ download_file()
return 0
fi
- echo "downloading file $file"
+ echo "downloading file $download_url/$file"
cd downloads
- if [ "$file" = "libpthread-stubs-0.3.tar.bz2" ]; then
- wget -cq http://xcb.freedesktop.org/dist/$file
- status=$?
- cd ..
- return $status
- elif [ "$file" = "libxcb-1.7.tar.bz2" ]; then
- wget -cq http://xcb.freedesktop.org/dist/$file
- status=$?
- cd ..
- return $status
- elif [ "$file" = "xcb-proto-1.6.tar.bz2" ]; then
- wget -cq http://xcb.freedesktop.org/dist/$file
- status=$?
- cd ..
- return $status
-# note pixman updated
- elif [ "$file" = "pixman-0.30.0.tar.bz2" ]; then
- wget -cq http://xorg.freedesktop.org/archive/individual/lib/$file
- status=$?
- cd ..
- return $status
- elif [ "$file" = "libdrm-2.4.26.tar.bz2" ]; then
- wget -cq http://dri.freedesktop.org/libdrm/$file
- status=$?
- cd ..
- return $status
- elif [ "$file" = "MesaLib-7.10.3.tar.bz2" ]; then
- wget -cq ftp://ftp.freedesktop.org/pub/mesa/7.10.3/$file
- status=$?
- cd ..
- return $status
- elif [ "$file" = "expat-2.0.1.tar.gz" ]; then
- wget -cq http://server1.xrdp.org/xrdp/expat-2.0.1.tar.gz
-
- status=$?
- cd ..
- return $status
- elif [ "$file" = "freetype-2.4.6.tar.bz2" ]; then
- wget -cq http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
- status=$?
- cd ..
- return $status
- elif [ "$file" = "xkeyboard-config-2.0.tar.bz2" ]; then
- wget -cq http://www.x.org/releases/individual/data/xkeyboard-config/xkeyboard-config-2.0.tar.bz2
- status=$?
- cd ..
- return $status
- elif [ "$file" = "makedepend-1.0.3.tar.bz2" ]; then
- wget -cq http://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.3.tar.bz2
- status=$?
- cd ..
- return $status
- elif [ "$file" = "libxml2-sources-2.7.8.tar.gz" ]; then
- wget -cq ftp://ftp.xmlsoft.org/libxml2/libxml2-sources-2.7.8.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "Python-2.5.tar.bz2" ]; then
- wget -cq http://www.python.org/ftp/python/2.5/Python-2.5.tar.bz2
- status=$?
- cd ..
- return $status
- elif [ "$file" = "Python-2.7.tar.bz2" ]; then
- wget -cq http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
- status=$?
- cd ..
- return $status
- elif [ "$file" = "expat-2.0.1.tar.gz" ]; then
- wget -cq http://server1.xrdp.org/xrdp/expat-2.0.1.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "cairo-1.8.8.tar.gz" ]; then
- wget -cq http://server1.xrdp.org/xrdp/cairo-1.8.8.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "libpng-1.2.46.tar.gz" ]; then
- wget -cq http://server1.xrdp.org/xrdp/libpng-1.2.46.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "intltool-0.41.1.tar.gz" ]; then
- wget -cq http://launchpad.net/intltool/trunk/0.41.1/+download/intltool-0.41.1.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "libxslt-1.1.26.tar.gz" ]; then
- wget -cq ftp://xmlsoft.org/libxslt/libxslt-1.1.26.tar.gz
- status=$?
- cd ..
- return $status
- elif [ "$file" = "fontconfig-2.8.0.tar.gz" ]; then
- wget -cq http://server1.xrdp.org/xrdp/fontconfig-2.8.0.tar.gz
- status=$?
- cd ..
- return $status
- else
- wget -cq $download_url/$file
- status=$?
- cd ..
- return $status
- fi
+ wget -cq $download_url/$file
+ status=$?
+ cd ..
+ return $status
}
remove_modules()
@@ -285,7 +186,9 @@ make_it()
data_file=x11_file_list.txt
# this is the default download location for most modules
-download_url=http://www.x.org/releases/X11R7.6/src/everything
+# changed now to server1.xrdp.org
+# was www.x.org/releases/X11R7.6/src/everything
+download_url=http://server1.xrdp.org/xrdp/X11R7.6
num_modules=`cat $data_file | wc -l`
count=0
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h
index 22dcdbf7..6fd7c38a 100644
--- a/xorg/X11R7.6/rdp/rdp.h
+++ b/xorg/X11R7.6/rdp/rdp.h
@@ -258,7 +258,7 @@ struct _rdpPixmapRec
int rdpindex;
int con_number;
int is_dirty;
- int pad0;
+ int is_scratch;
int kind_width;
struct rdp_draw_item* draw_item_head;
struct rdp_draw_item* draw_item_tail;
@@ -341,7 +341,7 @@ int
draw_item_pack(PixmapPtr pix, rdpPixmapRec* priv);
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode,
- int type);
+ int type, int code);
int
draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode);
diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c
index cdece2c9..a97aaf56 100644
--- a/xorg/X11R7.6/rdp/rdpCopyArea.c
+++ b/xorg/X11R7.6/rdp/rdpCopyArea.c
@@ -375,7 +375,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
WindowPtr pDstWnd;
WindowPtr pSrcWnd;
- LLOGLN(10, ("rdpCopyArea:"));
+ LLOGLN(10, ("rdpCopyArea: x %d y %d w %d h %d", dstx, dsty, w, h));
if (pSrc->type == DRAWABLE_WINDOW)
{
@@ -416,6 +416,10 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
srcx, srcy, w, h, dstx, dsty);
}
}
+ else
+ {
+ LLOGLN(10, ("rdpCopyArea: 1"));
+ }
}
}
}
@@ -456,8 +460,16 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
dstx, dsty);
}
}
+ else
+ {
+ LLOGLN(10, ("rdpCopyArea: 4"));
+ }
}
}
+ else
+ {
+ LLOGLN(10, ("rdpCopyArea: 2"));
+ }
}
/* do original call */
@@ -493,6 +505,10 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
got_id = 1;
}
}
+ else
+ {
+ LLOGLN(10, ("rdpCopyArea: 3"));
+ }
}
else
{
@@ -506,7 +522,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpCopyArea: gettig dirty"));
+ LLOGLN(10, ("rdpCopyArea: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -537,7 +553,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 1);
RegionUninit(&reg1);
}
else if (got_id)
@@ -561,7 +577,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
box.y2 = box.y1 + h;
RegionInit(&box_reg, &box, 0);
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 1);
RegionUninit(&box_reg);
}
else if (got_id)
diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c
index 47e66e59..aac03287 100644
--- a/xorg/X11R7.6/rdp/rdpCopyPlane.c
+++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c
@@ -168,7 +168,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 5);
RegionUninit(&reg1);
}
else if (got_id)
@@ -194,7 +194,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 5);
RegionUninit(&reg1);
RegionUninit(&reg2);
}
diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c
index 53227159..4c54f447 100644
--- a/xorg/X11R7.6/rdp/rdpFillPolygon.c
+++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c
@@ -203,7 +203,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 7);
RegionUninit(&reg1);
}
else if (got_id)
@@ -223,7 +223,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 7);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
index e0ec5502..c5fcfaa7 100644
--- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
+++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c
@@ -169,7 +169,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 13);
RegionUninit(&reg1);
}
else if (got_id)
@@ -189,7 +189,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 13);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c
index 71e9b351..e6048095 100644
--- a/xorg/X11R7.6/rdp/rdpImageText16.c
+++ b/xorg/X11R7.6/rdp/rdpImageText16.c
@@ -132,7 +132,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpImageText16: gettig dirty"));
+ LLOGLN(10, ("rdpImageText16: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -167,7 +167,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 12);
RegionUninit(&reg1);
}
else if (got_id)
@@ -187,7 +187,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 12);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c
index 6acdc205..641637e0 100644
--- a/xorg/X11R7.6/rdp/rdpImageText8.c
+++ b/xorg/X11R7.6/rdp/rdpImageText8.c
@@ -167,7 +167,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 9);
RegionUninit(&reg1);
}
else if (got_id)
@@ -187,7 +187,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 9);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c
index 42a8c19e..6d6651f1 100644
--- a/xorg/X11R7.6/rdp/rdpPolyArc.c
+++ b/xorg/X11R7.6/rdp/rdpPolyArc.c
@@ -185,7 +185,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 6);
}
else if (got_id)
{
@@ -217,7 +217,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 6);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c
index aa1171da..6582f69e 100644
--- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c
+++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c
@@ -185,7 +185,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 8);
}
else if (got_id)
{
@@ -217,7 +217,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type, 8);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c
index 254cdff8..e51fca4c 100644
--- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c
+++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c
@@ -98,8 +98,25 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
{
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
+ if (pDstPixmap->devPrivate.ptr == g_rdpScreen.pfbMemory)
+ {
+ /* treat like root window */
+ post_process = 1;
- if (xrdp_is_os(pDstPixmap, pDstPriv))
+ if (g_do_dirty_ons)
+ {
+ LLOGLN(10, ("rdpPolyFillRect: gettig dirty"));
+ g_screenPriv.is_dirty = 1;
+ pDirtyPriv = &g_screenPriv;
+ dirty_type = RDI_IMGLL;
+ }
+ else
+ {
+ rdpup_get_screen_image_rect(&id);
+ got_id = 1;
+ }
+ }
+ else if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;
@@ -131,7 +148,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpPolyFillRect: gettig dirty"));
+ LLOGLN(10, ("rdpPolyFillRect: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -148,12 +165,14 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
if (!post_process)
{
RegionDestroy(fill_reg);
+ LLOGLN(10, ("rdpPolyFillRect: out, post_process not set"));
return;
}
RegionTranslate(fill_reg, pDrawable->x, pDrawable->y);
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
+ LLOGLN(10, ("rdpPolyFillRect: cd %d", cd));
if (cd == 1) /* no clip */
{
@@ -166,14 +185,14 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
pGC->alu);
}
else
{
- draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL);
+ draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL, 2);
}
}
else if (got_id)
@@ -187,7 +206,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
@@ -229,20 +248,24 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
+ LLOGLN(10, ("rdpPolyFillRect: 3"));
draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu);
}
else
{
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL);
+ LLOGLN(10, ("rdpPolyFillRect: 4"));
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL, 2);
}
}
else if (got_id)
{
rdpup_begin_update();
+ LLOGLN(10, ("2 %x", pGC->fgPixel));
+
if (pGC->fillStyle == 0 && /* solid fill */
(pGC->alu == GXclear ||
pGC->alu == GXset ||
@@ -250,7 +273,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
- pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
+ pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
index f166b731..298b4b98 100644
--- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
+++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c
@@ -169,7 +169,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 14);
RegionUninit(&reg1);
}
else if (got_id)
@@ -189,7 +189,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 14);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c
index 7fdb4e8b..85bef306 100644
--- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c
+++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c
@@ -144,7 +144,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpPolyRectangle: gettig dirty"));
+ LLOGLN(10, ("rdpPolyRectangle: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -221,7 +221,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
}
else
{
- draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type, 4);
}
RegionDestroy(fill_reg);
@@ -275,7 +275,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
}
else
{
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 4);
}
}
else if (got_id)
diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c
index fab6445e..623ec748 100644
--- a/xorg/X11R7.6/rdp/rdpPolySegment.c
+++ b/xorg/X11R7.6/rdp/rdpPolySegment.c
@@ -141,7 +141,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpPolySegment: gettig dirty"));
+ LLOGLN(10, ("rdpPolySegment: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c
index 034b11e1..9a253464 100644
--- a/xorg/X11R7.6/rdp/rdpPolyText16.c
+++ b/xorg/X11R7.6/rdp/rdpPolyText16.c
@@ -170,7 +170,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 11);
RegionUninit(&reg1);
}
else if (got_id)
@@ -190,7 +190,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 11);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c
index c06feac3..59f04d78 100644
--- a/xorg/X11R7.6/rdp/rdpPolyText8.c
+++ b/xorg/X11R7.6/rdp/rdpPolyText8.c
@@ -170,7 +170,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 10);
RegionUninit(&reg1);
}
else if (got_id)
@@ -190,7 +190,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type, 10);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c
index 92bb0678..759d1ff9 100644
--- a/xorg/X11R7.6/rdp/rdpPolylines.c
+++ b/xorg/X11R7.6/rdp/rdpPolylines.c
@@ -192,7 +192,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpPolylines: gettig dirty"));
+ LLOGLN(10, ("rdpPolylines: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c
index f7b77f23..6a353977 100644
--- a/xorg/X11R7.6/rdp/rdpPushPixels.c
+++ b/xorg/X11R7.6/rdp/rdpPushPixels.c
@@ -160,7 +160,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 15);
RegionUninit(&reg1);
}
else if (got_id)
@@ -185,7 +185,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type, 15);
RegionUninit(&reg1);
}
else if (got_id)
diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c
index 614d0a31..737e4b31 100644
--- a/xorg/X11R7.6/rdp/rdpPutImage.c
+++ b/xorg/X11R7.6/rdp/rdpPutImage.c
@@ -83,6 +83,8 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
LLOGLN(10, ("rdpPutImage:"));
LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id)));
+ LLOGLN(10, ("rdpPutImage: x %d y %d w %d h %d is_window %d", x, y, w, h,
+ pDst->type == DRAWABLE_WINDOW));
/* do original call */
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
@@ -130,7 +132,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpPutImage: gettig dirty"));
+ LLOGLN(10, ("rdpPutImage: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -161,7 +163,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 3);
RegionUninit(&reg1);
}
else if (got_id)
@@ -183,7 +185,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 3);
RegionUninit(&reg1);
RegionUninit(&reg2);
}
diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c
index 839854af..4b900f4e 100644
--- a/xorg/X11R7.6/rdp/rdpdraw.c
+++ b/xorg/X11R7.6/rdp/rdpdraw.c
@@ -583,13 +583,35 @@ draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv)
return 0;
}
+static char g_strings[][32] =
+{
+ "Composite", /* 0 */
+ "CopyArea", /* 1 */
+ "PolyFillRect", /* 2 */
+ "PutImage", /* 3 */
+ "PolyRectangle", /* 4 */
+ "CopyPlane", /* 5 */
+ "PolyArc", /* 6 */
+ "FillPolygon", /* 7 */
+ "PolyFillArc", /* 8 */
+ "ImageText8", /* 9 */
+ "PolyText8", /* 10 */
+ "PolyText16", /* 11 */
+ "ImageText16", /* 12 */
+ "ImageGlyphBlt", /* 13 */
+ "PolyGlyphBlt", /* 14 */
+ "PushPixels", /* 15 */
+ "Other"
+};
+
/******************************************************************************/
int
draw_item_add_img_region(rdpPixmapRec *priv, RegionPtr reg, int opcode,
- int type)
+ int type, int code)
{
struct rdp_draw_item *di;
+ LLOGLN(10, ("draw_item_add_img_region: %s", g_strings[code]));
di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
di->type = type;
di->reg = RegionCreate(NullBox, 0);
@@ -606,6 +628,7 @@ draw_item_add_fill_region(rdpPixmapRec *priv, RegionPtr reg, int color,
{
struct rdp_draw_item *di;
+ LLOGLN(10, ("draw_item_add_fill_region:"));
di = (struct rdp_draw_item *)g_malloc(sizeof(struct rdp_draw_item), 1);
di->type = RDI_FILL;
di->u.fill.fg_color = color;
@@ -691,6 +714,10 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
priv->kind_width = width;
pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
pScreen->CreatePixmap = rdpCreatePixmap;
+ if (org_width == 0 && height == 0)
+ {
+ priv->is_scratch = 1;
+ }
return rv;
}
@@ -741,7 +768,8 @@ xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv)
height = pix->drawable.height;
if ((pix->usage_hint == 0) &&
(pix->drawable.depth >= g_rdpScreen.depth) &&
- (width > 1) && (height > 1) && (priv->kind_width > 0))
+ (width > 0) && (height > 0) && (priv->kind_width > 0) &&
+ (priv->is_scratch == 0))
{
LLOGLN(10, ("%d %d", priv->kind_width, pix->drawable.width));
priv->rdpindex = rdpup_add_os_bitmap(pix, priv);
@@ -760,7 +788,7 @@ xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv)
{
draw_item_remove_all(priv);
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(priv, &reg1, GXcopy, RDI_IMGLL);
+ draw_item_add_img_region(priv, &reg1, GXcopy, RDI_IMGLL, 16);
RegionUninit(&reg1);
priv->is_dirty = 1;
priv->con_number = g_con_number;
@@ -995,6 +1023,7 @@ void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{
RegionRec reg;
+ RegionRec reg1;
RegionRec clip;
int dx;
int dy;
@@ -1004,12 +1033,11 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
int num_reg_rects;
BoxRec box1;
BoxRec box2;
+ BoxPtr box3;
LLOGLN(10, ("in rdpCopyWindow"));
RegionInit(&reg, NullBox, 0);
RegionCopy(&reg, pOldRegion);
- g_pScreen->CopyWindow = g_rdpScreen.CopyWindow;
- g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
RegionInit(&clip, NullBox, 0);
RegionCopy(&clip, &pWin->borderClip);
dx = pWin->drawable.x - ptOldOrg.x;
@@ -1017,30 +1045,45 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpCopyWindow: gettig dirty TODO"));
- //draw_item_add_srcblt_region
+ rdpup_check_dirty_screen(&g_screenPriv);
+ }
+ rdpup_begin_update();
+ num_clip_rects = REGION_NUM_RECTS(&clip);
+ num_reg_rects = REGION_NUM_RECTS(&reg);
+ LLOGLN(10, ("rdpCopyWindow: num_clip_rects %d num_reg_rects %d",
+ num_clip_rects, num_reg_rects));
+
+ /* when there is a huge list of screen copies, just send as bitmap
+ firefox dragging test does this */
+ if ((num_clip_rects > 16) && (num_reg_rects > 16))
+ {
+ box3 = RegionExtents(&reg);
+ rdpup_send_area(0, box3->x1, box3->y1,
+ box3->x2 - box3->x1,
+ box3->y2 - box3->y1);
}
else
{
- rdpup_begin_update();
- num_clip_rects = REGION_NUM_RECTS(&clip);
- num_reg_rects = REGION_NUM_RECTS(&reg);
/* should maybe sort the rects instead of checking dy < 0 */
/* If we can depend on the rects going from top to bottom, left
- to right we are ok */
+ to right we are ok */
if (dy < 0 || (dy == 0 && dx < 0))
{
for (j = 0; j < num_clip_rects; j++)
{
box1 = REGION_RECTS(&clip)[j];
- rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
+ rdpup_set_clip(box1.x1, box1.y1,
+ box1.x2 - box1.x1,
+ box1.y2 - box1.y1);
for (i = 0; i < num_reg_rects; i++)
{
box2 = REGION_RECTS(&reg)[i];
- rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
- box2.y2 - box2.y1, box2.x1, box2.y1);
+ rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy,
+ box2.x2 - box2.x1,
+ box2.y2 - box2.y1,
+ box2.x1, box2.y1);
}
}
}
@@ -1049,23 +1092,29 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
for (j = num_clip_rects - 1; j >= 0; j--)
{
box1 = REGION_RECTS(&clip)[j];
- rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1);
+ rdpup_set_clip(box1.x1, box1.y1,
+ box1.x2 - box1.x1,
+ box1.y2 - box1.y1);
for (i = num_reg_rects - 1; i >= 0; i--)
{
box2 = REGION_RECTS(&reg)[i];
- rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1,
- box2.y2 - box2.y1, box2.x1, box2.y1);
+ rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy,
+ box2.x2 - box2.x1,
+ box2.y2 - box2.y1,
+ box2.x1, box2.y1);
}
}
}
-
- rdpup_reset_clip();
- rdpup_end_update();
}
+ rdpup_reset_clip();
+ rdpup_end_update();
+
RegionUninit(&reg);
RegionUninit(&clip);
+ g_pScreen->CopyWindow = g_rdpScreen.CopyWindow;
+ g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
g_pScreen->CopyWindow = rdpCopyWindow;
}
@@ -1104,7 +1153,7 @@ rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h,
if (g_do_dirty_ons)
{
- draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
+ draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL, 16);
}
else
{
@@ -1142,7 +1191,7 @@ rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed)
if (g_do_dirty_ons)
{
- draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL);
+ draw_item_add_img_region(&g_screenPriv, &reg, GXcopy, RDI_IMGLL, 16);
}
else
{
@@ -1304,7 +1353,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
if (g_do_dirty_ons)
{
- LLOGLN(0, ("rdpComposite: gettig dirty"));
+ LLOGLN(10, ("rdpComposite: gettig dirty"));
g_screenPriv.is_dirty = 1;
pDirtyPriv = &g_screenPriv;
dirty_type = RDI_IMGLL;
@@ -1337,7 +1386,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
if (dirty_type != 0)
{
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 0);
}
else if (got_id)
{
@@ -1370,7 +1419,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
- draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
+ draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type, 0);
RegionUninit(&reg1);
}
else if (got_id)
diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c
index ffb43d1f..f1645cfe 100644
--- a/xorg/X11R7.6/rdp/rdpmain.c
+++ b/xorg/X11R7.6/rdp/rdpmain.c
@@ -46,10 +46,12 @@ DeviceIntPtr g_keyboard = 0;
int g_can_do_pix_to_pix = 0;
int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */
-int g_do_dirty_ons = 0; /* delay remoting screen */
+int g_do_dirty_ons = 1; /* delay remoting screen */
Bool g_wrapWindow = 1;
Bool g_wrapPixmap = 1;
+int g_codec_mode = 0; /* 0 = standard rdp, 1 = rfx */
+
rdpPixmapRec g_screenPriv;
/* if true, running in RemoteApp / RAIL mode */
@@ -237,7 +239,7 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
memset(&g_screenPriv, 0, sizeof(g_screenPriv));
/*dpix = 75;
- dpiy = 75;*/
+ dpiy = 75; */
dpix = PixelDPI;
dpiy = PixelDPI;
diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c
index 61ed302a..06c8bd73 100644
--- a/xorg/X11R7.6/rdp/rdpup.c
+++ b/xorg/X11R7.6/rdp/rdpup.c
@@ -970,7 +970,7 @@ rdpup_check(void)
int
rdpup_begin_update(void)
{
- LLOGLN(10, ("rdpup_begin_update"));
+ LLOGLN(10, ("rdpup_begin_update:"));
if (g_connected)
{
@@ -978,7 +978,6 @@ rdpup_begin_update(void)
{
return 0;
}
-
init_stream(g_out_s, 0);
s_push_layer(g_out_s, iso_hdr, 8);
out_uint16_le(g_out_s, 1); /* begin update */
@@ -1001,6 +1000,7 @@ rdpup_end_update(void)
{
if (g_do_dirty_ons)
{
+ /* in this mode, end update is only called in check dirty */
rdpup_send_pending();
}
else
@@ -1059,7 +1059,8 @@ rdpup_screen_blt(short x, short y, int cx, int cy, short srcx, short srcy)
{
if (g_connected)
{
- LLOGLN(10, (" rdpup_screen_blt"));
+ LLOGLN(10, (" rdpup_screen_blt x %d y %d cx %d cy %d srcx %d srcy %d",
+ x, y, cx, cy, srcx, srcy));
rdpup_pre_check(16);
out_uint16_le(g_out_s, 4); /* screen blt */
out_uint16_le(g_out_s, 16); /* size */
@@ -1868,7 +1869,7 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv)
g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp;
g_os_bitmap_stamp++;
- LLOGLN(10, ("-----------------got dirty"));
+ LLOGLN(10, ("rdpup_check_dirty: got dirty"));
rdpup_switch_os_surface(pDirtyPriv->rdpindex);
rdpup_get_pixmap_image_rect(pDirtyPixmap, &id);
rdpup_begin_update();
@@ -1994,7 +1995,7 @@ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv)
return 0;
}
- LLOGLN(10, ("-----------------got dirty"));
+ LLOGLN(10, ("rdpup_check_dirty_screen: got dirty"));
rdpup_get_screen_image_rect(&id);
rdpup_begin_update();
draw_item_pack(0, pDirtyPriv);
diff --git a/xorg/server/Makefile b/xorg/server/Makefile
index 12548dd9..ad82975a 100644
--- a/xorg/server/Makefile
+++ b/xorg/server/Makefile
@@ -14,3 +14,9 @@ allclean:
cd xrdpdev; $(MAKE) clean
cd xrdpkeyb; $(MAKE) clean
cd xrdpmouse; $(MAKE) clean
+
+xinstall:
+ cp module/libxorgxrdp.so $(HOME)/xorg-modules/
+ cp xrdpdev/xrdpdev_drv.so $(HOME)/xorg-modules/drivers/
+ cp xrdpmouse/xrdpmouse_drv.so $(HOME)/xorg-modules/input/
+ cp xrdpkeyb/xrdpkeyb_drv.so $(HOME)/xorg-modules/input/
diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile
index 66b09f91..d30b2ba9 100644
--- a/xorg/server/module/Makefile
+++ b/xorg/server/module/Makefile
@@ -5,7 +5,7 @@ rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
-rdpComposite.o rdpGlyphs.o
+rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o
CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1
diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h
index 085e114f..c3533e98 100644
--- a/xorg/server/module/rdp.h
+++ b/xorg/server/module/rdp.h
@@ -33,6 +33,38 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PixelDPI 100
#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10))
+#define RDPMIN(_val1, _val2) ((_val1) < (_val2) ? (_val1) : (_val2))
+#define RDPMAX(_val1, _val2) ((_val1) < (_val2) ? (_val2) : (_val1))
+#define RDPCLAMP(_val, _lo, _hi) \
+ (_val) < (_lo) ? (_lo) : (_val) > (_hi) ? (_hi) : (_val)
+
+/* defined in rdpClientCon.h */
+typedef struct _rdpClientCon rdpClientCon;
+
+struct _rdpPointer
+{
+ int cursor_x;
+ int cursor_y;
+ int old_button_mask;
+ int button_mask;
+ DeviceIntPtr device;
+};
+typedef struct _rdpPointer rdpPointer;
+
+struct _rdpKeyboard
+{
+ int pause_spe;
+ int ctrl_down;
+ int alt_down;
+ int shift_down;
+ int tab_down;
+ /* this is toggled every time num lock key is released, not like the
+ above *_down vars */
+ int scroll_lock_down;
+ DeviceIntPtr device;
+};
+typedef struct _rdpKeyboard rdpKeyboard;
+
/* move this to common header */
struct _rdpRec
{
@@ -57,7 +89,12 @@ struct _rdpRec
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
+ /* keyboard and mouse */
miPointerScreenFuncPtr pCursorFuncs;
+ /* mouse */
+ rdpPointer pointer;
+ /* keyboard */
+ rdpKeyboard keyboard;
/* RandR */
RRSetConfigProcPtr rrSetConfig;
@@ -73,6 +110,10 @@ struct _rdpRec
RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning;
+ int listen_sck;
+ char uds_data[256];
+ rdpClientCon *clientConHead;
+ rdpClientCon *clientConTail;
};
typedef struct _rdpRec rdpRec;
typedef struct _rdpRec * rdpPtr;
diff --git a/xorg/server/module/rdpClientCon.c b/xorg/server/module/rdpClientCon.c
new file mode 100644
index 00000000..3edd1e0c
--- /dev/null
+++ b/xorg/server/module/rdpClientCon.c
@@ -0,0 +1,245 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Client connection to xrdp
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include "rdp.h"
+#include "rdpDraw.h"
+#include "rdpClientCon.h"
+#include "rdpMisc.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define LTOUI32(_in) ((unsigned int)(_in))
+
+/******************************************************************************/
+static int
+rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev)
+{
+ rdpClientCon *clientCon;
+
+ LLOGLN(0, ("rdpClientConGotConnection:"));
+ clientCon = (rdpClientCon *) g_malloc(sizeof(rdpClientCon), 1);
+ make_stream(clientCon->in_s);
+ init_stream(clientCon->in_s, 8192);
+ make_stream(clientCon->out_s);
+ init_stream(clientCon->out_s, 8192 * 4 + 100);
+ if (dev->clientConTail == NULL)
+ {
+ dev->clientConHead = clientCon;
+ dev->clientConTail = clientCon;
+ }
+ else
+ {
+ dev->clientConTail->next = clientCon;
+ dev->clientConTail = clientCon;
+ }
+ return 0;
+}
+
+/******************************************************************************/
+static int
+rdpClientConGotData(ScreenPtr pScreen, rdpPtr dev, rdpClientCon *clientCon)
+{
+ LLOGLN(0, ("rdpClientConGotData:"));
+ return 0;
+}
+
+/******************************************************************************/
+static int
+rdpClientConGotControlConnection(ScreenPtr pScreen, rdpPtr dev,
+ rdpClientCon *clientCon)
+{
+ LLOGLN(0, ("rdpClientConGotControlConnection:"));
+ return 0;
+}
+
+/******************************************************************************/
+static int
+rdpClientConGotControlData(ScreenPtr pScreen, rdpPtr dev,
+ rdpClientCon *clientCon)
+{
+ LLOGLN(0, ("rdpClientConGotControlData:"));
+ return 0;
+}
+
+/******************************************************************************/
+int
+rdpClientConCheck(ScreenPtr pScreen)
+{
+ rdpPtr dev;
+ rdpClientCon *clientCon;
+ fd_set rfds;
+ struct timeval time;
+ int max;
+ int sel;
+ int count;
+
+ LLOGLN(10, ("rdpClientConCheck:"));
+ dev = rdpGetDevFromScreen(pScreen);
+ time.tv_sec = 0;
+ time.tv_usec = 0;
+ FD_ZERO(&rfds);
+ count = 0;
+ max = 0;
+ if (dev->listen_sck > 0)
+ {
+ count++;
+ FD_SET(LTOUI32(dev->listen_sck), &rfds);
+ max = RDPMAX(dev->listen_sck, max);
+ }
+ clientCon = dev->clientConHead;
+ while (clientCon != NULL)
+ {
+ if (clientCon->sck > 0)
+ {
+ count++;
+ FD_SET(LTOUI32(clientCon->sck), &rfds);
+ max = RDPMAX(clientCon->sck, max);
+ }
+ if (clientCon->sckControl > 0)
+ {
+ count++;
+ FD_SET(LTOUI32(clientCon->sckControl), &rfds);
+ max = RDPMAX(clientCon->sckControl, max);
+ }
+ if (clientCon->sckControlListener > 0)
+ {
+ count++;
+ FD_SET(LTOUI32(clientCon->sckControlListener), &rfds);
+ max = RDPMAX(clientCon->sckControlListener, max);
+ }
+ clientCon = clientCon->next;
+ }
+ if (count < 1)
+ {
+ sel = 0;
+ }
+ else
+ {
+ sel = select(max + 1, &rfds, 0, 0, &time);
+ }
+ if (sel < 1)
+ {
+ LLOGLN(10, ("rdpClientConCheck: no select"));
+ return 0;
+ }
+ if (dev->listen_sck > 0)
+ {
+ if (FD_ISSET(LTOUI32(dev->listen_sck), &rfds))
+ {
+ rdpClientConGotConnection(pScreen, dev);
+ }
+ }
+ clientCon = dev->clientConHead;
+ while (clientCon != NULL)
+ {
+ if (clientCon->sck > 0)
+ {
+ if (FD_ISSET(LTOUI32(clientCon->sck), &rfds))
+ {
+ rdpClientConGotData(pScreen, dev, clientCon);
+ }
+ }
+ if (clientCon->sckControlListener > 0)
+ {
+ if (FD_ISSET(LTOUI32(clientCon->sckControlListener), &rfds))
+ {
+ rdpClientConGotControlConnection(pScreen, dev, clientCon);
+ }
+ }
+ if (clientCon->sckControl > 0)
+ {
+ if (FD_ISSET(LTOUI32(clientCon->sckControl), &rfds))
+ {
+ rdpClientConGotControlData(pScreen, dev, clientCon);
+ }
+ }
+ clientCon = clientCon->next;
+ }
+ return 0;
+}
+
+/******************************************************************************/
+int
+rdpClientConInit(rdpPtr dev)
+{
+ int i;
+
+ if (!g_directory_exist("/tmp/.xrdp"))
+ {
+ if (!g_create_dir("/tmp/.xrdp"))
+ {
+ if (!g_directory_exist("/tmp/.xrdp"))
+ {
+ LLOGLN(0, ("rdpup_init: g_create_dir failed"));
+ return 0;
+ }
+ }
+ g_chmod_hex("/tmp/.xrdp", 0x1777);
+ }
+ i = atoi(display);
+ if (i < 1)
+ {
+ LLOGLN(0, ("rdpClientConInit: can not run at display < 1"));
+ return 0;
+ }
+ g_sprintf(dev->uds_data, "/tmp/.xrdp/xrdp_display_%s", display);
+ if (dev->listen_sck == 0)
+ {
+ unlink(dev->uds_data);
+ dev->listen_sck = g_tcp_local_socket_stream();
+ if (g_tcp_local_bind(dev->listen_sck, dev->uds_data) != 0)
+ {
+ LLOGLN(0, ("rdpClientConInit: g_tcp_local_bind failed"));
+ return 1;
+ }
+ g_tcp_listen(dev->listen_sck);
+ AddEnabledDevice(dev->listen_sck);
+ }
+ return 0;
+}
+
+/******************************************************************************/
+int
+rdpClientConDeinit(rdpPtr dev)
+{
+ LLOGLN(0, ("rdpClientConDeinit:"));
+ if (dev->listen_sck != 0)
+ {
+ close(dev->listen_sck);
+ unlink(dev->uds_data);
+ }
+ return 0;
+}
diff --git a/xorg/server/module/rdpClientCon.h b/xorg/server/module/rdpClientCon.h
new file mode 100644
index 00000000..85a3925a
--- /dev/null
+++ b/xorg/server/module/rdpClientCon.h
@@ -0,0 +1,44 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Client connection to xrdp
+
+*/
+
+#ifndef _RDPCLIENTCON_H
+#define _RDPCLIENTCON_H
+
+struct _rdpClientCon
+{
+ int sck;
+ int sckControlListener;
+ int sckControl;
+ struct stream *out_s;
+ struct stream *in_s;
+ struct _rdpClientCon *next;
+};
+
+int
+rdpClientConCheck(ScreenPtr pScreen);
+int
+rdpClientConInit(rdpPtr dev);
+int
+rdpClientConDeinit(rdpPtr dev);
+
+#endif
diff --git a/xorg/server/module/rdpComposite.c b/xorg/server/module/rdpComposite.c
index a2c5568e..8776335b 100644
--- a/xorg/server/module/rdpComposite.c
+++ b/xorg/server/module/rdpComposite.c
@@ -36,6 +36,7 @@ composite(alpha blending) calls
#include "rdp.h"
#include "rdpComposite.h"
+#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -46,8 +47,8 @@ composite(alpha blending) calls
static void
rdpCompositeOrg(PictureScreenPtr ps, rdpPtr dev,
CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
- INT16 yDst, CARD16 width, CARD16 height)
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
{
ps->Composite = dev->Composite;
ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
@@ -63,14 +64,12 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
{
ScreenPtr pScreen;
rdpPtr dev;
- ScrnInfoPtr pScrn;
PictureScreenPtr ps;
LLOGLN(10, ("rdpComposite:"));
pScreen = pSrc->pDrawable->pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
ps = GetPictureScreen(pScreen);
- rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
+ rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
}
diff --git a/xorg/server/module/rdpCopyArea.c b/xorg/server/module/rdpCopyArea.c
index dd32644e..91df1896 100644
--- a/xorg/server/module/rdpCopyArea.c
+++ b/xorg/server/module/rdpCopyArea.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ static RegionPtr
rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
RegionPtr rv;
GC_OP_PROLOGUE(pGC);
diff --git a/xorg/server/module/rdpCopyPlane.c b/xorg/server/module/rdpCopyPlane.c
index 9b89125c..fb7c22b8 100644
--- a/xorg/server/module/rdpCopyPlane.c
+++ b/xorg/server/module/rdpCopyPlane.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -32,9 +43,8 @@ rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty, unsigned long bitPlane)
{
+ GC_OP_VARS;
RegionPtr rv;
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy,
diff --git a/xorg/server/module/rdpCursor.c b/xorg/server/module/rdpCursor.c
index 82aafd78..1e5ad311 100644
--- a/xorg/server/module/rdpCursor.c
+++ b/xorg/server/module/rdpCursor.c
@@ -38,6 +38,7 @@ cursor
#include <mi.h>
#include "rdp.h"
+#include "rdpMain.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -49,7 +50,7 @@ Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(0, ("rdpSpriteRealizeCursor:"));
- return 1;
+ return TRUE;
}
/******************************************************************************/
@@ -57,7 +58,7 @@ Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(0, ("rdpSpriteUnrealizeCursor:"));
- return 1;
+ return TRUE;
}
/******************************************************************************/
@@ -80,7 +81,7 @@ Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(0, ("rdpSpriteDeviceCursorInitialize:"));
- return 1;
+ return TRUE;
}
/******************************************************************************/
@@ -88,4 +89,5 @@ void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(0, ("rdpSpriteDeviceCursorCleanup:"));
+ xorgxrdpDownDown(pScr);
}
diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c
index 7abcb406..08fe4b85 100644
--- a/xorg/server/module/rdpDraw.c
+++ b/xorg/server/module/rdpDraw.c
@@ -38,82 +38,21 @@ misc draw calls
#include <mi.h>
#include "rdp.h"
+#include "rdpDraw.h"
-/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/*****************************************************************************/
-PixmapPtr
-rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
-{
- ScrnInfoPtr pScrn;
- rdpPtr dev;
- PixmapPtr rv;
-
- LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d",
- width, height, depth));
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
- pScreen->CreatePixmap = dev->CreatePixmap;
- rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
- pScreen->CreatePixmap = rdpCreatePixmap;
- return rv;
-}
-
-/******************************************************************************/
-Bool
-rdpDestroyPixmap(PixmapPtr pPixmap)
-{
- Bool rv;
- ScreenPtr pScreen;
- rdpPtr dev;
- ScrnInfoPtr pScrn;
-
- LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
- pScreen = pPixmap->drawable.pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
- pScreen->DestroyPixmap = dev->DestroyPixmap;
- rv = pScreen->DestroyPixmap(pPixmap);
- pScreen->DestroyPixmap = rdpDestroyPixmap;
- return rv;
-}
-
-/******************************************************************************/
-Bool
-rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- Bool rv;
- ScreenPtr pScreen;
- rdpPtr dev;
- ScrnInfoPtr pScrn;
-
- LLOGLN(10, ("rdpModifyPixmapHeader:"));
- pScreen = pPixmap->drawable.pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
- pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
- rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
- devKind, pPixData);
- pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
- return rv;
-}
-
-/*****************************************************************************/
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{
- ScrnInfoPtr pScrn;
ScreenPtr pScreen;
rdpPtr dev;
pScreen = pWin->drawable.pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
dev->pScreen->CopyWindow = dev->CopyWindow;
dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
dev->pScreen->CopyWindow = rdpCopyWindow;
@@ -123,13 +62,11 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
Bool
rdpCloseScreen(int index, ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn;
rdpPtr dev;
Bool rv;
LLOGLN(0, ("rdpCloseScreen:"));
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
dev->pScreen->CloseScreen = dev->CloseScreen;
rv = dev->pScreen->CloseScreen(index, pScreen);
dev->pScreen->CloseScreen = rdpCloseScreen;
@@ -146,3 +83,22 @@ rdpGetRootWindowPtr(ScreenPtr pScreen)
return pScreen->root;
#endif
}
+
+/******************************************************************************/
+rdpPtr
+rdpGetDevFromScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ rdpPtr dev;
+
+ if (pScreen == NULL)
+ {
+ pScrn = xf86Screens[0];
+ }
+ else
+ {
+ pScrn = xf86Screens[pScreen->myNum];
+ }
+ dev = XRDPPTR(pScrn);
+ return dev;
+}
diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h
index ba696541..e2711768 100644
--- a/xorg/server/module/rdpDraw.h
+++ b/xorg/server/module/rdpDraw.h
@@ -28,14 +28,12 @@ misc draw calls
#include <xf86.h>
/******************************************************************************/
+#define GC_OP_VARS rdpPtr dev; rdpGCPtr priv; GCFuncs *oldFuncs
+
+/******************************************************************************/
#define GC_OP_PROLOGUE(_pGC) \
do { \
- rdpPtr dev; \
- ScreenPtr pScreen; \
- ScrnInfoPtr pScrn; \
- pScreen = (_pGC)->pScreen; \
- pScrn = xf86Screens[pScreen->myNum]; \
- dev = XRDPPTR(pScrn); \
+ dev = rdpGetDevFromScreen((_pGC)->pScreen); \
priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
oldFuncs = (_pGC)->funcs; \
(_pGC)->funcs = priv->funcs; \
@@ -52,19 +50,13 @@ do { \
extern GCOps g_rdpGCOps; /* in rdpGC.c */
-PixmapPtr
-rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint);
-Bool
-rdpDestroyPixmap(PixmapPtr pPixmap);
-Bool
-rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData);
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
Bool
rdpCloseScreen(int index, ScreenPtr pScreen);
WindowPtr
rdpGetRootWindowPtr(ScreenPtr pScreen);
+rdpPtr
+rdpGetDevFromScreen(ScreenPtr pScreen);
#endif
diff --git a/xorg/server/module/rdpFillPolygon.c b/xorg/server/module/rdpFillPolygon.c
index 38043c0b..7c5a51b8 100644
--- a/xorg/server/module/rdpFillPolygon.c
+++ b/xorg/server/module/rdpFillPolygon.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -32,8 +43,7 @@ rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
diff --git a/xorg/server/module/rdpFillSpans.c b/xorg/server/module/rdpFillSpans.c
index dbd4cc1e..db1929fc 100644
--- a/xorg/server/module/rdpFillSpans.c
+++ b/xorg/server/module/rdpFillSpans.c
@@ -19,11 +19,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
-#define LDEBUG 0
-
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
@@ -33,8 +42,7 @@ static void
rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
diff --git a/xorg/server/module/rdpGC.c b/xorg/server/module/rdpGC.c
index 3a585e2c..5f34c21c 100644
--- a/xorg/server/module/rdpGC.c
+++ b/xorg/server/module/rdpGC.c
@@ -58,6 +58,7 @@ GC related calls
#include "rdpImageGlyphBlt.h"
#include "rdpPolyGlyphBlt.h"
#include "rdpPushPixels.h"
+#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -65,14 +66,12 @@ GC related calls
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
+#define GC_FUNC_VARS rdpPtr dev; rdpGCPtr priv;
+
+/******************************************************************************/
#define GC_FUNC_PROLOGUE(_pGC) \
do { \
- rdpPtr dev; \
- ScreenPtr pScreen; \
- ScrnInfoPtr pScrn; \
- pScreen = _pGC->pScreen; \
- pScrn = xf86Screens[pScreen->myNum]; \
- dev = XRDPPTR(pScrn); \
+ dev = rdpGetDevFromScreen((_pGC)->pScreen); \
priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
(_pGC)->funcs = priv->funcs; \
if (priv->ops != 0) \
@@ -127,7 +126,7 @@ GCOps g_rdpGCOps =
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpValidateGC:"));
GC_FUNC_PROLOGUE(pGC);
@@ -140,7 +139,7 @@ rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
static void
rdpChangeGC(GCPtr pGC, unsigned long mask)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeGC:"));
GC_FUNC_PROLOGUE(pGC);
@@ -152,7 +151,7 @@ rdpChangeGC(GCPtr pGC, unsigned long mask)
static void
rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyGC:"));
GC_FUNC_PROLOGUE(dst);
@@ -164,7 +163,7 @@ rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
static void
rdpDestroyGC(GCPtr pGC)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyGC:"));
GC_FUNC_PROLOGUE(pGC);
@@ -176,7 +175,7 @@ rdpDestroyGC(GCPtr pGC)
static void
rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeClip:"));
GC_FUNC_PROLOGUE(pGC);
@@ -188,7 +187,7 @@ rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
static void
rdpDestroyClip(GCPtr pGC)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyClip:"));
GC_FUNC_PROLOGUE(pGC);
@@ -200,7 +199,7 @@ rdpDestroyClip(GCPtr pGC)
static void
rdpCopyClip(GCPtr dst, GCPtr src)
{
- rdpGCRec *priv;
+ GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyClip:"));
GC_FUNC_PROLOGUE(dst);
@@ -215,13 +214,11 @@ rdpCreateGC(GCPtr pGC)
Bool rv;
rdpPtr dev;
ScreenPtr pScreen;
- ScrnInfoPtr pScrn;
rdpGCPtr priv;
LLOGLN(10, ("rdpCreateGC:"));
pScreen = pGC->pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
pScreen->CreateGC = dev->CreateGC;
rv = pScreen->CreateGC(pGC);
diff --git a/xorg/server/module/rdpGlyphs.c b/xorg/server/module/rdpGlyphs.c
index 3a222e79..fc2d347b 100644
--- a/xorg/server/module/rdpGlyphs.c
+++ b/xorg/server/module/rdpGlyphs.c
@@ -37,6 +37,7 @@ gylph(font) calls
#include "rdp.h"
#include "rdpGlyphs.h"
+#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -66,13 +67,11 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
{
ScreenPtr pScreen;
rdpPtr dev;
- ScrnInfoPtr pScrn;
PictureScreenPtr ps;
LLOGLN(10, ("rdpGlyphs:"));
pScreen = pSrc->pDrawable->pScreen;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
ps = GetPictureScreen(pScreen);
rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc,
nlists, lists, glyphs);
diff --git a/xorg/server/module/rdpImageGlyphBlt.c b/xorg/server/module/rdpImageGlyphBlt.c
index 0b0d7ce8..f1f03203 100644
--- a/xorg/server/module/rdpImageGlyphBlt.c
+++ b/xorg/server/module/rdpImageGlyphBlt.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -32,8 +43,7 @@ rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
diff --git a/xorg/server/module/rdpImageText16.c b/xorg/server/module/rdpImageText16.c
index 8ddd9bf3..cb421158 100644
--- a/xorg/server/module/rdpImageText16.c
+++ b/xorg/server/module/rdpImageText16.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ void
rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
diff --git a/xorg/server/module/rdpImageText8.c b/xorg/server/module/rdpImageText8.c
index ab41753b..4bb07fe4 100644
--- a/xorg/server/module/rdpImageText8.c
+++ b/xorg/server/module/rdpImageText8.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ void
rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
diff --git a/xorg/server/module/rdpInput.c b/xorg/server/module/rdpInput.c
new file mode 100644
index 00000000..a7bafd08
--- /dev/null
+++ b/xorg/server/module/rdpInput.c
@@ -0,0 +1,121 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include "rdp.h"
+#include "rdpDraw.h"
+#include "rdpInput.h"
+#include "rdpMisc.h"
+
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+#define MAX_INPUT_PROC 4
+
+struct input_proc_list
+{
+ int type;
+ rdpInputEventProcPtr proc;
+};
+
+static struct input_proc_list g_input_proc[MAX_INPUT_PROC];
+
+/******************************************************************************/
+int
+rdpRegisterInputCallback(int type, rdpInputEventProcPtr proc)
+{
+ if (type == 0)
+ {
+ g_input_proc[0].proc = proc;
+ }
+ else if (type == 1)
+ {
+ g_input_proc[1].proc = proc;
+ }
+ else
+ {
+ return 1;
+ }
+ return 0;
+}
+
+/******************************************************************************/
+int
+rdpUnregisterInputCallback(rdpInputEventProcPtr proc)
+{
+ int index;
+
+ for (index = 0; index < MAX_INPUT_PROC; index++)
+ {
+ if (g_input_proc[index].proc == proc)
+ {
+ g_input_proc[index].proc = 0;
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/******************************************************************************/
+int
+rdpInputKeyboardEvent(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4)
+{
+ if (g_input_proc[0].proc != 0)
+ {
+ return g_input_proc[0].proc(dev, msg, param1, param2, param3, param4);
+ }
+ return 0;
+}
+
+/******************************************************************************/
+int
+rdpInputMouseEvent(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4)
+{
+ if (g_input_proc[1].proc != 0)
+ {
+ return g_input_proc[1].proc(dev, msg, param1, param2, param3, param4);
+ }
+ return 0;
+}
+
+/******************************************************************************/
+/* called when module loads */
+int
+rdpInputInit(void)
+{
+ g_memset(g_input_proc, 0, sizeof(g_input_proc));
+ return 0;
+}
diff --git a/xorg/server/module/rdpInput.h b/xorg/server/module/rdpInput.h
new file mode 100644
index 00000000..19315026
--- /dev/null
+++ b/xorg/server/module/rdpInput.h
@@ -0,0 +1,46 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+input
+
+*/
+
+#ifndef _RDPINPUT_H
+#define _RDPINPUT_H
+
+typedef int (*rdpInputEventProcPtr)(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4);
+
+int
+rdpRegisterInputCallback(int type, rdpInputEventProcPtr proc);
+int
+rdpUnregisterInputCallback(rdpInputEventProcPtr proc);
+int
+rdpInputKeyboardEvent(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4);
+int
+rdpInputMouseEvent(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4);
+int
+rdpInputInit(void);
+
+#endif
diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpMain.c
index 9930764c..f19b06cd 100644
--- a/xorg/server/module/rdpMain.c
+++ b/xorg/server/module/rdpMain.c
@@ -38,6 +38,9 @@ rdp module main
#include <mi.h>
#include "rdp.h"
+#include "rdpInput.h"
+#include "rdpDraw.h"
+#include "rdpClientCon.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -52,20 +55,43 @@ rdp module main
#define PACKAGE_VERSION_MINOR 0
#define PACKAGE_VERSION_PATCHLEVEL 0
-static int g_initialised = 0;
+static Bool g_initialised = FALSE;
/*****************************************************************************/
static pointer
-xorgxrdpSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor)
+xorgxrdpSetup(pointer Module, pointer Options,
+ int *ErrorMajor, int *ErrorMinor)
{
LLOGLN(0, ("xorgxrdpSetup:"));
if (!g_initialised)
{
- g_initialised = 1;
+ g_initialised = TRUE;
}
+ rdpInputInit();
+ rdpPrivateInit();
return (pointer) 1;
}
+/*****************************************************************************/
+static void
+xorgxrdpTearDown(pointer Module)
+{
+ LLOGLN(0, ("xorgxrdpTearDown:"));
+}
+
+/*****************************************************************************/
+void
+xorgxrdpDownDown(ScreenPtr pScreen)
+{
+ LLOGLN(0, ("xorgxrdpDownDown:"));
+ if (g_initialised)
+ {
+ g_initialised = FALSE;
+ LLOGLN(0, ("xorgxrdpDownDown: 1"));
+ rdpClientConDeinit(rdpGetDevFromScreen(pScreen));
+ }
+}
+
static MODULESETUPPROTO(xorgxrdpSetup);
static XF86ModuleVersionInfo RDPVersRec =
{
@@ -83,4 +109,9 @@ static XF86ModuleVersionInfo RDPVersRec =
{ 0, 0, 0, 0 }
};
-XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, xorgxrdpSetup, NULL };
+_X_EXPORT XF86ModuleData xorgxrdpModuleData =
+{
+ &RDPVersRec,
+ xorgxrdpSetup,
+ xorgxrdpTearDown
+};
diff --git a/xorg/server/module/rdpMain.h b/xorg/server/module/rdpMain.h
new file mode 100644
index 00000000..0b9f7bb0
--- /dev/null
+++ b/xorg/server/module/rdpMain.h
@@ -0,0 +1,30 @@
+/*
+Copyright 2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+rdp module main
+
+*/
+
+#ifndef __RDPMAIN_H
+#define __RDPMAIN_H
+
+void
+xorgxrdpDownDown(ScreenPtr pScreen);
+
+#endif
diff --git a/xorg/server/module/rdpMisc.h b/xorg/server/module/rdpMisc.h
index 8318f7bd..bed95891 100644
--- a/xorg/server/module/rdpMisc.h
+++ b/xorg/server/module/rdpMisc.h
@@ -24,6 +24,8 @@ the rest
#ifndef __RDPMISC_H
#define __RDPMISC_H
+#include <X11/Xos.h>
+
int
rdpBitsPerPixel(int depth);
int
@@ -75,4 +77,177 @@ g_chmod_hex(const char *filename, int flags);
void
g_hexdump(unsigned char *p, unsigned int len);
+#if defined(X_BYTE_ORDER)
+# if X_BYTE_ORDER == X_LITTLE_ENDIAN
+# define L_ENDIAN
+# else
+# define B_ENDIAN
+# endif
+#else
+# error Unknown endianness in rdp.h
+#endif
+/* check if we need to align data */
+/* check if we need to align data */
+#if defined(__sparc__) || defined(__alpha__) || defined(__hppa__) || \
+ defined(__AIX__) || defined(__PPC__) || defined(__mips__) || \
+ defined(__ia64__) || defined(__ppc__) || defined(__arm__)
+#define NEED_ALIGN
+#endif
+
+/* parser state */
+struct stream
+{
+ char* p;
+ char* end;
+ char* data;
+ int size;
+ /* offsets of various headers */
+ char* iso_hdr;
+ char* mcs_hdr;
+ char* sec_hdr;
+ char* rdp_hdr;
+ char* channel_hdr;
+ char* next_packet;
+};
+
+/******************************************************************************/
+#define s_push_layer(s, h, n) \
+{ \
+ (s)->h = (s)->p; \
+ (s)->p += (n); \
+}
+
+/******************************************************************************/
+#define s_pop_layer(s, h) \
+{ \
+ (s)->p = (s)->h; \
+}
+
+/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define out_uint16_le(s, v) \
+{ \
+ *((s)->p) = (unsigned char)((v) >> 0); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 8); \
+ (s)->p++; \
+}
+#else
+#define out_uint16_le(s, v) \
+{ \
+ *((unsigned short*)((s)->p)) = (unsigned short)(v); \
+ (s)->p += 2; \
+}
+#endif
+
+/******************************************************************************/
+#define init_stream(s, v) \
+{ \
+ if ((v) > (s)->size) \
+ { \
+ g_free((s)->data); \
+ (s)->data = (char*)g_malloc((v), 0); \
+ (s)->size = (v); \
+ } \
+ (s)->p = (s)->data; \
+ (s)->end = (s)->data; \
+ (s)->next_packet = 0; \
+}
+
+/******************************************************************************/
+#define out_uint8p(s, v, n) \
+{ \
+ g_memcpy((s)->p, (v), (n)); \
+ (s)->p += (n); \
+}
+
+/******************************************************************************/
+#define out_uint8a(s, v, n) \
+{ \
+ out_uint8p((s), (v), (n)); \
+}
+
+/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define out_uint32_le(s, v) \
+{ \
+ *((s)->p) = (unsigned char)((v) >> 0); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 8); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 16); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 24); \
+ (s)->p++; \
+}
+#else
+#define out_uint32_le(s, v) \
+{ \
+ *((unsigned int*)((s)->p)) = (v); \
+ (s)->p += 4; \
+}
+#endif
+
+/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define in_uint32_le(s, v) \
+{ \
+ (v) = (unsigned int) \
+ ( \
+ (*((unsigned char*)((s)->p + 0)) << 0) | \
+ (*((unsigned char*)((s)->p + 1)) << 8) | \
+ (*((unsigned char*)((s)->p + 2)) << 16) | \
+ (*((unsigned char*)((s)->p + 3)) << 24) \
+ ); \
+ (s)->p += 4; \
+}
+#else
+#define in_uint32_le(s, v) \
+{ \
+ (v) = *((unsigned int*)((s)->p)); \
+ (s)->p += 4; \
+}
+#endif
+
+/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define in_uint16_le(s, v) \
+{ \
+ (v) = (unsigned short) \
+ ( \
+ (*((unsigned char*)((s)->p + 0)) << 0) | \
+ (*((unsigned char*)((s)->p + 1)) << 8) \
+ ); \
+ (s)->p += 2; \
+}
+#else
+#define in_uint16_le(s, v) \
+{ \
+ (v) = *((unsigned short*)((s)->p)); \
+ (s)->p += 2; \
+}
+#endif
+
+/******************************************************************************/
+#define s_mark_end(s) \
+{ \
+ (s)->end = (s)->p; \
+}
+
+/******************************************************************************/
+#define make_stream(s) \
+{ \
+ (s) = (struct stream*)g_malloc(sizeof(struct stream), 1); \
+}
+
+/******************************************************************************/
+#define free_stream(s) do \
+{ \
+ if ((s) != 0) \
+ { \
+ g_free((s)->data); \
+ } \
+ g_free((s)); \
+} while (0)
+
#endif
diff --git a/xorg/server/module/rdpPixmap.c b/xorg/server/module/rdpPixmap.c
new file mode 100644
index 00000000..08b76735
--- /dev/null
+++ b/xorg/server/module/rdpPixmap.c
@@ -0,0 +1,94 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+pixmap calls
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
+#include "rdp.h"
+#include "rdpDraw.h"
+
+/******************************************************************************/
+#define LOG_LEVEL 1
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
+/*****************************************************************************/
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ rdpPtr dev;
+ PixmapPtr rv;
+
+ LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d",
+ width, height, depth));
+ dev = rdpGetDevFromScreen(pScreen);
+ pScreen->CreatePixmap = dev->CreatePixmap;
+ rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
+ pScreen->CreatePixmap = rdpCreatePixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+
+ LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt));
+ pScreen = pPixmap->drawable.pScreen;
+ dev = rdpGetDevFromScreen(pScreen);
+ pScreen->DestroyPixmap = dev->DestroyPixmap;
+ rv = pScreen->DestroyPixmap(pPixmap);
+ pScreen->DestroyPixmap = rdpDestroyPixmap;
+ return rv;
+}
+
+/******************************************************************************/
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ Bool rv;
+ ScreenPtr pScreen;
+ rdpPtr dev;
+
+ LLOGLN(10, ("rdpModifyPixmapHeader:"));
+ pScreen = pPixmap->drawable.pScreen;
+ dev = rdpGetDevFromScreen(pScreen);
+ pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader;
+ rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel,
+ devKind, pPixData);
+ pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
+ return rv;
+}
diff --git a/xorg/server/module/rdpPixmap.h b/xorg/server/module/rdpPixmap.h
new file mode 100644
index 00000000..8456593f
--- /dev/null
+++ b/xorg/server/module/rdpPixmap.h
@@ -0,0 +1,36 @@
+/*
+Copyright 2005-2013 Jay Sorg
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+pixmap calls
+
+*/
+
+#ifndef __RDPPIXMAP_H
+#define __RDPPIXAMP_H
+
+PixmapPtr
+rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
+Bool
+rdpDestroyPixmap(PixmapPtr pPixmap);
+Bool
+rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData);
+
+#endif
diff --git a/xorg/server/module/rdpPolyArc.c b/xorg/server/module/rdpPolyArc.c
index 63fc699b..e4282524 100644
--- a/xorg/server/module/rdpPolyArc.c
+++ b/xorg/server/module/rdpPolyArc.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -30,8 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void
rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
diff --git a/xorg/server/module/rdpPolyFillArc.c b/xorg/server/module/rdpPolyFillArc.c
index b53a1131..825dc20d 100644
--- a/xorg/server/module/rdpPolyFillArc.c
+++ b/xorg/server/module/rdpPolyFillArc.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -30,8 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void
rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
diff --git a/xorg/server/module/rdpPolyFillRect.c b/xorg/server/module/rdpPolyFillRect.c
index dc929f9f..1de9cee1 100644
--- a/xorg/server/module/rdpPolyFillRect.c
+++ b/xorg/server/module/rdpPolyFillRect.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ static void
rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
xRectangle *prectInit)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
diff --git a/xorg/server/module/rdpPolyGlyphBlt.c b/xorg/server/module/rdpPolyGlyphBlt.c
index 5265ed72..2ba11996 100644
--- a/xorg/server/module/rdpPolyGlyphBlt.c
+++ b/xorg/server/module/rdpPolyGlyphBlt.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -32,8 +43,7 @@ rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
diff --git a/xorg/server/module/rdpPolyPoint.c b/xorg/server/module/rdpPolyPoint.c
index 6c9c77c1..8379c1c6 100644
--- a/xorg/server/module/rdpPolyPoint.c
+++ b/xorg/server/module/rdpPolyPoint.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ void
rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
diff --git a/xorg/server/module/rdpPolyRectangle.c b/xorg/server/module/rdpPolyRectangle.c
index e80b8178..90b23961 100644
--- a/xorg/server/module/rdpPolyRectangle.c
+++ b/xorg/server/module/rdpPolyRectangle.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ static void
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
diff --git a/xorg/server/module/rdpPolySegment.c b/xorg/server/module/rdpPolySegment.c
index f4a9d40c..1ae62d27 100644
--- a/xorg/server/module/rdpPolySegment.c
+++ b/xorg/server/module/rdpPolySegment.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -30,8 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void
rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
diff --git a/xorg/server/module/rdpPolyText16.c b/xorg/server/module/rdpPolyText16.c
index b5eac8c5..4a716e3f 100644
--- a/xorg/server/module/rdpPolyText16.c
+++ b/xorg/server/module/rdpPolyText16.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,9 +42,8 @@ int
rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
+ GC_OP_VARS;
int rv;
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars);
diff --git a/xorg/server/module/rdpPolyText8.c b/xorg/server/module/rdpPolyText8.c
index 8931a4c1..e6671252 100644
--- a/xorg/server/module/rdpPolyText8.c
+++ b/xorg/server/module/rdpPolyText8.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,9 +42,8 @@ int
rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
+ GC_OP_VARS;
int rv;
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars);
diff --git a/xorg/server/module/rdpPolylines.c b/xorg/server/module/rdpPolylines.c
index b439db28..7558407e 100644
--- a/xorg/server/module/rdpPolylines.c
+++ b/xorg/server/module/rdpPolylines.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ static void
rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
diff --git a/xorg/server/module/rdpPushPixels.c b/xorg/server/module/rdpPushPixels.c
index 3491d556..bab4b03d 100644
--- a/xorg/server/module/rdpPushPixels.c
+++ b/xorg/server/module/rdpPushPixels.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ void
rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
diff --git a/xorg/server/module/rdpPutImage.c b/xorg/server/module/rdpPutImage.c
index 2d9faa89..f7a33f7c 100644
--- a/xorg/server/module/rdpPutImage.c
+++ b/xorg/server/module/rdpPutImage.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -31,8 +42,7 @@ static void
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *pBits)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c
index fd080184..ad3808bd 100644
--- a/xorg/server/module/rdpRandR.c
+++ b/xorg/server/module/rdpRandR.c
@@ -69,29 +69,8 @@ Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize)
{
- ScrnInfoPtr pScrn;
- rdpPtr dev;
- rrScrPrivPtr pRRScrPriv;
- Bool rv;
-
LLOGLN(0, ("rdpRRSetConfig:"));
- rv = TRUE;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
-#if 0
- pRRScrPriv = rrGetScrPriv(pScreen);
- if (pRRScrPriv != 0)
- {
- if (dev->rrSetConfig != 0)
- {
- LLOGLN(0, ("rdpRRSetConfig: here"));
- pRRScrPriv->rrSetConfig = dev->rrSetConfig;
- rv = pRRScrPriv->rrSetConfig(pScreen, rotateKind, rate, pSize);
- pRRScrPriv->rrSetConfig = rdpRRSetConfig;
- }
- }
-#endif
- return rv;
+ return TRUE;
}
/******************************************************************************/
@@ -100,34 +79,15 @@ rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
int width;
int height;
- ScrnInfoPtr pScrn;
rdpPtr dev;
- rrScrPrivPtr pRRScrPriv;
- Bool rv;
LLOGLN(0, ("rdpRRGetInfo:"));
- rv = TRUE;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
-#if 0
- pRRScrPriv = rrGetScrPriv(pScreen);
- if (pRRScrPriv != 0)
- {
- if (dev->rrGetInfo != 0)
- {
- LLOGLN(0, ("rdpRRGetInfo: here"));
- pRRScrPriv->rrGetInfo = dev->rrGetInfo;
- rv = pRRScrPriv->rrGetInfo(pScreen, pRotations);
- pRRScrPriv->rrGetInfo = rdpRRGetInfo;
- }
- }
-#else
+ dev = rdpGetDevFromScreen(pScreen);
*pRotations = RR_Rotate_0;
width = dev->width;
height = dev->height;
rdpRRRegisterSize(pScreen, width, height);
-#endif
- return rv;
+ return TRUE;
}
/******************************************************************************/
@@ -138,13 +98,11 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
WindowPtr root;
PixmapPtr screenPixmap;
BoxRec box;
- ScrnInfoPtr pScrn;
rdpPtr dev;
LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d",
width, height, (int)mmWidth, (int)mmHeight));
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
root = rdpGetRootWindowPtr(pScreen);
if ((width < 1) || (height < 1))
{
@@ -266,12 +224,10 @@ Bool
rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16 *border)
{
- ScrnInfoPtr pScrn;
rdpPtr dev;
LLOGLN(0, ("rdpRRGetPanning: %p", crtc));
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
if (totalArea != 0)
{
diff --git a/xorg/server/module/rdpReg.c b/xorg/server/module/rdpReg.c
index 3a343f14..e0cd4ea5 100644
--- a/xorg/server/module/rdpReg.c
+++ b/xorg/server/module/rdpReg.c
@@ -20,6 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
to deal with regions changing in xorg versions
*/
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/xorg/server/module/rdpSetSpans.c b/xorg/server/module/rdpSetSpans.c
index 1bd9ed80..c2ea798e 100644
--- a/xorg/server/module/rdpSetSpans.c
+++ b/xorg/server/module/rdpSetSpans.c
@@ -19,6 +19,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* this should be before all X11 .h files */
+#include <xorg-server.h>
+
+/* all driver need this */
+#include <xf86.h>
+#include <xf86_OSproc.h>
+
#include "rdp.h"
#include "rdpDraw.h"
@@ -33,8 +44,7 @@ void
rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
- rdpGCPtr priv;
- GCFuncs *oldFuncs;
+ GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt
index 1207efda..dce66306 100644
--- a/xorg/server/readme.txt
+++ b/xorg/server/readme.txt
@@ -44,3 +44,6 @@ sudo mknod -m 666 /dev/vc/7 c 7 7
----input
xrdpkeyb_drv.so
xrdpmouse_drv.so
+
+dpkg -S /usr/lib/xorg/modules/extensions/libglx.so
+xserver-xorg-core
diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c
index cc863d4d..2bc6732a 100644
--- a/xorg/server/xrdpdev/xrdpdev.c
+++ b/xorg/server/xrdpdev/xrdpdev.c
@@ -47,6 +47,8 @@ This is the main driver file
#include "rdpMisc.h"
#include "rdpComposite.h"
#include "rdpGlyphs.h"
+#include "rdpPixmap.h"
+#include "rdpClientCon.h"
#define XRDP_DRIVER_NAME "XRDPDEV"
#define XRDP_NAME "XRDPDEV"
@@ -152,8 +154,6 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- rdpPrivateInit();
-
rdpAllocRec(pScrn);
dev = XRDPPTR(pScrn);
@@ -305,7 +305,7 @@ rdpResizeSession(rdpPtr dev, int width, int height)
{
LLOGLN(0, (" calling RRScreenSizeSet"));
ok = RRScreenSizeSet(dev->pScreen, width, height, mmwidth, mmheight);
- LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok));
+ LLOGLN(0, (" RRScreenSizeSet ok %d", ok));
}
return ok;
}
@@ -317,15 +317,13 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg)
{
ScreenPtr pScreen;
rrScrPrivPtr pRRScrPriv;
- ScrnInfoPtr pScrn;
rdpPtr dev;
char *envvar;
int width;
int height;
pScreen = (ScreenPtr) arg;
- pScrn = xf86Screens[pScreen->myNum];
- dev = XRDPPTR(pScrn);
+ dev = rdpGetDevFromScreen(pScreen);
LLOGLN(10, ("rdpDeferredRandR:"));
pRRScrPriv = rrGetScrPriv(pScreen);
if (pRRScrPriv == 0)
@@ -396,6 +394,19 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg)
return 0;
}
+/******************************************************************************/
+static void
+rdpBlockHandler1(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+}
+
+/******************************************************************************/
+static void
+rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
+{
+ rdpClientConCheck((ScreenPtr)blockData);
+}
+
/*****************************************************************************/
static Bool
rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
@@ -413,7 +424,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miClearVisualTypes();
miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
- pScrn->rgbBits, TrueColor);
+ pScrn->rgbBits, TrueColor);
miSetPixmapDepths();
LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d rgbBits %d depth %d",
pScrn->virtualX, pScrn->virtualY, pScrn->rgbBits, pScrn->depth));
@@ -521,8 +532,15 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ps->Glyphs = rdpGlyphs;
}
+ RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, pScreen);
+
g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen);
+ if (rdpClientConInit(dev) != 0)
+ {
+ LLOGLN(0, ("rdpScreenInit: rdpClientConInit failed"));
+ }
+
LLOGLN(0, ("rdpScreenInit: out"));
return TRUE;
}
@@ -696,10 +714,17 @@ xrdpdevSetup(pointer module, pointer opts, int *errmaj, int *errmin)
}
}
+/*****************************************************************************/
+static void
+xrdpdevTearDown(pointer Module)
+{
+ LLOGLN(0, ("xrdpdevTearDown:"));
+}
+
/* <drivername>ModuleData */
_X_EXPORT XF86ModuleData xrdpdevModuleData =
{
&g_VersRec,
xrdpdevSetup,
- 0
+ xrdpdevTearDown
};
diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c
index 4fda5e76..26ba73b4 100644
--- a/xorg/server/xrdpkeyb/rdpKeyboard.c
+++ b/xorg/server/xrdpkeyb/rdpKeyboard.c
@@ -39,12 +39,13 @@ xrdp keyboard module
#include <micmap.h>
#include <mi.h>
+#include <xkbsrv.h>
+
#include "X11/keysym.h"
#include "rdp.h"
-
-/* if 1, a keystroke is done every minute, down, then up */
-#define XRDPKB_TEST 0
+#include "rdpInput.h"
+#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -83,9 +84,6 @@ xrdp keyboard module
#define N_PREDEFINED_KEYS \
(sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
-static DeviceIntPtr g_keyboard = 0;
-static OsTimerPtr g_timer = 0;
-
static KeySym g_kbdMap[] =
{
NoSymbol, NoSymbol, /* 8 */
@@ -129,7 +127,7 @@ static KeySym g_kbdMap[] =
XK_L, NoSymbol,
XK_semicolon, XK_colon,
XK_apostrophe, XK_quotedbl,
- XK_grave, XK_asciitilde,
+ XK_grave, XK_asciitilde,
XK_Shift_L, NoSymbol, /* 50 */
XK_backslash, XK_bar,
XK_Z, NoSymbol,
@@ -206,34 +204,307 @@ static KeySym g_kbdMap[] =
/******************************************************************************/
static void
-rdpEnqueueKey(int type, int scancode)
+rdpEnqueueKey(DeviceIntPtr device, int type, int scancode)
{
if (type == KeyPress)
{
- /* need this cause rdp and X11 repeats are different */
- xf86PostKeyboardEvent(g_keyboard, scancode, FALSE);
- xf86PostKeyboardEvent(g_keyboard, scancode, TRUE);
+ xf86PostKeyboardEvent(device, scancode, TRUE);
}
else
{
- xf86PostKeyboardEvent(g_keyboard, scancode, FALSE);
+ xf86PostKeyboardEvent(device, scancode, FALSE);
}
}
-#if XRDPKB_TEST
/******************************************************************************/
-static CARD32
-rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg)
+static void
+sendDownUpKeyEvent(DeviceIntPtr device, int type, int x_scancode)
{
- LLOGLN(0, ("rdpDeferredUpdateCallback:"));
+ /* need this cause rdp and X11 repeats are different */
+ /* if type is keydown, send keyup + keydown */
+ if (type == KeyPress)
+ {
+ rdpEnqueueKey(device, KeyRelease, x_scancode);
+ rdpEnqueueKey(device, KeyPress, x_scancode);
+ }
+ else
+ {
+ rdpEnqueueKey(device, KeyRelease, x_scancode);
+ }
+}
- rdpEnqueueKey(KeyPress, 115);
- rdpEnqueueKey(KeyRelease, 115);
+/******************************************************************************/
+static void
+check_keysa(rdpKeyboard *keyboard)
+{
+ if (keyboard->ctrl_down != 0)
+ {
+ rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->ctrl_down);
+ keyboard->ctrl_down = 0;
+ }
+
+ if (keyboard->alt_down != 0)
+ {
+ rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->alt_down);
+ keyboard->alt_down = 0;
+ }
+
+ if (keyboard->shift_down != 0)
+ {
+ rdpEnqueueKey(keyboard->device, KeyRelease, keyboard->shift_down);
+ keyboard->shift_down = 0;
+ }
+}
+
+/**
+ * @param down - true for KeyDown events, false otherwise
+ * @param param1 - ASCII code of pressed key
+ * @param param2 -
+ * @param param3 - scancode of pressed key
+ * @param param4 -
+ ******************************************************************************/
+static void
+KbdAddEvent(rdpKeyboard *keyboard, int down, int param1, int param2,
+ int param3, int param4)
+{
+ int rdp_scancode;
+ int x_scancode;
+ int is_ext;
+ int is_spe;
+ int type;
+
+ type = down ? KeyPress : KeyRelease;
+ rdp_scancode = param3;
+ is_ext = param4 & 256; /* 0x100 */
+ is_spe = param4 & 512; /* 0x200 */
+ x_scancode = 0;
+
+ switch (rdp_scancode)
+ {
+ case 58: /* caps lock */
+ case 42: /* left shift */
+ case 54: /* right shift */
+ case 70: /* scroll lock */
+ x_scancode = rdp_scancode + MIN_KEY_CODE;
+
+ if (x_scancode > 0)
+ {
+ rdpEnqueueKey(keyboard->device, type, x_scancode);
+ }
+
+ break;
+
+ case 56: /* left - right alt button */
+
+ if (is_ext)
+ {
+ x_scancode = 113; /* right alt button */
+ }
+ else
+ {
+ x_scancode = 64; /* left alt button */
+ }
+
+ rdpEnqueueKey(keyboard->device, type, x_scancode);
+ break;
+
+ case 15: /* tab */
+
+ if (!down && !keyboard->tab_down)
+ {
+ /* leave x_scancode 0 here, we don't want the tab key up */
+ check_keysa(keyboard);
+ }
+ else
+ {
+ sendDownUpKeyEvent(keyboard->device, type, 23);
+ }
+
+ keyboard->tab_down = down;
+ break;
+
+ case 29: /* left or right ctrl */
+
+ /* this is to handle special case with pause key sending control first */
+ if (is_spe)
+ {
+ if (down)
+ {
+ keyboard->pause_spe = 1;
+ /* leave x_scancode 0 here, we don't want the control key down */
+ }
+ }
+ else
+ {
+ x_scancode = is_ext ? 109 : 37;
+ keyboard->ctrl_down = down ? x_scancode : 0;
+ rdpEnqueueKey(keyboard->device, type, x_scancode);
+ }
+
+ break;
+
+ case 69: /* Pause or Num Lock */
+
+ if (keyboard->pause_spe)
+ {
+ x_scancode = 110;
+
+ if (!down)
+ {
+ keyboard->pause_spe = 0;
+ }
+ }
+ else
+ {
+ x_scancode = keyboard->ctrl_down ? 110 : 77;
+ }
+
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 28: /* Enter or Return */
+ x_scancode = is_ext ? 108 : 36;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 53: /* / */
+ x_scancode = is_ext ? 112 : 61;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 55: /* * on KP or Print Screen */
+ x_scancode = is_ext ? 111 : 63;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 71: /* 7 or Home */
+ x_scancode = is_ext ? 97 : 79;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
- g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0);
+ case 72: /* 8 or Up */
+ x_scancode = is_ext ? 98 : 80;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 73: /* 9 or PgUp */
+ x_scancode = is_ext ? 99 : 81;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 75: /* 4 or Left */
+ x_scancode = is_ext ? 100 : 83;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 77: /* 6 or Right */
+ x_scancode = is_ext ? 102 : 85;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 79: /* 1 or End */
+ x_scancode = is_ext ? 103 : 87;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 80: /* 2 or Down */
+ x_scancode = is_ext ? 104 : 88;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 81: /* 3 or PgDn */
+ x_scancode = is_ext ? 105 : 89;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 82: /* 0 or Insert */
+ x_scancode = is_ext ? 106 : 90;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 83: /* . or Delete */
+ x_scancode = is_ext ? 107 : 91;
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ break;
+
+ case 91: /* left win key */
+ rdpEnqueueKey(keyboard->device, type, 115);
+ break;
+
+ case 92: /* right win key */
+ rdpEnqueueKey(keyboard->device, type, 116);
+ break;
+
+ case 93: /* menu key */
+ rdpEnqueueKey(keyboard->device, type, 117);
+ break;
+
+ default:
+ x_scancode = rdp_scancode + MIN_KEY_CODE;
+
+ if (x_scancode > 0)
+ {
+ sendDownUpKeyEvent(keyboard->device, type, x_scancode);
+ }
+
+ break;
+ }
+}
+
+/******************************************************************************/
+/* notes -
+ scroll lock doesn't seem to be a modifier in X
+*/
+static void
+KbdSync(rdpKeyboard *keyboard, int param1)
+{
+ int xkb_state;
+
+ xkb_state = XkbStateFieldFromRec(&(keyboard->device->key->xkbInfo->state));
+
+ if ((!(xkb_state & 0x02)) != (!(param1 & 4))) /* caps lock */
+ {
+ LLOGLN(0, ("KbdSync: toggling caps lock"));
+ KbdAddEvent(keyboard, 1, 58, 0, 58, 0);
+ KbdAddEvent(keyboard, 0, 58, 49152, 58, 49152);
+ }
+
+ if ((!(xkb_state & 0x10)) != (!(param1 & 2))) /* num lock */
+ {
+ LLOGLN(0, ("KbdSync: toggling num lock"));
+ KbdAddEvent(keyboard, 1, 69, 0, 69, 0);
+ KbdAddEvent(keyboard, 0, 69, 49152, 69, 49152);
+ }
+
+ if ((!(keyboard->scroll_lock_down)) != (!(param1 & 1))) /* scroll lock */
+ {
+ LLOGLN(0, ("KbdSync: toggling scroll lock"));
+ KbdAddEvent(keyboard, 1, 70, 0, 70, 0);
+ KbdAddEvent(keyboard, 0, 70, 49152, 70, 49152);
+ }
+}
+
+/******************************************************************************/
+static int
+rdpInputKeyboard(rdpPtr dev, int msg, long param1, long param2,
+ long param3, long param4)
+{
+ rdpKeyboard *keyboard;
+
+ keyboard = &(dev->keyboard);
+ LLOGLN(0, ("rdpInputKeyboard:"));
+ switch (msg)
+ {
+ case 15: /* key down */
+ case 16: /* key up */
+ KbdAddEvent(keyboard, msg == 15, param1, param2, param3, param4);
+ break;
+ case 17: /* from RDP_INPUT_SYNCHRONIZE */
+ KbdSync(keyboard, param1);
+ break;
+ }
return 0;
}
-#endif
/******************************************************************************/
void
@@ -322,6 +593,7 @@ rdpkeybControl(DeviceIntPtr device, int what)
CARD8 modMap[MAP_LENGTH];
DevicePtr pDev;
XkbRMLVOSet set;
+ rdpPtr dev;
LLOGLN(0, ("rdpkeybControl: what %d", what));
pDev = (DevicePtr)device;
@@ -338,10 +610,9 @@ rdpkeybControl(DeviceIntPtr device, int what)
set.options = "";
InitKeyboardDeviceStruct(device, &set, rdpkeybBell,
rdpkeybChangeKeyboardControl);
- g_keyboard = device;
-#if XRDPKB_TEST
- g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0);
-#endif
+ dev = rdpGetDevFromScreen(NULL);
+ dev->keyboard.device = device;
+ rdpRegisterInputCallback(0, rdpInputKeyboard);
break;
case DEVICE_ON:
pDev->on = 1;
@@ -426,13 +697,6 @@ static InputDriverRec rdpkeyb =
};
/******************************************************************************/
-static void
-rdpkeybUnplug(pointer p)
-{
- LLOGLN(0, ("rdpkeybUnplug:"));
-}
-
-/******************************************************************************/
static pointer
rdpkeybPlug(pointer module, pointer options, int *errmaj, int *errmin)
{
@@ -442,6 +706,13 @@ rdpkeybPlug(pointer module, pointer options, int *errmaj, int *errmin)
}
/******************************************************************************/
+static void
+rdpkeybUnplug(pointer p)
+{
+ LLOGLN(0, ("rdpkeybUnplug:"));
+}
+
+/******************************************************************************/
static XF86ModuleVersionInfo rdpkeybVersionRec =
{
XRDP_DRIVER_NAME,
@@ -459,7 +730,7 @@ static XF86ModuleVersionInfo rdpkeybVersionRec =
};
/******************************************************************************/
-XF86ModuleData xrdpkeybModuleData =
+_X_EXPORT XF86ModuleData xrdpkeybModuleData =
{
&rdpkeybVersionRec,
rdpkeybPlug,
diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c
index 7142a4ee..6215c408 100644
--- a/xorg/server/xrdpmouse/rdpMouse.c
+++ b/xorg/server/xrdpmouse/rdpMouse.c
@@ -42,6 +42,8 @@ xrdp mouse module
#include <xserver-properties.h>
#include "rdp.h"
+#include "rdpInput.h"
+#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
@@ -86,12 +88,134 @@ rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl)
/******************************************************************************/
static int
+l_bound_by(int val, int low, int high)
+{
+ val = RDPCLAMP(val, low, high);
+ return val;
+}
+
+/******************************************************************************/
+static void
+rdpEnqueueMotion(DeviceIntPtr device, int x, int y)
+{
+ int valuators[2];
+
+ valuators[0] = x;
+ valuators[1] = y;
+ xf86PostMotionEvent(device, TRUE, 0, 2, valuators);
+}
+
+/******************************************************************************/
+static void
+rdpEnqueueButton(DeviceIntPtr device, int type, int buttons)
+{
+ xf86PostButtonEvent(device, FALSE, buttons, type, 0, 0);
+}
+
+/******************************************************************************/
+static void
+PtrAddEvent(rdpPointer *pointer)
+{
+ int i;
+ int type;
+ int buttons;
+
+ rdpEnqueueMotion(pointer->device, pointer->cursor_x, pointer->cursor_y);
+
+ for (i = 0; i < 5; i++)
+ {
+ if ((pointer->button_mask ^ pointer->old_button_mask) & (1 << i))
+ {
+ if (pointer->button_mask & (1 << i))
+ {
+ type = ButtonPress;
+ buttons = i + 1;
+ rdpEnqueueButton(pointer->device, type, buttons);
+ }
+ else
+ {
+ type = ButtonRelease;
+ buttons = i + 1;
+ rdpEnqueueButton(pointer->device, type, buttons);
+ }
+ }
+ }
+
+ pointer->old_button_mask = pointer->button_mask;
+}
+
+/******************************************************************************/
+static int
+rdpInputMouse(rdpPtr dev, int msg,
+ long param1, long param2,
+ long param3, long param4)
+{
+ rdpPointer *pointer;
+
+ LLOGLN(0, ("rdpInputMouse:"));
+ pointer = &(dev->pointer);
+ switch (msg)
+ {
+ case 100:
+ /* without the minus 2, strange things happen when dragging
+ past the width or height */
+ pointer->cursor_x = l_bound_by(param1, 0, dev->width - 2);
+ pointer->cursor_y = l_bound_by(param2, 0, dev->height - 2);
+ PtrAddEvent(pointer);
+ break;
+ case 101:
+ pointer->button_mask = pointer->button_mask & (~1);
+ PtrAddEvent(pointer);
+ break;
+ case 102:
+ pointer->button_mask = pointer->button_mask | 1;
+ PtrAddEvent(pointer);
+ break;
+ case 103:
+ pointer->button_mask = pointer->button_mask & (~4);
+ PtrAddEvent(pointer);
+ break;
+ case 104:
+ pointer->button_mask = pointer->button_mask | 4;
+ PtrAddEvent(pointer);
+ break;
+ case 105:
+ pointer->button_mask = pointer->button_mask & (~2);
+ PtrAddEvent(pointer);
+ break;
+ case 106:
+ pointer->button_mask = pointer->button_mask | 2;
+ PtrAddEvent(pointer);
+ break;
+ case 107:
+ pointer->button_mask = pointer->button_mask & (~8);
+ PtrAddEvent(pointer);
+ break;
+ case 108:
+ pointer->button_mask = pointer->button_mask | 8;
+ PtrAddEvent(pointer);
+ break;
+ case 109:
+ pointer->button_mask = pointer->button_mask & (~16);
+ PtrAddEvent(pointer);
+ break;
+ case 110:
+ pointer->button_mask = pointer->button_mask | 16;
+ PtrAddEvent(pointer);
+ break;
+ }
+ return 0;
+}
+
+/******************************************************************************/
+static int
rdpmouseControl(DeviceIntPtr device, int what)
{
BYTE map[6];
DevicePtr pDev;
Atom btn_labels[6];
Atom axes_labels[2];
+ rdpPtr dev;
LLOGLN(0, ("rdpmouseControl: what %d", what));
pDev = (DevicePtr)device;
@@ -118,7 +242,9 @@ rdpmouseControl(DeviceIntPtr device, int what)
InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl,
GetMotionHistorySize(), 2, axes_labels);
-
+ dev = rdpGetDevFromScreen(NULL);
+ dev->pointer.device = device;
+ rdpRegisterInputCallback(1, rdpInputMouse);
break;
case DEVICE_ON:
pDev->on = 1;
@@ -205,13 +331,6 @@ static InputDriverRec rdpmouse =
};
/******************************************************************************/
-static void
-rdpmouseUnplug(pointer p)
-{
- LLOGLN(0, ("rdpmouseUnplug:"));
-}
-
-/******************************************************************************/
static pointer
rdpmousePlug(pointer module, pointer options, int *errmaj, int *errmin)
{
@@ -221,6 +340,13 @@ rdpmousePlug(pointer module, pointer options, int *errmaj, int *errmin)
}
/******************************************************************************/
+static void
+rdpmouseUnplug(pointer p)
+{
+ LLOGLN(0, ("rdpmouseUnplug:"));
+}
+
+/******************************************************************************/
static XF86ModuleVersionInfo rdpmouseVersionRec =
{
XRDP_DRIVER_NAME,
@@ -238,7 +364,7 @@ static XF86ModuleVersionInfo rdpmouseVersionRec =
};
/******************************************************************************/
-XF86ModuleData xrdpmouseModuleData =
+_X_EXPORT XF86ModuleData xrdpmouseModuleData =
{
&rdpmouseVersionRec,
rdpmousePlug,
diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini
index ea6576cb..8d97c0d3 100644
--- a/xrdp/xrdp.ini
+++ b/xrdp/xrdp.ini
@@ -24,6 +24,10 @@ tcp_keepalive=yes
#background=626c72
#autorun=xrdp1
#hidelogwindow=yes
+
+# when true, userid/password *must* be passed on cmd line
+# require_credentials=yes
+
#bulk_compression=yes
# You can set the PAM error text in a gateway setup (MAX 256 chars)
#pamerrortxt=change your password according to policy at http://url