Merge branch 'devel' of github.com:neutrinolabs/xrdp into devel

ulab-next
Jay Sorg 11 years ago
commit a9701a7cc3

@ -473,6 +473,24 @@ xrdp_jpeg_compress(void *handle, char* in_data, int width, int height,
struct stream* s, int bpp, int byte_limit, struct stream* s, int bpp, int byte_limit,
int start_line, struct stream* temp_s, int start_line, struct stream* temp_s,
int e, int quality); int e, int quality);
int APP_CC
xrdp_codec_jpeg_compress(void *handle,
int format, /* input data format */
char *inp_data, /* input data */
int width, /* width of inp_data */
int height, /* height of inp_data */
int stride, /* inp_data stride, in bytes*/
int x, /* x loc in inp_data */
int y, /* y loc in inp_data */
int cx, /* width of area to compress */
int cy, /* height of area to compress */
int quality, /* higher numbers compress less */
char *out_data, /* dest for jpg image */
int *io_len /* length of out_data and on return */
/* len of compressed data */
);
void *APP_CC void *APP_CC
xrdp_jpeg_init(void); xrdp_jpeg_init(void);
int APP_CC int APP_CC

@ -98,6 +98,67 @@ xrdp_jpeg_compress(void *handle, char *in_data, int width, int height,
return height; return height;
} }
/**
* Compress a rectangular area (aka inner rectangle) inside our
* frame buffer (inp_data)
*****************************************************************************/
int APP_CC
xrdp_codec_jpeg_compress(void *handle,
int format, /* input data format */
char *inp_data, /* input data */
int width, /* width of inp_data */
int height, /* height of inp_data */
int stride, /* inp_data stride, in bytes*/
int x, /* x loc in inp_data */
int y, /* y loc in inp_data */
int cx, /* width of area to compress */
int cy, /* height of area to compress */
int quality, /* higher numbers compress less */
char *out_data, /* dest for jpg image */
int *io_len /* length of out_data and on return */
/* len of compressed data */
)
{
tjhandle tj_han;
int error;
int bpp;
char *src_ptr;
/*
* note: for now we assume that format is always XBGR and ignore format
*/
if (handle == 0)
{
g_writeln("xrdp_codec_jpeg_compress: handle is nil");
return height;
}
tj_han = (tjhandle) handle;
/* get bytes per pixel */
bpp = stride / width;
/* start of inner rect in inp_data */
src_ptr = inp_data + (y * stride + x * bpp);
/* compress inner rect */
error = tjCompress(tj_han, /* opaque handle */
src_ptr, /* source buf */
cx, /* width of area to compress */
stride, /* pitch */
cy, /* height of area to compress */
TJPF_XBGR, /* pixel size */
out_data, /* dest buf */
io_len, /* inner_buf length & compressed_size */
TJSAMP_420, /* jpeg sub sample */
quality, /* jpeg quality */
0 /* flags */
);
return height;
}
/*****************************************************************************/ /*****************************************************************************/
void *APP_CC void *APP_CC
xrdp_jpeg_init(void) xrdp_jpeg_init(void)

@ -17,17 +17,17 @@
* limitations under the License. * limitations under the License.
*/ */
#include <freerdp/settings.h>
#include <X11/Xlib.h>
#include "xrdp-neutrinordp.h" #include "xrdp-neutrinordp.h"
#include "xrdp-color.h" #include "xrdp-color.h"
#include "xrdp_rail.h" #include "xrdp_rail.h"
#include "log.h" #include "log.h"
#include <freerdp/settings.h>
#include <X11/Xlib.h>
#ifdef XRDP_DEBUG #ifdef XRDP_DEBUG
#define LOG_LEVEL 99 #define LOG_LEVEL 99
#else #else
#define LOG_LEVEL 1 #define LOG_LEVEL 10
#endif #endif
#define LLOG(_level, _args) \ #define LLOG(_level, _args) \
@ -1478,8 +1478,10 @@ lrail_WindowCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo,
int index; int index;
struct mod *mod; struct mod *mod;
struct rail_window_state_order wso; struct rail_window_state_order wso;
UNICONV* uniconv;
LLOGLN(0, ("llrail_WindowCreate:")); LLOGLN(0, ("llrail_WindowCreate:"));
uniconv = freerdp_uniconv_new();
mod = ((struct mod_context *)context)->modi; mod = ((struct mod_context *)context)->modi;
memset(&wso, 0, sizeof(wso)); memset(&wso, 0, sizeof(wso));
/* copy the window state order */ /* copy the window state order */
@ -1490,7 +1492,8 @@ lrail_WindowCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo,
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
{ {
freerdp_UnicodeToAsciiAlloc(window_state->titleInfo.string, &wso.title_info, window_state->titleInfo.length / 2); wso.title_info = freerdp_uniconv_in(uniconv,
window_state->titleInfo.string, window_state->titleInfo.length);
} }
LLOGLN(0, ("lrail_WindowCreate: %s", wso.title_info)); LLOGLN(0, ("lrail_WindowCreate: %s", wso.title_info));
@ -1616,29 +1619,31 @@ lrail_NotifyIconCreate(rdpContext *context, WINDOW_ORDER_INFO *orderInfo,
{ {
struct mod *mod; struct mod *mod;
struct rail_notify_state_order rnso; struct rail_notify_state_order rnso;
UNICONV* uniconv;
LLOGLN(0, ("lrail_NotifyIconCreate:")); LLOGLN(0, ("lrail_NotifyIconCreate:"));
uniconv = freerdp_uniconv_new();
mod = ((struct mod_context *)context)->modi; mod = ((struct mod_context *)context)->modi;
memset(&rnso, 0, sizeof(rnso)); memset(&rnso, 0, sizeof(rnso));
rnso.version = notify_icon_state->version; rnso.version = notify_icon_state->version;
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
{ {
freerdp_UnicodeToAsciiAlloc(notify_icon_state->toolTip.string, rnso.tool_tip = freerdp_uniconv_in(uniconv,
&rnso.tool_tip, notify_icon_state->toolTip.length / 2); notify_icon_state->toolTip.string, notify_icon_state->toolTip.length);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP) {
{ rnso.infotip.timeout = notify_icon_state->infoTip.timeout;
rnso.infotip.timeout = notify_icon_state->infoTip.timeout; rnso.infotip.flags = notify_icon_state->infoTip.flags;
rnso.infotip.flags = notify_icon_state->infoTip.flags; rnso.infotip.text = freerdp_uniconv_in(uniconv,
freerdp_UnicodeToAsciiAlloc(notify_icon_state->infoTip.text.string, notify_icon_state->infoTip.text.string,
&rnso.infotip.text, notify_icon_state->infoTip.text.length / 2); notify_icon_state->infoTip.text.length);
freerdp_UnicodeToAsciiAlloc(notify_icon_state->infoTip.title.string, rnso.infotip.title = freerdp_uniconv_in(uniconv,
&rnso.infotip.title, notify_icon_state->infoTip.title.length / 2); notify_icon_state->infoTip.title.string,
} notify_icon_state->infoTip.title.length);
}
rnso.state = notify_icon_state->state; rnso.state = notify_icon_state->state;
rnso.icon_cache_entry = notify_icon_state->icon.cacheEntry; rnso.icon_cache_entry = notify_icon_state->icon.cacheEntry;

@ -5,7 +5,7 @@ rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \ rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \ rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \ rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o rdpCapture.o
CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 \ CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 \
-I../../../common -I../../../common

@ -0,0 +1,101 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Laxmikant Rashinkar 2014
*
* 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.
*
* Routines to copy regions from framebuffer to shared memory
*/
#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"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/**
* Copy an array of rectangles from one memory area to another
*****************************************************************************/
Bool rdpCapture(RegionPtr in_reg, RegionPtr out_reg,
void *src, int src_width, int src_height, int src_stride, int src_format,
void *dst, int dst_width, int dst_height, int dst_stride, int dst_format,
int mode)
{
BoxRec rect;
char *src_rect;
char *dst_rect;
int num_regions;
int bpp;
int width;
int height;
int offset;
int bytes;
int i;
int j;
/*
* note: mode = 0: default, one is to one copy
* xxx_format = 0: default, 4 bytes per pixel
*/
/* for now we only handle defaults */
/* number of rectangles to copy */
num_regions = REGION_NUM_RECTS(in_reg);
/* get bytes per pixel */
bpp = src_stride / src_width;
for (i = 0; i < num_regions; i++)
{
/* get rect to copy */
rect = REGION_RECTS(in_reg)[i];
/* get rect dimensions */
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
/* point to start of each rect in respective memory */
offset = rect.y1 * src_stride + rect.x1 * bpp;
src_rect = src + offset;
dst_rect = dst + offset;
/* bytes per line */
bytes = width * bpp;
/* copy one line at a time */
for (j = 0; j < height; j++)
{
memcpy(dst_rect, src_rect, bytes);
src_rect += src_stride;
dst_rect += src_stride;
}
}
return rdpRegionCopy(out_reg, in_reg);
}

@ -0,0 +1,24 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Laxmikant Rashinkar 2014
*
* 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.
*
* Routines to copy regions from framebuffer to shared memory
*/
Bool rdpCapture(RegionPtr in_reg, RegionPtr out_reg,
void *src, int src_width, int src_height, int src_stride, int src_format,
void *dst, int dst_width, int dst_height, int dst_stride, int dst_format,
int mode)

@ -1,7 +1,16 @@
Notes for building xrdpdev_drv.so and libxorgxrdp.so ------------------------------------------------------
Notes for building xrdpdev_drv.so and libxorgxrdp.so
------------------------------------------------------
Pre-requisites:
o sudo apt-get install xserver-xorg-dev
quick and easy way to build and run the driver
o cd xorg/server
o ./test-in-home.sh
o see /etc/X11/xrdp/xorg.conf to see how things are configured
to run it to run it
create /etc/X11/xrdp create /etc/X11/xrdp

Loading…
Cancel
Save