Merge branch 'devel'

master
Jay Sorg 9 years ago
commit ee8998483b

@ -649,17 +649,17 @@ ssl_tls_accept(struct ssl_tls *self)
return 1;
}
self->ssl = SSL_new(self->ctx);
if (self->ssl == NULL)
if (SSL_CTX_use_certificate_chain_file(self->ctx, self->cert) <= 0)
{
g_writeln("ssl_tls_accept: SSL_new failed");
g_writeln("ssl_tls_accept: SSL_CTX_use_certificate_chain_file failed");
return 1;
}
if (SSL_use_certificate_file(self->ssl, self->cert, SSL_FILETYPE_PEM) <= 0)
self->ssl = SSL_new(self->ctx);
if (self->ssl == NULL)
{
g_writeln("ssl_tls_accept: SSL_use_certificate_file failed");
g_writeln("ssl_tls_accept: SSL_new failed");
return 1;
}
@ -685,14 +685,24 @@ ssl_tls_accept(struct ssl_tls *self)
}
/*****************************************************************************/
/* returns error, */
int APP_CC
ssl_tls_disconnect(struct ssl_tls *self)
{
int status = SSL_shutdown(self->ssl);
int status;
if (self == NULL)
{
return 0;
}
if (self->ssl == NULL)
{
return 0;
}
status = SSL_shutdown(self->ssl);
while (status != 1)
{
status = SSL_shutdown(self->ssl);
if (status <= 0)
{
if (ssl_tls_print_error("SSL_shutdown", self->ssl, status))

@ -19,6 +19,13 @@ setxkbmap -model pc104 -layout de
setxkbmap -model pc104 -layout it
./xrdp-genkeymap ../instfiles/km-0410.ini
# Japanese 'jp' 0x0411
setxkbmap -model jp106 -layout jp -variant OADG109A
./xrdp-genkeymap ../instfiles/km-0411.ini
./xrdp-genkeymap ../instfiles/km-e0010411.ini
./xrdp-genkeymap ../instfiles/km-e0200411.ini
./xrdp-genkeymap ../instfiles/km-e0210411.ini
# Polish 'pl' 0x0415
setxkbmap -model pc104 -layout pl
./xrdp-genkeymap ../instfiles/km-0415.ini

@ -22,10 +22,14 @@ startscript_DATA = \
km-0409.ini \
km-040c.ini \
km-0410.ini \
km-0411.ini \
km-0415.ini \
km-0419.ini \
km-041d.ini \
km-0816.ini
km-0816.ini \
km-e0010411.ini \
km-e0200411.ini \
km-e0210411.ini
# must be tab below
install-data-hook:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,7 +1,12 @@
.nofail
.fail
load-module module-augment-properties
load-module module-always-sink
.ifexists module-xrdp-sink.so
load-module module-xrdp-sink
.endif
.ifexists module-xrdp-source.so
load-module module-xrdp-source
load-module module-always-sink
.endif
load-module module-native-protocol-unix

@ -117,16 +117,36 @@ xrdp_fastpath_init(struct xrdp_fastpath *self, struct stream *s)
int APP_CC
xrdp_fastpath_send(struct xrdp_fastpath *self, struct stream *s)
{
if (trans_force_write_s(self->trans, s) != 0)
if (trans_force_write_s(self->trans, s) != 0)
{
return 1;
}
return 0;
}
/*****************************************************************************/
static int APP_CC
xrdp_fastpath_session_callback(struct xrdp_fastpath *self, int msg,
long param1, long param2,
long param3, long param4)
{
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, msg,
param1, param2, param3, param4);
}
return 0;
}
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT_SCANCODE */
int APP_CC
static int APP_CC
xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
@ -152,25 +172,17 @@ xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self,
if ((eventFlags & FASTPATH_INPUT_KBDFLAGS_EXTENDED))
flags |= KBD_FLAG_EXT;
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, RDP_INPUT_SCANCODE, code, 0,
flags, 0);
}
xrdp_fastpath_session_callback(self, RDP_INPUT_SCANCODE,
code, 0, flags, 0);
return 0;
}
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT_MOUSE */
int APP_CC
xrdp_fastpath_process_EVENT_MOUSE(struct xrdp_fastpath *self, int eventFlags,
struct stream *s)
static int APP_CC
xrdp_fastpath_process_EVENT_MOUSE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
int pointerFlags;
int xPos;
@ -190,23 +202,15 @@ xrdp_fastpath_process_EVENT_MOUSE(struct xrdp_fastpath *self, int eventFlags,
in_uint16_le(s, xPos); /* xPos (2 bytes) */
in_uint16_le(s, yPos); /* yPos (2 bytes) */
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, RDP_INPUT_MOUSE,
xPos, yPos, pointerFlags, 0);
}
xrdp_fastpath_session_callback(self, RDP_INPUT_MOUSE,
xPos, yPos, pointerFlags, 0);
return 0;
}
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT_MOUSEX */
int APP_CC
static int APP_CC
xrdp_fastpath_process_EVENT_MOUSEX(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
@ -228,50 +232,35 @@ xrdp_fastpath_process_EVENT_MOUSEX(struct xrdp_fastpath *self,
in_uint16_le(s, xPos); /* xPos (2 bytes) */
in_uint16_le(s, yPos); /* yPos (2 bytes) */
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, RDP_INPUT_MOUSEX,
xPos, yPos, pointerFlags, 0);
}
xrdp_fastpath_session_callback(self, RDP_INPUT_MOUSEX,
xPos, yPos, pointerFlags, 0);
return 0;
}
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT_SYNC */
int APP_CC
xrdp_fastpath_process_EVENT_SYNC(struct xrdp_fastpath *self, int eventCode,
static int APP_CC
xrdp_fastpath_process_EVENT_SYNC(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
/*
/*
* The eventCode bitfield (3 bits in size) MUST be set to
* FASTPATH_INPUT_EVENT_SYNC (3).
* The eventFlags bitfield (5 bits in size) contains flags
* indicating the "on"
* status of the keyboard toggle keys.
*/
if (self->session->callback != 0)
{
/* msg_type can be
RDP_INPUT_SYNCHRONIZE - 0
RDP_INPUT_SCANCODE - 4
RDP_INPUT_MOUSE - 0x8001
RDP_INPUT_MOUSEX - 0x8002 */
/* call to xrdp_wm.c : callback */
self->session->callback(self->session->id, RDP_INPUT_SYNCHRONIZE,
eventCode, 0, eventFlags, 0);
}
xrdp_fastpath_session_callback(self, RDP_INPUT_SYNCHRONIZE,
eventFlags, 0, 0, 0);
return 0;
}
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT_UNICODE */
int APP_CC
static int APP_CC
xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
int eventFlags, struct stream *s)
{
@ -286,7 +275,8 @@ xrdp_fastpath_process_EVENT_UNICODE(struct xrdp_fastpath *self,
/*****************************************************************************/
/* FASTPATH_INPUT_EVENT */
int APP_CC
xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s)
xrdp_fastpath_process_input_event(struct xrdp_fastpath *self,
struct stream *s)
{
int i;
int eventHeader;
@ -315,7 +305,6 @@ xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s)
return 1;
}
break;
case FASTPATH_INPUT_EVENT_MOUSE:
if (xrdp_fastpath_process_EVENT_MOUSE(self,
eventFlags,
@ -333,7 +322,7 @@ xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s)
}
break;
case FASTPATH_INPUT_EVENT_SYNC:
if (xrdp_fastpath_process_EVENT_SYNC(self, eventCode,
if (xrdp_fastpath_process_EVENT_SYNC(self,
eventFlags,
s) != 0)
{
@ -352,7 +341,7 @@ xrdp_fastpath_process_input_event(struct xrdp_fastpath *self, struct stream *s)
g_writeln("xrdp_fastpath_process_input_event: unknown "
"eventCode %d", eventCode);
break;
}
}
}
return 0;
}

@ -51,7 +51,53 @@ xrdp_iso_delete(struct xrdp_iso *self)
/*****************************************************************************/
/* returns error */
static int APP_CC
xrdp_iso_process_rdpNegReq(struct xrdp_iso *self, struct stream *s)
xrdp_iso_negotiate_security(struct xrdp_iso *self)
{
int rv = 0;
int server_security_layer = self->mcs_layer->sec_layer->rdp_layer->client_info.security_layer;
self->selectedProtocol = server_security_layer;
switch (server_security_layer)
{
case PROTOCOL_RDP:
self->rdpNegData = 0; /* no need to send rdp_neg_data back to client */
break;
case PROTOCOL_SSL:
if (self->requestedProtocol & PROTOCOL_SSL)
{
self->selectedProtocol = PROTOCOL_SSL;
}
else
{
self->failureCode = SSL_REQUIRED_BY_SERVER;
rv = 1; /* error */
}
break;
case PROTOCOL_HYBRID:
case PROTOCOL_HYBRID_EX:
default:
if (self->requestedProtocol & PROTOCOL_SSL)
{
/* thats a patch since we don't support CredSSP for now */
self->selectedProtocol = PROTOCOL_SSL;
}
else
{
self->selectedProtocol = PROTOCOL_RDP;
}
break;
}
DEBUG(("xrdp_iso_negotiate_security: server security layer %d , client security layer %d",
self->selectedProtocol, self->requestedProtocol));
return rv;
}
/*****************************************************************************/
/* returns error */
static int APP_CC
xrdp_iso_process_rdp_neg_req(struct xrdp_iso *self, struct stream *s)
{
int flags;
int len;
@ -85,11 +131,11 @@ xrdp_iso_process_rdpNegReq(struct xrdp_iso *self, struct stream *s)
static int APP_CC
xrdp_iso_recv_msg(struct xrdp_iso *self, struct stream *s, int *code, int *len)
{
int ver; // tpkt ver
int plen; // tpkt len
int ver;
int plen;
*code = 0; // x.244 type
*len = 0; // X.224 len indicator
*code = 0;
*len = 0;
if (s != self->trans->in_s)
{
@ -212,7 +258,6 @@ xrdp_iso_send_cc(struct xrdp_iso *self)
out_uint32_le(s, self->selectedProtocol); /* selected protocol */
}
}
s_mark_end(s);
len = (int) (s->end - holdp);
@ -235,6 +280,7 @@ xrdp_iso_send_cc(struct xrdp_iso *self)
int APP_CC
xrdp_iso_incoming(struct xrdp_iso *self)
{
int rv = 0;
int code;
int len;
int cookie_index;
@ -274,7 +320,7 @@ xrdp_iso_incoming(struct xrdp_iso *self)
break;
case RDP_NEG_REQ: /* rdpNegReq 1 */
self->rdpNegData = 1;
if (xrdp_iso_process_rdpNegReq(self, s) != 0)
if (xrdp_iso_process_rdp_neg_req(self, s) != 0)
{
g_writeln("xrdp_iso_incoming: xrdp_iso_process_rdpNegReq returned non zero");
return 1;
@ -302,78 +348,8 @@ xrdp_iso_incoming(struct xrdp_iso *self)
}
}
int serverSecurityLayer = self->mcs_layer->sec_layer->rdp_layer->client_info.security_layer;
/* security layer negotiation */
if (self->rdpNegData)
{
self->selectedProtocol = PROTOCOL_RDP; /* set default security layer */
switch (serverSecurityLayer)
{
case (PROTOCOL_SSL | PROTOCOL_HYBRID | PROTOCOL_HYBRID_EX):
/* server supports tls+hybrid+hybrid_ex */
if (self->requestedProtocol == (PROTOCOL_SSL | PROTOCOL_HYBRID
| PROTOCOL_HYBRID_EX))
{
/* client supports tls+hybrid+hybrid_ex */
self->selectedProtocol = PROTOCOL_SSL; //TODO: change
}
else
{
self->failureCode = SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER;
}
break;
case (PROTOCOL_SSL | PROTOCOL_HYBRID):
/* server supports tls+hybrid */
if (self->requestedProtocol == (PROTOCOL_SSL | PROTOCOL_HYBRID))
{
/* client supports tls+hybrid */
self->selectedProtocol = PROTOCOL_SSL; //TODO: change
}
else
{
self->failureCode = HYBRID_REQUIRED_BY_SERVER;
}
break;
case PROTOCOL_SSL:
/* server supports tls */
if (self->requestedProtocol & PROTOCOL_SSL) //TODO
{
/* client supports tls */
self->selectedProtocol = PROTOCOL_SSL;
}
else
{
self->failureCode = SSL_REQUIRED_BY_SERVER;
}
break;
case PROTOCOL_RDP:
/* server supports rdp */
if (self->requestedProtocol == PROTOCOL_RDP)
{
/* client supports rdp */
self->selectedProtocol = PROTOCOL_RDP;
}
else
{
self->failureCode = SSL_NOT_ALLOWED_BY_SERVER;
}
break;
default:
/* unsupported protocol */
g_writeln("xrdp_iso_incoming: unsupported protocol %d",
self->requestedProtocol);
self->failureCode = INCONSISTENT_FLAGS; //TODO: ?
}
}
else if (self->requestedProtocol != serverSecurityLayer)
{
/* enforce server security */
return 1;
}
/* set things for tls connection */
/* negotiate client-server security layer */
rv = xrdp_iso_negotiate_security(self);
/* send connection confirm back to client */
if (xrdp_iso_send_cc(self) != 0)
@ -383,7 +359,7 @@ xrdp_iso_incoming(struct xrdp_iso *self)
}
DEBUG((" out xrdp_iso_incoming"));
return 0;
return rv;
}
/*****************************************************************************/

@ -878,7 +878,7 @@ xrdp_mcs_send_connect_response(struct xrdp_mcs *self)
xrdp_iso_init(self->iso_layer, s);
//TODO: we should calculate the whole length include MCS_CONNECT_RESPONSE
xrdp_mcs_ber_out_header(self, s, MCS_CONNECT_RESPONSE,
data_len > 0x80 ? data_len + 38 : data_len + 36);
data_len > 0x80 ? data_len + 38 : data_len + 36);
xrdp_mcs_ber_out_header(self, s, BER_TAG_RESULT, 1);
out_uint8(s, 0);
xrdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);

@ -186,15 +186,15 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
g_memset(client_info->certificate, 0, sizeof(char) * 1024);
if (value[0] != '/')
{
/* default certificate path */
/* default certificate path */
g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH);
log_message(LOG_LEVEL_ALWAYS,"WARNING: Invalid x.509 certificate path defined, "
"default path will be used: %s", client_info->certificate);
}
else
{
/* use user defined certificate */
g_strncpy(client_info->certificate, value, 1023);
/* use user defined certificate */
g_strncpy(client_info->certificate, value, 1023);
}
}
else if (g_strcasecmp(item, "key_file") == 0)
@ -202,15 +202,15 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
g_memset(client_info->key_file, 0, sizeof(char) * 1024);
if (value[0] != '/')
{
/* default key_file path */
/* default key_file path */
g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH);
log_message(LOG_LEVEL_ALWAYS,"WARNING: Invalid x.509 certificate path defined, "
"default path will be used: %s", client_info->key_file);
}
else
{
/* use user defined key_file */
g_strncpy(client_info->key_file, value, 1023);
/* use user defined key_file */
g_strncpy(client_info->key_file, value, 1023);
}
}

@ -480,16 +480,20 @@ xrdp_sec_init(struct xrdp_sec *self, struct stream *s)
return 1;
}
if (self->crypt_level == CRYPT_LEVEL_FIPS)
{
s_push_layer(s, sec_hdr, 4 + 4 + 8);
}
else if (self->crypt_level > CRYPT_LEVEL_LOW)
{
s_push_layer(s, sec_hdr, 4 + 8);
}
else
if (self->crypt_level > CRYPT_LEVEL_NONE) /* RDP encryption */
{
if (self->crypt_level == CRYPT_LEVEL_FIPS)
{
s_push_layer(s, sec_hdr, 4 + 4 + 8);
}
else if (self->crypt_level > CRYPT_LEVEL_LOW)
{
s_push_layer(s, sec_hdr, 4 + 8);
}
else if (self->crypt_level)
{
s_push_layer(s, sec_hdr, 4);
}
}
return 0;
@ -1408,30 +1412,33 @@ xrdp_sec_send(struct xrdp_sec *self, struct stream *s, int chan)
DEBUG((" in xrdp_sec_send"));
s_pop_layer(s, sec_hdr);
if (self->crypt_level == CRYPT_LEVEL_FIPS)
if (self->crypt_level > CRYPT_LEVEL_NONE)
{
LLOGLN(10, ("xrdp_sec_send: fips"));
out_uint32_le(s, SEC_ENCRYPT);
datalen = (int)((s->end - s->p) - 12);
out_uint16_le(s, 16); /* crypto header size */
out_uint8(s, 1); /* fips version */
pad = (8 - (datalen % 8)) & 7;
g_memset(s->end, 0, pad);
s->end += pad;
out_uint8(s, pad); /* fips pad */
xrdp_sec_fips_sign(self, s->p, 8, s->p + 8, datalen);
xrdp_sec_fips_encrypt(self, s->p + 8, datalen + pad);
}
else if (self->crypt_level > CRYPT_LEVEL_LOW)
{
out_uint32_le(s, SEC_ENCRYPT);
datalen = (int)((s->end - s->p) - 8);
xrdp_sec_sign(self, s->p, 8, s->p + 8, datalen);
xrdp_sec_encrypt(self, s->p + 8, datalen);
}
else
{
// out_uint32_le(s, 0);
if (self->crypt_level == CRYPT_LEVEL_FIPS)
{
LLOGLN(10, ("xrdp_sec_send: fips"));
out_uint32_le(s, SEC_ENCRYPT);
datalen = (int)((s->end - s->p) - 12);
out_uint16_le(s, 16); /* crypto header size */
out_uint8(s, 1); /* fips version */
pad = (8 - (datalen % 8)) & 7;
g_memset(s->end, 0, pad);
s->end += pad;
out_uint8(s, pad); /* fips pad */
xrdp_sec_fips_sign(self, s->p, 8, s->p + 8, datalen);
xrdp_sec_fips_encrypt(self, s->p + 8, datalen + pad);
}
else if (self->crypt_level > CRYPT_LEVEL_LOW)
{
out_uint32_le(s, SEC_ENCRYPT);
datalen = (int)((s->end - s->p) - 8);
xrdp_sec_sign(self, s->p, 8, s->p + 8, datalen);
xrdp_sec_encrypt(self, s->p + 8, datalen);
}
else
{
out_uint32_le(s, 0);
}
}
if (xrdp_mcs_send(self->mcs_layer, s, chan) != 0)
@ -2123,7 +2130,7 @@ xrdp_sec_init_rdp_security(struct xrdp_sec *self)
else
{
self->encrypt_rc4_info = ssl_rc4_info_create();
}
}
return 0;
}
@ -2151,7 +2158,7 @@ xrdp_sec_incoming(struct xrdp_sec *self)
}
/* initialize selected security layer */
if (iso->requestedProtocol > PROTOCOL_RDP)
if (iso->selectedProtocol > PROTOCOL_RDP)
{
/* init tls security */
DEBUG((" in xrdp_sec_incoming: init tls security"));

@ -174,6 +174,7 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
int fd;
int bytes;
int read_bytes;
struct sockaddr_un s;
char *data;
char buf[11];
@ -216,7 +217,12 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
buf[9] = 0;
buf[10] = 0;
lsend(u->fd, buf, 11);
if (lsend(u->fd, buf, 11) != 11) {
close(u->fd);
u->fd = 0;
pa_memblock_release(chunk->memblock);
return -1;
}
u->want_src_data = 1;
pa_log_debug("###### started recording");
}
@ -234,10 +240,22 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
buf[9] = (unsigned char) chunk->length;
buf[10] = (unsigned char) ((chunk->length >> 8) & 0xff);
lsend(u->fd, buf, 11);
if (lsend(u->fd, buf, 11) != 11) {
close(u->fd);
u->fd = 0;
pa_memblock_release(chunk->memblock);
u->want_src_data = 0;
return -1;
}
/* read length of data available */
lrecv(u->fd, (char *) ubuf, 2);
if (lrecv(u->fd, (char *) ubuf, 2) != 2) {
close(u->fd);
u->fd = 0;
pa_memblock_release(chunk->memblock);
u->want_src_data = 0;
return -1;
}
bytes = ((ubuf[1] << 8) & 0xff00) | (ubuf[0] & 0xff);
if (bytes == 0) {
@ -246,15 +264,22 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
}
/* get data */
bytes = lrecv(u->fd, data, bytes);
read_bytes = lrecv(u->fd, data, bytes);
if (read_bytes != bytes) {
close(u->fd);
u->fd = 0;
pa_memblock_release(chunk->memblock);
u->want_src_data = 0;
return -1;
}
pa_memblock_release(chunk->memblock);
return bytes;
return read_bytes;
}
static void thread_func(void *userdata) {
struct userdata *u = userdata;
int bytes;
pa_assert(u);
pa_thread_mq_install(&u->thread_mq);
@ -271,10 +296,15 @@ static void thread_func(void *userdata) {
now = pa_rtclock_now();
if ((chunk.length = pa_usec_to_bytes(now - u->timestamp, &u->source->sample_spec)) > 0) {
chunk.memblock = pa_memblock_new(u->core->mempool, (size_t) -1); /* or chunk.length? */
chunk.length *= 4;
chunk.memblock = pa_memblock_new(u->core->mempool, chunk.length);
chunk.index = 0;
data_get(u, &chunk);
pa_source_post(u->source, &chunk);
bytes = data_get(u, &chunk);
if (bytes > 0)
{
chunk.length = bytes;
pa_source_post(u->source, &chunk);
}
pa_memblock_unref(chunk.memblock);
u->timestamp = now;
}
@ -298,7 +328,10 @@ static void thread_func(void *userdata) {
buf[9] = 0;
buf[10] = 0;
lsend(u->fd, buf, 11);
if (lsend(u->fd, buf, 11) != 11) {
close(u->fd);
u->fd = 0;
}
u->want_src_data = 0;
pa_log_debug("###### stopped recording");
}
@ -338,7 +371,7 @@ int pa__init(pa_module *m) {
goto fail;
}
#if 0
#if 1
ss = m->core->default_sample_spec;
#else
ss.format = PA_SAMPLE_S16LE;

@ -140,8 +140,8 @@ static struct xr_wave_format_ex g_pcm_inp_44100 =
#define SND_NUM_INP_FORMATS 2
static struct xr_wave_format_ex *g_wave_inp_formats[SND_NUM_INP_FORMATS] =
{
&g_pcm_inp_22050,
&g_pcm_inp_44100
&g_pcm_inp_44100,
&g_pcm_inp_22050
};
static int g_client_input_format_index = 0;
@ -960,7 +960,7 @@ sound_process_input_format(int aindex, int wFormatTag, int nChannels,
LOG(10, (" wBitsPerSample %d", wBitsPerSample));
LOG(10, (" cbSize %d", cbSize));
#if 0
#if 1
/* select CD quality audio */
if (wFormatTag == g_pcm_inp_44100.wFormatTag &&
nChannels == g_pcm_inp_44100.nChannels &&
@ -1047,7 +1047,9 @@ sound_input_start_recording(void)
/* if there is any data in FIFO, discard it */
while ((s = (struct stream *) fifo_remove(&g_in_fifo)) != NULL)
{
xstream_free(s);
}
g_bytes_in_fifo = 0;
xstream_new(s, 1024);
@ -1110,14 +1112,15 @@ sound_process_input_data(struct stream *s, int bytes)
{
struct stream *ls;
LOG(0, ("sound_process_input_data: bytes %d g_bytes_in_fifo %d",
LOG(10, ("sound_process_input_data: bytes %d g_bytes_in_fifo %d",
bytes, g_bytes_in_fifo));
#if 0 /* no need to cap anymore */
/* cap data in fifo */
if (g_bytes_in_fifo > 8 * 1024)
{
return 0;
}
#endif
xstream_new(ls, bytes);
g_memcpy(ls->data, s->p, bytes);
ls->p += bytes;

@ -68,7 +68,7 @@ static int g_x = 0;
static int g_y = 0;
static int g_timer_schedualed = 0;
static int g_delay_motion = 1; /* turn on or off */
static int g_use_evdev = 1;
static int g_use_evdev = 0;
/* Copied from Xvnc/lib/font/util/utilbitmap.c */
static unsigned char g_reverse_byte[0x100] =
@ -306,7 +306,7 @@ rdpLoadLayout(struct xrdp_client_info *client_info)
set.rules = "base";
}
set.model = "pc104";
set.model = "pc105";
set.layout = "us";
set.variant = "";
set.options = "";
@ -360,7 +360,8 @@ rdpLoadLayout(struct xrdp_client_info *client_info)
NULL, serverClient);
}
}
} else
}
else
{
/* sometimes, variant doesn't support all layouts */
set.variant = "";
@ -394,7 +395,7 @@ rdpKeybdProc(DeviceIntPtr pDevice, int onoff)
{
set.rules = "base";
}
set.model = "pc104";
set.model = "pc105";
set.layout = "us";
set.variant = "";
set.options = "";

@ -81,6 +81,7 @@ extern int g_tab_down; /* in rdpmain.c */
#define XSCAN_Menu 117 /* 135 */
#define XSCAN_LMeta 156
#define XSCAN_RMeta 156
#define XSCAN_211 211 /* "/ ?" on br keybaord, "\ _" on jp keyboard */
/******************************************************************************/
void
@ -278,7 +279,7 @@ KbdAddEvent_base(int down, int param1, int param2, int param3, int param4)
break;
case RDPSCAN_115:
rdpEnqueueKey(type, XSCAN_97); /* "/ ?" on br keybaord */
rdpEnqueueKey(type, XSCAN_211); /* "/ ?" on br keybaord, "\ _" on jp keyboard */
break;
case RDPSCAN_126:

@ -1,7 +0,0 @@
EXTRA_DIST = bootstrap readme.txt
SUBDIRS = \
module \
xrdpdev \
xrdpkeyb \
xrdpmouse

@ -1,36 +0,0 @@
#!/bin/sh
which autoconf
if ! test $? -eq 0
then
echo "error, install autoconf"
exit 1
fi
which automake
if ! test $? -eq 0
then
echo "error, install automake"
exit 1
fi
which libtool
if ! test $? -eq 0
then
echo "error, install libtool"
exit 1
fi
which pkg-config
if ! test $? -eq 0
then
echo "error, install pkg-config"
exit 1
fi
touch configure.ac
touch NEWS
touch AUTHORS
touch README
touch ChangeLog
autoreconf -fvi

@ -1,35 +0,0 @@
# Process this file with autoconf to produce a configure script
AC_PREREQ(2.59)
AC_INIT([xrdpmod], [0.1.0], [xrdp-devel@lists.sourceforge.net])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.6 foreign])
AC_PROG_CC
AC_C_CONST
AC_PROG_LIBTOOL
AM_CONDITIONAL(GOT_PREFIX, test "x${prefix}" != "xNONE"])
AC_CHECK_HEADER([xorg/xorg-server.h], [],
[AC_MSG_ERROR([please install xserver-xorg-dev or xorg-x11-server-sdk])])
PKG_CHECK_MODULES([XORG_SERVER], [xorg-server >= 0])
AC_SUBST([XORG_SERVER_CFLAGS])
AC_SUBST([XORG_SERVER_LIBS])
moduledir=`pkg-config xorg-server --variable=moduledir`
AC_SUBST([moduledir])
if test "x${prefix}" = "xNONE" ; then
sysconfdir="/etc";
fi
AC_CONFIG_FILES([Makefile
module/Makefile
xrdpdev/Makefile
xrdpkeyb/Makefile
xrdpmouse/Makefile
])
AC_OUTPUT

@ -1,22 +0,0 @@
EXTRA_DIST =
AM_CFLAGS = \
$(XORG_SERVER_CFLAGS) \
-I../../../common
libxorgxrdp_la_LTLIBRARIES = libxorgxrdp.la
libxorgxrdp_la_LDFLAGS = -module -avoid-version
libxorgxrdp_ladir = $(moduledir)
libxorgxrdp_la_SOURCES = rdpDraw.c rdpPri.c rdpGC.c rdpFillSpans.c \
rdpSetSpans.c rdpPutImage.c rdpCopyArea.c rdpCopyPlane.c rdpPolyPoint.c \
rdpPolylines.c rdpPolySegment.c rdpPolyRectangle.c rdpPolyArc.c \
rdpFillPolygon.c rdpPolyFillRect.c rdpPolyFillArc.c rdpPolyText8.c \
rdpPolyText16.c rdpImageText8.c rdpImageText16.c rdpImageGlyphBlt.c \
rdpPolyGlyphBlt.c rdpPushPixels.c rdpCursor.c rdpMain.c rdpRandR.c \
rdpMisc.c rdpReg.c rdpComposite.c rdpGlyphs.c rdpPixmap.c rdpInput.c \
rdpClientCon.c rdpCapture.c rdpTrapezoids.c rdpXv.c rdpSimd.c
libxorgxrdp_la_LIBADD =

@ -1,41 +0,0 @@
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
;The first six integer or pointer arguments are passed in registers
;RDI, RSI, RDX, RCX, R8, and R9
;int
;cpuid_amd64(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
PROC cpuid_amd64
; save registers
push rbx
push rdx
push rcx
push r8
push r9
mov rax, rdi
mov rcx, rsi
cpuid
pop rdi
mov [rdi], edx
pop rdi
mov [rdi], ecx
pop rdi
mov [rdi], ebx
pop rdi
mov [rdi], eax
mov eax, 0
; restore registers
pop rbx
ret;
align 16

@ -1,39 +0,0 @@
/*
Copyright 2014 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.
amd64 asm functions
*/
#ifndef __FUNCS_AMD64_H
#define __FUNCS_AMD64_H
int
cpuid_amd64(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx);
int
yv12_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
i420_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
yuy2_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
uyvy_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
#endif

@ -1,248 +0,0 @@
;
;Copyright 2014 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.
;
;I420 to RGB32
;amd64 SSE2 32 bit
;
; RGB to YUV
; 0.299 0.587 0.114
; -0.14713 -0.28886 0.436
; 0.615 -0.51499 -0.10001
; YUV to RGB
; 1 0 1.13983
; 1 -0.39465 -0.58060
; 1 2.03211 0
; shift left 12
; 4096 0 4669
; 4096 -1616 -2378
; 4096 9324 0
SECTION .data
align 16
c128 times 8 dw 128
c4669 times 8 dw 4669
c1616 times 8 dw 1616
c2378 times 8 dw 2378
c9324 times 8 dw 9324
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
do8_uv:
; v
movd xmm1, [rbx] ; 4 at a time
lea rbx, [rbx + 4]
punpcklbw xmm1, xmm1
pxor xmm6, xmm6
punpcklbw xmm1, xmm6
movdqa xmm7, [rel c128]
psubw xmm1, xmm7
psllw xmm1, 4
; v
movd xmm2, [rdx] ; 4 at a time
lea rdx, [rdx + 4]
punpcklbw xmm2, xmm2
punpcklbw xmm2, xmm6
psubw xmm2, xmm7
psllw xmm2, 4
do8:
; y
movq xmm0, [rsi] ; 8 at a time
lea rsi, [rsi + 8]
pxor xmm6, xmm6
punpcklbw xmm0, xmm6
; r = y + hiword(4669 * (v << 4))
movdqa xmm4, [rel c4669]
pmulhw xmm4, xmm1
movdqa xmm3, xmm0
paddw xmm3, xmm4
; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
movdqa xmm5, [rel c1616]
pmulhw xmm5, xmm2
movdqa xmm6, [rel c2378]
pmulhw xmm6, xmm1
movdqa xmm4, xmm0
psubw xmm4, xmm5
psubw xmm4, xmm6
; b = y + hiword(9324 * (u << 4))
movdqa xmm6, [rel c9324]
pmulhw xmm6, xmm2
movdqa xmm5, xmm0
paddw xmm5, xmm6
packuswb xmm3, xmm3 ; b
packuswb xmm4, xmm4 ; g
punpcklbw xmm3, xmm4 ; gb
pxor xmm4, xmm4 ; a
packuswb xmm5, xmm5 ; r
punpcklbw xmm5, xmm4 ; ar
movdqa xmm4, xmm3
punpcklwd xmm3, xmm5 ; argb
movdqa [rdi], xmm3
lea rdi, [rdi + 16]
punpckhwd xmm4, xmm5 ; argb
movdqa [rdi], xmm4
lea rdi, [rdi + 16]
ret;
;The first six integer or pointer arguments are passed in registers
; RDI, RSI, RDX, RCX, R8, and R9
;int
;i420_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC i420_to_rgb32_amd64_sse2
push rbx
push rsi
push rdi
push rbp
push rdi
push rdx
mov rdi, rcx ; rgbs
mov rcx, rsi ; width
mov rdx, rcx
pop rbp ; height
mov rax, rbp
shr rbp, 1
imul rax, rcx ; rax = width * height
pop rsi ; y
mov rbx, rsi ; u = y + width * height
add rbx, rax
; local vars
; char* yptr1
; char* yptr2
; char* uptr
; char* vptr
; int* rgbs1
; int* rgbs2
; int width
sub rsp, 56 ; local vars, 56 bytes
mov [rsp + 0], rsi ; save y1
add rsi, rdx
mov [rsp + 8], rsi ; save y2
mov [rsp + 16], rbx ; save u
shr rax, 2
add rbx, rax ; v = u + (width * height / 4)
mov [rsp + 24], rbx ; save v
mov [rsp + 32], rdi ; save rgbs1
mov rax, rdx
shl rax, 2
add rdi, rax
mov [rsp + 40], rdi ; save rgbs2
loop_y:
mov rcx, rdx ; width
shr rcx, 3
; save rdx
mov [rsp + 48], rdx
;prefetchnta 4096[rsp + 0] ; y
;prefetchnta 1024[rsp + 16] ; u
;prefetchnta 1024[rsp + 24] ; v
loop_x:
mov rsi, [rsp + 0] ; y1
mov rbx, [rsp + 16] ; u
mov rdx, [rsp + 24] ; v
mov rdi, [rsp + 32] ; rgbs1
; y1
call do8_uv
mov [rsp + 0], rsi ; y1
mov [rsp + 32], rdi ; rgbs1
mov rsi, [rsp + 8] ; y2
mov rdi, [rsp + 40] ; rgbs2
; y2
call do8
mov [rsp + 8], rsi ; y2
mov [rsp + 16], rbx ; u
mov [rsp + 24], rdx ; v
mov [rsp + 40], rdi ; rgbs2
dec rcx ; width
jnz loop_x
; restore rdx
mov rdx, [rsp + 48]
; update y1 and 2
mov rax, [rsp + 0]
mov rbx, rdx
add rax, rbx
mov [rsp + 0], rax
mov rax, [rsp + 8]
add rax, rbx
mov [rsp + 8], rax
; update rgb1 and 2
mov rax, [rsp + 32]
mov rbx, rdx
shl rbx, 2
add rax, rbx
mov [rsp + 32], rax
mov rax, [rsp + 40]
add rax, rbx
mov [rsp + 40], rax
mov rcx, rbp
dec rcx ; height
mov rbp, rcx
jnz loop_y
add rsp, 56
mov rax, 0
pop rbp
pop rdi
pop rsi
pop rbx
ret
align 16

@ -1,17 +0,0 @@
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;uyvy_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC uyvy_to_rgb32_amd64_sse2
push rbx
mov rax, 0
pop rbx
ret
align 16

@ -1,17 +0,0 @@
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;yuy2_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC yuy2_to_rgb32_amd64_sse2
push rbx
mov rax, 0
pop rbx
ret
align 16

@ -1,248 +0,0 @@
;
;Copyright 2014 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.
;
;YV12 to RGB32
;amd64 SSE2 32 bit
;
; RGB to YUV
; 0.299 0.587 0.114
; -0.14713 -0.28886 0.436
; 0.615 -0.51499 -0.10001
; YUV to RGB
; 1 0 1.13983
; 1 -0.39465 -0.58060
; 1 2.03211 0
; shift left 12
; 4096 0 4669
; 4096 -1616 -2378
; 4096 9324 0
SECTION .data
align 16
c128 times 8 dw 128
c4669 times 8 dw 4669
c1616 times 8 dw 1616
c2378 times 8 dw 2378
c9324 times 8 dw 9324
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
do8_uv:
; u
movd xmm1, [rbx] ; 4 at a time
lea rbx, [rbx + 4]
punpcklbw xmm1, xmm1
pxor xmm6, xmm6
punpcklbw xmm1, xmm6
movdqa xmm7, [rel c128]
psubw xmm1, xmm7
psllw xmm1, 4
; v
movd xmm2, [rdx] ; 4 at a time
lea rdx, [rdx + 4]
punpcklbw xmm2, xmm2
punpcklbw xmm2, xmm6
psubw xmm2, xmm7
psllw xmm2, 4
do8:
; y
movq xmm0, [rsi] ; 8 at a time
lea rsi, [rsi + 8]
pxor xmm6, xmm6
punpcklbw xmm0, xmm6
; r = y + hiword(4669 * (v << 4))
movdqa xmm4, [rel c4669]
pmulhw xmm4, xmm2
movdqa xmm3, xmm0
paddw xmm3, xmm4
; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
movdqa xmm5, [rel c1616]
pmulhw xmm5, xmm1
movdqa xmm6, [rel c2378]
pmulhw xmm6, xmm2
movdqa xmm4, xmm0
psubw xmm4, xmm5
psubw xmm4, xmm6
; b = y + hiword(9324 * (u << 4))
movdqa xmm6, [rel c9324]
pmulhw xmm6, xmm1
movdqa xmm5, xmm0
paddw xmm5, xmm6
packuswb xmm3, xmm3 ; b
packuswb xmm4, xmm4 ; g
punpcklbw xmm3, xmm4 ; gb
pxor xmm4, xmm4 ; a
packuswb xmm5, xmm5 ; r
punpcklbw xmm5, xmm4 ; ar
movdqa xmm4, xmm3
punpcklwd xmm3, xmm5 ; argb
movdqa [rdi], xmm3
lea rdi, [rdi + 16]
punpckhwd xmm4, xmm5 ; argb
movdqa [rdi], xmm4
lea rdi, [rdi + 16]
ret;
;The first six integer or pointer arguments are passed in registers
; RDI, RSI, RDX, RCX, R8, and R9
;int
;yv12_to_rgb32_amd64_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC yv12_to_rgb32_amd64_sse2
push rbx
push rsi
push rdi
push rbp
push rdi
push rdx
mov rdi, rcx ; rgbs
mov rcx, rsi ; width
mov rdx, rcx
pop rbp ; height
mov rax, rbp
shr rbp, 1
imul rax, rcx ; rax = width * height
pop rsi ; y
mov rbx, rsi ; u = y + width * height
add rbx, rax
; local vars
; char* yptr1
; char* yptr2
; char* uptr
; char* vptr
; int* rgbs1
; int* rgbs2
; int width
sub rsp, 56 ; local vars, 56 bytes
mov [rsp + 0], rsi ; save y1
add rsi, rdx
mov [rsp + 8], rsi ; save y2
mov [rsp + 16], rbx ; save u
shr rax, 2
add rbx, rax ; v = u + (width * height / 4)
mov [rsp + 24], rbx ; save v
mov [rsp + 32], rdi ; save rgbs1
mov rax, rdx
shl rax, 2
add rdi, rax
mov [rsp + 40], rdi ; save rgbs2
loop_y:
mov rcx, rdx ; width
shr rcx, 3
; save rdx
mov [rsp + 48], rdx
;prefetchnta 4096[rsp + 0] ; y
;prefetchnta 1024[rsp + 16] ; u
;prefetchnta 1024[rsp + 24] ; v
loop_x:
mov rsi, [rsp + 0] ; y1
mov rbx, [rsp + 16] ; u
mov rdx, [rsp + 24] ; v
mov rdi, [rsp + 32] ; rgbs1
; y1
call do8_uv
mov [rsp + 0], rsi ; y1
mov [rsp + 32], rdi ; rgbs1
mov rsi, [rsp + 8] ; y2
mov rdi, [rsp + 40] ; rgbs2
; y2
call do8
mov [rsp + 8], rsi ; y2
mov [rsp + 16], rbx ; u
mov [rsp + 24], rdx ; v
mov [rsp + 40], rdi ; rgbs2
dec rcx ; width
jnz loop_x
; restore rdx
mov rdx, [rsp + 48]
; update y1 and 2
mov rax, [rsp + 0]
mov rbx, rdx
add rax, rbx
mov [rsp + 0], rax
mov rax, [rsp + 8]
add rax, rbx
mov [rsp + 8], rax
; update rgb1 and 2
mov rax, [rsp + 32]
mov rbx, rdx
shl rbx, 2
add rax, rbx
mov [rsp + 32], rax
mov rax, [rsp + 40]
add rax, rbx
mov [rsp + 40], rax
mov rcx, rbp
dec rcx ; height
mov rbp, rcx
jnz loop_y
add rsp, 56
mov rax, 0
pop rbp
pop rdi
pop rsi
pop rbx
ret
align 16

@ -1,372 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef _RDP_H
#define _RDP_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
#include <scrnintstr.h>
#include <gcstruct.h>
#include <mipointer.h>
#include <randrstr.h>
#include "rdpPri.h"
#define XRDP_MODULE_NAME "XRDPMOD"
#define XRDP_DRIVER_NAME "XRDPDEV"
#define XRDP_MOUSE_NAME "XRDPMOUSE"
#define XRDP_KEYB_NAME "XRDPKEYB"
#define XRDP_VERSION 1000
#define PACKAGE_VERSION_MAJOR 1
#define PACKAGE_VERSION_MINOR 0
#define PACKAGE_VERSION_PATCHLEVEL 0
#define COLOR8(r, g, b) \
((((r) >> 5) << 0) | (((g) >> 5) << 3) | (((b) >> 6) << 6))
#define COLOR15(r, g, b) \
((((r) >> 3) << 10) | (((g) >> 3) << 5) | (((b) >> 3) << 0))
#define COLOR16(r, g, b) \
((((r) >> 3) << 11) | (((g) >> 2) << 5) | (((b) >> 3) << 0))
#define COLOR24(r, g, b) \
((((r) >> 0) << 0) | (((g) >> 0) << 8) | (((b) >> 0) << 16))
#define SPLITCOLOR32(r, g, b, c) \
do { \
r = ((c) >> 16) & 0xff; \
g = ((c) >> 8) & 0xff; \
b = (c) & 0xff; \
} while (0)
/* PIXMAN_a8b8g8r8 */
#define XRDP_a8b8g8r8 \
((32 << 24) | (3 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8)
/* PIXMAN_a8r8g8b8 */
#define XRDP_a8r8g8b8 \
((32 << 24) | (2 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8)
/* PIXMAN_r5g6b5 */
#define XRDP_r5g6b5 \
((16 << 24) | (2 << 16) | (0 << 12) | (5 << 8) | (6 << 4) | 5)
/* PIXMAN_a1r5g5b5 */
#define XRDP_a1r5g5b5 \
((16 << 24) | (2 << 16) | (1 << 12) | (5 << 8) | (5 << 4) | 5)
/* PIXMAN_r3g3b2 */
#define XRDP_r3g3b2 \
((8 << 24) | (2 << 16) | (0 << 12) | (3 << 8) | (3 << 4) | 2)
#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)
#define RDPALIGN(_val, _al) ((((long)(_val)) + ((_al) - 1)) & ~((_al) - 1))
#define XRDP_CD_NODRAW 0
#define XRDP_CD_NOCLIP 1
#define XRDP_CD_CLIP 2
#if 0
#define RegionCopy DONOTUSE
#define RegionTranslate DONOTUSE
#define RegionNotEmpty DONOTUSE
#define RegionIntersect DONOTUSE
#define RegionContainsRect DONOTUSE
#define RegionInit DONOTUSE
#define RegionUninit DONOTUSE
#define RegionFromRects DONOTUSE
#define RegionDestroy DONOTUSE
#define RegionCreate DONOTUSE
#define RegionUnion DONOTUSE
#define RegionSubtract DONOTUSE
#define RegionInverse DONOTUSE
#define RegionExtents DONOTUSE
#define RegionReset DONOTUSE
#define RegionBreak DONOTUSE
#define RegionUnionRect DONOTUSE
#endif
struct image_data
{
int width;
int height;
int bpp;
int Bpp;
int lineBytes;
char *pixels;
char *shmem_pixels;
int shmem_id;
int shmem_offset;
int shmem_lineBytes;
};
/* 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;
struct _rdpPixmapRec
{
int status;
int rdpindex;
int con_number;
int is_dirty;
int is_scratch;
int is_alpha_dirty_not;
/* number of times used in a remote operation
if this gets above XRDP_USE_COUNT_THRESHOLD
then we force remote the pixmap */
int use_count;
int kind_width;
struct rdp_draw_item *draw_item_head;
struct rdp_draw_item *draw_item_tail;
};
typedef struct _rdpPixmapRec rdpPixmapRec;
typedef struct _rdpPixmapRec * rdpPixmapPtr;
#define GETPIXPRIV(_dev, _pPixmap) (rdpPixmapPtr) \
rdpGetPixmapPrivate(&((_pPixmap)->devPrivates), (_dev)->privateKeyRecPixmap)
struct _rdpCounts
{
CARD32 rdpFillSpansCallCount; /* 1 */
CARD32 rdpSetSpansCallCount;
CARD32 rdpPutImageCallCount;
CARD32 rdpCopyAreaCallCount;
CARD32 rdpCopyPlaneCallCount;
CARD32 rdpPolyPointCallCount;
CARD32 rdpPolylinesCallCount;
CARD32 rdpPolySegmentCallCount;
CARD32 rdpPolyRectangleCallCount;
CARD32 rdpPolyArcCallCount; /* 10 */
CARD32 rdpFillPolygonCallCount;
CARD32 rdpPolyFillRectCallCount;
CARD32 rdpPolyFillArcCallCount;
CARD32 rdpPolyText8CallCount;
CARD32 rdpPolyText16CallCount;
CARD32 rdpImageText8CallCount;
CARD32 rdpImageText16CallCount;
CARD32 rdpImageGlyphBltCallCount;
CARD32 rdpPolyGlyphBltCallCount;
CARD32 rdpPushPixelsCallCount; /* 20 */
CARD32 rdpCompositeCallCount;
CARD32 rdpCopyWindowCallCount; /* 22 */
CARD32 rdpTrapezoidsCallCount;
CARD32 callCount[64 - 23];
};
typedef int (*yuv_to_rgb32_proc)(unsigned char *yuvs, int width, int height, int *rgbs);
typedef int (*copy_box_proc)(char *s8, int src_stride,
char *d8, int dst_stride,
int width, int height);
/* move this to common header */
struct _rdpRec
{
int width;
int height;
int depth;
int paddedWidthInBytes;
int sizeInBytes;
int num_modes;
int bitsPerPixel;
int Bpp;
int Bpp_mask;
char *pfbMemory_alloc;
char *pfbMemory;
ScreenPtr pScreen;
rdpDevPrivateKey privateKeyRecGC;
rdpDevPrivateKey privateKeyRecPixmap;
CopyWindowProcPtr CopyWindow;
CreateGCProcPtr CreateGC;
CreatePixmapProcPtr CreatePixmap;
DestroyPixmapProcPtr DestroyPixmap;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
CloseScreenProcPtr CloseScreen;
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
TrapezoidsProcPtr Trapezoids;
/* keyboard and mouse */
miPointerScreenFuncPtr pCursorFuncs;
/* mouse */
rdpPointer pointer;
/* keyboard */
rdpKeyboard keyboard;
/* RandR */
RRSetConfigProcPtr rrSetConfig;
RRGetInfoProcPtr rrGetInfo;
RRScreenSetSizeProcPtr rrScreenSetSize;
RRCrtcSetProcPtr rrCrtcSet;
RRCrtcSetGammaProcPtr rrCrtcSetGamma;
RRCrtcGetGammaProcPtr rrCrtcGetGamma;
RROutputSetPropertyProcPtr rrOutputSetProperty;
RROutputValidateModeProcPtr rrOutputValidateMode;
RRModeDestroyProcPtr rrModeDestroy;
RROutputGetPropertyProcPtr rrOutputGetProperty;
RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning;
int listen_sck;
char uds_data[256];
rdpClientCon *clientConHead;
rdpClientCon *clientConTail;
rdpPixmapRec screenPriv;
int sendUpdateScheduled; /* boolean */
OsTimerPtr sendUpdateTimer;
int do_dirty_os; /* boolean */
int do_dirty_ons; /* boolean */
int disconnect_scheduled; /* boolean */
int do_kill_disconnected; /* boolean */
OsTimerPtr disconnectTimer;
int disconnectScheduled; /* boolean */
int disconnect_timeout_s;
int disconnect_time_ms;
int conNumber;
struct _rdpCounts counts;
yuv_to_rgb32_proc i420_to_rgb32;
yuv_to_rgb32_proc yv12_to_rgb32;
yuv_to_rgb32_proc yuy2_to_rgb32;
yuv_to_rgb32_proc uyvy_to_rgb32;
char *xv_data;
int xv_data_bytes;
int xv_timer_schedualed;
OsTimerPtr xv_timer;
copy_box_proc a8r8g8b8_to_a8b8g8r8_box;
};
typedef struct _rdpRec rdpRec;
typedef struct _rdpRec * rdpPtr;
#define XRDPPTR(_p) ((rdpPtr)((_p)->driverPrivate))
struct _rdpGCRec
{
GCFuncs *funcs;
GCOps *ops;
};
typedef struct _rdpGCRec rdpGCRec;
typedef struct _rdpGCRec * rdpGCPtr;
#define RDI_FILL 1
#define RDI_IMGLL 2 /* lossless */
#define RDI_IMGLY 3 /* lossy */
#define RDI_LINE 4
#define RDI_SCRBLT 5
#define RDI_TEXT 6
struct urdp_draw_item_fill
{
int opcode;
int fg_color;
int bg_color;
int pad0;
};
struct urdp_draw_item_img
{
int opcode;
int pad0;
};
struct urdp_draw_item_line
{
int opcode;
int fg_color;
int bg_color;
int width;
xSegment* segs;
int nseg;
int flags;
};
struct urdp_draw_item_scrblt
{
int srcx;
int srcy;
int dstx;
int dsty;
int cx;
int cy;
};
struct urdp_draw_item_text
{
int opcode;
int fg_color;
struct rdp_text* rtext; /* in rdpglyph.h */
};
union urdp_draw_item
{
struct urdp_draw_item_fill fill;
struct urdp_draw_item_img img;
struct urdp_draw_item_line line;
struct urdp_draw_item_scrblt scrblt;
struct urdp_draw_item_text text;
};
struct rdp_draw_item
{
int type; /* RDI_FILL, RDI_IMGLL, ... */
int flags;
struct rdp_draw_item* prev;
struct rdp_draw_item* next;
RegionPtr reg;
union urdp_draw_item u;
};
#define XRDP_USE_COUNT_THRESHOLD 1
#endif

@ -1,788 +0,0 @@
/**
* 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpMisc.h"
#include "rdpCapture.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
#define RDP_MAX_TILES 1024
/******************************************************************************/
static int
rdpLimitRects(RegionPtr reg, int max_rects, BoxPtr *rects)
{
int nrects;
nrects = REGION_NUM_RECTS(reg);
if (nrects > max_rects)
{
nrects = 1;
*rects = rdpRegionExtents(reg);
}
else
{
*rects = REGION_RECTS(reg);
}
return nrects;
}
/******************************************************************************/
/* copy rects with no error checking */
static int
rdpCopyBox_a8r8g8b8_to_a8r8g8b8(rdpClientCon *clientCon,
void *src, int src_stride, int srcx, int srcy,
void *dst, int dst_stride, int dstx, int dsty,
BoxPtr rects, int num_rects)
{
char *s8;
char *d8;
int index;
int jndex;
int bytes;
int height;
BoxPtr box;
for (index = 0; index < num_rects; index++)
{
box = rects + index;
s8 = ((char *) src) + (box->y1 - srcy) * src_stride;
s8 += (box->x1 - srcx) * 4;
d8 = ((char *) dst) + (box->y1 - dsty) * dst_stride;
d8 += (box->x1 - dstx) * 4;
bytes = box->x2 - box->x1;
bytes *= 4;
height = box->y2 - box->y1;
for (jndex = 0; jndex < height; jndex++)
{
g_memcpy(d8, s8, bytes);
d8 += dst_stride;
s8 += src_stride;
}
}
return 0;
}
/******************************************************************************/
static int
rdpFillBox_yuvalp(int ax, int ay,
void *dst, int dst_stride)
{
dst = ((char *) dst) + (ay << 8) * (dst_stride >> 8) + (ax << 8);
g_memset(dst, 0, 64 * 64 * 4);
return 0;
}
/******************************************************************************/
/* copy rects with no error checking
* convert ARGB32 to 64x64 linear planar YUVA */
/* http://msdn.microsoft.com/en-us/library/ff635643.aspx
* 0.299 -0.168935 0.499813
* 0.587 -0.331665 -0.418531
* 0.114 0.50059 -0.081282
y = r * 0.299000 + g * 0.587000 + b * 0.114000;
u = r * -0.168935 + g * -0.331665 + b * 0.500590;
v = r * 0.499813 + g * -0.418531 + b * -0.081282; */
/* 19595 38470 7471
-11071 -21736 32807
32756 -27429 -5327 */
static int
rdpCopyBox_a8r8g8b8_to_yuvalp(int ax, int ay,
void *src, int src_stride,
void *dst, int dst_stride,
BoxPtr rects, int num_rects)
{
char *s8;
char *d8;
char *yptr;
char *uptr;
char *vptr;
char *aptr;
int *s32;
int index;
int jndex;
int kndex;
int width;
int height;
int pixel;
int a;
int r;
int g;
int b;
int y;
int u;
int v;
BoxPtr box;
dst = ((char *) dst) + (ay << 8) * (dst_stride >> 8) + (ax << 8);
for (index = 0; index < num_rects; index++)
{
box = rects + index;
s8 = ((char *) src) + box->y1 * src_stride;
s8 += box->x1 * 4;
d8 = ((char *) dst) + (box->y1 - ay) * 64;
d8 += box->x1 - ax;
width = box->x2 - box->x1;
height = box->y2 - box->y1;
for (jndex = 0; jndex < height; jndex++)
{
s32 = (int *) s8;
yptr = d8;
uptr = yptr + 64 * 64;
vptr = uptr + 64 * 64;
aptr = vptr + 64 * 64;
kndex = 0;
while (kndex < width)
{
pixel = *(s32++);
a = (pixel >> 24) & 0xff;
r = (pixel >> 16) & 0xff;
g = (pixel >> 8) & 0xff;
b = (pixel >> 0) & 0xff;
y = (r * 19595 + g * 38470 + b * 7471) >> 16;
u = (r * -11071 + g * -21736 + b * 32807) >> 16;
v = (r * 32756 + g * -27429 + b * -5327) >> 16;
u = u + 128;
v = v + 128;
y = max(y, 0);
u = max(u, 0);
v = max(v, 0);
y = min(y, 255);
u = min(u, 255);
v = min(v, 255);
*(yptr++) = y;
*(uptr++) = u;
*(vptr++) = v;
*(aptr++) = a;
kndex++;
}
d8 += 64;
s8 += src_stride;
}
}
return 0;
}
/******************************************************************************/
int
a8r8g8b8_to_a8b8g8r8_box(char *s8, int src_stride,
char *d8, int dst_stride,
int width, int height)
{
int index;
int jndex;
int red;
int green;
int blue;
unsigned int *s32;
unsigned int *d32;
for (index = 0; index < height; index++)
{
s32 = (unsigned int *) s8;
d32 = (unsigned int *) d8;
for (jndex = 0; jndex < width; jndex++)
{
SPLITCOLOR32(red, green, blue, *s32);
*d32 = COLOR24(red, green, blue);
s32++;
d32++;
}
d8 += dst_stride;
s8 += src_stride;
}
return 0;
}
/******************************************************************************/
/* copy rects with no error checking */
static int
rdpCopyBox_a8r8g8b8_to_a8b8g8r8(rdpClientCon *clientCon,
void *src, int src_stride, int srcx, int srcy,
void *dst, int dst_stride, int dstx, int dsty,
BoxPtr rects, int num_rects)
{
char *s8;
char *d8;
int index;
int bytes;
int width;
int height;
BoxPtr box;
copy_box_proc copy_box;
copy_box = clientCon->dev->a8r8g8b8_to_a8b8g8r8_box;
for (index = 0; index < num_rects; index++)
{
box = rects + index;
s8 = ((char *) src) + (box->y1 - srcy) * src_stride;
s8 += (box->x1 - srcx) * 4;
d8 = ((char *) dst) + (box->y1 - dsty) * dst_stride;
d8 += (box->x1 - dstx) * 4;
bytes = box->x2 - box->x1;
bytes *= 4;
width = box->x2 - box->x1;
height = box->y2 - box->y1;
copy_box(s8, src_stride, d8, dst_stride, width, height);
}
return 0;
}
/******************************************************************************/
static Bool
rdpCapture0(rdpClientCon *clientCon,
RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
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 max_rects)
{
BoxPtr psrc_rects;
BoxRec rect;
RegionRec reg;
char *src_rect;
char *dst_rect;
int num_rects;
int src_bytespp;
int dst_bytespp;
int width;
int height;
int src_offset;
int dst_offset;
int i;
int j;
int k;
int red;
int green;
int blue;
Bool rv;
unsigned int *s32;
unsigned short *d16;
unsigned char *d8;
LLOGLN(10, ("rdpCapture0:"));
rv = TRUE;
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = RDPMIN(dst_width, src_width);
rect.y2 = RDPMIN(dst_height, src_height);
rdpRegionInit(&reg, &rect, 0);
rdpRegionIntersect(&reg, in_reg, &reg);
psrc_rects = 0;
num_rects = rdpLimitRects(&reg, max_rects, &psrc_rects);
if (num_rects < 1)
{
rdpRegionUninit(&reg);
return FALSE;
}
*num_out_rects = num_rects;
*out_rects = (BoxPtr) g_malloc(sizeof(BoxRec) * num_rects, 0);
for (i = 0; i < num_rects; i++)
{
rect = psrc_rects[i];
(*out_rects)[i] = rect;
}
if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a8r8g8b8))
{
rdpCopyBox_a8r8g8b8_to_a8r8g8b8(clientCon,
src, src_stride, 0, 0,
dst, dst_stride, 0, 0,
psrc_rects, num_rects);
}
else if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a8b8g8r8))
{
rdpCopyBox_a8r8g8b8_to_a8b8g8r8(clientCon,
src, src_stride, 0, 0,
dst, dst_stride, 0, 0,
psrc_rects, num_rects);
}
else if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_r5g6b5))
{
src_bytespp = 4;
dst_bytespp = 2;
for (i = 0; i < num_rects; i++)
{
/* get rect to copy */
rect = (*out_rects)[i];
/* get rect dimensions */
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
/* point to start of each rect in respective memory */
src_offset = rect.y1 * src_stride + rect.x1 * src_bytespp;
dst_offset = rect.y1 * dst_stride + rect.x1 * dst_bytespp;
src_rect = src + src_offset;
dst_rect = dst + dst_offset;
/* copy one line at a time */
for (j = 0; j < height; j++)
{
s32 = (unsigned int *) src_rect;
d16 = (unsigned short *) dst_rect;
for (k = 0; k < width; k++)
{
SPLITCOLOR32(red, green, blue, *s32);
*d16 = COLOR16(red, green, blue);
s32++;
d16++;
}
src_rect += src_stride;
dst_rect += dst_stride;
}
}
}
else if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a1r5g5b5))
{
src_bytespp = 4;
dst_bytespp = 2;
for (i = 0; i < num_rects; i++)
{
/* get rect to copy */
rect = (*out_rects)[i];
/* get rect dimensions */
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
/* point to start of each rect in respective memory */
src_offset = rect.y1 * src_stride + rect.x1 * src_bytespp;
dst_offset = rect.y1 * dst_stride + rect.x1 * dst_bytespp;
src_rect = src + src_offset;
dst_rect = dst + dst_offset;
/* copy one line at a time */
for (j = 0; j < height; j++)
{
s32 = (unsigned int *) src_rect;
d16 = (unsigned short *) dst_rect;
for (k = 0; k < width; k++)
{
SPLITCOLOR32(red, green, blue, *s32);
*d16 = COLOR15(red, green, blue);
s32++;
d16++;
}
src_rect += src_stride;
dst_rect += dst_stride;
}
}
}
else if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_r3g3b2))
{
src_bytespp = 4;
dst_bytespp = 1;
for (i = 0; i < num_rects; i++)
{
/* get rect to copy */
rect = (*out_rects)[i];
/* get rect dimensions */
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
/* point to start of each rect in respective memory */
src_offset = rect.y1 * src_stride + rect.x1 * src_bytespp;
dst_offset = rect.y1 * dst_stride + rect.x1 * dst_bytespp;
src_rect = src + src_offset;
dst_rect = dst + dst_offset;
/* copy one line at a time */
for (j = 0; j < height; j++)
{
s32 = (unsigned int *) src_rect;
d8 = (unsigned char *) dst_rect;
for (k = 0; k < width; k++)
{
SPLITCOLOR32(red, green, blue, *s32);
*d8 = COLOR8(red, green, blue);
s32++;
d8++;
}
src_rect += src_stride;
dst_rect += dst_stride;
}
}
}
else
{
LLOGLN(0, ("rdpCapture0: unimp color conversion"));
}
rdpRegionUninit(&reg);
return rv;
}
/******************************************************************************/
/* make out_rects always multiple of 16 width and height */
static Bool
rdpCapture1(rdpClientCon *clientCon,
RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
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 max_rects)
{
BoxPtr psrc_rects;
BoxRec rect;
RegionRec reg;
char *src_rect;
char *dst_rect;
int num_regions;
int src_bytespp;
int dst_bytespp;
int width;
int height;
int min_width;
int min_height;
int src_offset;
int dst_offset;
int index;
int jndex;
int kndex;
int red;
int green;
int blue;
int ex;
int ey;
Bool rv;
unsigned int *s32;
unsigned int *d32;
LLOGLN(10, ("rdpCapture1:"));
rv = TRUE;
min_width = RDPMIN(dst_width, src_width);
min_height = RDPMIN(dst_height, src_height);
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = min_width;
rect.y2 = min_height;
rdpRegionInit(&reg, &rect, 0);
rdpRegionIntersect(&reg, in_reg, &reg);
num_regions = REGION_NUM_RECTS(&reg);
if (num_regions > max_rects)
{
num_regions = 1;
psrc_rects = rdpRegionExtents(&reg);
}
else
{
psrc_rects = REGION_RECTS(&reg);
}
if (num_regions < 1)
{
return FALSE;
}
*num_out_rects = num_regions;
*out_rects = (BoxPtr) g_malloc(sizeof(BoxRec) * num_regions * 4, 0);
index = 0;
while (index < num_regions)
{
rect = psrc_rects[index];
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
ex = ((width + 15) & ~15) - width;
if (ex != 0)
{
rect.x2 += ex;
if (rect.x2 > min_width)
{
rect.x1 -= rect.x2 - min_width;
rect.x2 = min_width;
}
if (rect.x1 < 0)
{
rect.x1 += 16;
}
}
ey = ((height + 15) & ~15) - height;
if (ey != 0)
{
rect.y2 += ey;
if (rect.y2 > min_height)
{
rect.y1 -= rect.y2 - min_height;
rect.y2 = min_height;
}
if (rect.y1 < 0)
{
rect.y1 += 16;
}
}
#if 0
if (rect.x1 < 0)
{
LLOGLN(0, ("rdpCapture1: error"));
}
if (rect.y1 < 0)
{
LLOGLN(0, ("rdpCapture1: error"));
}
if (rect.x2 > min_width)
{
LLOGLN(0, ("rdpCapture1: error"));
}
if (rect.y2 > min_height)
{
LLOGLN(0, ("rdpCapture1: error"));
}
if ((rect.x2 - rect.x1) % 16 != 0)
{
LLOGLN(0, ("rdpCapture1: error"));
}
if ((rect.y2 - rect.y1) % 16 != 0)
{
LLOGLN(0, ("rdpCapture1: error"));
}
#endif
(*out_rects)[index] = rect;
index++;
}
if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a8b8g8r8))
{
src_bytespp = 4;
dst_bytespp = 4;
for (index = 0; index < num_regions; index++)
{
/* get rect to copy */
rect = (*out_rects)[index];
/* get rect dimensions */
width = rect.x2 - rect.x1;
height = rect.y2 - rect.y1;
/* point to start of each rect in respective memory */
src_offset = rect.y1 * src_stride + rect.x1 * src_bytespp;
dst_offset = rect.y1 * dst_stride + rect.x1 * dst_bytespp;
src_rect = src + src_offset;
dst_rect = dst + dst_offset;
/* copy one line at a time */
for (jndex = 0; jndex < height; jndex++)
{
s32 = (unsigned int *) src_rect;
d32 = (unsigned int *) dst_rect;
for (kndex = 0; kndex < width; kndex++)
{
SPLITCOLOR32(red, green, blue, *s32);
*d32 = COLOR24(red, green, blue);
s32++;
d32++;
}
src_rect += src_stride;
dst_rect += dst_stride;
}
}
}
else
{
LLOGLN(0, ("rdpCapture1: unimp color conversion"));
}
rdpRegionUninit(&reg);
return rv;
}
/******************************************************************************/
static Bool
rdpCapture2(rdpClientCon *clientCon,
RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
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 max_rects)
{
int x;
int y;
int out_rect_index;
int num_rects;
int rcode;
BoxRec rect;
BoxRec extents_rect;
BoxPtr rects;
RegionRec tile_reg;
RegionRec lin_reg;
RegionRec temp_reg;
RegionPtr pin_reg;
LLOGLN(10, ("rdpCapture2:"));
*out_rects = (BoxPtr) g_malloc(sizeof(BoxRec) * RDP_MAX_TILES, 0);
if (*out_rects == NULL)
{
return FALSE;
}
out_rect_index = 0;
/* clip for smaller of 2 */
rect.x1 = 0;
rect.y1 = 0;
rect.x2 = min(dst_width, src_width);
rect.y2 = min(dst_height, src_height);
rdpRegionInit(&temp_reg, &rect, 0);
rdpRegionIntersect(&temp_reg, in_reg, &temp_reg);
/* limit the numer of rects */
num_rects = REGION_NUM_RECTS(&temp_reg);
if (num_rects > max_rects)
{
LLOGLN(10, ("rdpCapture2: too many rects"));
rdpRegionInit(&lin_reg, rdpRegionExtents(&temp_reg), 0);
pin_reg = &lin_reg;
}
else
{
LLOGLN(10, ("rdpCapture2: not too many rects"));
rdpRegionInit(&lin_reg, NullBox, 0);
pin_reg = &temp_reg;
}
extents_rect = *rdpRegionExtents(pin_reg);
y = extents_rect.y1 & ~63;
while (y < extents_rect.y2)
{
x = extents_rect.x1 & ~63;
while (x < extents_rect.x2)
{
rect.x1 = x;
rect.y1 = y;
rect.x2 = rect.x1 + 64;
rect.y2 = rect.y1 + 64;
rcode = rdpRegionContainsRect(pin_reg, &rect);
LLOGLN(10, ("rdpCapture2: rcode %d", rcode));
if (rcode != rgnOUT)
{
if (rcode == rgnPART)
{
LLOGLN(10, ("rdpCapture2: rgnPART"));
rdpFillBox_yuvalp(x, y, dst, dst_stride);
rdpRegionInit(&tile_reg, &rect, 0);
rdpRegionIntersect(&tile_reg, pin_reg, &tile_reg);
rects = REGION_RECTS(&tile_reg);
num_rects = REGION_NUM_RECTS(&tile_reg);
rdpCopyBox_a8r8g8b8_to_yuvalp(x, y,
src, src_stride,
dst, dst_stride,
rects, num_rects);
rdpRegionUninit(&tile_reg);
}
else /* rgnIN */
{
LLOGLN(10, ("rdpCapture2: rgnIN"));
rdpCopyBox_a8r8g8b8_to_yuvalp(x, y,
src, src_stride,
dst, dst_stride,
&rect, 1);
}
(*out_rects)[out_rect_index] = rect;
out_rect_index++;
if (out_rect_index >= RDP_MAX_TILES)
{
g_free(*out_rects);
*out_rects = NULL;
rdpRegionUninit(&temp_reg);
rdpRegionUninit(&lin_reg);
return FALSE;
}
}
x += 64;
}
y += 64;
}
*num_out_rects = out_rect_index;
rdpRegionUninit(&temp_reg);
rdpRegionUninit(&lin_reg);
return TRUE;
}
/**
* Copy an array of rectangles from one memory area to another
*****************************************************************************/
Bool
rdpCapture(rdpClientCon *clientCon,
RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
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)
{
LLOGLN(10, ("rdpCapture:"));
LLOGLN(10, ("rdpCapture: src %p dst %p", src, dst));
switch (mode)
{
case 0:
return rdpCapture0(clientCon, in_reg, out_rects, num_out_rects,
src, src_width, src_height,
src_stride, src_format,
dst, dst_width, dst_height,
dst_stride, dst_format, 15);
case 1:
return rdpCapture1(clientCon, in_reg, out_rects, num_out_rects,
src, src_width, src_height,
src_stride, src_format,
dst, dst_width, dst_height,
dst_stride, dst_format, 15);
case 2:
return rdpCapture2(clientCon, in_reg, out_rects, num_out_rects,
src, src_width, src_height,
src_stride, src_format,
dst, dst_width, dst_height,
dst_stride, dst_format, 15);
default:
LLOGLN(0, ("rdpCapture: unimp mode"));
break;
}
return FALSE;
}

@ -1,41 +0,0 @@
/**
* 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
*/
#ifndef __RDPCAPTURE_H
#define __RDPCAPTURE_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpCapture(rdpClientCon *clientCon,
RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
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);
extern _X_EXPORT int
a8r8g8b8_to_a8b8g8r8_box(char *s8, int src_stride,
char *d8, int dst_stride,
int width, int height);
#endif

File diff suppressed because it is too large Load Diff

@ -1,168 +0,0 @@
/*
Copyright 2005-2014 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 <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
/* in xrdp/common */
#include "xrdp_client_info.h"
#include "xrdp_constants.h"
#ifndef _RDPCLIENTCON_H
#define _RDPCLIENTCON_H
/* used in rdpGlyphs.c */
struct font_cache
{
int offset;
int baseline;
int width;
int height;
int crc;
int stamp;
};
struct rdpup_os_bitmap
{
int used;
PixmapPtr pixmap;
rdpPixmapPtr priv;
int stamp;
};
/* one of these for each client */
struct _rdpClientCon
{
rdpPtr dev;
int sck;
int sckControlListener;
int sckControl;
struct stream *out_s;
struct stream *in_s;
int rectIdAck;
int rectId;
int connected; /* boolean */
int begin; /* boolean */
int count;
int sckClosed; /* boolean */
struct rdpup_os_bitmap *osBitmaps;
int maxOsBitmaps;
int osBitmapStamp;
int osBitmapAllocSize;
int osBitmapNumUsed;
int doComposite;
int doGlyphCache;
int canDoPixToPix;
int doMultimon;
int rdp_bpp; /* client depth */
int rdp_Bpp;
int rdp_Bpp_mask;
int rdp_width;
int rdp_height;
int rdp_format; /* XRDP_a8r8g8b8, XRDP_r5g6b5, ... */
int cap_width;
int cap_height;
int rdpIndex; /* current os target */
int conNumber;
/* rdpGlyphs.c */
struct font_cache font_cache[12][256];
int font_stamp;
struct xrdp_client_info client_info;
char *shmemptr;
int shmemid;
int shmem_lineBytes;
RegionPtr shmRegion;
int rect_id;
int rect_id_ack;
OsTimerPtr updateTimer;
int updateSchedualed; /* boolean */
RegionPtr dirtyRegion;
struct _rdpClientCon *next;
};
extern _X_EXPORT int
rdpClientConBeginUpdate(rdpPtr dev, rdpClientCon *clientCon);
extern _X_EXPORT int
rdpClientConEndUpdate(rdpPtr dev, rdpClientCon *clientCon);
extern _X_EXPORT int
rdpClientConSetFgcolor(rdpPtr dev, rdpClientCon *clientCon, int fgcolor);
extern _X_EXPORT void
rdpClientConSendArea(rdpPtr dev, rdpClientCon *clientCon,
struct image_data *id, int x, int y, int w, int h);
extern _X_EXPORT int
rdpClientConFillRect(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, int cx, int cy);
extern _X_EXPORT int
rdpClientConCheck(ScreenPtr pScreen);
extern _X_EXPORT int
rdpClientConInit(rdpPtr dev);
extern _X_EXPORT int
rdpClientConDeinit(rdpPtr dev);
extern _X_EXPORT int
rdpClientConDeleteOsSurface(rdpPtr dev, rdpClientCon *clientCon, int rdpindex);
extern _X_EXPORT int
rdpClientConRemoveOsBitmap(rdpPtr dev, rdpClientCon *clientCon, int rdpindex);
extern _X_EXPORT void
rdpClientConScheduleDeferredUpdate(rdpPtr dev);
extern _X_EXPORT int
rdpClientConCheckDirtyScreen(rdpPtr dev, rdpClientCon *clientCon);
extern _X_EXPORT int
rdpClientConAddDirtyScreenReg(rdpPtr dev, rdpClientCon *clientCon,
RegionPtr reg);
extern _X_EXPORT int
rdpClientConAddDirtyScreenBox(rdpPtr dev, rdpClientCon *clientCon,
BoxPtr box);
extern _X_EXPORT int
rdpClientConAddDirtyScreen(rdpPtr dev, rdpClientCon *clientCon,
int x, int y, int cx, int cy);
extern _X_EXPORT void
rdpClientConGetScreenImageRect(rdpPtr dev, rdpClientCon *clientCon,
struct image_data *id);
extern _X_EXPORT int
rdpClientConAddAllReg(rdpPtr dev, RegionPtr reg, DrawablePtr pDrawable);
extern _X_EXPORT int
rdpClientConAddAllBox(rdpPtr dev, BoxPtr box, DrawablePtr pDrawable);
extern _X_EXPORT int
rdpClientConSetCursor(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, char *cur_data, char *cur_mask);
extern _X_EXPORT int
rdpClientConSetCursorEx(rdpPtr dev, rdpClientCon *clientCon,
short x, short y, char *cur_data,
char *cur_mask, int bpp);
#endif

@ -1,94 +0,0 @@
/*
Copyright 2005-2014 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.
composite(alpha blending) calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "mipict.h"
#include <picture.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpComposite.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
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)
{
ps->Composite = dev->Composite;
ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
xDst, yDst, width, height);
ps->Composite = rdpComposite;
}
/******************************************************************************/
void
rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height)
{
ScreenPtr pScreen;
rdpPtr dev;
PictureScreenPtr ps;
BoxRec box;
RegionRec reg;
LLOGLN(10, ("rdpComposite:"));
pScreen = pDst->pDrawable->pScreen;
dev = rdpGetDevFromScreen(pScreen);
dev->counts.rdpCompositeCallCount++;
box.x1 = xDst + pDst->pDrawable->x;
box.y1 = yDst + pDst->pDrawable->y;
box.x2 = box.x1 + width;
box.y2 = box.y1 + height;
rdpRegionInit(&reg, &box, 0);
if (pDst->pCompositeClip != NULL)
{
rdpRegionIntersect(&reg, pDst->pCompositeClip, &reg);
}
ps = GetPictureScreen(pScreen);
/* do original call */
rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);
rdpClientConAddAllReg(dev, &reg, pDst->pDrawable);
rdpRegionUninit(&reg);
}

@ -1,36 +0,0 @@
/*
Copyright 2005-2014 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.
composite(alpha blending) calls
*/
#ifndef _RDPCOMPOSITE_H
#define _RDPCOMPOSITE_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height);
#endif

@ -1,94 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpCopyArea.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static RegionPtr
rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty)
{
GC_OP_VARS;
RegionPtr rv;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
GC_OP_EPILOGUE(pGC);
return rv;
}
/******************************************************************************/
RegionPtr
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty)
{
rdpPtr dev;
RegionPtr rv;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpCopyArea:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpCopyAreaCallCount++;
box.x1 = dstx + pDst->x;
box.y1 = dsty + pDst->y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC);
LLOGLN(10, ("rdpCopyArea: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDst);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
return rv;
}

@ -1,33 +0,0 @@
/*
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.
*/
#ifndef __RDPCOPYAREA_H
#define __RDPCOPYAREA_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
RegionPtr
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty);
#endif

@ -1,98 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpCopyPlane.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static RegionPtr
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;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy,
w, h, dstx, dsty, bitPlane);
GC_OP_EPILOGUE(pGC);
return rv;
}
/******************************************************************************/
RegionPtr
rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int w, int h,
int dstx, int dsty, unsigned long bitPlane)
{
RegionPtr rv;
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpCopyPlane:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpCopyPlaneCallCount++;
box.x1 = pDst->x + dstx;
box.y1 = pDst->y + dsty;
box.x2 = box.x1 + w;
box.y2 = box.x1 + h;
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC);
LLOGLN(10, ("rdpCopyPlane: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDst);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
return rv;
}

@ -1,34 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPCOPYPLANE_H
#define __RDPCOPYPLANE_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
RegionPtr
rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, int srcx, int srcy, int width, int height,
int dstx, int dsty, unsigned long bitPlane);
#endif

@ -1,358 +0,0 @@
/*
Copyright 2005-2014 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.
cursor
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include <cursor.h>
#include <cursorstr.h>
#include <X11/Xarch.h>
#include "rdp.h"
#include "rdpMain.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpCursor.h"
#ifndef X_BYTE_ORDER
#warning X_BYTE_ORDER not defined
#endif
#if (X_BYTE_ORDER == X_LITTLE_ENDIAN)
/* Copied from Xvnc/lib/font/util/utilbitmap.c */
static unsigned char g_reverse_byte[0x100] =
{
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
#endif
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(10, ("rdpSpriteRealizeCursor:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs)
{
LLOGLN(10, ("rdpSpriteUnrealizeCursor:"));
return TRUE;
}
/******************************************************************************/
static int
get_pixel_safe(char *data, int x, int y, int width, int height, int bpp)
{
int start;
int shift;
int c;
unsigned int *src32;
if (x < 0)
{
return 0;
}
if (y < 0)
{
return 0;
}
if (x >= width)
{
return 0;
}
if (y >= height)
{
return 0;
}
if (bpp == 1)
{
width = (width + 7) / 8;
start = (y * width) + x / 8;
shift = x % 8;
c = (unsigned char)(data[start]);
#if (X_BYTE_ORDER == X_LITTLE_ENDIAN)
return (g_reverse_byte[c] & (0x80 >> shift)) != 0;
#else
return (c & (0x80 >> shift)) != 0;
#endif
}
else if (bpp == 32)
{
src32 = (unsigned int*)data;
return src32[y * width + x];
}
return 0;
}
/******************************************************************************/
static void
set_pixel_safe(char *data, int x, int y, int width, int height, int bpp,
int pixel)
{
int start;
int shift;
unsigned int *dst32;
if (x < 0)
{
return;
}
if (y < 0)
{
return;
}
if (x >= width)
{
return;
}
if (y >= height)
{
return;
}
if (bpp == 1)
{
width = (width + 7) / 8;
start = (y * width) + x / 8;
shift = x % 8;
if (pixel & 1)
{
data[start] = data[start] | (0x80 >> shift);
}
else
{
data[start] = data[start] & ~(0x80 >> shift);
}
}
else if (bpp == 24)
{
*(data + (3 * (y * width + x)) + 0) = pixel >> 0;
*(data + (3 * (y * width + x)) + 1) = pixel >> 8;
*(data + (3 * (y * width + x)) + 2) = pixel >> 16;
}
else if (bpp == 32)
{
dst32 = (unsigned int*)data;
dst32[y * width + x] = pixel;
}
}
/******************************************************************************/
void
rdpSpriteSetCursorCon(rdpClientCon *clientCon,
DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
char cur_data[32 * (32 * 4)];
char cur_mask[32 * (32 / 8)];
char *mask;
char *data;
int i;
int j;
int w;
int h;
int p;
int xhot;
int yhot;
int paddedRowBytes;
int fgcolor;
int bgcolor;
int bpp;
LLOGLN(10, ("rdpSpriteSetCursorCon:"));
w = pCurs->bits->width;
h = pCurs->bits->height;
if ((pCurs->bits->argb != 0) &&
(clientCon->client_info.pointer_flags & 1))
{
bpp = 32;
paddedRowBytes = PixmapBytePad(w, 32);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->argb);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(data, i, j, paddedRowBytes / 4, h, 32);
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 32, p);
}
}
}
else
{
bpp = 0;
paddedRowBytes = PixmapBytePad(w, 1);
xhot = pCurs->bits->xhot;
yhot = pCurs->bits->yhot;
data = (char *)(pCurs->bits->source);
mask = (char *)(pCurs->bits->mask);
fgcolor = (((pCurs->foreRed >> 8) & 0xff) << 16) |
(((pCurs->foreGreen >> 8) & 0xff) << 8) |
((pCurs->foreBlue >> 8) & 0xff);
bgcolor = (((pCurs->backRed >> 8) & 0xff) << 16) |
(((pCurs->backGreen >> 8) & 0xff) << 8) |
((pCurs->backBlue >> 8) & 0xff);
memset(cur_data, 0, sizeof(cur_data));
memset(cur_mask, 0, sizeof(cur_mask));
for (j = 0; j < 32; j++)
{
for (i = 0; i < 32; i++)
{
p = get_pixel_safe(mask, i, j, paddedRowBytes * 8, h, 1);
set_pixel_safe(cur_mask, i, 31 - j, 32, 32, 1, !p);
if (p != 0)
{
p = get_pixel_safe(data, i, j, paddedRowBytes * 8, h, 1);
p = p ? fgcolor : bgcolor;
set_pixel_safe(cur_data, i, 31 - j, 32, 32, 24, p);
}
}
}
}
rdpClientConBeginUpdate(clientCon->dev, clientCon);
rdpClientConSetCursorEx(clientCon->dev, clientCon, xhot, yhot,
cur_data, cur_mask, bpp);
rdpClientConEndUpdate(clientCon->dev, clientCon);
}
/******************************************************************************/
void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y)
{
rdpPtr dev;
rdpClientCon *clientCon;
LLOGLN(10, ("rdpSpriteSetCursor:"));
if (pCurs == 0)
{
return;
}
if (pCurs->bits == 0)
{
return;
}
dev = rdpGetDevFromScreen(pScr);
clientCon = dev->clientConHead;
while (clientCon != NULL)
{
rdpSpriteSetCursorCon(clientCon, pDev, pScr, pCurs, x, y);
clientCon = clientCon->next;
}
}
/******************************************************************************/
void
rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y)
{
LLOGLN(10, ("rdpSpriteMoveCursor:"));
}
/******************************************************************************/
Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(10, ("rdpSpriteDeviceCursorInitialize:"));
return TRUE;
}
/******************************************************************************/
void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
{
LLOGLN(10, ("rdpSpriteDeviceCursorCleanup:"));
xorgxrdpDownDown(pScr);
}

@ -1,45 +0,0 @@
/*
Copyright 2005-2014 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.
misc draw calls
*/
#ifndef __RDPCURSOR_H
#define __RDPCURSOR_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
extern _X_EXPORT Bool
rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs);
extern _X_EXPORT void
rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs,
int x, int y);
extern _X_EXPORT void
rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y);
extern _X_EXPORT Bool
rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr);
extern _X_EXPORT void
rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr);
#endif

@ -1,411 +0,0 @@
/*
Copyright 2005-2014 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.
misc draw calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include <dixfontstr.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpMisc.h"
#include "rdpGlyphs.h"
#include "rdpReg.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
/* return 0, draw nothing */
/* return 1, draw with no clip */
/* return 2, draw using clip */
int
rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
{
WindowPtr pWindow;
RegionPtr temp;
BoxRec box;
int rv;
rv = 0;
if (pDrawable->type == DRAWABLE_PIXMAP)
{
switch (pGC->clientClipType)
{
case CT_NONE:
rv = 1;
break;
case CT_REGION:
rv = 2;
rdpRegionCopy(pRegion, pGC->clientClip);
break;
default:
LLOGLN(0, ("rdpDrawGetClip: unimp clip type %d",
pGC->clientClipType));
break;
}
if (rv == 2) /* check if the clip is the entire pixmap */
{
box.x1 = 0;
box.y1 = 0;
box.x2 = pDrawable->width;
box.y2 = pDrawable->height;
if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
{
rv = 1;
}
}
}
else if (pDrawable->type == DRAWABLE_WINDOW)
{
pWindow = (WindowPtr)pDrawable;
if (pWindow->viewable)
{
if (pGC->subWindowMode == IncludeInferiors)
{
temp = &pWindow->borderClip;
}
else
{
temp = &pWindow->clipList;
}
if (rdpRegionNotEmpty(temp))
{
switch (pGC->clientClipType)
{
case CT_NONE:
rv = 2;
rdpRegionCopy(pRegion, temp);
break;
case CT_REGION:
rv = 2;
rdpRegionCopy(pRegion, pGC->clientClip);
rdpRegionTranslate(pRegion,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
rdpRegionIntersect(pRegion, pRegion, temp);
break;
default:
LLOGLN(0, ("rdpDrawGetClip: unimp clip type %d",
pGC->clientClipType));
break;
}
if (rv == 2) /* check if the clip is the entire screen */
{
box.x1 = 0;
box.y1 = 0;
box.x2 = dev->width;
box.y2 = dev->height;
if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
{
rv = 1;
}
}
}
}
}
return rv;
}
/******************************************************************************/
void
GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y,
int n, BoxPtr pbox)
{
int maxAscent;
int maxDescent;
int maxCharWidth;
if (FONTASCENT(font) > FONTMAXBOUNDS(font, ascent))
{
maxAscent = FONTASCENT(font);
}
else
{
maxAscent = FONTMAXBOUNDS(font, ascent);
}
if (FONTDESCENT(font) > FONTMAXBOUNDS(font, descent))
{
maxDescent = FONTDESCENT(font);
}
else
{
maxDescent = FONTMAXBOUNDS(font, descent);
}
if (FONTMAXBOUNDS(font, rightSideBearing) >
FONTMAXBOUNDS(font, characterWidth))
{
maxCharWidth = FONTMAXBOUNDS(font, rightSideBearing);
}
else
{
maxCharWidth = FONTMAXBOUNDS(font, characterWidth);
}
pbox->x1 = pDrawable->x + x;
pbox->y1 = pDrawable->y + y - maxAscent;
pbox->x2 = pbox->x1 + maxCharWidth * n;
pbox->y2 = pbox->y1 + maxAscent + maxDescent;
if (FONTMINBOUNDS(font, leftSideBearing) < 0)
{
pbox->x1 += FONTMINBOUNDS(font, leftSideBearing);
}
}
/******************************************************************************/
int
rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di)
{
priv->is_alpha_dirty_not = FALSE;
if (priv->draw_item_tail == NULL)
{
priv->draw_item_tail = di;
priv->draw_item_head = di;
}
else
{
di->prev = priv->draw_item_tail;
priv->draw_item_tail->next = di;
priv->draw_item_tail = di;
}
if (priv == &(dev->screenPriv))
{
rdpClientConScheduleDeferredUpdate(dev);
}
return 0;
}
/******************************************************************************/
int
rdpDrawItemRemove(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di)
{
if (di->prev != NULL)
{
di->prev->next = di->next;
}
if (di->next != NULL)
{
di->next->prev = di->prev;
}
if (priv->draw_item_head == di)
{
priv->draw_item_head = di->next;
}
if (priv->draw_item_tail == di)
{
priv->draw_item_tail = di->prev;
}
if (di->type == RDI_LINE)
{
if (di->u.line.segs != NULL)
{
g_free(di->u.line.segs);
}
}
if (di->type == RDI_TEXT)
{
rdpGlyphDeleteRdpText(di->u.text.rtext);
}
rdpRegionDestroy(di->reg);
g_free(di);
return 0;
}
/******************************************************************************/
int
rdpDrawItemRemoveAll(rdpPtr dev, rdpPixmapRec *priv)
{
struct rdp_draw_item *di;
di = priv->draw_item_head;
while (di != NULL)
{
rdpDrawItemRemove(dev, priv, di);
di = priv->draw_item_head;
}
return 0;
}
/*****************************************************************************/
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{
ScreenPtr pScreen;
rdpPtr dev;
RegionRec reg;
RegionRec clip;
int dx;
int dy;
int num_clip_rects;
int num_reg_rects;
BoxPtr box;
BoxRec box1;
LLOGLN(10, ("rdpCopyWindow:"));
pScreen = pWin->drawable.pScreen;
dev = rdpGetDevFromScreen(pScreen);
dev->counts.rdpCopyWindowCallCount++;
rdpRegionInit(&reg, NullBox, 0);
rdpRegionCopy(&reg, pOldRegion);
rdpRegionInit(&clip, NullBox, 0);
rdpRegionCopy(&clip, &pWin->borderClip);
dx = pWin->drawable.x - ptOldOrg.x;
dy = pWin->drawable.y - ptOldOrg.y;
dev->pScreen->CopyWindow = dev->CopyWindow;
dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
dev->pScreen->CopyWindow = rdpCopyWindow;
num_clip_rects = REGION_NUM_RECTS(&clip);
num_reg_rects = REGION_NUM_RECTS(&reg);
if ((num_clip_rects == 0) || (num_reg_rects == 0))
{
}
else
{
if ((num_clip_rects > 16) || (num_reg_rects > 16))
{
LLOGLN(10, ("rdpCopyWindow: big list"));
box = rdpRegionExtents(&reg);
box1 = *box;
box1.x1 += dx;
box1.y1 += dy;
box1.x2 += dx;
box1.y2 += dy;
rdpClientConAddAllBox(dev, &box1, &(pWin->drawable));
}
else
{
rdpRegionTranslate(&reg, dx, dy);
rdpRegionIntersect(&reg, &reg, &clip);
rdpClientConAddAllReg(dev, &reg, &(pWin->drawable));
}
}
rdpRegionUninit(&reg);
rdpRegionUninit(&clip);
}
#if XRDP_CLOSESCR == 1 /* before v1.13 */
/*****************************************************************************/
Bool
rdpCloseScreen(int index, ScreenPtr pScreen)
{
rdpPtr dev;
Bool rv;
LLOGLN(0, ("rdpCloseScreen:"));
dev = rdpGetDevFromScreen(pScreen);
dev->pScreen->CloseScreen = dev->CloseScreen;
rv = dev->pScreen->CloseScreen(index, pScreen);
dev->pScreen->CloseScreen = rdpCloseScreen;
return rv;
}
#else
/*****************************************************************************/
Bool
rdpCloseScreen(ScreenPtr pScreen)
{
rdpPtr dev;
Bool rv;
LLOGLN(0, ("rdpCloseScreen:"));
dev = rdpGetDevFromScreen(pScreen);
dev->pScreen->CloseScreen = dev->CloseScreen;
rv = dev->pScreen->CloseScreen(pScreen);
dev->pScreen->CloseScreen = rdpCloseScreen;
return rv;
}
#endif
/******************************************************************************/
WindowPtr
rdpGetRootWindowPtr(ScreenPtr pScreen)
{
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 0, 0, 0)
return WindowTable[pScreen->myNum]; /* in globals.c */
#else
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;
}

@ -1,93 +0,0 @@
/*
Copyright 2005-2014 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.
misc draw calls
*/
#ifndef __RDPDRAW_H
#define __RDPDRAW_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
/* 1.1, 1.2, 1.3, 1.4 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12 */
#define XRDP_CLOSESCR 1
#else
/* 1.13 */
#define XRDP_CLOSESCR 2
#endif
/* true if drawable is window or pixmap is screen */
#define XRDP_DRAWABLE_IS_VISIBLE(_dev, _drw) \
(((_drw)->type == DRAWABLE_WINDOW && ((WindowPtr)(_drw))->viewable) || \
((_drw)->type == DRAWABLE_PIXMAP && \
((PixmapPtr)(_drw))->devPrivate.ptr == (_dev)->pfbMemory))
/******************************************************************************/
#define GC_OP_VARS rdpPtr dev; rdpGCPtr priv; GCFuncs *oldFuncs
/******************************************************************************/
#define GC_OP_PROLOGUE(_pGC) \
do { \
dev = rdpGetDevFromScreen((_pGC)->pScreen); \
priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
oldFuncs = (_pGC)->funcs; \
(_pGC)->funcs = priv->funcs; \
(_pGC)->ops = priv->ops; \
} while (0)
/******************************************************************************/
#define GC_OP_EPILOGUE(_pGC) \
do { \
priv->ops = (_pGC)->ops; \
(_pGC)->funcs = oldFuncs; \
(_pGC)->ops = &g_rdpGCOps; \
} while (0)
extern GCOps g_rdpGCOps; /* in rdpGC.c */
extern _X_EXPORT int
rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC);
extern _X_EXPORT void
GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y,
int n, BoxPtr pbox);
extern _X_EXPORT int
rdpDrawItemAdd(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di);
extern _X_EXPORT int
rdpDrawItemRemove(rdpPtr dev, rdpPixmapRec *priv, struct rdp_draw_item *di);
extern _X_EXPORT int
rdpDrawItemRemoveAll(rdpPtr dev, rdpPixmapRec *priv);
extern _X_EXPORT void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
#if XRDP_CLOSESCR == 1
extern _X_EXPORT Bool
rdpCloseScreen(int index, ScreenPtr pScreen);
#else
extern _X_EXPORT Bool
rdpCloseScreen(ScreenPtr pScreen);
#endif
extern _X_EXPORT WindowPtr
rdpGetRootWindowPtr(ScreenPtr pScreen);
extern _X_EXPORT rdpPtr
rdpGetDevFromScreen(ScreenPtr pScreen);
#endif

@ -1,119 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpFillPolygon.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
int maxx;
int maxy;
int minx;
int miny;
int index;
int x;
int y;
BoxRec box;
LLOGLN(10, ("rdpFillPolygon:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpFillPolygonCallCount++;
box.x1 = 0;
box.y1 = 0;
box.x2 = 0;
box.y2 = 0;
if (count > 0)
{
maxx = pPts[0].x;
maxy = pPts[0].y;
minx = maxx;
miny = maxy;
for (index = 1; index < count; index++)
{
x = pPts[index].x;
y = pPts[index].y;
maxx = RDPMAX(x, maxx);
minx = RDPMIN(x, minx);
maxy = RDPMAX(y, maxy);
miny = RDPMIN(y, miny);
}
box.x1 = pDrawable->x + minx;
box.y1 = pDrawable->y + miny;
box.x2 = pDrawable->x + maxx + 1;
box.y2 = pDrawable->y + maxy + 1;
}
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpFillPolygon: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,34 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPFILLPOLYGON_H
#define __RDPFILLPOLYGON_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count,
DDXPointPtr pPts);
#endif

@ -1,62 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpFillSpans.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
LLOGLN(0, ("rdpFillSpans:"));
/* do original call */
rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPFILLSPANS_H
#define __RDPFILLSPANS_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
void
rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int* pwidthInit, int fSorted);
#endif

@ -1,235 +0,0 @@
/*
Copyright 2005-2014 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.
GC related calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdp.h"
#include "rdpFillSpans.h"
#include "rdpSetSpans.h"
#include "rdpPutImage.h"
#include "rdpCopyArea.h"
#include "rdpCopyPlane.h"
#include "rdpPolyPoint.h"
#include "rdpPolylines.h"
#include "rdpPolySegment.h"
#include "rdpPolyRectangle.h"
#include "rdpPolyArc.h"
#include "rdpFillPolygon.h"
#include "rdpPolyFillRect.h"
#include "rdpPolyFillArc.h"
#include "rdpPolyText8.h"
#include "rdpPolyText16.h"
#include "rdpImageText8.h"
#include "rdpImageText16.h"
#include "rdpImageGlyphBlt.h"
#include "rdpPolyGlyphBlt.h"
#include "rdpPushPixels.h"
#include "rdpDraw.h"
#include "rdpGC.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
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 { \
dev = rdpGetDevFromScreen((_pGC)->pScreen); \
priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \
(_pGC)->funcs = priv->funcs; \
if (priv->ops != 0) \
{ \
(_pGC)->ops = priv->ops; \
} \
} while (0)
/******************************************************************************/
#define GC_FUNC_EPILOGUE(_pGC) \
do { \
priv->funcs = (_pGC)->funcs; \
(_pGC)->funcs = &g_rdpGCFuncs; \
if (priv->ops != 0) \
{ \
priv->ops = (_pGC)->ops; \
(_pGC)->ops = &g_rdpGCOps; \
} \
} while (0)
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d);
static void
rdpChangeGC(GCPtr pGC, unsigned long mask);
static void
rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst);
static void
rdpDestroyGC(GCPtr pGC);
static void
rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
static void
rdpDestroyClip(GCPtr pGC);
static void
rdpCopyClip(GCPtr dst, GCPtr src);
GCFuncs g_rdpGCFuncs =
{
rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
rdpDestroyClip, rdpCopyClip
};
GCOps g_rdpGCOps =
{
rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane,
rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle,
rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc,
rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16,
rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels
};
/******************************************************************************/
static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpValidateGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ValidateGC(pGC, changes, d);
priv->ops = pGC->ops;
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpChangeGC(GCPtr pGC, unsigned long mask)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeGC(pGC, mask);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyGC:"));
GC_FUNC_PROLOGUE(dst);
dst->funcs->CopyGC(src, mask, dst);
GC_FUNC_EPILOGUE(dst);
}
/******************************************************************************/
static void
rdpDestroyGC(GCPtr pGC)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyGC:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyGC(pGC);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpChangeClip:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpDestroyClip(GCPtr pGC)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpDestroyClip:"));
GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyClip(pGC);
GC_FUNC_EPILOGUE(pGC);
}
/******************************************************************************/
static void
rdpCopyClip(GCPtr dst, GCPtr src)
{
GC_FUNC_VARS;
LLOGLN(10, ("rdpCopyClip:"));
GC_FUNC_PROLOGUE(dst);
dst->funcs->CopyClip(dst, src);
GC_FUNC_EPILOGUE(dst);
}
/*****************************************************************************/
Bool
rdpCreateGC(GCPtr pGC)
{
Bool rv;
rdpPtr dev;
ScreenPtr pScreen;
rdpGCPtr priv;
LLOGLN(10, ("rdpCreateGC:"));
pScreen = pGC->pScreen;
dev = rdpGetDevFromScreen(pScreen);
priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC);
pScreen->CreateGC = dev->CreateGC;
rv = pScreen->CreateGC(pGC);
if (rv)
{
priv->funcs = pGC->funcs;
priv->ops = 0;
pGC->funcs = &g_rdpGCFuncs;
}
pScreen->CreateGC = rdpCreateGC;
return rv;
}

@ -1,34 +0,0 @@
/*
Copyright 2005-2014 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.
GC related calls
*/
#ifndef _RDPGC_H
#define _RDPGC_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpCreateGC(GCPtr pGC);
#endif

@ -1,105 +0,0 @@
/*
Copyright 2012-2014 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.
gylph(font) calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <picture.h>
#include <glyphstr.h>
#include "rdp.h"
#include "rdpGlyphs.h"
#include "rdpDraw.h"
#include "rdpMisc.h"
#include "rdpReg.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
int
rdpGlyphDeleteRdpText(struct rdp_text *rtext)
{
int index;
if (rtext == NULL)
{
return 0;
}
for (index = 0; index < rtext->num_chars; index++)
{
if (rtext->chars[index] != NULL)
{
g_free(rtext->chars[index]->data);
g_free(rtext->chars[index]);
}
}
rdpRegionDestroy(rtext->reg);
rdpGlyphDeleteRdpText(rtext->next);
g_free(rtext);
return 0;
}
/******************************************************************************/
static void
rdpGlyphsOrg(PictureScreenPtr ps, rdpPtr dev,
CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
GlyphPtr *glyphs)
{
ps->Glyphs = dev->Glyphs;
ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc,
nlists, lists, glyphs);
ps->Glyphs = rdpGlyphs;
}
/******************************************************************************/
void
rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
GlyphPtr *glyphs)
{
ScreenPtr pScreen;
rdpPtr dev;
PictureScreenPtr ps;
LLOGLN(10, ("rdpGlyphs:"));
pScreen = pDst->pDrawable->pScreen;
dev = rdpGetDevFromScreen(pScreen);
ps = GetPictureScreen(pScreen);
rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc,
nlists, lists, glyphs);
}

@ -1,66 +0,0 @@
/*
Copyright 2012-2014 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.
gylph(font) calls
*/
#ifndef _RDPGLYPHS_H
#define _RDPGLYPHS_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
struct rdp_font_char
{
int offset; /* x */
int baseline; /* y */
int width; /* cx */
int height; /* cy */
int incby;
int bpp;
char *data;
int data_bytes;
};
struct rdp_text
{
RegionPtr reg;
int font;
int x;
int y;
int flags;
int mixmode;
char data[256];
int data_bytes;
struct rdp_font_char* chars[256];
int num_chars;
struct rdp_text* next;
};
extern _X_EXPORT int
rdpGlyphDeleteRdpText(struct rdp_text* rtext);
extern _X_EXPORT void
rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
GlyphPtr *glyphs);
#endif

@ -1,89 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpImageGlyphBlt.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(0, ("rdpImageGlyphBlt:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpImageGlyphBltCallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpImageGlyphBlt: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,34 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPIMAGEGLYPHBLT_H
#define __RDPIMAGEGLYPHBLT_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr* ppci, pointer pglyphBase);
#endif

@ -1,87 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpImageText16.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpImageText16:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpImageText16CallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpImageText16: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPIMAGETEXT16_H
#define __RDPIMAGETEXT16_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short* chars);
#endif

@ -1,87 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpImageText8.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpImageText8:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpImageText8CallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpImageText8: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPIMAGETEXT8_H
#define __RDPIMAGETEXT8_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char* chars);
#endif

@ -1,133 +0,0 @@
/*
Copyright 2013-2014 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>
#include <xorgVersion.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)
{
LLOGLN(0, ("rdpRegisterInputCallback: type %d proc %p", type, 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;
char text[256];
LLOGLN(0, ("rdpUnregisterInputCallback: proc %p", proc));
for (index = 0; index < MAX_INPUT_PROC; index++)
{
if (g_input_proc[index].proc == proc)
{
if (index == 0)
{
/* hack to cleanup
remove when xrdpdevTearDown is working */
g_sprintf(text, "/tmp/.xrdp/xrdp_display_%s", display);
LLOGLN(0, ("rdpUnregisterInputCallback: deleting file %s", text));
unlink(text);
}
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;
}

@ -1,50 +0,0 @@
/*
Copyright 2013-2014 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
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
typedef int (*rdpInputEventProcPtr)(rdpPtr dev, int msg,
long param1, long param2,
long param3, long param4);
extern _X_EXPORT int
rdpRegisterInputCallback(int type, rdpInputEventProcPtr proc);
extern _X_EXPORT int
rdpUnregisterInputCallback(rdpInputEventProcPtr proc);
extern _X_EXPORT int
rdpInputKeyboardEvent(rdpPtr dev, int msg,
long param1, long param2,
long param3, long param4);
extern _X_EXPORT int
rdpInputMouseEvent(rdpPtr dev, int msg,
long param1, long param2,
long param3, long param4);
extern _X_EXPORT int
rdpInputInit(void);
#endif

@ -1,111 +0,0 @@
/*
Copyright 2013-2014 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdp.h"
#include "rdpInput.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpMain.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
static Bool g_initialised = FALSE;
/*****************************************************************************/
static pointer
xorgxrdpSetup(pointer Module, pointer Options,
int *ErrorMajor, int *ErrorMinor)
{
LLOGLN(0, ("xorgxrdpSetup:"));
if (!g_initialised)
{
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 =
{
XRDP_MODULE_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
PACKAGE_VERSION_MAJOR,
PACKAGE_VERSION_MINOR,
PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_VIDEODRV,
ABI_VIDEODRV_VERSION,
0,
{ 0, 0, 0, 0 }
};
_X_EXPORT XF86ModuleData xorgxrdpModuleData =
{
&RDPVersRec,
xorgxrdpSetup,
xorgxrdpTearDown
};

@ -1,34 +0,0 @@
/*
Copyright 2013-2014 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
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
xorgxrdpDownDown(ScreenPtr pScreen);
#endif

@ -1,446 +0,0 @@
/*
Copyright 2005-2014 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.
the rest
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdpMisc.h"
/******************************************************************************/
int
rdpBitsPerPixel(int depth)
{
if (depth == 1)
{
return 1;
}
else if (depth <= 8)
{
return 8;
}
else if (depth <= 16)
{
return 16;
}
else
{
return 32;
}
}
/* the g_ functions from os_calls.c */
/*****************************************************************************/
/* wait 'millis' milliseconds for the socket to be able to receive */
/* returns boolean */
int
g_sck_can_recv(int sck, int millis)
{
fd_set rfds;
struct timeval time;
int rv;
time.tv_sec = millis / 1000;
time.tv_usec = (millis * 1000) % 1000000;
FD_ZERO(&rfds);
if (sck > 0)
{
FD_SET(((unsigned int)sck), &rfds);
rv = select(sck + 1, &rfds, 0, 0, &time);
if (rv > 0)
{
return 1;
}
}
return 0;
}
/*****************************************************************************/
int
g_sck_recv(int sck, void *ptr, int len, int flags)
{
return recv(sck, ptr, len, flags);
}
/*****************************************************************************/
void
g_sck_close(int sck)
{
if (sck == 0)
{
return;
}
shutdown(sck, 2);
close(sck);
}
/*****************************************************************************/
int
g_sck_last_error_would_block(int sck)
{
return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
}
/*****************************************************************************/
void
g_sleep(int msecs)
{
usleep(msecs * 1000);
}
/*****************************************************************************/
int
g_sck_send(int sck, void *ptr, int len, int flags)
{
return send(sck, ptr, len, flags);
}
/*****************************************************************************/
void *
g_malloc(int size, int zero)
{
char *rv;
rv = (char *)malloc(size);
if (zero)
{
if (rv != 0)
{
memset(rv, 0, size);
}
}
return rv;
}
/*****************************************************************************/
void
g_free(void *ptr)
{
if (ptr != 0)
{
free(ptr);
}
}
/*****************************************************************************/
void
g_sprintf(char *dest, char *format, ...)
{
va_list ap;
va_start(ap, format);
vsprintf(dest, format, ap);
va_end(ap);
}
/*****************************************************************************/
int
g_sck_tcp_socket(void)
{
int rv;
int i;
i = 1;
rv = socket(PF_INET, SOCK_STREAM, 0);
setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i));
return rv;
}
/*****************************************************************************/
int
g_sck_local_socket_dgram(void)
{
return socket(AF_UNIX, SOCK_DGRAM, 0);
}
/*****************************************************************************/
int
g_sck_local_socket_stream(void)
{
return socket(AF_UNIX, SOCK_STREAM, 0);
}
/*****************************************************************************/
void
g_memcpy(void *d_ptr, const void *s_ptr, int size)
{
memcpy(d_ptr, s_ptr, size);
}
/*****************************************************************************/
void
g_memset(void *d_ptr, const unsigned char chr, int size)
{
memset(d_ptr, chr, size);
}
/*****************************************************************************/
int
g_sck_tcp_set_no_delay(int sck)
{
int i;
i = 1;
setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
return 0;
}
/*****************************************************************************/
int
g_sck_set_non_blocking(int sck)
{
unsigned long i;
i = fcntl(sck, F_GETFL);
i = i | O_NONBLOCK;
fcntl(sck, F_SETFL, i);
return 0;
}
/*****************************************************************************/
int
g_sck_accept(int sck)
{
struct sockaddr_in s;
unsigned int i;
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
return accept(sck, (struct sockaddr *)&s, &i);
}
/*****************************************************************************/
int
g_sck_select(int sck1, int sck2, int sck3)
{
fd_set rfds;
struct timeval time;
int max;
int rv;
time.tv_sec = 0;
time.tv_usec = 0;
FD_ZERO(&rfds);
if (sck1 > 0)
{
FD_SET(((unsigned int)sck1), &rfds);
}
if (sck2 > 0)
{
FD_SET(((unsigned int)sck2), &rfds);
}
if (sck3 > 0)
{
FD_SET(((unsigned int)sck3), &rfds);
}
max = sck1;
if (sck2 > max)
{
max = sck2;
}
if (sck3 > max)
{
max = sck3;
}
rv = select(max + 1, &rfds, 0, 0, &time);
if (rv > 0)
{
rv = 0;
if (FD_ISSET(((unsigned int)sck1), &rfds))
{
rv = rv | 1;
}
if (FD_ISSET(((unsigned int)sck2), &rfds))
{
rv = rv | 2;
}
if (FD_ISSET(((unsigned int)sck3), &rfds))
{
rv = rv | 4;
}
}
else
{
rv = 0;
}
return rv;
}
/*****************************************************************************/
int
g_sck_tcp_bind(int sck, char *port)
{
struct sockaddr_in s;
memset(&s, 0, sizeof(struct sockaddr_in));
s.sin_family = AF_INET;
s.sin_port = htons(atoi(port));
s.sin_addr.s_addr = INADDR_ANY;
return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
}
/*****************************************************************************/
int
g_sck_local_bind(int sck, char *port)
{
struct sockaddr_un s;
memset(&s, 0, sizeof(struct sockaddr_un));
s.sun_family = AF_UNIX;
strcpy(s.sun_path, port);
return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un));
}
/*****************************************************************************/
int
g_sck_listen(int sck)
{
return listen(sck, 2);
}
/*****************************************************************************/
/* returns boolean */
int
g_create_dir(const char *dirname)
{
return mkdir(dirname, (mode_t) - 1) == 0;
}
/*****************************************************************************/
/* returns boolean, non zero if the directory exists */
int
g_directory_exist(const char *dirname)
{
struct stat st;
if (stat(dirname, &st) == 0)
{
return S_ISDIR(st.st_mode);
}
else
{
return 0;
}
}
/*****************************************************************************/
/* returns error */
int
g_chmod_hex(const char *filename, int flags)
{
int fl;
fl = 0;
fl |= (flags & 0x4000) ? S_ISUID : 0;
fl |= (flags & 0x2000) ? S_ISGID : 0;
fl |= (flags & 0x1000) ? S_ISVTX : 0;
fl |= (flags & 0x0400) ? S_IRUSR : 0;
fl |= (flags & 0x0200) ? S_IWUSR : 0;
fl |= (flags & 0x0100) ? S_IXUSR : 0;
fl |= (flags & 0x0040) ? S_IRGRP : 0;
fl |= (flags & 0x0020) ? S_IWGRP : 0;
fl |= (flags & 0x0010) ? S_IXGRP : 0;
fl |= (flags & 0x0004) ? S_IROTH : 0;
fl |= (flags & 0x0002) ? S_IWOTH : 0;
fl |= (flags & 0x0001) ? S_IXOTH : 0;
return chmod(filename, fl);
}
/*****************************************************************************/
/* produce a hex dump */
void
g_hexdump(void *p, long len)
{
unsigned char *line;
int i;
int thisline;
int offset;
offset = 0;
line = (unsigned char *) p;
while (offset < (int) len)
{
ErrorF("%04x ", offset);
thisline = len - offset;
if (thisline > 16)
{
thisline = 16;
}
for (i = 0; i < thisline; i++)
{
ErrorF("%02x ", line[i]);
}
for (; i < 16; i++)
{
ErrorF(" ");
}
for (i = 0; i < thisline; i++)
{
ErrorF("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
ErrorF("\n");
offset += thisline;
line += thisline;
}
}

@ -1,265 +0,0 @@
/*
Copyright 2005-2014 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.
the rest
*/
#ifndef __RDPMISC_H
#define __RDPMISC_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
#include <X11/Xos.h>
extern _X_EXPORT int
rdpBitsPerPixel(int depth);
extern _X_EXPORT int
g_sck_can_recv(int sck, int millis);
extern _X_EXPORT int
g_sck_recv(int sck, void *ptr, int len, int flags);
extern _X_EXPORT void
g_sck_close(int sck);
extern _X_EXPORT int
g_sck_last_error_would_block(int sck);
extern _X_EXPORT void
g_sleep(int msecs);
extern _X_EXPORT int
g_sck_send(int sck, void *ptr, int len, int flags);
extern _X_EXPORT void *
g_malloc(int size, int zero);
extern _X_EXPORT void
g_free(void *ptr);
extern _X_EXPORT void
g_sprintf(char *dest, char *format, ...);
extern _X_EXPORT int
g_sck_tcp_socket(void);
extern _X_EXPORT int
g_sck_local_socket_dgram(void);
extern _X_EXPORT int
g_sck_local_socket_stream(void);
extern _X_EXPORT void
g_memcpy(void *d_ptr, const void *s_ptr, int size);
extern _X_EXPORT void
g_memset(void *d_ptr, const unsigned char chr, int size);
extern _X_EXPORT int
g_sck_tcp_set_no_delay(int sck);
extern _X_EXPORT int
g_sck_set_non_blocking(int sck);
extern _X_EXPORT int
g_sck_accept(int sck);
extern _X_EXPORT int
g_sck_select(int sck1, int sck2, int sck3);
extern _X_EXPORT int
g_sck_tcp_bind(int sck, char *port);
extern _X_EXPORT int
g_sck_local_bind(int sck, char *port);
extern _X_EXPORT int
g_sck_listen(int sck);
extern _X_EXPORT int
g_create_dir(const char *dirname);
extern _X_EXPORT int
g_directory_exist(const char *dirname);
extern _X_EXPORT int
g_chmod_hex(const char *filename, int flags);
extern _X_EXPORT void
g_hexdump(void *p, long 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 */
#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) \
do { \
(s)->h = (s)->p; \
(s)->p += (n); \
} while (0)
/******************************************************************************/
#define s_pop_layer(s, h) \
do { \
(s)->p = (s)->h; \
} while (0)
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint16_le(s, v) \
do { \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
*((s)->p) = (unsigned char)((v) >> 8); \
(s)->p++; \
} while (0)
#else
#define out_uint16_le(s, v) \
do { \
*((unsigned short*)((s)->p)) = (unsigned short)(v); \
(s)->p += 2; \
} while (0)
#endif
/******************************************************************************/
#define init_stream(s, v) \
do { \
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; \
} while (0)
/******************************************************************************/
#define out_uint8p(s, v, n) \
do { \
g_memcpy((s)->p, (v), (n)); \
(s)->p += (n); \
} while (0)
/******************************************************************************/
#define out_uint8a(s, v, n) \
do { \
out_uint8p((s), (v), (n)); \
} while (0)
/******************************************************************************/
#define out_uint8(s, v) \
do { \
*((s)->p) = (unsigned char)((v) >> 0); \
(s)->p++; \
} while (0)
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define out_uint32_le(s, v) \
do { \
*((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++; \
} while (0)
#else
#define out_uint32_le(s, v) \
do { \
*((unsigned int*)((s)->p)) = (v); \
(s)->p += 4; \
} while (0)
#endif
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint32_le(s, v) \
do { \
(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; \
} while (0)
#else
#define in_uint32_le(s, v) \
do { \
(v) = *((unsigned int*)((s)->p)); \
(s)->p += 4; \
} while (0)
#endif
/******************************************************************************/
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
#define in_uint16_le(s, v) \
do { \
(v) = (unsigned short) \
( \
(*((unsigned char*)((s)->p + 0)) << 0) | \
(*((unsigned char*)((s)->p + 1)) << 8) \
); \
(s)->p += 2; \
} while (0)
#else
#define in_uint16_le(s, v) \
do { \
(v) = *((unsigned short*)((s)->p)); \
(s)->p += 2; \
} while (0)
#endif
/******************************************************************************/
#define s_mark_end(s) \
do { \
(s)->end = (s)->p; \
} while (0)
/******************************************************************************/
#define make_stream(s) \
do { \
(s) = (struct stream*)g_malloc(sizeof(struct stream), 1); \
} while (0)
/******************************************************************************/
#define free_stream(s) \
do { \
if ((s) != 0) \
{ \
g_free((s)->data); \
} \
g_free((s)); \
} while (0)
#endif

@ -1,122 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpPixmap.h"
#ifndef XRDP_PIX
#warning XRDP_PIX not defined
#endif
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
#if XRDP_PIX == 2
/*****************************************************************************/
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;
}
#else
/*****************************************************************************/
PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
{
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);
pScreen->CreatePixmap = rdpCreatePixmap;
return rv;
}
#endif
/******************************************************************************/
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;
}

@ -1,53 +0,0 @@
/*
Copyright 2005-2014 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
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 5, 0, 0, 0)
/* 1.1, 1.2, 1.3, 1.4 */
#define XRDP_PIX 1
#else
/* 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12 */
#define XRDP_PIX 2
#endif
#if XRDP_PIX == 2
extern _X_EXPORT PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint);
#else
extern _X_EXPORT PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth);
#endif
extern _X_EXPORT Bool
rdpDestroyPixmap(PixmapPtr pPixmap);
extern _X_EXPORT Bool
rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData);
#endif

@ -1,104 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyArc.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
rdpPtr dev;
BoxRec box;
int index;
int cd;
int lw;
int extra;
RegionRec clip_reg;
RegionRec reg;
LLOGLN(0, ("rdpPolyArc:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyArcCallCount++;
rdpRegionInit(&reg, NullBox, 0);
if (narcs > 0)
{
lw = pGC->lineWidth;
if (lw == 0)
{
lw = 1;
}
extra = lw / 2;
for (index = 0; index < narcs; index++)
{
box.x1 = (parcs[index].x - extra) + pDrawable->x;
box.y1 = (parcs[index].y - extra) + pDrawable->y;
box.x2 = box.x1 + parcs[index].width + lw;
box.y2 = box.y1 + parcs[index].height + lw;
rdpRegionUnionRect(&reg, &box);
}
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyArc: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,32 +0,0 @@
/*
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.
*/
#ifndef __RDPPOLYARC_H
#define __RDPPOLYARC_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
#endif

@ -1,104 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyFillArc.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
{
rdpPtr dev;
BoxRec box;
int index;
int cd;
int lw;
int extra;
RegionRec clip_reg;
RegionRec reg;
LLOGLN(10, ("rdpPolyFillArc:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyFillArcCallCount++;
rdpRegionInit(&reg, NullBox, 0);
if (narcs > 0)
{
lw = pGC->lineWidth;
if (lw == 0)
{
lw = 1;
}
extra = lw / 2;
for (index = 0; index < narcs; index++)
{
box.x1 = (parcs[index].x - extra) + pDrawable->x;
box.y1 = (parcs[index].y - extra) + pDrawable->y;
box.x2 = box.x1 + parcs[index].width + lw;
box.y2 = box.y1 + parcs[index].height + lw;
rdpRegionUnionRect(&reg, &box);
}
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyFillArc: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,32 +0,0 @@
/*
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.
*/
#ifndef __RDPPOLYFILLARC_H
#define __RDPPOLYFILLARC_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
#endif

@ -1,87 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyFillRect.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
xRectangle *prectInit)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
xRectangle *prectInit)
{
rdpPtr dev;
RegionRec clip_reg;
RegionPtr reg;
int cd;
LLOGLN(10, ("rdpPolyFillRect:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyFillRectCallCount++;
/* make a copy of rects */
reg = rdpRegionFromRects(nrectFill, prectInit, CT_NONE);
rdpRegionTranslate(reg, pDrawable->x, pDrawable->y);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyFillRect: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(reg, &clip_reg, reg);
}
/* do original call */
rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionDestroy(reg);
}

@ -1,33 +0,0 @@
/*
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.
*/
#ifndef __RDPPOLYFILLRECT_H
#define __RDPPOLYFILLRECT_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
xRectangle* prectInit);
#endif

@ -1,89 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyGlyphBlt.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(0, ("rdpPolyGlyphBlt:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyGlyphBltCallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyGlyphBlt: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,34 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYGLYPHBLT_H
#define __RDPPOLYGLYPHBLT_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr* ppci, pointer pglyphBase);
#endif

@ -1,95 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyPoint.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
int index;
BoxRec box;
LLOGLN(10, ("rdpPolyPoint:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyPointCallCount++;
rdpRegionInit(&reg, NullBox, 0);
for (index = 0; index < npt; index++)
{
box.x1 = in_pts[index].x + pDrawable->x;
box.y1 = in_pts[index].y + pDrawable->y;
box.x2 = box.x1 + 1;
box.y2 = box.y1 + 1;
rdpRegionUnionRect(&reg, &box);
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyPoint: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYPOINT_H
#define __RDPPOLYPOINT_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr in_pts);
#endif

@ -1,134 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyRectangle.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle *rects)
{
rdpPtr dev;
BoxRec box;
int index;
int up;
int down;
int lw;
int cd;
int x1;
int y1;
int x2;
int y2;
RegionRec clip_reg;
RegionRec reg;
LLOGLN(10, ("rdpPolyRectangle:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyRectangleCallCount++;
rdpRegionInit(&reg, NullBox, 0);
lw = pGC->lineWidth;
if (lw < 1)
{
lw = 1;
}
up = lw / 2;
down = 1 + (lw - 1) / 2;
index = 0;
while (index < nrects)
{
x1 = rects[index].x + pDrawable->x;
y1 = rects[index].y + pDrawable->y;
x2 = x1 + rects[index].width;
y2 = y1 + rects[index].height;
/* top */
box.x1 = x1 - up;
box.y1 = y1 - up;
box.x2 = x2 + down;
box.y2 = y1 + down;
rdpRegionUnionRect(&reg, &box);
/* left */
box.x1 = x1 - up;
box.y1 = y1 - up;
box.x2 = x1 + down;
box.y2 = y2 + down;
rdpRegionUnionRect(&reg, &box);
/* right */
box.x1 = x2 - up;
box.y1 = y1 - up;
box.x2 = x2 + down;
box.y2 = y2 + down;
rdpRegionUnionRect(&reg, &box);
/* bottom */
box.x1 = x1 - up;
box.y1 = y2 - up;
box.x2 = x2 + down;
box.y2 = y2 + down;
rdpRegionUnionRect(&reg, &box);
index++;
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyRectangle: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
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.
*/
#ifndef __RDPPOLYRECTANGLE_H
#define __RDPPOLYRECTANGLE_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
xRectangle* rects);
#endif

@ -1,101 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolySegment.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
int index;
int x1;
int y1;
int x2;
int y2;
BoxRec box;
LLOGLN(10, ("rdpPolySegment:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolySegmentCallCount++;
rdpRegionInit(&reg, NullBox, 0);
for (index = 0; index < nseg; index++)
{
x1 = pSegs[index].x1 + pDrawable->x;
y1 = pSegs[index].y1 + pDrawable->y;
x2 = pSegs[index].x2 + pDrawable->x;
y2 = pSegs[index].y2 + pDrawable->y;
box.x1 = RDPMIN(x1, x2);
box.y1 = RDPMIN(y1, y2);
box.x2 = RDPMAX(x1, x2) + 1;
box.y2 = RDPMAX(y1, y2) + 1;
rdpRegionUnionRect(&reg, &box);
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolySegment: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,32 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYSEGMENT_H
#define __RDPPOLYSEGMENT_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs);
#endif

@ -1,91 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyText16.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static int
rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
GC_OP_VARS;
int rv;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars);
GC_OP_EPILOGUE(pGC);
return rv;
}
/******************************************************************************/
int
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short *chars)
{
int rv;
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpPolyText16:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyText16CallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyText16: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
return rv;
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYTEXT16_H
#define __RDPPOLYTEXT16_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT int
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, unsigned short* chars);
#endif

@ -1,91 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolyText8.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static int
rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
GC_OP_VARS;
int rv;
GC_OP_PROLOGUE(pGC);
rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars);
GC_OP_EPILOGUE(pGC);
return rv;
}
/******************************************************************************/
int
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char *chars)
{
int rv;
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpPolyText8:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolyText8CallCount++;
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolyText8: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
return rv;
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYTEXT8_H
#define __RDPPOLYTEXT8_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
int
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, int count, char* chars);
#endif

@ -1,103 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPolylines.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
int index;
int x1;
int y1;
int x2;
int y2;
BoxRec box;
LLOGLN(10, ("rdpPolylines:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPolylinesCallCount++;
rdpRegionInit(&reg, NullBox, 0);
for (index = 1; index < npt; index++)
{
x1 = pptInit[index - 1].x + pDrawable->x;
y1 = pptInit[index - 1].y + pDrawable->y;
x2 = pptInit[index].x + pDrawable->x;
y2 = pptInit[index].y + pDrawable->y;
box.x1 = RDPMIN(x1, x2);
box.y1 = RDPMIN(y1, y2);
box.x2 = RDPMAX(x1, x2) + 1;
box.y2 = RDPMAX(y1, y2) + 1;
rdpRegionUnionRect(&reg, &box);
}
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolylines: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDrawable);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPOLYLINES_H
#define __RDPPOLYLINES_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit);
#endif

@ -1,177 +0,0 @@
/*
Copyright 2013-2014 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.
to deal with privates changing in xorg versions
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdpPri.h"
#include "rdpMisc.h"
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 5, 0, 0, 0)
/* 1.1, 1.2, 1.3, 1.4 */
#define XRDP_PRI 1
#elif XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 0, 0, 0)
/* 1.5, 1.6, 1.7, 1.8 */
#define XRDP_PRI 2
#else
/* 1.9, 1.10, 1.11, 1.12 */
#define XRDP_PRI 3
#endif
#define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr))))
#define INT2PTR(_int) ((void *) ((long) ((int) (_int))))
#if XRDP_PRI == 3
static DevPrivateKeyRec g_privateKeyRecGC;
static DevPrivateKeyRec g_privateKeyRecPixmap;
static DevPrivateKeyRec g_privateKeyRecWindow;
#elif XRDP_PRI == 2
static int g_privateKeyRecGC = 0;
static int g_privateKeyRecPixmap = 0;
static int g_privateKeyRecWindow = 0;
#endif
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes)
{
rdpDevPrivateKey rv;
#if XRDP_PRI == 1
rv = INT2PTR(AllocateGCPrivateIndex());
AllocateGCPrivate(pScreen, PTR2INT(rv), bytes);
#elif XRDP_PRI == 2
dixRequestPrivate(&g_privateKeyRecGC, bytes);
rv = &g_privateKeyRecGC;
#else
dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes);
rv = &g_privateKeyRecGC;
#endif
return rv;
}
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes)
{
rdpDevPrivateKey rv;
#if XRDP_PRI == 1
rv = INT2PTR(AllocatePixmapPrivateIndex());
AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes);
#elif XRDP_PRI == 2
dixRequestPrivate(&g_privateKeyRecPixmap, bytes);
rv = &g_privateKeyRecPixmap;
#else
dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes);
rv = &g_privateKeyRecPixmap;
#endif
return rv;
}
/*****************************************************************************/
rdpDevPrivateKey
rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes)
{
rdpDevPrivateKey rv;
#if XRDP_PRI == 1
rv = INT2PTR(AllocateWindowPrivateIndex());
AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes);
#elif XRDP_PRI == 2
dixRequestPrivate(&g_privateKeyRecWindow, bytes);
rv = &g_privateKeyRecWindow;
#else
dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes);
rv = &g_privateKeyRecWindow;
#endif
return rv;
}
/*****************************************************************************/
void *
rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key)
{
void *rv;
#if XRDP_PRI == 1
rv = pGC->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pGC->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
void *
rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key)
{
void *rv;
#if XRDP_PRI == 1
rv = pPixmap->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pPixmap->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
void *
rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key)
{
void *rv;
#if XRDP_PRI == 1
rv = pWindow->devPrivates[PTR2INT(key)].ptr;
#else
rv = dixLookupPrivate(&(pWindow->devPrivates), key);
#endif
return rv;
}
/*****************************************************************************/
int
rdpPrivateInit(void)
{
#if XRDP_PRI == 3
g_memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC));
g_memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow));
g_memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap));
#endif
return 0;
}

@ -1,51 +0,0 @@
/*
Copyright 2013-2014 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.
to deal with privates changing in xorg versions
*/
#ifndef _XRDPPRI_H
#define _XRDPPRI_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
#include <screenint.h>
#include <gc.h>
typedef void* rdpDevPrivateKey;
extern _X_EXPORT rdpDevPrivateKey
rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes);
extern _X_EXPORT rdpDevPrivateKey
rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes);
extern _X_EXPORT rdpDevPrivateKey
rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes);
extern _X_EXPORT void*
rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key);
extern _X_EXPORT void*
rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key);
extern _X_EXPORT void*
rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key);
extern _X_EXPORT int
rdpPrivateInit(void);
#endif

@ -1,62 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpPushPixels.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y)
{
LLOGLN(0, ("rdpPushPixels:"));
/* do original call */
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPUSHPIXELS_H
#define __RDPPUSHPIXELS_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y);
#endif

@ -1,91 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpPutImage.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *pBits)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
format, pBits);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *pBits)
{
rdpPtr dev;
RegionRec clip_reg;
RegionRec reg;
int cd;
BoxRec box;
LLOGLN(10, ("rdpPutImage:"));
dev = rdpGetDevFromScreen(pGC->pScreen);
dev->counts.rdpPutImageCallCount++;
box.x1 = x + pDst->x;
box.y1 = y + pDst->y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
rdpRegionInit(&reg, &box, 0);
rdpRegionInit(&clip_reg, NullBox, 0);
cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC);
LLOGLN(10, ("rdpPutImage: cd %d", cd));
if (cd == XRDP_CD_CLIP)
{
rdpRegionIntersect(&reg, &clip_reg, &reg);
}
/* do original call */
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
if (cd != XRDP_CD_NODRAW)
{
rdpClientConAddAllReg(dev, &reg, pDst);
}
rdpRegionUninit(&clip_reg);
rdpRegionUninit(&reg);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPPUTIMAGE_H
#define __RDPPUTIMAGE_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char* pBits);
#endif

@ -1,273 +0,0 @@
/*
Copyright 2011-2014 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.
RandR draw calls
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpReg.h"
#include "rdpMisc.h"
#include "rdpRandR.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
{
int mmwidth;
int mmheight;
RRScreenSizePtr pSize;
LLOGLN(0, ("rdpRRRegisterSize: width %d height %d", width, height));
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
/* Tell RandR what the current config is */
RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize);
return TRUE;
}
/******************************************************************************/
Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize)
{
LLOGLN(0, ("rdpRRSetConfig:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
int width;
int height;
rdpPtr dev;
LLOGLN(0, ("rdpRRGetInfo:"));
dev = rdpGetDevFromScreen(pScreen);
*pRotations = RR_Rotate_0;
width = dev->width;
height = dev->height;
rdpRRRegisterSize(pScreen, width, height);
return TRUE;
}
/******************************************************************************/
Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight)
{
WindowPtr root;
PixmapPtr screenPixmap;
BoxRec box;
rdpPtr dev;
LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d",
width, height, (int)mmWidth, (int)mmHeight));
dev = rdpGetDevFromScreen(pScreen);
root = rdpGetRootWindowPtr(pScreen);
if ((width < 1) || (height < 1))
{
LLOGLN(10, (" error width %d height %d", width, height));
return FALSE;
}
dev->width = width;
dev->height = height;
dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
pScreen->width = width;
pScreen->height = height;
pScreen->mmWidth = mmWidth;
pScreen->mmHeight = mmHeight;
screenPixmap = pScreen->GetScreenPixmap(pScreen);
g_free(dev->pfbMemory_alloc);
dev->pfbMemory_alloc = (char *) g_malloc(dev->sizeInBytes + 16, 1);
dev->pfbMemory = (char *) RDPALIGN(dev->pfbMemory_alloc, 16);
if (screenPixmap != 0)
{
pScreen->ModifyPixmapHeader(screenPixmap, width, height,
-1, -1,
dev->paddedWidthInBytes,
dev->pfbMemory);
}
box.x1 = 0;
box.y1 = 0;
box.x2 = width;
box.y2 = height;
rdpRegionInit(&root->winSize, &box, 1);
rdpRegionInit(&root->borderSize, &box, 1);
rdpRegionReset(&root->borderClip, &box);
rdpRegionBreak(&root->clipList);
root->drawable.width = width;
root->drawable.height = height;
ResizeChildrenWinSize(root, 0, 0, 0, 0);
RRGetInfo(pScreen, 1);
LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height));
RRScreenSizeNotify(pScreen);
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
xf86EnableDisableFBAccess(pScreen->myNum, FALSE);
xf86EnableDisableFBAccess(pScreen->myNum, TRUE);
#else
xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], FALSE);
xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], TRUE);
#endif
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
int x, int y, Rotation rotation, int numOutputs,
RROutputPtr *outputs)
{
LLOGLN(0, ("rdpRRCrtcSet:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
LLOGLN(0, ("rdpRRCrtcSetGamma:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p %p", crtc, crtc->gammaRed,
crtc->gammaBlue, crtc->gammaGreen));
crtc->gammaSize = 1;
if (crtc->gammaRed == NULL)
{
crtc->gammaRed = g_malloc(32, 1);
}
if (crtc->gammaBlue == NULL)
{
crtc->gammaBlue = g_malloc(32, 1);
}
if (crtc->gammaGreen == NULL)
{
crtc->gammaGreen = g_malloc(32, 1);
}
return TRUE;
}
/******************************************************************************/
Bool
rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
RRPropertyValuePtr value)
{
LLOGLN(0, ("rdpRROutputSetProperty:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
RRModePtr mode)
{
LLOGLN(0, ("rdpRROutputValidateMode:"));
return TRUE;
}
/******************************************************************************/
void
rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode)
{
LLOGLN(0, ("rdpRRModeDestroy:"));
}
/******************************************************************************/
Bool
rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property)
{
LLOGLN(0, ("rdpRROutputGetProperty:"));
return TRUE;
}
/******************************************************************************/
Bool
rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16 *border)
{
rdpPtr dev;
LLOGLN(0, ("rdpRRGetPanning: %p", crtc));
dev = rdpGetDevFromScreen(pScreen);
if (totalArea != 0)
{
totalArea->x1 = 0;
totalArea->y1 = 0;
totalArea->x2 = dev->width;
totalArea->y2 = dev->height;
}
if (trackingArea != 0)
{
trackingArea->x1 = 0;
trackingArea->y1 = 0;
trackingArea->x2 = dev->width;
trackingArea->y2 = dev->height;
}
if (border != 0)
{
border[0] = 0;
border[1] = 0;
border[2] = 0;
border[3] = 0;
}
return TRUE;
}
/******************************************************************************/
Bool
rdpRRSetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16 *border)
{
LLOGLN(0, ("rdpRRSetPanning:"));
return TRUE;
}

@ -1,64 +0,0 @@
/*
Copyright 2011-2014 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.
*/
#ifndef _RDPRANDR_H
#define _RDPRANDR_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height);
extern _X_EXPORT Bool
rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations);
extern _X_EXPORT Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize);
extern _X_EXPORT Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight);
extern _X_EXPORT Bool
rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
int x, int y, Rotation rotation, int numOutputs,
RROutputPtr* outputs);
extern _X_EXPORT Bool
rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
extern _X_EXPORT Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
extern _X_EXPORT Bool
rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
RRPropertyValuePtr value);
extern _X_EXPORT Bool
rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
RRModePtr mode);
extern _X_EXPORT void
rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode);
extern _X_EXPORT Bool
rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property);
extern _X_EXPORT Bool
rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border);
extern _X_EXPORT Bool
rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border);
#endif

@ -1,267 +0,0 @@
/*
Copyright 2013-2014 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.
to deal with regions changing in xorg versions
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdpReg.h"
/*
miRegionCopy -> RegionCopy
miTranslateRegion -> RegionTranslate
miRegionNotEmpty -> RegionNotEmpty
miIntersect -> RegionIntersect
miRectIn -> RegionContainsRect
miRegionInit -> RegionInit
miRegionUninit -> RegionUninit
miRectsToRegion -> RegionFromRects
miRegionDestroy -> RegionDestroy
miRegionCreate -> RegionCreate
miUnion -> RegionUnion
miRegionExtents -> RegionExtents
miRegionReset -> RegionReset
miRegionBreak -> RegionBreak
*/
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 0, 0, 0)
/* 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 */
#define XRDP_REG 1
#else
/* 1.9, 1.10, 1.11, 1.12 */
#define XRDP_REG 2
#endif
/*****************************************************************************/
Bool
rdpRegionCopy(RegionPtr dst, RegionPtr src)
{
#if XRDP_REG == 1
return miRegionCopy(dst, src);
#else
return RegionCopy(dst, src);
#endif
}
/*****************************************************************************/
void
rdpRegionTranslate(RegionPtr pReg, int x, int y)
{
#if XRDP_REG == 1
miTranslateRegion(pReg, x, y);
#else
RegionTranslate(pReg, x, y);
#endif
}
/*****************************************************************************/
Bool
rdpRegionNotEmpty(RegionPtr pReg)
{
#if XRDP_REG == 1
return miRegionNotEmpty(pReg);
#else
return RegionNotEmpty(pReg);
#endif
}
/*****************************************************************************/
Bool
rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
{
#if XRDP_REG == 1
return miIntersect(newReg, reg1, reg2);
#else
return RegionIntersect(newReg, reg1, reg2);
#endif
}
/*****************************************************************************/
int
rdpRegionContainsRect(RegionPtr region, BoxPtr prect)
{
#if XRDP_REG == 1
return miRectIn(region, prect);
#else
return RegionContainsRect(region, prect);
#endif
}
/*****************************************************************************/
void
rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size)
{
#if XRDP_REG == 1
miRegionInit(pReg, rect, size);
#else
RegionInit(pReg, rect, size);
#endif
}
/*****************************************************************************/
void
rdpRegionUninit(RegionPtr pReg)
{
#if XRDP_REG == 1
miRegionUninit(pReg);
#else
RegionUninit(pReg);
#endif
}
/*****************************************************************************/
RegionPtr
rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype)
{
#if XRDP_REG == 1
return miRectsToRegion(nrects, prect, ctype);
#else
return RegionFromRects(nrects, prect, ctype);
#endif
}
/*****************************************************************************/
void
rdpRegionDestroy(RegionPtr pReg)
{
#if XRDP_REG == 1
miRegionDestroy(pReg);
#else
RegionDestroy(pReg);
#endif
}
/*****************************************************************************/
RegionPtr
rdpRegionCreate(BoxPtr rect, int size)
{
#if XRDP_REG == 1
return miRegionCreate(rect, size);
#else
return RegionCreate(rect, size);
#endif
}
/*****************************************************************************/
Bool
rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
{
#if XRDP_REG == 1
return miUnion(newReg, reg1, reg2);
#else
return RegionUnion(newReg, reg1, reg2);
#endif
}
/*****************************************************************************/
Bool
rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2)
{
#if XRDP_REG == 1
return miSubtract(newReg, reg1, reg2);
#else
return RegionSubtract(newReg, reg1, reg2);
#endif
}
/*****************************************************************************/
Bool
rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect)
{
#if XRDP_REG == 1
return miInverse(newReg, reg1, invRect);
#else
return RegionInverse(newReg, reg1, invRect);
#endif
}
/*****************************************************************************/
BoxPtr
rdpRegionExtents(RegionPtr pReg)
{
#if XRDP_REG == 1
return miRegionExtents(pReg);
#else
return RegionExtents(pReg);
#endif
}
/*****************************************************************************/
void
rdpRegionReset(RegionPtr pReg, BoxPtr pBox)
{
#if XRDP_REG == 1
miRegionReset(pReg, pBox);
#else
RegionReset(pReg, pBox);
#endif
}
/*****************************************************************************/
Bool
rdpRegionBreak(RegionPtr pReg)
{
#if XRDP_REG == 1
return miRegionBreak(pReg);
#else
return RegionBreak(pReg);
#endif
}
/*****************************************************************************/
void
rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect)
{
RegionRec reg;
rdpRegionInit(&reg, prect, 0);
rdpRegionUnion(pReg, pReg, &reg);
rdpRegionUninit(&reg);
}
/*****************************************************************************/
int
rdpRegionPixelCount(RegionPtr pReg)
{
int index;
int count;
int rv;
BoxRec box;
rv = 0;
count = REGION_NUM_RECTS(pReg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(pReg)[index];
rv += (box.x2 - box.x1) * (box.y2 - box.y1);
}
return rv;
}

@ -1,68 +0,0 @@
/*
Copyright 2013-2014 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.
to deal with regions changing in xorg versions
*/
#ifndef __RDPREG_H
#define __RDPREG_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpRegionCopy(RegionPtr dst, RegionPtr src);
extern _X_EXPORT void
rdpRegionTranslate(RegionPtr pReg, int x, int y);
extern _X_EXPORT Bool
rdpRegionNotEmpty(RegionPtr pReg);
extern _X_EXPORT Bool
rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
extern _X_EXPORT int
rdpRegionContainsRect(RegionPtr region, BoxPtr prect);
extern _X_EXPORT void
rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size);
extern _X_EXPORT void
rdpRegionUninit(RegionPtr pReg);
extern _X_EXPORT RegionPtr
rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype);
extern _X_EXPORT void
rdpRegionDestroy(RegionPtr pReg);
extern _X_EXPORT RegionPtr
rdpRegionCreate(BoxPtr rect, int size);
extern _X_EXPORT Bool
rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
extern _X_EXPORT Bool
rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
extern _X_EXPORT Bool
rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect);
extern _X_EXPORT BoxPtr
rdpRegionExtents(RegionPtr pReg);
extern _X_EXPORT void
rdpRegionReset(RegionPtr pReg, BoxPtr pBox);
extern _X_EXPORT Bool
rdpRegionBreak(RegionPtr pReg);
extern _X_EXPORT void
rdpRegionUnionRect(RegionPtr pReg, BoxPtr prect);
extern _X_EXPORT int
rdpRegionPixelCount(RegionPtr pReg);
#endif

@ -1,64 +0,0 @@
/*
Copyright 2005-2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpSetSpans.h"
#define LDEBUG 0
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
void
rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
GC_OP_VARS;
GC_OP_PROLOGUE(pGC);
pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
LLOGLN(0, ("rdpSetSpans:"));
/* do original call */
rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
}

@ -1,33 +0,0 @@
/*
Copyright 2005-2014 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.
*/
#ifndef __RDPSETSPANS_H
#define __RDPSETSPANS_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
DDXPointPtr ppt, int* pwidth, int nspans, int fSorted);
#endif

@ -1,110 +0,0 @@
/*
Copyright 2014 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.
SIMD function asign
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpXv.h"
#include "rdpCapture.h"
#include "rdpSimd.h"
/* use simd, run time */
int g_simd_use_accel = 1;
/* use simd, compile time, if zero, g_simd_use_accel does not matter */
#if !defined(SIMD_USE_ACCEL)
#define SIMD_USE_ACCEL 0
#endif
#if SIMD_USE_ACCEL
#if defined(__x86_64__) || defined(__AMD64__) || defined (_M_AMD64)
#include "amd64/funcs_amd64.h"
#elif defined(__x86__) || defined(_M_IX86) || defined(__i386__)
#include "x86/funcs_x86.h"
#endif
#endif
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/*****************************************************************************/
Bool
rdpSimdInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
{
rdpPtr dev;
dev = XRDPPTR(pScrn);
/* assign functions */
LLOGLN(0, ("rdpSimdInit: assigning yuv functions"));
dev->yv12_to_rgb32 = YV12_to_RGB32;
dev->i420_to_rgb32 = I420_to_RGB32;
dev->yuy2_to_rgb32 = YUY2_to_RGB32;
dev->uyvy_to_rgb32 = UYVY_to_RGB32;
dev->a8r8g8b8_to_a8b8g8r8_box = a8r8g8b8_to_a8b8g8r8_box;
#if SIMD_USE_ACCEL
if (g_simd_use_accel)
{
#if defined(__x86_64__) || defined(__AMD64__) || defined (_M_AMD64)
int ax, bx, cx, dx;
cpuid_amd64(1, 0, &ax, &bx, &cx, &dx);
LLOGLN(0, ("rdpSimdInit: cpuid ax 1 cx 0 return ax 0x%8.8x bx "
"0x%8.8x cx 0x%8.8x dx 0x%8.8x", ax, bx, cx, dx));
if (dx & (1 << 26)) /* SSE 2 */
{
dev->yv12_to_rgb32 = yv12_to_rgb32_amd64_sse2;
dev->i420_to_rgb32 = i420_to_rgb32_amd64_sse2;
dev->yuy2_to_rgb32 = yuy2_to_rgb32_amd64_sse2;
dev->uyvy_to_rgb32 = uyvy_to_rgb32_amd64_sse2;
LLOGLN(0, ("rdpSimdInit: sse2 amd64 yuv functions assigned"));
}
#elif defined(__x86__) || defined(_M_IX86) || defined(__i386__)
int ax, bx, cx, dx;
cpuid_x86(1, 0, &ax, &bx, &cx, &dx);
LLOGLN(0, ("rdpSimdInit: cpuid ax 1 cx 0 return ax 0x%8.8x bx "
"0x%8.8x cx 0x%8.8x dx 0x%8.8x", ax, bx, cx, dx));
if (dx & (1 << 26)) /* SSE 2 */
{
dev->yv12_to_rgb32 = yv12_to_rgb32_x86_sse2;
dev->i420_to_rgb32 = i420_to_rgb32_x86_sse2;
dev->yuy2_to_rgb32 = yuy2_to_rgb32_x86_sse2;
dev->uyvy_to_rgb32 = uyvy_to_rgb32_x86_sse2;
dev->a8r8g8b8_to_a8b8g8r8_box = a8r8g8b8_to_a8b8g8r8_box_x86_sse2;
LLOGLN(0, ("rdpSimdInit: sse2 x86 yuv functions assigned"));
}
#endif
}
#endif
return 1;
}

@ -1,34 +0,0 @@
/*
Copyright 2014 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.
SIMD function asign
*/
#ifndef __RDPSIMD_H
#define __RDPSIMD_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpSimdInit(ScreenPtr pScreen, ScrnInfoPtr pScrn);
#endif

@ -1,88 +0,0 @@
/*
Copyright 2014 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>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipict.h>
#include <picture.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpReg.h"
#include "rdpTrapezoids.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpTrapezoidsOrg(PictureScreenPtr ps, rdpPtr dev,
CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps)
{
ps->Trapezoids = dev->Trapezoids;
ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps);
ps->Trapezoids = rdpTrapezoids;
}
/******************************************************************************/
void
rdpTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps)
{
ScreenPtr pScreen;
rdpPtr dev;
PictureScreenPtr ps;
BoxRec box;
RegionRec reg;
LLOGLN(10, ("rdpTrapezoids:"));
pScreen = pDst->pDrawable->pScreen;
dev = rdpGetDevFromScreen(pScreen);
dev->counts.rdpTrapezoidsCallCount++;
miTrapezoidBounds(ntrap, traps, &box);
box.x1 += pDst->pDrawable->x;
box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y;
rdpRegionInit(&reg, &box, 0);
ps = GetPictureScreen(pScreen);
/* do original call */
rdpTrapezoidsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc,
ntrap, traps);
rdpClientConAddAllReg(dev, &reg, pDst->pDrawable);
rdpRegionUninit(&reg);
}

@ -1,34 +0,0 @@
/*
Copyright 2014 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.
*/
#ifndef _RDPTRAPEZOIDS_H
#define _RDPTRAPEZOIDS_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT void
rdpTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps);
#endif

@ -1,690 +0,0 @@
/*
Copyright 2014 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.
XVideo
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <xf86xv.h>
#include <X11/extensions/Xv.h>
#include <fourcc.h>
#include <fb.h>
#include "rdp.h"
#include "rdpMisc.h"
#include "rdpReg.h"
#include "rdpClientCon.h"
#include "rdpXv.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
#define T_NUM_ENCODINGS 1
static XF86VideoEncodingRec g_xrdpVidEncodings[T_NUM_ENCODINGS] =
{ { 0, "XV_IMAGE", 2046, 2046, { 1, 1 } } };
#define T_NUM_FORMATS 1
static XF86VideoFormatRec g_xrdpVidFormats[T_NUM_FORMATS] =
{ { 0, TrueColor } };
/* YV12
I420
12 bpp planar
YUV 4:2:0 8 bit Y plane followed by 8 bit 2x2 subsampled
U and V planes. */
/* YUY2
UYVY
16 bpp packed
YUV 4:2:2 Y sample at every pixel, U and V sampled at
every second pixel */
/* XVIMAGE_YV12 FOURCC_YV12 0x32315659 */
/* XVIMAGE_I420 FOURCC_I420 0x30323449 */
/* XVIMAGE_YUY2 FOURCC_YUY2 0x32595559 */
/* XVIMAGE_UYVY FOURCC_UYVY 0x59565955 */
static XF86ImageRec g_xrdpVidImages[] =
{ XVIMAGE_YV12, XVIMAGE_I420, XVIMAGE_YUY2, XVIMAGE_UYVY };
#define T_MAX_PORTS 1
/*****************************************************************************/
static int
xrdpVidPutVideo(ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
pointer data, DrawablePtr pDraw)
{
LLOGLN(0, ("xrdpVidPutVideo:"));
return Success;
}
/*****************************************************************************/
static int
xrdpVidPutStill(ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
pointer data, DrawablePtr pDraw)
{
LLOGLN(0, ("xrdpVidPutStill:"));
return Success;
}
/*****************************************************************************/
static int
xrdpVidGetVideo(ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
pointer data, DrawablePtr pDraw)
{
LLOGLN(0, ("xrdpVidGetVideo:"));
return Success;
}
/*****************************************************************************/
static int
xrdpVidGetStill(ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
pointer data, DrawablePtr pDraw)
{
LLOGLN(0, ("FBDevTIVidGetStill:"));
return Success;
}
/*****************************************************************************/
static void
xrdpVidStopVideo(ScrnInfoPtr pScrn, pointer data, Bool Cleanup)
{
LLOGLN(0, ("xrdpVidStopVideo:"));
}
/*****************************************************************************/
static int
xrdpVidSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
INT32 value, pointer data)
{
LLOGLN(0, ("xrdpVidSetPortAttribute:"));
return Success;
}
/*****************************************************************************/
static int
xrdpVidGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
INT32 *value, pointer data)
{
LLOGLN(0, ("xrdpVidGetPortAttribute:"));
return Success;
}
/*****************************************************************************/
static void
xrdpVidQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
short vid_w, short vid_h, short drw_w, short drw_h,
unsigned int *p_w, unsigned int *p_h, pointer data)
{
LLOGLN(0, ("xrdpVidQueryBestSize:"));
}
/*****************************************************************************/
int
YV12_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs)
{
int size_total;
int y;
int u;
int v;
int c;
int d;
int e;
int r;
int g;
int b;
int t;
int i;
int j;
size_total = width * height;
for (j = 0; j < height; j++)
{
for (i = 0; i < width; i++)
{
y = yuvs[j * width + i];
u = yuvs[(j / 2) * (width / 2) + (i / 2) + size_total];
v = yuvs[(j / 2) * (width / 2) + (i / 2) + size_total + (size_total / 4)];
c = y - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
}
}
return 0;
}
/*****************************************************************************/
int
I420_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs)
{
int size_total;
int y;
int u;
int v;
int c;
int d;
int e;
int r;
int g;
int b;
int t;
int i;
int j;
size_total = width * height;
for (j = 0; j < height; j++)
{
for (i = 0; i < width; i++)
{
y = yuvs[j * width + i];
v = yuvs[(j / 2) * (width / 2) + (i / 2) + size_total];
u = yuvs[(j / 2) * (width / 2) + (i / 2) + size_total + (size_total / 4)];
c = y - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
}
}
return 0;
}
/*****************************************************************************/
int
YUY2_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs)
{
int y1;
int y2;
int u;
int v;
int c;
int d;
int e;
int r;
int g;
int b;
int t;
int i;
int j;
for (j = 0; j < height; j++)
{
for (i = 0; i < width; i++)
{
y1 = *(yuvs++);
v = *(yuvs++);
y2 = *(yuvs++);
u = *(yuvs++);
c = y1 - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
i++;
c = y2 - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
}
}
return 0;
}
/*****************************************************************************/
int
UYVY_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs)
{
int y1;
int y2;
int u;
int v;
int c;
int d;
int e;
int r;
int g;
int b;
int t;
int i;
int j;
for (j = 0; j < height; j++)
{
for (i = 0; i < width; i++)
{
v = *(yuvs++);
y1 = *(yuvs++);
u = *(yuvs++);
y2 = *(yuvs++);
c = y1 - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
i++;
c = y2 - 16;
d = u - 128;
e = v - 128;
t = (298 * c + 409 * e + 128) >> 8;
b = RDPCLAMP(t, 0, 255);
t = (298 * c - 100 * d - 208 * e + 128) >> 8;
g = RDPCLAMP(t, 0, 255);
t = (298 * c + 516 * d + 128) >> 8;
r = RDPCLAMP(t, 0, 255);
rgbs[j * width + i] = (r << 16) | (g << 8) | b;
}
}
return 0;
}
#if 0
/*****************************************************************************/
static int
stretch_RGB32_RGB32(int *src, int src_width, int src_height,
int src_x, int src_y, int src_w, int src_h,
int *dst, int dst_w, int dst_h)
{
int mwidth;
int mheight;
int index;
mwidth = RDPMIN(src_width, dst_w);
mheight = RDPMIN(src_height, dst_h);
for (index = 0; index < mheight; index++)
{
g_memcpy(dst, src, mwidth * 4);
src += src_width;
dst += dst_w;
}
return 0;
}
#endif
/*****************************************************************************/
static int
stretch_RGB32_RGB32(int *src, int src_width, int src_height,
int src_x, int src_y, int src_w, int src_h,
int *dst, int dst_w, int dst_h)
{
int index;
int jndex;
int lndex;
int last_lndex;
int oh;
int ih;
int ov;
int iv;
int pix;
int *src32;
int *dst32;
LLOGLN(10, ("stretch_RGB32_RGB32: oh 0x%8.8x ov 0x%8.8x", oh, ov));
oh = (src_w << 16) / dst_w;
ov = (src_h << 16) / dst_h;
iv = ov;
lndex = src_y;
last_lndex = -1;
for (index = 0; index < dst_h; index++)
{
if (lndex == last_lndex)
{
/* repeat line */
dst32 = dst + index * dst_w;
src32 = dst32 - dst_w;
g_memcpy(dst32, src32, dst_w * 4);
}
else
{
ih = oh;
src32 = src + lndex * src_width + src_x;
pix = *src32;
dst32 = dst + index * dst_w;
for (jndex = 0; jndex < dst_w; jndex++)
{
*dst32 = pix;
while (ih > (1 << 16) - 1)
{
ih -= 1 << 16;
src32++;
}
pix = *src32;
ih += oh;
dst32++;
}
}
last_lndex = lndex;
while (iv > (1 << 16) - 1)
{
iv -= 1 << 16;
lndex++;
}
iv += ov;
}
LLOGLN(10, ("stretch_RGB32_RGB32: out"));
return 0;
}
/******************************************************************************/
/* returns error */
static CARD32
rdpDeferredXvCleanup(OsTimerPtr timer, CARD32 now, pointer arg)
{
rdpPtr dev;
LLOGLN(0, ("rdpDeferredXvCleanup:"));
dev = (rdpPtr) arg;
dev->xv_timer_schedualed = 0;
dev->xv_data_bytes = 0;
g_free(dev->xv_data);
dev->xv_data = 0;
return 0;
}
/*****************************************************************************/
/* see hw/xfree86/common/xf86xv.c for info */
static int
xrdpVidPutImage(ScrnInfoPtr pScrn,
short src_x, short src_y, short drw_x, short drw_y,
short src_w, short src_h, short drw_w, short drw_h,
int format, unsigned char* buf,
short width, short height,
Bool sync, RegionPtr clipBoxes,
pointer data, DrawablePtr dst)
{
rdpPtr dev;
int *rgborg32;
int *rgbend32;
int index;
int error;
GCPtr tempGC;
LLOGLN(10, ("xrdpVidPutImage: format 0x%8.8x", format));
LLOGLN(10, ("xrdpVidPutImage: src_x %d srcy_y %d", src_x, src_y));
dev = XRDPPTR(pScrn);
if (dev->xv_timer_schedualed)
{
TimerCancel(dev->xv_timer);
dev->xv_timer = TimerSet(dev->xv_timer, 0, 2000,
rdpDeferredXvCleanup, dev);
}
else
{
dev->xv_timer_schedualed = 1;
dev->xv_timer = TimerSet(dev->xv_timer, 0, 2000,
rdpDeferredXvCleanup, dev);
}
index = width * height * 4 + drw_w * drw_h * 4 + 64;
if (index > dev->xv_data_bytes)
{
g_free(dev->xv_data);
dev->xv_data = g_malloc(index, 0);
if (dev->xv_data == NULL)
{
LLOGLN(0, ("xrdpVidPutImage: memory alloc error"));
dev->xv_data_bytes = 0;
return Success;
}
dev->xv_data_bytes = index;
}
rgborg32 = (int *) RDPALIGN(dev->xv_data, 16);
rgbend32 = rgborg32 + width * height;
rgbend32 = (int *) RDPALIGN(rgbend32, 16);
error = 0;
switch (format)
{
case FOURCC_YV12:
LLOGLN(10, ("xrdpVidPutImage: FOURCC_YV12"));
error = dev->yv12_to_rgb32(buf, width, height, rgborg32);
break;
case FOURCC_I420:
LLOGLN(10, ("xrdpVidPutImage: FOURCC_I420"));
error = dev->i420_to_rgb32(buf, width, height, rgborg32);
break;
case FOURCC_YUY2:
LLOGLN(10, ("xrdpVidPutImage: FOURCC_YUY2"));
error = dev->yuy2_to_rgb32(buf, width, height, rgborg32);
break;
case FOURCC_UYVY:
LLOGLN(10, ("xrdpVidPutImage: FOURCC_UYVY"));
error = dev->uyvy_to_rgb32(buf, width, height, rgborg32);
break;
default:
LLOGLN(0, ("xrdpVidPutImage: unknown format 0x%8.8x", format));
return Success;
}
if (error != 0)
{
return Success;
}
if ((width == drw_w) && (height == drw_h))
{
LLOGLN(10, ("xrdpVidPutImage: strech skip"));
rgbend32 = rgborg32;
}
else
{
error = stretch_RGB32_RGB32(rgborg32, width, height,
src_x, src_y, src_w, src_h,
rgbend32, drw_w, drw_h);
if (error != 0)
{
return Success;
}
}
tempGC = GetScratchGC(dst->depth, pScrn->pScreen);
if (tempGC != NULL)
{
ValidateGC(dst, tempGC);
(*tempGC->ops->PutImage)(dst, tempGC, 24,
drw_x - dst->x, drw_y - dst->y,
drw_w, drw_h, 0, ZPixmap,
(char *) rgbend32);
FreeScratchGC(tempGC);
}
return Success;
}
/*****************************************************************************/
static int
xrdpVidQueryImageAttributes(ScrnInfoPtr pScrn, int id,
unsigned short *w, unsigned short *h,
int *pitches, int *offsets)
{
int size, tmp;
LLOGLN(10, ("xrdpVidQueryImageAttributes:"));
/* this is same code as all drivers currently have */
if (*w > 2046)
{
*w = 2046;
}
if (*h > 2046)
{
*h = 2046;
}
/* make w multiple of 4 so that resizing works properly */
*w = (*w + 3) & ~3;
if (offsets != NULL)
{
offsets[0] = 0;
}
switch (id)
{
case FOURCC_YV12:
case FOURCC_I420:
/* make h be even */
*h = (*h + 1) & ~1;
/* make w be multiple of 4 (ie. pad it) */
size = (*w + 3) & ~3;
/* width of a Y row => width of image */
if (pitches != NULL)
{
pitches[0] = size;
}
/* offset of U plane => w * h */
size *= *h;
if (offsets != NULL)
{
offsets[1] = size;
}
/* width of U, V row => width / 2 */
tmp = ((*w >> 1) + 3) & ~3;
if (pitches != NULL)
{
pitches[1] = pitches[2] = tmp;
}
/* offset of V => Y plane + U plane (w * h + w / 2 * h / 2) */
tmp *= (*h >> 1);
size += tmp;
if (offsets != NULL)
{
offsets[2] = size;
}
size += tmp;
break;
case FOURCC_YUY2:
case FOURCC_UYVY:
size = (*w) * 2;
if (pitches != NULL)
{
pitches[0] = size;
}
size *= *h;
break;
default:
LLOGLN(0, ("xrdpVidQueryImageAttributes: Unsupported image"));
return 0;
}
LLOGLN(10, ("xrdpVidQueryImageAttributes: finished size %d id 0x%x", size, id));
return size;
}
/*****************************************************************************/
Bool
rdpXvInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
{
XF86VideoAdaptorPtr adaptor;
DevUnion* pDevUnion;
int bytes;
adaptor = xf86XVAllocateVideoAdaptorRec(pScrn);
if (adaptor == 0)
{
LLOGLN(0, ("rdpXvInit: xf86XVAllocateVideoAdaptorRec failed"));
return 0;
}
adaptor->type = XvInputMask | XvImageMask | XvVideoMask | XvStillMask | XvWindowMask | XvPixmapMask;
//adaptor->flags = VIDEO_NO_CLIPPING;
//adaptor->flags = VIDEO_CLIP_TO_VIEWPORT;
adaptor->flags = 0;
adaptor->name = XRDP_MODULE_NAME " XVideo Adaptor";
adaptor->nEncodings = T_NUM_ENCODINGS;
adaptor->pEncodings = &(g_xrdpVidEncodings[0]);
adaptor->nFormats = T_NUM_FORMATS;
adaptor->pFormats = &(g_xrdpVidFormats[0]);
adaptor->pFormats[0].depth = pScrn->depth;
LLOGLN(0, ("rdpXvInit: depth %d", pScrn->depth));
adaptor->nImages = sizeof(g_xrdpVidImages) / sizeof(XF86ImageRec);
adaptor->pImages = g_xrdpVidImages;
adaptor->nAttributes = 0;
adaptor->pAttributes = 0;
adaptor->nPorts = T_MAX_PORTS;
bytes = sizeof(DevUnion) * T_MAX_PORTS;
pDevUnion = (DevUnion*) g_malloc(bytes, 1);
adaptor->pPortPrivates = pDevUnion;
adaptor->PutVideo = xrdpVidPutVideo;
adaptor->PutStill = xrdpVidPutStill;
adaptor->GetVideo = xrdpVidGetVideo;
adaptor->GetStill = xrdpVidGetStill;
adaptor->StopVideo = xrdpVidStopVideo;
adaptor->SetPortAttribute = xrdpVidSetPortAttribute;
adaptor->GetPortAttribute = xrdpVidGetPortAttribute;
adaptor->QueryBestSize = xrdpVidQueryBestSize;
adaptor->PutImage = xrdpVidPutImage;
adaptor->QueryImageAttributes = xrdpVidQueryImageAttributes;
if (!xf86XVScreenInit(pScreen, &adaptor, 1))
{
LLOGLN(0, ("rdpXvInit: xf86XVScreenInit failed"));
return 0;
}
xf86XVFreeVideoAdaptorRec(adaptor);
return 1;
}

@ -1,42 +0,0 @@
/*
Copyright 2014 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.
XVideo
*/
#ifndef __RDPXV_H
#define __RDPXV_H
#include <xorg-server.h>
#include <xorgVersion.h>
#include <xf86.h>
extern _X_EXPORT Bool
rdpXvInit(ScreenPtr pScreen, ScrnInfoPtr pScrn);
extern _X_EXPORT int
YV12_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs);
extern _X_EXPORT int
I420_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs);
extern _X_EXPORT int
YUY2_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs);
extern _X_EXPORT int
UYVY_to_RGB32(unsigned char *yuvs, int width, int height, int *rgbs);
#endif

@ -1,174 +0,0 @@
;
;Copyright 2014 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.
;
;ARGB to ABGR
;x86 SSE2 32 bit
;
SECTION .data
align 16
c1 times 4 dd 0xFF00FF00
c2 times 4 dd 0x00FF0000
c3 times 4 dd 0x000000FF
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;a8r8g8b8_to_a8b8g8r8_box_x86_sse2(char *s8, int src_stride,
; char *d8, int dst_stride,
; int width, int height);
PROC a8r8g8b8_to_a8b8g8r8_box_x86_sse2
push ebx
push esi
push edi
push ebp
movdqa xmm4, [c1]
movdqa xmm5, [c2]
movdqa xmm6, [c3]
mov esi, [esp + 20] ; src
mov edi, [esp + 28] ; dst
loop_y:
mov ecx, [esp + 36] ; width
loop_xpre:
mov eax, esi ; look for aligned
and eax, 0x0F ; we can jump to next
mov ebx, eax
mov eax, edi
and eax, 0x0F
or eax, ebx
cmp eax, 0
je done_loop_xpre
cmp ecx, 1
jl done_loop_x ; all done with this row
mov eax, [esi]
lea esi, [esi + 4]
mov edx, eax ; a and g
and edx, 0xFF00FF00
mov ebx, eax ; r
and ebx, 0x00FF0000
shr ebx, 16
or edx, ebx
mov ebx, eax ; b
and ebx, 0x000000FF
shl ebx, 16
or edx, ebx
mov [edi], edx
lea edi, [edi + 4]
dec ecx
jmp loop_xpre;
done_loop_xpre:
prefetchnta [esi]
; A R G B A R G B A R G B A R G B to
; A B G R A B G R A B G R A B G R
loop_x8:
cmp ecx, 8
jl done_loop_x8
prefetchnta [esi + 32]
movdqa xmm0, [esi]
lea esi, [esi + 16]
movdqa xmm3, xmm0 ; a and g
pand xmm3, xmm4
movdqa xmm1, xmm0 ; r
pand xmm1, xmm5
psrld xmm1, 16
por xmm3, xmm1
movdqa xmm1, xmm0 ; b
pand xmm1, xmm6
pslld xmm1, 16
por xmm3, xmm1
movdqa [edi], xmm3
lea edi, [edi + 16]
sub ecx, 4
movdqa xmm0, [esi]
lea esi, [esi + 16]
movdqa xmm3, xmm0 ; a and g
pand xmm3, xmm4
movdqa xmm1, xmm0 ; r
pand xmm1, xmm5
psrld xmm1, 16
por xmm3, xmm1
movdqa xmm1, xmm0 ; b
pand xmm1, xmm6
pslld xmm1, 16
por xmm3, xmm1
movdqa [edi], xmm3
lea edi, [edi + 16]
sub ecx, 4
jmp loop_x8;
done_loop_x8:
loop_x:
cmp ecx, 1
jl done_loop_x
mov eax, [esi]
lea esi, [esi + 4]
mov edx, eax ; a and g
and edx, 0xFF00FF00
mov ebx, eax ; r
and ebx, 0x00FF0000
shr ebx, 16
or edx, ebx
mov ebx, eax ; b
and ebx, 0x000000FF
shl ebx, 16
or edx, ebx
mov [edi], edx
lea edi, [edi + 4]
dec ecx
jmp loop_x;
done_loop_x:
mov esi, [esp + 20]
add esi, [esp + 24]
mov [esp + 20], esi
mov edi, [esp + 28]
add edi, [esp + 32]
mov [esp + 28], edi
mov ecx, [esp + 40] ; height
dec ecx
mov [esp + 40], ecx
jnz loop_y
mov eax, 0 ; return value
pop ebp
pop edi
pop esi
pop ebx
ret
align 16

@ -1,39 +0,0 @@
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
PROC cpuid_x86
; save registers
push ebx
push ecx
push edx
push edi
; cpuid
mov eax, [esp + 20]
mov ecx, [esp + 24]
cpuid
mov edi, [esp + 28]
mov [edi], eax
mov edi, [esp + 32]
mov [edi], ebx
mov edi, [esp + 36]
mov [edi], ecx
mov edi, [esp + 40]
mov [edi], edx
mov eax, 0
; restore registers
pop edi
pop edx
pop ecx
pop ebx
ret;
align 16

@ -1,43 +0,0 @@
/*
Copyright 2014 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.
x86 asm files
*/
#ifndef __FUNCS_X86_H
#define __FUNCS_X86_H
int
cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx);
int
yv12_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
i420_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
yuy2_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
uyvy_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs);
int
a8r8g8b8_to_a8b8g8r8_box_x86_sse2(char *s8, int src_stride,
char *d8, int dst_stride,
int width, int height);
#endif

@ -1,243 +0,0 @@
;
;Copyright 2014 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.
;
;I420 to RGB32
;x86 SSE2 32 bit
;
; RGB to YUV
; 0.299 0.587 0.114
; -0.14713 -0.28886 0.436
; 0.615 -0.51499 -0.10001
; YUV to RGB
; 1 0 1.13983
; 1 -0.39465 -0.58060
; 1 2.03211 0
; shift left 12
; 4096 0 4669
; 4096 -1616 -2378
; 4096 9324 0
SECTION .data
align 16
c128 times 8 dw 128
c4669 times 8 dw 4669
c1616 times 8 dw 1616
c2378 times 8 dw 2378
c9324 times 8 dw 9324
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
do8_uv:
; v
movd xmm1, [ebx] ; 4 at a time
lea ebx, [ebx + 4]
punpcklbw xmm1, xmm1
pxor xmm6, xmm6
punpcklbw xmm1, xmm6
movdqa xmm7, [c128]
psubw xmm1, xmm7
psllw xmm1, 4
; u
movd xmm2, [edx] ; 4 at a time
lea edx, [edx + 4]
punpcklbw xmm2, xmm2
punpcklbw xmm2, xmm6
psubw xmm2, xmm7
psllw xmm2, 4
do8:
; y
movq xmm0, [esi] ; 8 at a time
lea esi, [esi + 8]
pxor xmm6, xmm6
punpcklbw xmm0, xmm6
; r = y + hiword(4669 * (v << 4))
movdqa xmm4, [c4669]
pmulhw xmm4, xmm1
movdqa xmm3, xmm0
paddw xmm3, xmm4
; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
movdqa xmm5, [c1616]
pmulhw xmm5, xmm2
movdqa xmm6, [c2378]
pmulhw xmm6, xmm1
movdqa xmm4, xmm0
psubw xmm4, xmm5
psubw xmm4, xmm6
; b = y + hiword(9324 * (u << 4))
movdqa xmm6, [c9324]
pmulhw xmm6, xmm2
movdqa xmm5, xmm0
paddw xmm5, xmm6
packuswb xmm3, xmm3 ; b
packuswb xmm4, xmm4 ; g
punpcklbw xmm3, xmm4 ; gb
pxor xmm4, xmm4 ; a
packuswb xmm5, xmm5 ; r
punpcklbw xmm5, xmm4 ; ar
movdqa xmm4, xmm3
punpcklwd xmm3, xmm5 ; argb
movdqa [edi], xmm3
lea edi, [edi + 16]
punpckhwd xmm4, xmm5 ; argb
movdqa [edi], xmm4
lea edi, [edi + 16]
ret;
;int
;i420_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC i420_to_rgb32_x86_sse2
push ebx
push esi
push edi
push ebp
mov edi, [esp + 32] ; rgbs
mov ecx, [esp + 24] ; width
mov edx, ecx
mov ebp, [esp + 28] ; height
mov eax, ebp
shr ebp, 1
imul eax, ecx ; eax = width * height
mov esi, [esp + 20] ; y
mov ebx, esi ; u = y + width * height
add ebx, eax
; local vars
; char* yptr1
; char* yptr2
; char* uptr
; char* vptr
; int* rgbs1
; int* rgbs2
; int width
sub esp, 28 ; local vars, 28 bytes
mov [esp + 0], esi ; save y1
add esi, edx
mov [esp + 4], esi ; save y2
mov [esp + 8], ebx ; save u
shr eax, 2
add ebx, eax ; v = u + (width * height / 4)
mov [esp + 12], ebx ; save v
mov [esp + 16], edi ; save rgbs1
mov eax, edx
shl eax, 2
add edi, eax
mov [esp + 20], edi ; save rgbs2
loop_y:
mov ecx, edx ; width
shr ecx, 3
; save edx
mov [esp + 24], edx
;prefetchnta 4096[esp + 0] ; y
;prefetchnta 1024[esp + 8] ; u
;prefetchnta 1024[esp + 12] ; v
loop_x:
mov esi, [esp + 0] ; y1
mov ebx, [esp + 8] ; u
mov edx, [esp + 12] ; v
mov edi, [esp + 16] ; rgbs1
; y1
call do8_uv
mov [esp + 0], esi ; y1
mov [esp + 16], edi ; rgbs1
mov esi, [esp + 4] ; y2
mov edi, [esp + 20] ; rgbs2
; y2
call do8
mov [esp + 4], esi ; y2
mov [esp + 8], ebx ; u
mov [esp + 12], edx ; v
mov [esp + 20], edi ; rgbs2
dec ecx ; width
jnz loop_x
; restore edx
mov edx, [esp + 24]
; update y1 and 2
mov eax, [esp + 0]
mov ebx, edx
add eax, ebx
mov [esp + 0], eax
mov eax, [esp + 4]
add eax, ebx
mov [esp + 4], eax
; update rgb1 and 2
mov eax, [esp + 16]
mov ebx, edx
shl ebx, 2
add eax, ebx
mov [esp + 16], eax
mov eax, [esp + 20]
add eax, ebx
mov [esp + 20], eax
mov ecx, ebp
dec ecx ; height
mov ebp, ecx
jnz loop_y
add esp, 28
mov eax, 0
pop ebp
pop edi
pop esi
pop ebx
ret
align 16

@ -1,22 +0,0 @@
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;uyvy_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC uyvy_to_rgb32_x86_sse2
push ebx
push esi
push edi
mov eax, 0
pop edi
pop esi
pop ebx
ret
align 16

@ -1,22 +0,0 @@
%macro PROC 1
align 16
global %1
%1:
%endmacro
;int
;yuy2_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC yuy2_to_rgb32_x86_sse2
push ebx
push esi
push edi
mov eax, 0
pop edi
pop esi
pop ebx
ret
align 16

@ -1,243 +0,0 @@
;
;Copyright 2014 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.
;
;YV12 to RGB32
;x86 SSE2 32 bit
;
; RGB to YUV
; 0.299 0.587 0.114
; -0.14713 -0.28886 0.436
; 0.615 -0.51499 -0.10001
; YUV to RGB
; 1 0 1.13983
; 1 -0.39465 -0.58060
; 1 2.03211 0
; shift left 12
; 4096 0 4669
; 4096 -1616 -2378
; 4096 9324 0
SECTION .data
align 16
c128 times 8 dw 128
c4669 times 8 dw 4669
c1616 times 8 dw 1616
c2378 times 8 dw 2378
c9324 times 8 dw 9324
SECTION .text
%macro PROC 1
align 16
global %1
%1:
%endmacro
do8_uv:
; u
movd xmm1, [ebx] ; 4 at a time
lea ebx, [ebx + 4]
punpcklbw xmm1, xmm1
pxor xmm6, xmm6
punpcklbw xmm1, xmm6
movdqa xmm7, [c128]
psubw xmm1, xmm7
psllw xmm1, 4
; v
movd xmm2, [edx] ; 4 at a time
lea edx, [edx + 4]
punpcklbw xmm2, xmm2
punpcklbw xmm2, xmm6
psubw xmm2, xmm7
psllw xmm2, 4
do8:
; y
movq xmm0, [esi] ; 8 at a time
lea esi, [esi + 8]
pxor xmm6, xmm6
punpcklbw xmm0, xmm6
; r = y + hiword(4669 * (v << 4))
movdqa xmm4, [c4669]
pmulhw xmm4, xmm2
movdqa xmm3, xmm0
paddw xmm3, xmm4
; g = y - hiword(1616 * (u << 4)) - hiword(2378 * (v << 4))
movdqa xmm5, [c1616]
pmulhw xmm5, xmm1
movdqa xmm6, [c2378]
pmulhw xmm6, xmm2
movdqa xmm4, xmm0
psubw xmm4, xmm5
psubw xmm4, xmm6
; b = y + hiword(9324 * (u << 4))
movdqa xmm6, [c9324]
pmulhw xmm6, xmm1
movdqa xmm5, xmm0
paddw xmm5, xmm6
packuswb xmm3, xmm3 ; b
packuswb xmm4, xmm4 ; g
punpcklbw xmm3, xmm4 ; gb
pxor xmm4, xmm4 ; a
packuswb xmm5, xmm5 ; r
punpcklbw xmm5, xmm4 ; ar
movdqa xmm4, xmm3
punpcklwd xmm3, xmm5 ; argb
movdqa [edi], xmm3
lea edi, [edi + 16]
punpckhwd xmm4, xmm5 ; argb
movdqa [edi], xmm4
lea edi, [edi + 16]
ret;
;int
;yv12_to_rgb32_x86_sse2(unsigned char *yuvs, int width, int height, int *rgbs)
PROC yv12_to_rgb32_x86_sse2
push ebx
push esi
push edi
push ebp
mov edi, [esp + 32] ; rgbs
mov ecx, [esp + 24] ; width
mov edx, ecx
mov ebp, [esp + 28] ; height
mov eax, ebp
shr ebp, 1
imul eax, ecx ; eax = width * height
mov esi, [esp + 20] ; y
mov ebx, esi ; u = y + width * height
add ebx, eax
; local vars
; char* yptr1
; char* yptr2
; char* uptr
; char* vptr
; int* rgbs1
; int* rgbs2
; int width
sub esp, 28 ; local vars, 28 bytes
mov [esp + 0], esi ; save y1
add esi, edx
mov [esp + 4], esi ; save y2
mov [esp + 8], ebx ; save u
shr eax, 2
add ebx, eax ; v = u + (width * height / 4)
mov [esp + 12], ebx ; save v
mov [esp + 16], edi ; save rgbs1
mov eax, edx
shl eax, 2
add edi, eax
mov [esp + 20], edi ; save rgbs2
loop_y:
mov ecx, edx ; width
shr ecx, 3
; save edx
mov [esp + 24], edx
;prefetchnta 4096[esp + 0] ; y
;prefetchnta 1024[esp + 8] ; u
;prefetchnta 1024[esp + 12] ; v
loop_x:
mov esi, [esp + 0] ; y1
mov ebx, [esp + 8] ; u
mov edx, [esp + 12] ; v
mov edi, [esp + 16] ; rgbs1
; y1
call do8_uv
mov [esp + 0], esi ; y1
mov [esp + 16], edi ; rgbs1
mov esi, [esp + 4] ; y2
mov edi, [esp + 20] ; rgbs2
; y2
call do8
mov [esp + 4], esi ; y2
mov [esp + 8], ebx ; u
mov [esp + 12], edx ; v
mov [esp + 20], edi ; rgbs2
dec ecx ; width
jnz loop_x
; restore edx
mov edx, [esp + 24]
; update y1 and 2
mov eax, [esp + 0]
mov ebx, edx
add eax, ebx
mov [esp + 0], eax
mov eax, [esp + 4]
add eax, ebx
mov [esp + 4], eax
; update rgb1 and 2
mov eax, [esp + 16]
mov ebx, edx
shl ebx, 2
add eax, ebx
mov [esp + 16], eax
mov eax, [esp + 20]
add eax, ebx
mov [esp + 20], eax
mov ecx, ebp
dec ecx ; height
mov ebp, ecx
jnz loop_y
add esp, 28
mov eax, 0
pop ebp
pop edi
pop esi
pop ebx
ret
align 16

@ -1,100 +0,0 @@
------------------------------------------------------
11/01/2014
------------------------------------------------------
There are four modules built for the Xorg driver model and one configuration file
This works best with newer Xorg installs, xserver 1.10 +, example Debian 7 +, Ubuntu 12.04 +
To see what version you have, run
xdpyinfo | grep version:
or
dpkg -l | grep xserver-xorg-core
or
yum list | grep xorg-x11-server-Xorg
It should compile with older version and may run but may be problems.
Usually, the problems are related to startup / login.
autotools should build and install them
./bootstrap
./configure
make
sudo make install
This should install the following...
libxorgxrdp.so goes in /usr/lib/xorg/modules/
xrdpdev_drv.so goes in /usr/lib/xorg/modules/drivers/
xrdpkeyb_drv.so goes in /usr/lib/xorg/modules/input/
xrdpmouse_drv.so goes in /usr/lib/xorg/modules/input/
xorg.conf goes in /etc/X11/xrdp/
with all these components in place, you can start Xorg with the xrdp modules with
Xorg -config xrdp/xorg.conf -logfile /tmp/Xtmp.log -noreset -ac :10
or
Xorg -config xrdp/xorg.conf -logfile /dev/null -noreset -ac :10
older notes
------------------------------------------------------
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
create /etc/X11/xrdp
copy xorg.conf into it
copy xrdpdev_drv.so to /usr/lib/xorg/modules/drivers
copy libxorgxrdp.so to /usr/lib/xorg/modules
copy xrdpmouse_drv.so to /usr/lib/xorg/modules/input
copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input
start xserver like this
Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10
or this on older Xorg but need /dev/vc/ thing below
Xorg -modulepath /home/jay/xorg-modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -ac vt7 :10
older Xorg don't have -nohwaccess so you need to run Xorg as root
or do something like this.
sudo rm /dev/tty0
sudo mknod -m 666 /dev/tty0 c 4 0
sudo mkdir /dev/vc/
sudo mknod -m 666 /dev/vc/7 c 7 7
--modules
libfb.so
libint10.so
libvbe.so
libxorgxrdp.so
----drivers
xrdpdev_drv.so
----extensions
libdbe.so
libdri.so
libdri2.so
libextmod.so
libglx.so
librecord.so
----input
xrdpkeyb_drv.so
xrdpmouse_drv.so
dpkg -S /usr/lib/xorg/modules/extensions/libglx.so
xserver-xorg-core

@ -1,41 +0,0 @@
#!/bin/sh
if [ -e /etc/X11/xrdp/xorg.conf ]; then
echo "/etc/X11/xrdp/xorg.conf ok"
else
echo "/etc/X11/xrdp/xorg.conf missing, run"
echo "sudo mkdir /etc/X11/xrdp"
echo "sudo cp xrdpdev/xorg.conf /etc/X11/xrdp/"
exit 1
fi
if [ -d $HOME/xorg-modules ]; then
echo "found directory ok"
else
echo "creating directory"
mkdir $HOME/xorg-modules
mkdir $HOME/xorg-modules/drivers
mkdir $HOME/xorg-modules/extensions
mkdir $HOME/xorg-modules/input
cp /usr/lib/xorg/modules/libfb.so $HOME/xorg-modules/
cp /usr/lib/xorg/modules/libint10.so $HOME/xorg-modules/
cp /usr/lib/xorg/modules/libvbe.so $HOME/xorg-modules/
cp /usr/lib/xorg/modules/extensions/libdbe.so $HOME/xorg-modules/extensions/
cp /usr/lib/xorg/modules/extensions/libdri.so $HOME/xorg-modules/extensions/
cp /usr/lib/xorg/modules/extensions/libdri2.so $HOME/xorg-modules/extensions/
cp /usr/lib/xorg/modules/extensions/libextmod.so $HOME/xorg-modules/extensions/
cp /usr/lib/xorg/modules/extensions/libglx.so $HOME/xorg-modules/extensions/
cp /usr/lib/xorg/modules/extensions/librecord.so $HOME/xorg-modules/extensions/
fi
make
if test $? -ne 0
then
echo "make failed"
exit 1
fi
make xinstall
exec Xorg -modulepath $HOME/xorg-modules -config xrdp/xorg.conf -logfile /tmp/Xtmp.log -novtswitch -sharevts -noreset -ac vt7 :20

@ -1,17 +0,0 @@
EXTRA_DIST = \
xorg.conf
AM_CFLAGS = \
$(XORG_SERVER_CFLAGS) \
-I../module \
-I../../../common
xrdpdev_drv_la_LTLIBRARIES = xrdpdev_drv.la
xrdpdev_drv_la_LDFLAGS = -module -avoid-version
xrdpdev_drv_ladir = $(moduledir)/drivers
xrdpdev_drv_la_SOURCES = xrdpdev.c
xrdpdev_drv_la_LIBADD =

@ -1,68 +0,0 @@
Section "ServerLayout"
Identifier "X11 Server"
Screen "Screen (xrdpdev)"
InputDevice "xrdpMouse" "CorePointer"
InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection
Section "ServerFlags"
Option "DontVTSwitch" "on"
Option "AutoAddDevices" "off"
EndSection
Section "Files"
FontPath "/usr/X11R6/lib/X11/fonts/misc/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/viewtouch"
EndSection
Section "Module"
Load "dbe"
Load "ddc"
Load "extmod"
Load "glx"
Load "int10"
Load "record"
Load "vbe"
Load "xorgxrdp"
Load "fb"
EndSection
Section "InputDevice"
Identifier "xrdpKeyboard"
Driver "xrdpkeyb"
EndSection
Section "InputDevice"
Identifier "xrdpMouse"
Driver "xrdpmouse"
EndSection
Section "Monitor"
Identifier "Monitor"
Option "DPMS"
HorizSync 30-80
VertRefresh 60-75
ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync
Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync
EndSection
Section "Device"
Identifier "Video Card (xrdpdev)"
Driver "xrdpdev"
EndSection
Section "Screen"
Identifier "Screen (xrdpdev)"
Device "Video Card (xrdpdev)"
Monitor "Monitor"
DefaultDepth 24
SubSectionSub "Display"
Depth 24
Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x1080"
EndSubSection
EndSection

@ -1,779 +0,0 @@
/*
Copyright 2013-2014 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.
This is the main driver file
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include <randrstr.h>
#include <xf86Modes.h>
#include "rdp.h"
#include "rdpPri.h"
#include "rdpDraw.h"
#include "rdpGC.h"
#include "rdpCursor.h"
#include "rdpRandR.h"
#include "rdpMisc.h"
#include "rdpComposite.h"
#include "rdpTrapezoids.h"
#include "rdpGlyphs.h"
#include "rdpPixmap.h"
#include "rdpClientCon.h"
#include "rdpXv.h"
#include "rdpSimd.h"
#define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \
do \
{ \
if (_level < LLOG_LEVEL) \
{ \
ErrorF _args ; \
ErrorF("\n"); \
} \
} \
while (0)
int g_bpp = 32;
int g_depth = 24;
int g_rgb_bits = 8;
int g_redOffset = 16;
int g_redBits = 8;
int g_greenOffset = 8;
int g_greenBits = 8;
int g_blueOffset = 0;
int g_blueBits = 8;
static int g_setup_done = 0;
static OsTimerPtr g_timer = 0;
/* Supported "chipsets" */
static SymTabRec g_Chipsets[] =
{
{ 0, XRDP_DRIVER_NAME },
{ -1, 0 }
};
static XF86ModuleVersionInfo g_VersRec =
{
XRDP_DRIVER_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
PACKAGE_VERSION_MAJOR,
PACKAGE_VERSION_MINOR,
PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_VIDEODRV,
ABI_VIDEODRV_VERSION,
0,
{ 0, 0, 0, 0 }
};
/*****************************************************************************/
static Bool
rdpAllocRec(ScrnInfoPtr pScrn)
{
LLOGLN(10, ("rdpAllocRec:"));
if (pScrn->driverPrivate != 0)
{
return TRUE;
}
/* xnfcalloc exits if alloc failed */
pScrn->driverPrivate = xnfcalloc(sizeof(rdpRec), 1);
return TRUE;
}
/*****************************************************************************/
static void
rdpFreeRec(ScrnInfoPtr pScrn)
{
LLOGLN(10, ("rdpFreeRec:"));
if (pScrn->driverPrivate == 0)
{
return;
}
free(pScrn->driverPrivate);
pScrn->driverPrivate = 0;
}
/*****************************************************************************/
static Bool
rdpPreInit(ScrnInfoPtr pScrn, int flags)
{
rgb zeros1;
Gamma zeros2;
int got_res_match;
char **modename;
DisplayModePtr mode;
rdpPtr dev;
LLOGLN(0, ("rdpPreInit:"));
if (flags & PROBE_DETECT)
{
return FALSE;
}
if (pScrn->numEntities != 1)
{
return FALSE;
}
rdpAllocRec(pScrn);
dev = XRDPPTR(pScrn);
dev->width = 1024;
dev->height = 768;
pScrn->monitor = pScrn->confScreen->monitor;
pScrn->bitsPerPixel = g_bpp;
pScrn->virtualX = dev->width;
pScrn->displayWidth = dev->width;
pScrn->virtualY = dev->height;
pScrn->progClock = 1;
pScrn->rgbBits = g_rgb_bits;
pScrn->depth = g_depth;
pScrn->chipset = XRDP_DRIVER_NAME;
pScrn->currentMode = pScrn->modes;
pScrn->offset.blue = g_blueOffset;
pScrn->offset.green = g_greenOffset;
pScrn->offset.red = g_redOffset;
pScrn->mask.blue = ((1 << g_blueBits) - 1) << pScrn->offset.blue;
pScrn->mask.green = ((1 << g_greenBits) - 1) << pScrn->offset.green;
pScrn->mask.red = ((1 << g_redBits) - 1) << pScrn->offset.red;
if (!xf86SetDepthBpp(pScrn, g_depth, g_bpp, g_bpp,
Support24bppFb | Support32bppFb |
SupportConvert32to24 | SupportConvert24to32))
{
LLOGLN(0, ("rdpPreInit: xf86SetDepthBpp failed"));
rdpFreeRec(pScrn);
return FALSE;
}
xf86PrintDepthBpp(pScrn);
g_memset(&zeros1, 0, sizeof(zeros1));
if (!xf86SetWeight(pScrn, zeros1, zeros1))
{
LLOGLN(0, ("rdpPreInit: xf86SetWeight failed"));
rdpFreeRec(pScrn);
return FALSE;
}
g_memset(&zeros2, 0, sizeof(zeros2));
if (!xf86SetGamma(pScrn, zeros2))
{
LLOGLN(0, ("rdpPreInit: xf86SetGamma failed"));
rdpFreeRec(pScrn);
return FALSE;
}
if (!xf86SetDefaultVisual(pScrn, -1))
{
LLOGLN(0, ("rdpPreInit: xf86SetDefaultVisual failed"));
rdpFreeRec(pScrn);
return FALSE;
}
xf86SetDpi(pScrn, 0, 0);
if (0 == pScrn->display->modes)
{
LLOGLN(0, ("rdpPreInit: modes error"));
rdpFreeRec(pScrn);
return FALSE;
}
pScrn->virtualX = pScrn->display->virtualX;
pScrn->virtualY = pScrn->display->virtualY;
got_res_match = 0;
for (modename = pScrn->display->modes; *modename != 0; modename++)
{
for (mode = pScrn->monitor->Modes; mode != 0; mode = mode->next)
{
LLOGLN(10, ("%s %s", mode->name, *modename));
if (0 == strcmp(mode->name, *modename))
{
break;
}
}
if (0 == mode)
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" not found\n",
*modename);
continue;
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename);
LLOGLN(10, ("%d %d %d %d", mode->HDisplay, dev->width,
mode->VDisplay, dev->height));
if ((mode->HDisplay == dev->width) && (mode->VDisplay == dev->height))
{
pScrn->virtualX = mode->HDisplay;
pScrn->virtualY = mode->VDisplay;
got_res_match = 1;
}
if (got_res_match)
{
pScrn->modes = xf86DuplicateMode(mode);
pScrn->modes->next = pScrn->modes;
pScrn->modes->prev = pScrn->modes;
dev->num_modes = 1;
break;
}
}
pScrn->currentMode = pScrn->modes;
xf86PrintModes(pScrn);
LLOGLN(10, ("rdpPreInit: out fPtr->num_modes %d", dev->num_modes));
if (!got_res_match)
{
LLOGLN(0, ("rdpPreInit: could not find screen resolution %dx%d",
dev->width, dev->height));
return FALSE;
}
return TRUE;
}
/******************************************************************************/
static miPointerSpriteFuncRec g_rdpSpritePointerFuncs =
{
/* these are in rdpCursor.c */
rdpSpriteRealizeCursor,
rdpSpriteUnrealizeCursor,
rdpSpriteSetCursor,
rdpSpriteMoveCursor,
rdpSpriteDeviceCursorInitialize,
rdpSpriteDeviceCursorCleanup
};
/******************************************************************************/
static Bool
rdpSaveScreen(ScreenPtr pScreen, int on)
{
LLOGLN(0, ("rdpSaveScreen:"));
return TRUE;
}
/******************************************************************************/
static Bool
rdpResizeSession(rdpPtr dev, int width, int height)
{
int mmwidth;
int mmheight;
RRScreenSizePtr pSize;
Bool ok;
LLOGLN(0, ("rdpResizeSession: width %d height %d", width, height));
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight);
RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize);
ok = TRUE;
if ((dev->width != width) || (dev->height != height))
{
LLOGLN(0, (" calling RRScreenSizeSet"));
ok = RRScreenSizeSet(dev->pScreen, width, height, mmwidth, mmheight);
LLOGLN(0, (" RRScreenSizeSet ok %d", ok));
}
return ok;
}
/******************************************************************************/
/* returns error */
static CARD32
rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg)
{
ScreenPtr pScreen;
rrScrPrivPtr pRRScrPriv;
rdpPtr dev;
char *envvar;
int width;
int height;
pScreen = (ScreenPtr) arg;
dev = rdpGetDevFromScreen(pScreen);
LLOGLN(0, ("rdpDeferredRandR:"));
pRRScrPriv = rrGetScrPriv(pScreen);
if (pRRScrPriv == 0)
{
LLOGLN(0, ("rdpDeferredRandR: rrGetScrPriv failed"));
return 1;
}
dev->rrSetConfig = pRRScrPriv->rrSetConfig;
dev->rrGetInfo = pRRScrPriv->rrGetInfo;
dev->rrScreenSetSize = pRRScrPriv->rrScreenSetSize;
dev->rrCrtcSet = pRRScrPriv->rrCrtcSet;
dev->rrCrtcSetGamma = pRRScrPriv->rrCrtcSetGamma;
dev->rrCrtcGetGamma = pRRScrPriv->rrCrtcGetGamma;
dev->rrOutputSetProperty = pRRScrPriv->rrOutputSetProperty;
dev->rrOutputValidateMode = pRRScrPriv->rrOutputValidateMode;
dev->rrModeDestroy = pRRScrPriv->rrModeDestroy;
dev->rrOutputGetProperty = pRRScrPriv->rrOutputGetProperty;
dev->rrGetPanning = pRRScrPriv->rrGetPanning;
dev->rrSetPanning = pRRScrPriv->rrSetPanning;
LLOGLN(10, (" rrSetConfig = %p", dev->rrSetConfig));
LLOGLN(10, (" rrGetInfo = %p", dev->rrGetInfo));
LLOGLN(10, (" rrScreenSetSize = %p", dev->rrScreenSetSize));
LLOGLN(10, (" rrCrtcSet = %p", dev->rrCrtcSet));
LLOGLN(10, (" rrCrtcSetGamma = %p", dev->rrCrtcSetGamma));
LLOGLN(10, (" rrCrtcGetGamma = %p", dev->rrCrtcGetGamma));
LLOGLN(10, (" rrOutputSetProperty = %p", dev->rrOutputSetProperty));
LLOGLN(10, (" rrOutputValidateMode = %p", dev->rrOutputValidateMode));
LLOGLN(10, (" rrModeDestroy = %p", dev->rrModeDestroy));
LLOGLN(10, (" rrOutputGetProperty = %p", dev->rrOutputGetProperty));
LLOGLN(10, (" rrGetPanning = %p", dev->rrGetPanning));
LLOGLN(10, (" rrSetPanning = %p", dev->rrSetPanning));
pRRScrPriv->rrSetConfig = rdpRRSetConfig;
pRRScrPriv->rrGetInfo = rdpRRGetInfo;
pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize;
pRRScrPriv->rrCrtcSet = rdpRRCrtcSet;
pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma;
pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma;
pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty;
pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode;
pRRScrPriv->rrModeDestroy = rdpRRModeDestroy;
pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty;
pRRScrPriv->rrGetPanning = rdpRRGetPanning;
pRRScrPriv->rrSetPanning = rdpRRSetPanning;
rdpResizeSession(dev, dev->width, dev->height);
envvar = getenv("XRDP_START_WIDTH");
if (envvar != 0)
{
width = atoi(envvar);
if ((width >= 16) && (width < 8192))
{
envvar = getenv("XRDP_START_HEIGHT");
if (envvar != 0)
{
height = atoi(envvar);
if ((height >= 16) && (height < 8192))
{
rdpResizeSession(dev, width, height);
}
}
}
}
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
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#else
rdpScreenInit(ScreenPtr pScreen, int argc, char **argv)
#endif
{
ScrnInfoPtr pScrn;
rdpPtr dev;
VisualPtr vis;
Bool vis_found;
PictureScreenPtr ps;
pScrn = xf86Screens[pScreen->myNum];
dev = XRDPPTR(pScrn);
dev->pScreen = pScreen;
miClearVisualTypes();
miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, TrueColor);
miSetPixmapDepths();
LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d rgbBits %d depth %d",
pScrn->virtualX, pScrn->virtualY, pScrn->rgbBits, pScrn->depth));
dev->depth = pScrn->depth;
dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
dev->bitsPerPixel = rdpBitsPerPixel(dev->depth);
dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
LLOGLN(0, ("rdpScreenInit: pfbMemory bytes %d", dev->sizeInBytes));
dev->pfbMemory_alloc = (char *) g_malloc(dev->sizeInBytes + 16, 1);
dev->pfbMemory = (char*) RDPALIGN(dev->pfbMemory_alloc, 16);
LLOGLN(0, ("rdpScreenInit: pfbMemory %p", dev->pfbMemory));
if (!fbScreenInit(pScreen, dev->pfbMemory,
pScrn->virtualX, pScrn->virtualY,
pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
pScrn->bitsPerPixel))
{
LLOGLN(0, ("rdpScreenInit: fbScreenInit failed"));
return FALSE;
}
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 14, 0, 0, 0)
/* 1.13 has this function, 1.14 and up does not */
miInitializeBackingStore(pScreen);
#endif
/* try in init simd functions */
rdpSimdInit(pScreen, pScrn);
#if defined(XvExtension) && XvExtension
/* XVideo */
if (!rdpXvInit(pScreen, pScrn))
{
LLOGLN(0, ("rdpScreenInit: rdpXvInit failed"));
}
#endif
vis = pScreen->visuals + (pScreen->numVisuals - 1);
while (vis >= pScreen->visuals)
{
if ((vis->class | DynamicClass) == DirectColor)
{
vis->offsetBlue = pScrn->offset.blue;
vis->blueMask = pScrn->mask.blue;
vis->offsetGreen = pScrn->offset.green;
vis->greenMask = pScrn->mask.green;
vis->offsetRed = pScrn->offset.red;
vis->redMask = pScrn->mask.red;
}
vis--;
}
fbPictureInit(pScreen, 0, 0);
xf86SetBlackWhitePixels(pScreen);
xf86SetBackingStore(pScreen);
#if 1
/* hardware cursor */
dev->pCursorFuncs = xf86GetPointerScreenFuncs();
miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs,
dev->pCursorFuncs, 0);
#else
/* software cursor */
dev->pCursorFuncs = xf86GetPointerScreenFuncs();
miDCInitialize(pScreen, dev->pCursorFuncs);
#endif
fbCreateDefColormap(pScreen);
/* must assign this one */
pScreen->SaveScreen = rdpSaveScreen;
vis_found = FALSE;
vis = pScreen->visuals + (pScreen->numVisuals - 1);
while (vis >= pScreen->visuals)
{
if (vis->vid == pScreen->rootVisual)
{
vis_found = TRUE;
}
vis--;
}
if (!vis_found)
{
LLOGLN(0, ("rdpScreenInit: no root visual"));
return FALSE;
}
dev->privateKeyRecGC = rdpAllocateGCPrivate(pScreen, sizeof(rdpGCRec));
dev->privateKeyRecPixmap = rdpAllocatePixmapPrivate(pScreen, sizeof(rdpPixmapRec));
dev->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = rdpCopyWindow;
dev->CreateGC = pScreen->CreateGC;
pScreen->CreateGC = rdpCreateGC;
dev->CreatePixmap = pScreen->CreatePixmap;
pScreen->CreatePixmap = rdpCreatePixmap;
dev->DestroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = rdpDestroyPixmap;
dev->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader;
ps = GetPictureScreenIfSet(pScreen);
if (ps != 0)
{
/* composite */
dev->Composite = ps->Composite;
ps->Composite = rdpComposite;
/* glyphs */
dev->Glyphs = ps->Glyphs;
ps->Glyphs = rdpGlyphs;
/* trapezoids */
dev->Trapezoids = ps->Trapezoids;
ps->Trapezoids = rdpTrapezoids;
}
RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, pScreen);
g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen);
if (rdpClientConInit(dev) != 0)
{
LLOGLN(0, ("rdpScreenInit: rdpClientConInit failed"));
}
dev->Bpp_mask = 0x00FFFFFF;
dev->Bpp = 4;
dev->bitsPerPixel = 32;
LLOGLN(0, ("rdpScreenInit: out"));
return TRUE;
}
/*****************************************************************************/
static Bool
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpSwitchMode(int a, DisplayModePtr b, int c)
#else
rdpSwitchMode(ScrnInfoPtr a, DisplayModePtr b)
#endif
{
LLOGLN(0, ("rdpSwitchMode:"));
return TRUE;
}
/*****************************************************************************/
static void
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpAdjustFrame(int a, int b, int c, int d)
#else
rdpAdjustFrame(ScrnInfoPtr a, int b, int c)
#endif
{
LLOGLN(10, ("rdpAdjustFrame:"));
}
/*****************************************************************************/
static Bool
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpEnterVT(int a, int b)
#else
rdpEnterVT(ScrnInfoPtr a)
#endif
{
LLOGLN(0, ("rdpEnterVT:"));
return TRUE;
}
/*****************************************************************************/
static void
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpLeaveVT(int a, int b)
#else
rdpLeaveVT(ScrnInfoPtr a)
#endif
{
LLOGLN(0, ("rdpLeaveVT:"));
}
/*****************************************************************************/
static ModeStatus
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpValidMode(int a, DisplayModePtr b, Bool c, int d)
#else
rdpValidMode(ScrnInfoPtr a, DisplayModePtr b, Bool c, int d)
#endif
{
LLOGLN(0, ("rdpValidMode:"));
return 0;
}
/*****************************************************************************/
static void
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
rdpFreeScreen(int a, int b)
#else
rdpFreeScreen(ScrnInfoPtr a)
#endif
{
LLOGLN(0, ("rdpFreeScreen:"));
}
/*****************************************************************************/
static Bool
rdpProbe(DriverPtr drv, int flags)
{
int num_dev_sections;
int i;
int entity;
GDevPtr *dev_sections;
Bool found_screen;
ScrnInfoPtr pscrn;
LLOGLN(0, ("rdpProbe:"));
if (flags & PROBE_DETECT)
{
return FALSE;
}
/* fbScreenInit, fbPictureInit, ... */
if (!xf86LoadDrvSubModule(drv, "fb"))
{
LLOGLN(0, ("rdpProbe: xf86LoadDrvSubModule for fb failed"));
return FALSE;
}
num_dev_sections = xf86MatchDevice(XRDP_DRIVER_NAME, &dev_sections);
if (num_dev_sections <= 0)
{
LLOGLN(0, ("rdpProbe: xf86MatchDevice failed"));
return FALSE;
}
pscrn = 0;
found_screen = FALSE;
for (i = 0; i < num_dev_sections; i++)
{
entity = xf86ClaimFbSlot(drv, 0, dev_sections[i], 1);
pscrn = xf86ConfigFbEntity(pscrn, 0, entity, 0, 0, 0, 0);
if (pscrn)
{
LLOGLN(10, ("rdpProbe: found screen"));
found_screen = 1;
pscrn->driverVersion = XRDP_VERSION;
pscrn->driverName = XRDP_DRIVER_NAME;
pscrn->name = XRDP_DRIVER_NAME;
pscrn->Probe = rdpProbe;
pscrn->PreInit = rdpPreInit;
pscrn->ScreenInit = rdpScreenInit;
pscrn->SwitchMode = rdpSwitchMode;
pscrn->AdjustFrame = rdpAdjustFrame;
pscrn->EnterVT = rdpEnterVT;
pscrn->LeaveVT = rdpLeaveVT;
pscrn->ValidMode = rdpValidMode;
pscrn->FreeScreen = rdpFreeScreen;
xf86DrvMsg(pscrn->scrnIndex, X_INFO, "%s", "using default device\n");
}
}
free(dev_sections);
return found_screen;
}
/*****************************************************************************/
static const OptionInfoRec *
rdpAvailableOptions(int chipid, int busid)
{
LLOGLN(0, ("rdpAvailableOptions:"));
return 0;
}
#ifndef HW_SKIP_CONSOLE
#define HW_SKIP_CONSOLE 4
#endif
/*****************************************************************************/
static Bool
rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr)
{
xorgHWFlags *flags;
int rv;
rv = FALSE;
LLOGLN(0, ("rdpDriverFunc: op %d", (int)op));
if (op == GET_REQUIRED_HW_INTERFACES)
{
flags = (xorgHWFlags *) ptr;
*flags = HW_SKIP_CONSOLE;
rv = TRUE;
}
return rv;
}
/*****************************************************************************/
static void
rdpIdentify(int flags)
{
LLOGLN(0, ("rdpIdentify:"));
xf86PrintChipsets(XRDP_DRIVER_NAME, "driver for xrdp", g_Chipsets);
}
/*****************************************************************************/
_X_EXPORT DriverRec g_DriverRec =
{
XRDP_VERSION,
XRDP_DRIVER_NAME,
rdpIdentify,
rdpProbe,
rdpAvailableOptions,
0,
0,
rdpDriverFunc
};
/*****************************************************************************/
static pointer
xrdpdevSetup(pointer module, pointer opts, int *errmaj, int *errmin)
{
LLOGLN(0, ("xrdpdevSetup:"));
if (!g_setup_done)
{
g_setup_done = 1;
xf86AddDriver(&g_DriverRec, module, HaveDriverFuncs);
return (pointer)1;
}
else
{
if (errmaj != 0)
{
*errmaj = LDR_ONCEONLY;
}
return 0;
}
}
/*****************************************************************************/
static void
xrdpdevTearDown(pointer Module)
{
LLOGLN(0, ("xrdpdevTearDown:"));
}
/* <drivername>ModuleData */
_X_EXPORT XF86ModuleData xrdpdevModuleData =
{
&g_VersRec,
xrdpdevSetup,
xrdpdevTearDown
};

@ -1,16 +0,0 @@
EXTRA_DIST =
AM_CFLAGS = \
$(XORG_SERVER_CFLAGS) \
-I../module \
-I../../../common
xrdpkeyb_drv_la_LTLIBRARIES = xrdpkeyb_drv.la
xrdpkeyb_drv_la_LDFLAGS = -module -avoid-version
xrdpkeyb_drv_ladir = $(moduledir)/input
xrdpkeyb_drv_la_SOURCES = rdpKeyboard.c
xrdpkeyb_drv_la_LIBADD =

@ -1,732 +0,0 @@
/*
Copyright 2013-2014 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.
xrdp keyboard module
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "xf86Xinput.h"
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include <xkbsrv.h>
#include "X11/keysym.h"
#include "rdp.h"
#include "rdpInput.h"
#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
#define MIN_KEY_CODE 8
#define MAX_KEY_CODE 255
#define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1)
#define GLYPHS_PER_KEY 2
/* control */
#define CONTROL_L_KEY_CODE 37
#define CONTROL_R_KEY_CODE 109
/* shift */
#define SHIFT_L_KEY_CODE 50
#define SHIFT_R_KEY_CODE 62
/* win keys */
#define SUPER_L_KEY_CODE 115
#define SUPER_R_KEY_CODE 116
/* alt */
#define ALT_L_KEY_CODE 64
#define ALT_R_KEY_CODE 113
/* caps lock */
#define CAPS_LOCK_KEY_CODE 66
/* num lock */
#define NUM_LOCK_KEY_CODE 77
#define N_PREDEFINED_KEYS \
(sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY))
static KeySym g_kbdMap[] =
{
NoSymbol, NoSymbol, /* 8 */
XK_Escape, NoSymbol, /* 9 */
XK_1, XK_exclam, /* 10 */
XK_2, XK_at,
XK_3, XK_numbersign,
XK_4, XK_dollar,
XK_5, XK_percent,
XK_6, XK_asciicircum,
XK_7, XK_ampersand,
XK_8, XK_asterisk,
XK_9, XK_parenleft,
XK_0, XK_parenright,
XK_minus, XK_underscore, /* 20 */
XK_equal, XK_plus,
XK_BackSpace, NoSymbol,
XK_Tab, XK_ISO_Left_Tab,
XK_Q, NoSymbol,
XK_W, NoSymbol,
XK_E, NoSymbol,
XK_R, NoSymbol,
XK_T, NoSymbol,
XK_Y, NoSymbol,
XK_U, NoSymbol, /* 30 */
XK_I, NoSymbol,
XK_O, NoSymbol,
XK_P, NoSymbol,
XK_bracketleft, XK_braceleft,
XK_bracketright, XK_braceright,
XK_Return, NoSymbol,
XK_Control_L, NoSymbol,
XK_A, NoSymbol,
XK_S, NoSymbol,
XK_D, NoSymbol, /* 40 */
XK_F, NoSymbol,
XK_G, NoSymbol,
XK_H, NoSymbol,
XK_J, NoSymbol,
XK_K, NoSymbol,
XK_L, NoSymbol,
XK_semicolon, XK_colon,
XK_apostrophe, XK_quotedbl,
XK_grave, XK_asciitilde,
XK_Shift_L, NoSymbol, /* 50 */
XK_backslash, XK_bar,
XK_Z, NoSymbol,
XK_X, NoSymbol,
XK_C, NoSymbol,
XK_V, NoSymbol,
XK_B, NoSymbol,
XK_N, NoSymbol,
XK_M, NoSymbol,
XK_comma, XK_less,
XK_period, XK_greater, /* 60 */
XK_slash, XK_question,
XK_Shift_R, NoSymbol,
XK_KP_Multiply, NoSymbol,
XK_Alt_L, NoSymbol,
XK_space, NoSymbol,
XK_Caps_Lock, NoSymbol,
XK_F1, NoSymbol,
XK_F2, NoSymbol,
XK_F3, NoSymbol,
XK_F4, NoSymbol, /* 70 */
XK_F5, NoSymbol,
XK_F6, NoSymbol,
XK_F7, NoSymbol,
XK_F8, NoSymbol,
XK_F9, NoSymbol,
XK_F10, NoSymbol,
XK_Num_Lock, NoSymbol,
XK_Scroll_Lock, NoSymbol,
XK_KP_Home, XK_KP_7,
XK_KP_Up, XK_KP_8, /* 80 */
XK_KP_Prior, XK_KP_9,
XK_KP_Subtract, NoSymbol,
XK_KP_Left, XK_KP_4,
XK_KP_Begin, XK_KP_5,
XK_KP_Right, XK_KP_6,
XK_KP_Add, NoSymbol,
XK_KP_End, XK_KP_1,
XK_KP_Down, XK_KP_2,
XK_KP_Next, XK_KP_3,
XK_KP_Insert, XK_KP_0, /* 90 */
XK_KP_Delete, XK_KP_Decimal,
NoSymbol, NoSymbol,
NoSymbol, NoSymbol,
NoSymbol, NoSymbol,
XK_F11, NoSymbol,
XK_F12, NoSymbol,
XK_Home, NoSymbol,
XK_Up, NoSymbol,
XK_Prior, NoSymbol,
XK_Left, NoSymbol, /* 100 */
XK_Print, NoSymbol,
XK_Right, NoSymbol,
XK_End, NoSymbol,
XK_Down, NoSymbol,
XK_Next, NoSymbol,
XK_Insert, NoSymbol,
XK_Delete, NoSymbol,
XK_KP_Enter, NoSymbol,
XK_Control_R, NoSymbol,
XK_Pause, NoSymbol, /* 110 */
XK_Print, NoSymbol,
XK_KP_Divide, NoSymbol,
XK_Alt_R, NoSymbol,
NoSymbol, NoSymbol,
XK_Super_L, NoSymbol,
XK_Super_R, NoSymbol,
XK_Menu, NoSymbol,
NoSymbol, NoSymbol,
NoSymbol, NoSymbol,
NoSymbol, NoSymbol, /* 120 */
NoSymbol, NoSymbol
};
/******************************************************************************/
static void
rdpEnqueueKey(DeviceIntPtr device, int type, int scancode)
{
if (type == KeyPress)
{
xf86PostKeyboardEvent(device, scancode, TRUE);
}
else
{
xf86PostKeyboardEvent(device, scancode, FALSE);
}
}
/******************************************************************************/
static void
sendDownUpKeyEvent(DeviceIntPtr device, int type, int x_scancode)
{
/* 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);
}
}
/******************************************************************************/
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;
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(10, ("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;
}
/******************************************************************************/
void
rdpkeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap)
{
int i;
LLOGLN(0, ("rdpkeybDeviceInit:"));
LLOGLN(10, (" MAP_LENGTH %d GLYPHS_PER_KEY %d N_PREDEFINED_KEYS %d",
MAP_LENGTH, GLYPHS_PER_KEY, (int) N_PREDEFINED_KEYS));
for (i = 0; i < MAP_LENGTH; i++)
{
pModMap[i] = NoSymbol;
}
pModMap[SHIFT_L_KEY_CODE] = ShiftMask;
pModMap[SHIFT_R_KEY_CODE] = ShiftMask;
pModMap[CAPS_LOCK_KEY_CODE] = LockMask;
pModMap[CONTROL_L_KEY_CODE] = ControlMask;
pModMap[CONTROL_R_KEY_CODE] = ControlMask;
pModMap[ALT_L_KEY_CODE] = Mod1Mask;
pModMap[ALT_R_KEY_CODE] = Mod1Mask;
pModMap[NUM_LOCK_KEY_CODE] = Mod2Mask;
pModMap[SUPER_L_KEY_CODE] = Mod4Mask;
pModMap[SUPER_R_KEY_CODE] = Mod4Mask;
pKeySyms->minKeyCode = MIN_KEY_CODE;
pKeySyms->maxKeyCode = MAX_KEY_CODE;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
i = sizeof(KeySym) * MAP_LENGTH * GLYPHS_PER_KEY;
pKeySyms->map = (KeySym *)malloc(i);
if (pKeySyms->map == 0)
{
LLOGLN(0, ("rdpkeybDeviceInit: malloc failed"));
exit(1);
}
else
{
memset(pKeySyms->map, 0, i);
}
for (i = 0; i < MAP_LENGTH * GLYPHS_PER_KEY; i++)
{
pKeySyms->map[i] = NoSymbol;
}
for (i = 0; i < N_PREDEFINED_KEYS * GLYPHS_PER_KEY; i++)
{
pKeySyms->map[i] = g_kbdMap[i];
}
}
/******************************************************************************/
static void
rdpkeybDeviceOn(void)
{
LLOGLN(0, ("rdpkeybDeviceOn:"));
}
/******************************************************************************/
static void
rdpkeybDeviceOff(void)
{
LLOGLN(0, ("rdpkeybDeviceOff:"));
}
/******************************************************************************/
static void
rdpkeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
{
LLOGLN(0, ("rdpkeybBell:"));
}
/******************************************************************************/
static void
rdpkeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
{
LLOGLN(0, ("rdpkeybChangeKeyboardControl:"));
}
/******************************************************************************/
static int
rdpkeybControl(DeviceIntPtr device, int what)
{
KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH];
DevicePtr pDev;
XkbRMLVOSet set;
rdpPtr dev;
LLOGLN(0, ("rdpkeybControl: what %d", what));
pDev = (DevicePtr)device;
switch (what)
{
case DEVICE_INIT:
rdpkeybDeviceInit(device, &keySyms, modMap);
memset(&set, 0, sizeof(set));
set.rules = "base";
set.model = "pc104";
set.layout = "us";
set.variant = "";
set.options = "";
InitKeyboardDeviceStruct(device, &set, rdpkeybBell,
rdpkeybChangeKeyboardControl);
dev = rdpGetDevFromScreen(NULL);
dev->keyboard.device = device;
rdpRegisterInputCallback(0, rdpInputKeyboard);
break;
case DEVICE_ON:
pDev->on = 1;
rdpkeybDeviceOn();
break;
case DEVICE_OFF:
pDev->on = 0;
rdpkeybDeviceOff();
break;
case DEVICE_CLOSE:
if (pDev->on)
{
rdpkeybDeviceOff();
}
break;
}
return Success;
}
#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1)
/* debian 6
ubuntu 10.04 */
/******************************************************************************/
static InputInfoPtr
rdpkeybPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr info;
LLOGLN(0, ("rdpkeybPreInit: drv %p dev %p, flags 0x%x",
drv, dev, flags));
info = xf86AllocateInput(drv, 0);
info->name = dev->identifier;
info->device_control = rdpkeybControl;
info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS |
XI86_CORE_KEYBOARD | XI86_KEYBOARD_CAPABLE;
info->type_name = "Keyboard";
info->fd = -1;
info->conf_idev = dev;
return info;
}
#else
/* debian 7
ubuntu 12.04 */
/******************************************************************************/
static int
rdpkeybPreInit(InputDriverPtr drv, InputInfoPtr info, int flags)
{
LLOGLN(0, ("rdpkeybPreInit: drv %p info %p, flags 0x%x",
drv, info, flags));
info->device_control = rdpkeybControl;
info->type_name = "Keyboard";
return 0;
}
#endif
/******************************************************************************/
static void
rdpkeybUnInit(InputDriverPtr drv, InputInfoPtr info, int flags)
{
LLOGLN(0, ("rdpkeybUnInit: drv %p info %p, flags 0x%x",
drv, info, flags));
rdpUnregisterInputCallback(rdpInputKeyboard);
}
/******************************************************************************/
static InputDriverRec rdpkeyb =
{
PACKAGE_VERSION_MAJOR, /* version */
XRDP_KEYB_NAME, /* name */
NULL, /* identify */
rdpkeybPreInit, /* preinit */
rdpkeybUnInit, /* uninit */
NULL, /* module */
0 /* ref count */
};
/******************************************************************************/
static pointer
rdpkeybPlug(pointer module, pointer options, int *errmaj, int *errmin)
{
LLOGLN(0, ("rdpkeybPlug:"));
xf86AddInputDriver(&rdpkeyb, module, 0);
return module;
}
/******************************************************************************/
static void
rdpkeybUnplug(pointer p)
{
LLOGLN(0, ("rdpkeybUnplug:"));
}
/******************************************************************************/
static XF86ModuleVersionInfo rdpkeybVersionRec =
{
XRDP_KEYB_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
PACKAGE_VERSION_MAJOR,
PACKAGE_VERSION_MINOR,
PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_XINPUT,
ABI_XINPUT_VERSION,
MOD_CLASS_XINPUT,
{ 0, 0, 0, 0 }
};
/******************************************************************************/
_X_EXPORT XF86ModuleData xrdpkeybModuleData =
{
&rdpkeybVersionRec,
rdpkeybPlug,
rdpkeybUnplug
};

@ -1,16 +0,0 @@
EXTRA_DIST =
AM_CFLAGS = \
$(XORG_SERVER_CFLAGS) \
-I../module \
-I../../../common
xrdpmouse_drv_la_LTLIBRARIES = xrdpmouse_drv.la
xrdpmouse_drv_la_LDFLAGS = -module -avoid-version
xrdpmouse_drv_ladir = $(moduledir)/input
xrdpmouse_drv_la_SOURCES = rdpMouse.c
xrdpmouse_drv_la_LIBADD =

@ -1,367 +0,0 @@
/*
Copyright 2013-2014 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.
xrdp mouse module
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
#include <xorgVersion.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "xf86Xinput.h"
#include <mipointer.h>
#include <fb.h>
#include <micmap.h>
#include <mi.h>
#include <exevents.h>
#include <xserver-properties.h>
#include "rdp.h"
#include "rdpInput.h"
#include "rdpDraw.h"
/******************************************************************************/
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
/******************************************************************************/
static void
rdpmouseDeviceInit(void)
{
LLOGLN(0, ("rdpmouseDeviceInit:"));
}
/******************************************************************************/
static void
rdpmouseDeviceOn(DeviceIntPtr pDev)
{
LLOGLN(0, ("rdpmouseDeviceOn:"));
}
/******************************************************************************/
static void
rdpmouseDeviceOff(void)
{
LLOGLN(0, ("rdpmouseDeviceOff:"));
}
/******************************************************************************/
static void
rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl)
{
LLOGLN(0, ("rdpmouseCtrl:"));
}
/******************************************************************************/
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)
{
LLOGLN(10, ("rdpEnqueueMotion:"));
xf86PostMotionEvent(device, TRUE, 0, 2, x, y);
}
/******************************************************************************/
static void
rdpEnqueueButton(DeviceIntPtr device, int type, int buttons)
{
LLOGLN(10, ("rdpEnqueueButton:"));
xf86PostButtonEvent(device, FALSE, buttons, type == ButtonPress, 0, 0);
}
/******************************************************************************/
static void
PtrAddEvent(rdpPointer *pointer)
{
int i;
int type;
int buttons;
rdpEnqueueMotion(pointer->device, pointer->cursor_x, pointer->cursor_y);
LLOGLN(10, ("PtrAddEvent: x %d y %d", 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(10, ("rdpInputMouse: msg %d param1 %ld param2 %ld param3 %ld param4 %ld",
msg, param1, param2, param3, param4));
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;
switch (what)
{
case DEVICE_INIT:
rdpmouseDeviceInit();
map[0] = 0;
map[1] = 1;
map[2] = 2;
map[3] = 3;
map[4] = 4;
map[5] = 5;
btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
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;
rdpmouseDeviceOn(device);
break;
case DEVICE_OFF:
pDev->on = 0;
rdpmouseDeviceOff();
break;
case DEVICE_CLOSE:
if (pDev->on)
{
rdpmouseDeviceOff();
}
break;
}
return Success;
}
#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1)
/* debian 6
ubuntu 10.04 */
/******************************************************************************/
static InputInfoPtr
rdpmousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr info;
LLOGLN(0, ("rdpmousePreInit: drv %p dev %p, flags 0x%x",
drv, dev, flags));
info = xf86AllocateInput(drv, 0);
info->name = dev->identifier;
info->device_control = rdpmouseControl;
info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS |
XI86_CORE_POINTER | XI86_POINTER_CAPABLE;
info->type_name = "Mouse";
info->fd = -1;
info->conf_idev = dev;
return info;
}
#else
/* debian 7
ubuntu 12.04 */
/******************************************************************************/
static int
rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags)
{
LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x",
drv, info, flags));
info->device_control = rdpmouseControl;
info->type_name = "Mouse";
return 0;
}
#endif
/******************************************************************************/
static void
rdpmouseUnInit(InputDriverPtr drv, InputInfoPtr info, int flags)
{
LLOGLN(0, ("rdpmouseUnInit: drv %p info %p, flags 0x%x",
drv, info, flags));
rdpUnregisterInputCallback(rdpInputMouse);
}
/******************************************************************************/
static InputDriverRec rdpmouse =
{
PACKAGE_VERSION_MAJOR, /* version */
XRDP_MOUSE_NAME, /* name */
NULL, /* identify */
rdpmousePreInit, /* preinit */
rdpmouseUnInit, /* uninit */
NULL, /* module */
0 /* ref count */
};
/******************************************************************************/
static pointer
rdpmousePlug(pointer module, pointer options, int *errmaj, int *errmin)
{
LLOGLN(0, ("rdpmousePlug:"));
xf86AddInputDriver(&rdpmouse, module, 0);
return module;
}
/******************************************************************************/
static void
rdpmouseUnplug(pointer p)
{
LLOGLN(0, ("rdpmouseUnplug:"));
}
/******************************************************************************/
static XF86ModuleVersionInfo rdpmouseVersionRec =
{
XRDP_MOUSE_NAME,
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
PACKAGE_VERSION_MAJOR,
PACKAGE_VERSION_MINOR,
PACKAGE_VERSION_PATCHLEVEL,
ABI_CLASS_XINPUT,
ABI_XINPUT_VERSION,
MOD_CLASS_XINPUT,
{ 0, 0, 0, 0 }
};
/******************************************************************************/
_X_EXPORT XF86ModuleData xrdpmouseModuleData =
{
&rdpmouseVersionRec,
rdpmousePlug,
rdpmouseUnplug
};

@ -1 +1 @@
Subproject commit 7c4d67356db815a9b4b003fca06394f43aaf7f82
Subproject commit 6edf9e519765e0257221c24b01f0a7eeb2aee1dc

@ -62,6 +62,9 @@ rdp_layout_de=0x00000407
rdp_layout_fr=0x0000040C
rdp_layout_it=0x00000410
rdp_layout_jp=0x00000411
rdp_layout_jp2=0xe0010411
rdp_layout_jp3=0xe0200411
rdp_layout_jp4=0xe0210411
rdp_layout_ru=0x00000419
rdp_layout_se=0x0000041D
rdp_layout_pt=0x00000816
@ -75,6 +78,9 @@ rdp_layout_de=de
rdp_layout_fr=fr
rdp_layout_it=it
rdp_layout_jp=jp
rdp_layout_jp2=jp
rdp_layout_jp3=jp
rdp_layout_jp4=jp
rdp_layout_ru=ru
rdp_layout_se=se
rdp_layout_pt=pt
@ -92,6 +98,7 @@ layouts_map=rdp_layouts_map_mac
[rdp_keyboard_jp]
keyboard_type=7
keyboard_subtype=2
model=jp106
rdp_layouts=default_rdp_layouts
layouts_map=default_layouts_map
@ -100,6 +107,9 @@ rdp_layout_us=us
rdp_layout_de=de
rdp_layout_fr=fr
rdp_layout_jp=jp
rdp_layout_jp2=jp
rdp_layout_jp3=jp
rdp_layout_jp4=jp
rdp_layout_it=it
rdp_layout_ru=ru
rdp_layout_se=se

Loading…
Cancel
Save