ran indent (-bli0 -i8 -cli8 -npcs -npsl)
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@23 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
4c253c0df7
commit
b9613445f9
66
bitmap.c
66
bitmap.c
@ -128,7 +128,9 @@ BOOL bitmap_decompress(unsigned char *output, int width, int height,
|
||||
if (prevline == NULL)
|
||||
line[x] = mix;
|
||||
else
|
||||
line[x] = prevline[x] ^ mix;
|
||||
line[x] =
|
||||
prevline[x] ^
|
||||
mix;
|
||||
|
||||
insertmix = False;
|
||||
count--;
|
||||
@ -136,73 +138,79 @@ BOOL bitmap_decompress(unsigned char *output, int width, int height,
|
||||
}
|
||||
|
||||
if (prevline == NULL)
|
||||
REPEAT(line[x] = 0)
|
||||
{
|
||||
REPEAT(line[x] = 0);
|
||||
}
|
||||
else
|
||||
REPEAT(line[x] = prevline[x])
|
||||
{
|
||||
REPEAT(line[x] = prevline[x]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: /* Mix */
|
||||
if (prevline == NULL)
|
||||
REPEAT(line[x] = mix)
|
||||
{
|
||||
REPEAT(line[x] = mix);
|
||||
}
|
||||
else
|
||||
REPEAT(line[x] = prevline[x] ^ mix)
|
||||
{
|
||||
REPEAT(line[x] =
|
||||
prevline[x] ^ mix);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Fill or Mix */
|
||||
if (prevline == NULL)
|
||||
REPEAT(
|
||||
MASK_UPDATE();
|
||||
|
||||
{
|
||||
REPEAT(MASK_UPDATE();
|
||||
if (mask & mixmask)
|
||||
line[x] = mix;
|
||||
else
|
||||
line[x] = 0;
|
||||
)
|
||||
line[x] = 0;);
|
||||
}
|
||||
else
|
||||
REPEAT(
|
||||
MASK_UPDATE();
|
||||
|
||||
{
|
||||
REPEAT(MASK_UPDATE();
|
||||
if (mask & mixmask)
|
||||
line[x] = prevline[x] ^ mix;
|
||||
line[x] =
|
||||
prevline[x] ^ mix;
|
||||
else
|
||||
line[x] = prevline[x];
|
||||
)
|
||||
line[x] =
|
||||
prevline[x];);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: /* Colour */
|
||||
REPEAT(line[x] = colour2)
|
||||
REPEAT(line[x] = colour2);
|
||||
break;
|
||||
|
||||
case 4: /* Copy */
|
||||
REPEAT(line[x] = CVAL(input))
|
||||
REPEAT(line[x] = CVAL(input));
|
||||
break;
|
||||
|
||||
case 8: /* Bicolour */
|
||||
REPEAT(
|
||||
if (bicolour)
|
||||
REPEAT(if (bicolour)
|
||||
{
|
||||
line[x] = colour2;
|
||||
bicolour = False;
|
||||
}
|
||||
bicolour = False;}
|
||||
else
|
||||
{
|
||||
line[x] = colour1;
|
||||
bicolour = True;
|
||||
count++;
|
||||
}
|
||||
)
|
||||
bicolour = True; count++;}
|
||||
);
|
||||
break;
|
||||
|
||||
case 13: /* White */
|
||||
REPEAT(line[x] = 0xff)
|
||||
REPEAT(line[x] = 0xff);
|
||||
break;
|
||||
|
||||
case 14: /* Black */
|
||||
REPEAT(line[x] = 0x00)
|
||||
REPEAT(line[x] = 0x00);
|
||||
break;
|
||||
|
||||
default:
|
||||
NOTIMP("bitmap opcode 0x%x\n", opcode);
|
||||
NOTIMP("bitmap opcode 0x%x\n",
|
||||
opcode);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
7
cache.c
7
cache.c
@ -86,7 +86,8 @@ FONTGLYPH *cache_get_font(uint8 font, uint16 character)
|
||||
|
||||
/* Store a glyph in the font cache */
|
||||
void cache_put_font(uint8 font, uint16 character, uint16 offset,
|
||||
uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap)
|
||||
uint16 baseline, uint16 width, uint16 height,
|
||||
HGLYPH pixmap)
|
||||
{
|
||||
FONTGLYPH *glyph;
|
||||
|
||||
@ -169,7 +170,8 @@ uint8 *cache_get_desktop(uint32 offset, int cx, int cy)
|
||||
}
|
||||
|
||||
/* Store desktop data in the cache */
|
||||
void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, uint8 *data)
|
||||
void cache_put_desktop(uint32 offset, int cx, int cy, int scanline,
|
||||
uint8 *data)
|
||||
{
|
||||
int length = cx * cy;
|
||||
|
||||
@ -187,4 +189,3 @@ void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, uint8 *data)
|
||||
ERROR("put desktop %d:%d\n", offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,8 @@ static BOOL licence_parse_authreq(STREAM s, uint8 **token, uint8 **signature)
|
||||
static void licence_process_authreq(STREAM s)
|
||||
{
|
||||
uint8 *in_token, *in_sig;
|
||||
uint8 out_token[LICENCE_TOKEN_SIZE], decrypt_token[LICENCE_TOKEN_SIZE];
|
||||
uint8 out_token[LICENCE_TOKEN_SIZE],
|
||||
decrypt_token[LICENCE_TOKEN_SIZE];
|
||||
uint8 hwid[LICENCE_HWID_SIZE], crypt_hwid[LICENCE_HWID_SIZE];
|
||||
uint8 sealed_buffer[LICENCE_TOKEN_SIZE + LICENCE_HWID_SIZE];
|
||||
uint8 out_sig[LICENCE_SIGNATURE_SIZE];
|
||||
|
9
mcs.c
9
mcs.c
@ -33,8 +33,7 @@ static BOOL ber_parse_header(STREAM s, int tagval, int *length)
|
||||
}
|
||||
else
|
||||
{
|
||||
in_uint8(s, tag)
|
||||
}
|
||||
in_uint8(s, tag)}
|
||||
|
||||
if (tag != tagval)
|
||||
{
|
||||
@ -51,7 +50,8 @@ static BOOL ber_parse_header(STREAM s, int tagval, int *length)
|
||||
while (len--)
|
||||
next_be(s, *length);
|
||||
}
|
||||
else *length = len;
|
||||
else
|
||||
*length = len;
|
||||
|
||||
return s_check(s);
|
||||
}
|
||||
@ -73,7 +73,8 @@ static void ber_out_header(STREAM s, int tagval, int length)
|
||||
out_uint8(s, 0x82);
|
||||
out_uint16_be(s, length);
|
||||
}
|
||||
else out_uint8(s, length);
|
||||
else
|
||||
out_uint8(s, length);
|
||||
}
|
||||
|
||||
/* Output an ASN.1 BER integer */
|
||||
|
26
orders.c
26
orders.c
@ -330,7 +330,8 @@ static void process_desksave(STREAM s, DESKSAVE_ORDER *os,
|
||||
if (os->action == 0)
|
||||
ui_desktop_save(os->offset, os->left, os->top, width, height);
|
||||
else
|
||||
ui_desktop_restore(os->offset, os->left, os->top, width, height);
|
||||
ui_desktop_restore(os->offset, os->left, os->top, width,
|
||||
height);
|
||||
}
|
||||
|
||||
/* Process a memory blt order */
|
||||
@ -428,7 +429,8 @@ static void process_triblt(STREAM s, TRIBLT_ORDER *os,
|
||||
if (present & 0x010000)
|
||||
in_uint16_le(s, os->unknown);
|
||||
|
||||
DEBUG("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n",
|
||||
DEBUG
|
||||
("TRIBLT(op=0x%x,x=%d,y=%d,cx=%d,cy=%d,id=%d,idx=%d,bs=%d,bg=0x%x,fg=0x%x)\n",
|
||||
os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id,
|
||||
os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour);
|
||||
|
||||
@ -529,7 +531,8 @@ static void process_polyline(STREAM s, POLYLINE_ORDER *os,
|
||||
}
|
||||
|
||||
/* Process a text order */
|
||||
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
|
||||
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present,
|
||||
BOOL delta)
|
||||
{
|
||||
DATABLOB *entry;
|
||||
int i;
|
||||
@ -588,7 +591,8 @@ static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
|
||||
in_uint8a(s, os->text, os->length);
|
||||
}
|
||||
|
||||
DEBUG("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,bb=%d,br=%d,fg=0x%x,bg=0x%x,font=%d,fl=0x%x,mix=%d,unk=0x%x,n=%d)\n",
|
||||
DEBUG
|
||||
("TEXT2(x=%d,y=%d,cl=%d,ct=%d,cr=%d,cb=%d,bl=%d,bt=%d,bb=%d,br=%d,fg=0x%x,bg=0x%x,font=%d,fl=0x%x,mix=%d,unk=0x%x,n=%d)\n",
|
||||
os->x, os->y, os->clipleft, os->cliptop, os->clipright,
|
||||
os->clipbottom, os->boxleft, os->boxtop, os->boxright,
|
||||
os->boxbottom, os->fgcolour, os->bgcolour, os->font,
|
||||
@ -615,7 +619,8 @@ static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
|
||||
else if ((os->length >= 3) && (os->text[os->length - 3] == 0xff))
|
||||
{
|
||||
os->length -= 3;
|
||||
cache_put_text(os->text[os->length+1], os->text, os->length);
|
||||
cache_put_text(os->text[os->length + 1], os->text,
|
||||
os->length);
|
||||
}
|
||||
|
||||
ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y,
|
||||
@ -723,8 +728,8 @@ static void process_fontcache(STREAM s)
|
||||
HGLYPH bitmap;
|
||||
uint8 font, nglyphs;
|
||||
uint16 character, offset, baseline, width, height;
|
||||
uint8 *data, *rev_data, in, out;
|
||||
int i, j, datasize;
|
||||
int i, datasize;
|
||||
uint8 *data;
|
||||
|
||||
in_uint8(s, font);
|
||||
in_uint8(s, nglyphs);
|
||||
@ -847,8 +852,10 @@ void process_orders(STREAM s)
|
||||
|
||||
ui_set_clip(os->bounds.left,
|
||||
os->bounds.top,
|
||||
os->bounds.right - os->bounds.left + 1,
|
||||
os->bounds.bottom - os->bounds.top + 1);
|
||||
os->bounds.right -
|
||||
os->bounds.left + 1,
|
||||
os->bounds.bottom -
|
||||
os->bounds.top + 1);
|
||||
}
|
||||
|
||||
delta = order_flags & RDP_ORDER_DELTA;
|
||||
@ -926,4 +933,3 @@ void reset_order_state()
|
||||
{
|
||||
memset(&order_state, 0, sizeof(order_state));
|
||||
}
|
||||
|
||||
|
11
rdesktop.c
11
rdesktop.c
@ -68,7 +68,8 @@ int main(int argc, char *argv[])
|
||||
int c;
|
||||
|
||||
STATUS("rdesktop: A Remote Desktop Protocol client.\n");
|
||||
STATUS("Version "VERSION". Copyright (C) 1999-2000 Matt Chapman.\n");
|
||||
STATUS("Version " VERSION
|
||||
". Copyright (C) 1999-2000 Matt Chapman.\n");
|
||||
STATUS("See http://www.rdesktop.org/ for more information.\n\n");
|
||||
|
||||
flags = RDP_LOGON_NORMAL;
|
||||
@ -253,13 +254,13 @@ void hexdump(unsigned char *p, unsigned int len)
|
||||
thisline = 16;
|
||||
|
||||
for (i = 0; i < thisline; i++)
|
||||
STATUS("%02x ", line[i])
|
||||
|
||||
for (; i < 16; i++)
|
||||
STATUS("%02x ", line[i]) for (; i < 16; i++)
|
||||
STATUS(" ");
|
||||
|
||||
for (i = 0; i < thisline; i++)
|
||||
STATUS("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
|
||||
STATUS("%c",
|
||||
(line[i] >= 0x20
|
||||
&& line[i] < 0x7f) ? line[i] : '.');
|
||||
|
||||
STATUS("\n");
|
||||
offset += thisline;
|
||||
|
43
rdp.c
43
rdp.c
@ -139,7 +139,8 @@ void rdp_out_unistr(STREAM s, char *string, int len)
|
||||
|
||||
/* Parse a logon info packet */
|
||||
static void rdp_send_logon_info(uint32 flags, char *domain, char *user,
|
||||
char *password, char *program, char *directory)
|
||||
char *password, char *program,
|
||||
char *directory)
|
||||
{
|
||||
int len_domain = 2 * strlen(domain);
|
||||
int len_user = 2 * strlen(user);
|
||||
@ -369,15 +370,24 @@ static void rdp_out_colcache_caps(STREAM s)
|
||||
|
||||
static uint8 canned_caps[] = {
|
||||
0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x04,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x08,0x00,0x01,
|
||||
0x00,0x00,0x00,0x0E,0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x34,0x00,0xFE,
|
||||
0x00,0x04,0x00,0xFE,0x00,0x04,0x00,0xFE,0x00,0x08,0x00,0xFE,0x00,0x08,0x00,0xFE,
|
||||
0x00,0x10,0x00,0xFE,0x00,0x20,0x00,0xFE,0x00,0x40,0x00,0xFE,0x00,0x80,0x00,0xFE,
|
||||
0x00,0x00,0x01,0x40,0x00,0x00,0x08,0x00,0x01,0x00,0x01,0x02,0x00,0x00,0x00
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0C, 0x00, 0x08, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x0E, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x34, 0x00, 0xFE,
|
||||
0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x08, 0x00,
|
||||
0xFE, 0x00, 0x08, 0x00, 0xFE,
|
||||
0x00, 0x10, 0x00, 0xFE, 0x00, 0x20, 0x00, 0xFE, 0x00, 0x40, 0x00,
|
||||
0xFE, 0x00, 0x80, 0x00, 0xFE,
|
||||
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01,
|
||||
0x02, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/* Output unknown capability set */
|
||||
@ -393,10 +403,11 @@ static void rdp_out_unknown_caps(STREAM s)
|
||||
static void rdp_send_confirm_active()
|
||||
{
|
||||
STREAM s;
|
||||
uint16 caplen = RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER
|
||||
+ RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE + RDP_CAPLEN_ACTIVATE
|
||||
+ RDP_CAPLEN_CONTROL + RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE
|
||||
+ RDP_CAPLEN_UNKNOWN;
|
||||
uint16 caplen =
|
||||
RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER +
|
||||
RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE +
|
||||
RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL +
|
||||
RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE + RDP_CAPLEN_UNKNOWN;
|
||||
|
||||
s = rdp_init(14 + caplen + sizeof(RDP_SOURCE));
|
||||
|
||||
@ -502,7 +513,8 @@ static void process_bitmap_updates(STREAM s)
|
||||
if (!compress)
|
||||
{
|
||||
in_uint8p(s, data, bufsize);
|
||||
ui_paint_bitmap(left, top, cx, cy, width, height, data);
|
||||
ui_paint_bitmap(left, top, cx, cy, width, height,
|
||||
data);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -643,4 +655,3 @@ void rdp_disconnect()
|
||||
{
|
||||
sec_disconnect();
|
||||
}
|
||||
|
||||
|
33
secure.c
33
secure.c
@ -45,7 +45,8 @@ static uint8 sec_crypted_random[64];
|
||||
* a client and server salt) and a global salt value used for padding.
|
||||
* Both SHA1 and MD5 algorithms are used.
|
||||
*/
|
||||
void sec_hash_48(uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2, uint8 salt)
|
||||
void sec_hash_48(uint8 *out, uint8 *in, uint8 *salt1, uint8 *salt2,
|
||||
uint8 salt)
|
||||
{
|
||||
uint8 shasig[20];
|
||||
uint8 pad[4];
|
||||
@ -114,8 +115,10 @@ static void sec_generate_keys(uint8 *client_key, uint8 *server_key,
|
||||
memcpy(sec_sign_key, session_key, 8);
|
||||
|
||||
/* Generate RC4 keys */
|
||||
sec_hash_16(sec_decrypt_key, &session_key[16], client_key, server_key);
|
||||
sec_hash_16(sec_encrypt_key, &session_key[32], client_key, server_key);
|
||||
sec_hash_16(sec_decrypt_key, &session_key[16], client_key,
|
||||
server_key);
|
||||
sec_hash_16(sec_encrypt_key, &session_key[32], client_key,
|
||||
server_key);
|
||||
|
||||
if (rc4_key_size == 1)
|
||||
{
|
||||
@ -140,16 +143,18 @@ static void sec_generate_keys(uint8 *client_key, uint8 *server_key,
|
||||
RC4_set_key(&rc4_encrypt_key, rc4_key_len, sec_encrypt_key);
|
||||
}
|
||||
|
||||
static uint8 pad_54[40] =
|
||||
{
|
||||
54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,
|
||||
54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54
|
||||
static uint8 pad_54[40] = {
|
||||
54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
||||
54, 54, 54,
|
||||
54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
|
||||
54, 54, 54
|
||||
};
|
||||
|
||||
static uint8 pad_92[48] =
|
||||
{
|
||||
92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
|
||||
92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92
|
||||
static uint8 pad_92[48] = {
|
||||
92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
|
||||
92, 92, 92, 92, 92, 92, 92,
|
||||
92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
|
||||
92, 92, 92, 92, 92, 92, 92
|
||||
};
|
||||
|
||||
/* Output a uint32 into a buffer (little-endian) */
|
||||
@ -426,7 +431,8 @@ static BOOL sec_parse_public_key(STREAM s, uint8 **modulus, uint8 **exponent)
|
||||
|
||||
/* Parse a crypto information structure */
|
||||
static BOOL sec_parse_crypt_info(STREAM s, uint32 *rc4_key_size,
|
||||
uint8 **server_random, uint8 **modulus, uint8 **exponent)
|
||||
uint8 **server_random, uint8 **modulus,
|
||||
uint8 **exponent)
|
||||
{
|
||||
uint32 crypt_level, random_len, rsa_info_len;
|
||||
uint16 tag, length;
|
||||
@ -462,7 +468,8 @@ static BOOL sec_parse_crypt_info(STREAM s, uint32 *rc4_key_size,
|
||||
switch (tag)
|
||||
{
|
||||
case SEC_TAG_PUBKEY:
|
||||
if (!sec_parse_public_key(s, modulus, exponent))
|
||||
if (!sec_parse_public_key
|
||||
(s, modulus, exponent))
|
||||
return False;
|
||||
|
||||
break;
|
||||
|
10
tcp.c
10
tcp.c
@ -119,7 +119,8 @@ BOOL tcp_connect(char *server)
|
||||
|
||||
if ((nslookup = gethostbyname(server)) != NULL)
|
||||
{
|
||||
memcpy(&servaddr.sin_addr, nslookup->h_addr, sizeof(servaddr.sin_addr));
|
||||
memcpy(&servaddr.sin_addr, nslookup->h_addr,
|
||||
sizeof(servaddr.sin_addr));
|
||||
}
|
||||
else if (!(servaddr.sin_addr.s_addr = inet_addr(server)))
|
||||
{
|
||||
@ -136,14 +137,17 @@ BOOL tcp_connect(char *server)
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_port = htons(TCP_PORT_RDP);
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&servaddr, sizeof(struct sockaddr)) < 0)
|
||||
if (connect
|
||||
(sock, (struct sockaddr *) &servaddr,
|
||||
sizeof(struct sockaddr)) < 0)
|
||||
{
|
||||
STATUS("connect: %s\n", strerror(errno));
|
||||
close(sock);
|
||||
return False;
|
||||
}
|
||||
|
||||
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *)&true, sizeof(true));
|
||||
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true,
|
||||
sizeof(true));
|
||||
|
||||
in.size = 4096;
|
||||
in.data = xmalloc(in.size);
|
||||
|
31
xwin.c
31
xwin.c
@ -61,7 +61,8 @@ BOOL ui_create_window(char *title)
|
||||
|
||||
visual = DefaultVisual(display, DefaultScreen(display));
|
||||
|
||||
attribs.background_pixel = BlackPixel(display, DefaultScreen(display));
|
||||
attribs.background_pixel =
|
||||
BlackPixel(display, DefaultScreen(display));
|
||||
attribs.backing_store = Always;
|
||||
wnd = XCreateWindow(display, DefaultRootWindow(display),
|
||||
0, 0, width, height, 0, 8, InputOutput, visual,
|
||||
@ -146,7 +147,9 @@ void ui_process_events()
|
||||
switch (event.type)
|
||||
{
|
||||
case KeyPress:
|
||||
scancode = xwin_translate_key(event.xkey.keycode);
|
||||
scancode =
|
||||
xwin_translate_key(event.xkey.
|
||||
keycode);
|
||||
if (scancode == 0)
|
||||
break;
|
||||
|
||||
@ -155,7 +158,9 @@ void ui_process_events()
|
||||
break;
|
||||
|
||||
case KeyRelease:
|
||||
scancode = xwin_translate_key(event.xkey.keycode);
|
||||
scancode =
|
||||
xwin_translate_key(event.xkey.
|
||||
keycode);
|
||||
if (scancode == 0)
|
||||
break;
|
||||
|
||||
@ -165,7 +170,9 @@ void ui_process_events()
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
button = xwin_translate_mouse(event.xbutton.button);
|
||||
button =
|
||||
xwin_translate_mouse(event.xbutton.
|
||||
button);
|
||||
|
||||
if (button == 0)
|
||||
break;
|
||||
@ -177,7 +184,9 @@ void ui_process_events()
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
button = xwin_translate_mouse(event.xbutton.button);
|
||||
button =
|
||||
xwin_translate_mouse(event.xbutton.
|
||||
button);
|
||||
if (button == 0)
|
||||
break;
|
||||
|
||||
@ -402,8 +411,7 @@ void ui_screenblt(uint8 opcode,
|
||||
{
|
||||
xwin_set_function(opcode);
|
||||
|
||||
XCopyArea(display, wnd, wnd, gc, srcx, srcy,
|
||||
cx, cy, x, y);
|
||||
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);
|
||||
}
|
||||
|
||||
void ui_memblt(uint8 opcode,
|
||||
@ -412,8 +420,7 @@ void ui_memblt(uint8 opcode,
|
||||
{
|
||||
xwin_set_function(opcode);
|
||||
|
||||
XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy,
|
||||
cx, cy, x, y);
|
||||
XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y);
|
||||
}
|
||||
|
||||
void ui_triblt(uint8 opcode,
|
||||
@ -468,7 +475,8 @@ void ui_rect(
|
||||
|
||||
void ui_draw_glyph(int mixmode,
|
||||
/* dest */ int x, int y, int cx, int cy,
|
||||
/* src */ HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)
|
||||
/* src */ HGLYPH glyph, int srcx, int srcy, int bgcolour,
|
||||
int fgcolour)
|
||||
{
|
||||
Pixmap pixmap = (Pixmap) glyph;
|
||||
|
||||
@ -482,8 +490,7 @@ void ui_draw_glyph(int mixmode,
|
||||
XSetStipple(display, gc, pixmap);
|
||||
XSetFillStyle(display, gc, FillStippled);
|
||||
XSetTSOrigin(display, gc, x, y);
|
||||
XFillRectangle(display, wnd, gc,
|
||||
x, y, cx, cy);
|
||||
XFillRectangle(display, wnd, gc, x, y, cx, cy);
|
||||
XSetFillStyle(display, gc, FillSolid);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user