ReactOS 0.4.15-dev-8390-g075894b
qtwin.cpp File Reference
#include "rdesktop.h"
#include <qapplication.h>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qbrush.h>
#include <qimage.h>
#include <qbitmap.h>
#include <qcursor.h>
#include <qsocketnotifier.h>
#include <qscrollview.h>
#include <qfile.h>
#include "qtwin.h"
#include <unistd.h>
#include <pwd.h>
#include <stdarg.h>
#include <errno.h>
#include <fcntl.h>
Include dependency graph for qtwin.cpp:

Go to the source code of this file.

Classes

struct  QColorMap
 

Macros

#define DO_GLYPH(ttext, idx)
 

Functions

uint32 Color15to32 (uint32 InColor)
 
uint32 Color16to32 (uint32 InColor)
 
uint32 Color24to32 (uint32 InColor)
 
void SetColorx (QColor *Color, uint32 InColor)
 
void SetOpCode (int opcode)
 
void ResetOpCode (int opcode)
 
int GetScanCode (QKeyEvent *e)
 
void ui_begin_update (void)
 
void ui_end_update (void)
 
int ui_init (void)
 
void ui_deinit (void)
 
int ui_create_window (void)
 
void ui_main_loop (void)
 
void ui_destroy_window (void)
 
void ui_bell (void)
 
int ui_select (int in_val)
 
void ui_destroy_cursor (void *cursor)
 
voidui_create_glyph (int width, int height, uint8 *data)
 
void ui_destroy_glyph (void *glyph)
 
void ui_destroy_bitmap (void *bmp)
 
void ui_reset_clip (void)
 
void ui_set_clip (int x, int y, int cx, int cy)
 
voidui_create_colourmap (COLOURMAP *colours)
 
void ui_destroy_colourmap (HCOLOURMAP map)
 
void ui_set_colourmap (void *map)
 
HBITMAP ui_create_bitmap (int width, int height, uint8 *data)
 
int WarpCoords (int *x, int *y, int *cx, int *cy, int *srcx, int *srcy)
 
void bitBltClip (QPaintDevice *dst1, QPaintDevice *dst2, int dx, int dy, QPaintDevice *src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool im)
 
void ui_draw_text (uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
 
void ui_line (uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
 
void ui_triblt (uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_memblt (uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
 
void CommonDeskSave (QPixmap *Pixmap1, QPixmap *Pixmap2, int Offset, int x, int y, int cx, int cy, int dir)
 
void ui_desktop_restore (uint32 offset, int x, int y, int cx, int cy)
 
void ui_desktop_save (uint32 offset, int x, int y, int cx, int cy)
 
void ui_rect (int x, int y, int cx, int cy, int colour)
 
void ui_screenblt (uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
 
void ui_patblt (uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_destblt (uint8 opcode, int x, int y, int cx, int cy)
 
void ui_move_pointer (int x, int y)
 
void ui_set_null_cursor (void)
 
void ui_paint_bitmap (int x, int y, int cx, int cy, int width, int height, uint8 *data)
 
int Is24On (uint8 *Data, int X, int Y)
 
int Is1On (uint8 *Data, int X, int Y)
 
void Set1 (uint8 *Data, int X, int Y)
 
void FlipOver (uint8 *Data)
 
void ui_set_cursor (HCURSOR cursor)
 
HCURSOR ui_create_cursor (unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
 
uint16 ui_get_numlock_state (uint32 state)
 
uint32 read_keyboard_state (void)
 
void ui_resize_window (void)
 
void ui_polygon (uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_polyline (uint8 opcode, POINT *points, int npoints, PEN *pen)
 
void ui_ellipse (uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void generate_random (uint8 *random)
 
void save_licence (uint8 *data, int length)
 
int load_licence (uint8 **data)
 
voidxrealloc (void *in_val, int size)
 
voidxmalloc (int size)
 
void xfree (void *in_val)
 
charxstrdup (const char *s)
 
void warning (char *format,...)
 
void unimpl (char *format,...)
 
void error (char *format,...)
 
void out_params (void)
 
void hexdump (uint8 *p, uint32 len)
 
int rd_pstcache_mkdir (void)
 
int rd_open_file (char *filename)
 
void rd_close_file (int fd)
 
int rd_read_file (int fd, void *ptr, int len)
 
int rd_write_file (int fd, void *ptr, int len)
 
int rd_lseek_file (int fd, int offset)
 
int rd_lock_file (int fd, int start, int len)
 
void get_username_and_hostname (void)
 
int parse_parameters (int in_argc, char **in_argv)
 
int main (int in_argc, char **in_argv)
 

Variables

int g_tcp_port_rdp
 
int g_use_rdp5 = 1
 
char g_hostname [16]
 
char g_username [64]
 
int g_height = 600
 
int g_width = 800
 
int g_server_depth = 8
 
int g_encryption = 1
 
int g_desktop_save = 1
 
int g_polygon_ellipse_orders = 0
 
int g_bitmap_cache = 1
 
int g_bitmap_cache_persist_enable = False
 
int g_bitmap_cache_precache = True
 
int g_bitmap_compression = 1
 
int g_rdp5_performanceflags = 0
 
int g_console_session = 0
 
int g_keylayout = 0x409
 
int g_keyboard_type = 0x4
 
int g_keyboard_subtype = 0x0
 
int g_keyboard_functionkeys = 0xc
 
static int g_argc = 0
 
static char ** g_argv = 0
 
static int g_UpAndRunning = 0
 
static int g_sock = 0
 
static int g_deactivated = 0
 
static uint32 g_ext_disc_reason = 0
 
static char g_servername [128]
 
static char g_title [128] = ""
 
static int g_flags = RDP_LOGON_NORMAL
 
static QSocketNotifier * g_SocketNotifier = 0
 
static QApplication * g_App = 0
 
static QMyMainWindowg_MW = 0
 
static QMyScrollViewg_SV = 0
 
static QPixmap * g_BS = 0
 
static QPixmap * g_DS = 0
 
static QPainter * g_P1 = 0
 
static QPainter * g_P2 = 0
 
static QColor g_Color1
 
static QColor g_Color2
 
static struct QColorMapg_CM = 0
 
static QRegion * g_ClipRect
 
static Qt::RasterOp g_OpCodes [16]
 
BOOL g_redirect = False
 
char g_redirect_server [64]
 
char g_redirect_domain [16]
 
char g_redirect_password [64]
 
char g_redirect_username [64]
 
char g_redirect_cookie [128]
 
uint32 g_redirect_flags = 0
 

Macro Definition Documentation

◆ DO_GLYPH

#define DO_GLYPH (   ttext,
  idx 
)
Value:
{ \
glyph = cache_get_font (font, ttext[idx]); \
if (!(flags & TEXT2_IMPLICIT_X)) \
{ \
xyoffset = ttext[++idx]; \
if ((xyoffset & 0x80)) \
{ \
y += ttext[idx+1] | (ttext[idx+2] << 8); \
else \
x += ttext[idx+1] | (ttext[idx+2] << 8); \
idx += 2; \
} \
else \
{ \
y += xyoffset; \
else \
x += xyoffset; \
} \
} \
if (glyph != NULL) \
{ \
g_P2->drawPixmap(x + glyph->offset, y + glyph->baseline, \
*((QBitmap*)glyph->pixmap)); \
x += glyph->width; \
} \
}
FONTGLYPH * cache_get_font(uint8 font, uint16 character)
Definition: cache.c:279
#define TEXT2_IMPLICIT_X
Definition: constants.h:276
#define TEXT2_VERTICAL
Definition: constants.h:275
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLbitfield flags
Definition: glext.h:7161
Definition: mk_font.cpp:20
static QPainter * g_P2
Definition: qtwin.cpp:93

Definition at line 874 of file qtwin.cpp.

Function Documentation

◆ bitBltClip()

void bitBltClip ( QPaintDevice *  dst1,
QPaintDevice *  dst2,
int  dx,
int  dy,
QPaintDevice *  src,
int  sx,
int  sy,
int  sw,
int  sh,
Qt::RasterOp  rop,
bool  im 
)

Definition at line 843 of file qtwin.cpp.

846{
847 if (WarpCoords(&dx, &dy, &sw, &sh, &sx, &sy))
848 {
849 if (dst1 != NULL)
850 {
851 if (src == NULL)
852 {
853 bitBlt(dst1, dx, dy, dst1, sx, sy, sw, sh, rop, im);
854 }
855 else
856 {
857 bitBlt(dst1, dx, dy, src, sx, sy, sw, sh, rop, im);
858 }
859 }
860 if (dst2 != NULL)
861 {
862 if (src == NULL)
863 {
864 bitBlt(dst2, dx, dy, dst2, sx, sy, sw, sh, rop, im);
865 }
866 else
867 {
868 bitBlt(dst2, dx, dy, src, sx, sy, sw, sh, rop, im);
869 }
870 }
871 }
872}
GLenum src
Definition: glext.h:6340
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
static int rop(int rop, int src, int dst)
Definition: nanoxwin.c:124
int WarpCoords(int *x, int *y, int *cx, int *cy, int *srcx, int *srcy)
Definition: qtwin.cpp:818
short sh
Definition: format.c:272

Referenced by ui_desktop_restore(), ui_draw_text(), ui_patblt(), and ui_screenblt().

◆ Color15to32()

uint32 Color15to32 ( uint32  InColor)

Definition at line 133 of file qtwin.cpp.

134{
135 uint32 r, g, b;
136
137 r = (InColor & 0x7c00) >> 10;
138 r = (r * 0xff) / 0x1f;
139 g = (InColor & 0x03e0) >> 5;
140 g = (g * 0xff) / 0x1f;
141 b = (InColor & 0x001f);
142 b = (b * 0xff) / 0x1f;
143 return (r << 16) | (g << 8) | b;
144}
unsigned int uint32
Definition: types.h:32
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

Referenced by SetColorx(), ui_create_bitmap(), and ui_paint_bitmap().

◆ Color16to32()

uint32 Color16to32 ( uint32  InColor)

Definition at line 147 of file qtwin.cpp.

148{
149 uint32 r, g, b;
150
151 r = (InColor & 0xf800) >> 11;
152 r = (r * 0xff) / 0x1f;
153 g = (InColor & 0x07e0) >> 5;
154 g = (g * 0xff) / 0x3f;
155 b = (InColor & 0x001f);
156 b = (b * 0xff) / 0x1f;
157 return (r << 16) | (g << 8) | b;
158}

Referenced by SetColorx(), ui_create_bitmap(), and ui_paint_bitmap().

◆ Color24to32()

uint32 Color24to32 ( uint32  InColor)

Definition at line 161 of file qtwin.cpp.

162{
163 return ((InColor & 0x00ff0000) >> 16) |
164 ((InColor & 0x000000ff) << 16) |
165 (InColor & 0x0000ff00);
166}

Referenced by SetColorx().

◆ CommonDeskSave()

void CommonDeskSave ( QPixmap *  Pixmap1,
QPixmap *  Pixmap2,
int  Offset,
int  x,
int  y,
int  cx,
int  cy,
int  dir 
)

Definition at line 1044 of file qtwin.cpp.

1046{
1047 int lx;
1048 int ly;
1049 int x1;
1050 int y1;
1051 int width;
1052 int lcx;
1053 int right;
1054 int bottom;
1055 lx = Offset % 480;
1056 ly = Offset / 480;
1057 y1 = y;
1058 right = x + cx;
1059 bottom = y + cy;
1060 while (y1 < bottom)
1061 {
1062 x1 = x;
1063 lcx = cx;
1064 while (x1 < right)
1065 {
1066 width = 480 - lx;
1067 if (width > lcx)
1068 width = lcx;
1069 if (dir == 0)
1070 bitBlt(Pixmap1, lx, ly, Pixmap2, x1, y1, width, 1, Qt::CopyROP, true);
1071 else
1072 bitBlt(Pixmap2, x1, y1, Pixmap1, lx, ly, width, 1, Qt::CopyROP, true);
1073 lx = lx + width;
1074 if (lx >= 480)
1075 {
1076 lx = 0;
1077 ly++;
1078 if (ly >= 480)
1079 ly = 0;
1080 }
1081 lcx = lcx - width;
1082 x1 = x1 + width;
1083 }
1084 y1++;
1085 }
1086}
unsigned int dir
Definition: maze.c:112
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble right
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708

Referenced by ui_desktop_restore(), and ui_desktop_save().

◆ error()

void error ( char format,
  ... 
)

Definition at line 1545 of file qtwin.cpp.

1546{
1547 va_list ap;
1548
1549 fprintf(stderr, "ERROR: ");
1550 va_start(ap, format);
1552 va_end(ap);
1553}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ FlipOver()

void FlipOver ( uint8 Data)

Definition at line 1275 of file qtwin.cpp.

1276{
1277 uint8 AData[128];
1278 int Index;
1279 memcpy(AData, Data, 128);
1280 for (Index = 0; Index <= 31; Index++)
1281 {
1282 Data[127 - (Index * 4 + 3)] = AData[Index * 4];
1283 Data[127 - (Index * 4 + 2)] = AData[Index * 4 + 1];
1284 Data[127 - (Index * 4 + 1)] = AData[Index * 4 + 2];
1285 Data[127 - Index * 4] = AData[Index * 4 + 3];
1286 }
1287}
unsigned char uint8
Definition: types.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by ui_create_cursor().

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 1398 of file qtwin.cpp.

1399{
1400 QFile File("/dev/random");
1401 File.open(IO_ReadOnly);
1402 if (File.readBlock((char*)random, 32) == 32)
1403 {
1404 return;
1405 }
1406 warning("no /dev/random\n");
1407 memcpy(random, "12345678901234567890123456789012", 32);
1408}
Definition: File.h:16
bool open(const char *filename, const char *mode)
Definition: File.cpp:10
#define random
Definition: rosdhcp.h:81
#define warning(s)
Definition: debug.h:83

◆ get_username_and_hostname()

void get_username_and_hostname ( void  )

Definition at line 1698 of file qtwin.cpp.

1699{
1700 char fullhostname[64];
1701 char * p;
1702 struct passwd * pw;
1703
1704 STRNCPY(g_username, "unknown", sizeof(g_username));
1705 STRNCPY(g_hostname, "unknown", sizeof(g_hostname));
1706 pw = getpwuid(getuid());
1707 if (pw != NULL && pw->pw_name != NULL)
1708 {
1709 STRNCPY(g_username, pw->pw_name, sizeof(g_username));
1710 }
1711 if (gethostname(fullhostname, sizeof(fullhostname)) != -1)
1712 {
1713 p = strchr(fullhostname, '.');
1714 if (p != NULL)
1715 {
1716 *p = 0;
1717 }
1718 STRNCPY(g_hostname, fullhostname, sizeof(g_hostname));
1719 }
1720}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
uid_t getuid()
Definition: uid.c:27
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
Definition: getxbyxx.c:397
GLfloat GLfloat p
Definition: glext.h:8902
char g_hostname[16]
Definition: qtwin.cpp:48
char g_username[64]
Definition: qtwin.cpp:49

Referenced by main().

◆ GetScanCode()

int GetScanCode ( QKeyEvent *  e)

Definition at line 306 of file qtwin.cpp.

307{
308 int Key = e->key();
309 int ScanCode = 0;
310 Qt::ButtonState bs = e->state();
311 if (!(bs & Qt::ShiftButton)) // shift is not down
312 {
313 if (Key == 42) // *
314 return 0x37;
315 if (Key == 43) // +
316 return 0x4e;
317 }
318 switch (Key)
319 {
320 case 4100: ScanCode = 0x1c; break; // enter
321 case 4101: ScanCode = 0x1c; break;
322 case 4117: ScanCode = 0xd0; break; // down arrow
323 case 4115: ScanCode = 0xc8; break; // up arrow
324 case 4114: ScanCode = 0xcb; break; // left arrow
325 case 4116: ScanCode = 0xcd; break; // right arrow
326 case 4112: ScanCode = 0xc7; break; // home
327 case 4113: ScanCode = 0xcf; break; // end
328 case 4102: ScanCode = 0xd2; break; // insert
329 case 4103: ScanCode = 0xd3; break; // delete
330 case 4118: ScanCode = 0xc9; break; // page up
331 case 4119: ScanCode = 0xd1; break; // page down
332 case 4143: ScanCode = 0x00; break; // num lock
333 case 47: ScanCode = 0x35; break; // /
334 case 42: ScanCode = 0x37; break; // *
335 case 45: ScanCode = 0x0c; break; // -
336 case 95: ScanCode = 0x0c; break; // _
337 case 43: ScanCode = 0x0d; break; // +
338 case 46: ScanCode = 0x34; break; // .
339 case 48: ScanCode = 0x0b; break; // 0
340 case 41: ScanCode = 0x0b; break; // )
341 case 49: ScanCode = 0x02; break; // 1
342 case 33: ScanCode = 0x02; break; // !
343 case 50: ScanCode = 0x03; break; // 2
344 case 64: ScanCode = 0x03; break; // @
345 case 51: ScanCode = 0x04; break; // 3
346 case 35: ScanCode = 0x04; break; // #
347 case 52: ScanCode = 0x05; break; // 4
348 case 36: ScanCode = 0x05; break; // $
349 case 53: ScanCode = 0x06; break; // 5
350 case 37: ScanCode = 0x06; break; // %
351 case 54: ScanCode = 0x07; break; // 6
352 case 94: ScanCode = 0x07; break; // ^
353 case 55: ScanCode = 0x08; break; // 7
354 case 38: ScanCode = 0x08; break; // &
355 case 56: ScanCode = 0x09; break; // 8
356 case 57: ScanCode = 0x0a; break; // 9
357 case 40: ScanCode = 0x0a; break; // (
358 case 61: ScanCode = 0x0d; break; // =
359 case 65: ScanCode = 0x1e; break; // a
360 case 66: ScanCode = 0x30; break; // b
361 case 67: ScanCode = 0x2e; break; // c
362 case 68: ScanCode = 0x20; break; // d
363 case 69: ScanCode = 0x12; break; // e
364 case 70: ScanCode = 0x21; break; // f
365 case 71: ScanCode = 0x22; break; // g
366 case 72: ScanCode = 0x23; break; // h
367 case 73: ScanCode = 0x17; break; // i
368 case 74: ScanCode = 0x24; break; // j
369 case 75: ScanCode = 0x25; break; // k
370 case 76: ScanCode = 0x26; break; // l
371 case 77: ScanCode = 0x32; break; // m
372 case 78: ScanCode = 0x31; break; // n
373 case 79: ScanCode = 0x18; break; // o
374 case 80: ScanCode = 0x19; break; // p
375 case 81: ScanCode = 0x10; break; // q
376 case 82: ScanCode = 0x13; break; // r
377 case 83: ScanCode = 0x1f; break; // s
378 case 84: ScanCode = 0x14; break; // t
379 case 85: ScanCode = 0x16; break; // u
380 case 86: ScanCode = 0x2f; break; // v
381 case 87: ScanCode = 0x11; break; // w
382 case 88: ScanCode = 0x2d; break; // x
383 case 89: ScanCode = 0x15; break; // y
384 case 90: ScanCode = 0x2c; break; // z
385 case 32: ScanCode = 0x39; break; // space
386 case 44: ScanCode = 0x33; break; // ,
387 case 60: ScanCode = 0x33; break; // <
388 case 62: ScanCode = 0x34; break; // >
389 case 63: ScanCode = 0x35; break; // ?
390 case 92: ScanCode = 0x2b; break; // backslash
391 case 124: ScanCode = 0x2b; break; // bar
392 case 4097: ScanCode = 0x0f; break; // tab
393 case 4132: ScanCode = 0x3a; break; // caps lock
394 case 4096: ScanCode = 0x01; break; // esc
395 case 59: ScanCode = 0x27; break; // ;
396 case 58: ScanCode = 0x27; break; // :
397 case 39: ScanCode = 0x28; break; // '
398 case 34: ScanCode = 0x28; break; // "
399 case 91: ScanCode = 0x1a; break; // [
400 case 123: ScanCode = 0x1a; break; // {
401 case 93: ScanCode = 0x1b; break; // ]
402 case 125: ScanCode = 0x1b; break; // }
403 case 4144: ScanCode = 0x3b; break; // f1
404 case 4145: ScanCode = 0x3c; break; // f2
405 case 4146: ScanCode = 0x3d; break; // f3
406 case 4147: ScanCode = 0x3e; break; // f4
407 case 4148: ScanCode = 0x3f; break; // f5
408 case 4149: ScanCode = 0x40; break; // f6
409 case 4150: ScanCode = 0x41; break; // f7
410 case 4151: ScanCode = 0x42; break; // f8
411 case 4152: ScanCode = 0x43; break; // f9
412 case 4153: ScanCode = 0x44; break; // f10
413 case 4154: ScanCode = 0x57; break; // f11
414 case 4155: ScanCode = 0x58; break; // f12
415 case 4128: ScanCode = 0x2a; break; // shift
416 case 4131: ScanCode = 0x38; break; // alt
417 case 4129: ScanCode = 0x1d; break; // ctrl
418 case 96: ScanCode = 0x29; break; // `
419 case 126: ScanCode = 0x29; break; // ~
420 case 4099: ScanCode = 0x0e; break; // backspace
421 }
422// if (ScanCode == 0)
423// printf("key %d scancode %d\n", Key, ScanCode);
424 return ScanCode;
425}
UINT ScanCode
Definition: VirtualKey.c:24
#define e
Definition: ke_i.h:82
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539

◆ hexdump()

void hexdump ( uint8 p,
uint32  len 
)

Definition at line 1578 of file qtwin.cpp.

1579{
1580 uint8 * line = p;
1581 int i, thisline;
1582 uint32 offset = 0;
1583
1584 while (offset < len)
1585 {
1586 printf("%04x ", offset);
1587 thisline = len - offset;
1588 if (thisline > 16)
1589 {
1590 thisline = 16;
1591 }
1592 for (i = 0; i < thisline; i++)
1593 {
1594 printf("%02x ", line[i]);
1595 }
1596 for (; i < 16; i++)
1597 {
1598 printf(" ");
1599 }
1600 for (i = 0; i < thisline; i++)
1601 {
1602 printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
1603 }
1604 printf("\n");
1605 offset += thisline;
1606 line += thisline;
1607 }
1608}
#define printf
Definition: freeldr.h:97
GLenum GLsizei len
Definition: glext.h:6722
GLintptr offset
Definition: glext.h:5920
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: parser.c:49

◆ Is1On()

int Is1On ( uint8 Data,
int  X,
int  Y 
)

Definition at line 1255 of file qtwin.cpp.

1256{
1257 int Start;
1258 int Shift;
1259 Start = (Y * 32) / 8 + X / 8;
1260 Shift = X % 8;
1261 return (Data[Start] & (0x80 >> Shift)) == 0;
1262}
#define Y(I)
return pTarget Start()
_In_ ULONG Shift
Definition: rtlfuncs.h:2681

Referenced by ui_create_cursor().

◆ Is24On()

int Is24On ( uint8 Data,
int  X,
int  Y 
)

Definition at line 1243 of file qtwin.cpp.

1244{
1245 uint8 R, G, B;
1246 int Start;
1247 Start = Y * 32 * 3 + X * 3;
1248 R = Data[Start];
1249 G = Data[Start + 1];
1250 B = Data[Start + 2];
1251 return !((R == 0) && (G == 0) && (B == 0));
1252}
#define G(r, i, a, b, c, d)
Definition: blake2b-ref.c:117
Definition: ehthrow.cxx:54
#define B(row, col)
#define R(b, x)
Definition: sha2.c:134

Referenced by ui_create_cursor().

◆ load_licence()

int load_licence ( uint8 **  data)

Definition at line 1457 of file qtwin.cpp.

1458{
1459 char * home, * path;
1460 struct stat st;
1461 int fd, length;
1462
1463 home = getenv("HOME");
1464 if (home == NULL)
1465 {
1466 return -1;
1467 }
1468 path = (char *) xmalloc(strlen(home) + strlen(g_hostname) +
1469 sizeof("/.rdesktop/licence."));
1470 sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
1471 fd = open(path, O_RDONLY);
1472 if (fd == -1)
1473 {
1474 return -1;
1475 }
1476 if (fstat(fd, &st))
1477 {
1478 close(fd);
1479 xfree(path);
1480 return -1;
1481 }
1482 *data = (uint8 *) xmalloc(st.st_size);
1483 length = read(fd, *data, st.st_size);
1484 close(fd);
1485 xfree(path);
1486 return length;
1487}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define read
Definition: acwin.h:96
#define O_RDONLY
Definition: acwin.h:108
#define open
Definition: acwin.h:95
#define close
Definition: acwin.h:98
#define fstat
Definition: acwin.h:100
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void xfree(void *in_val)
Definition: qtwin.cpp:1502
void * xmalloc(int size)
Definition: qtwin.cpp:1496
static int fd
Definition: io.c:51
Definition: tftpd.h:38
Definition: stat.h:55

◆ main()

int main ( int  in_argc,
char **  in_argv 
)

Definition at line 1809 of file qtwin.cpp.

1810{
1812 if (!parse_parameters(in_argc, in_argv))
1813 {
1814 return 0;
1815 }
1816 if (!ui_init())
1817 {
1818 return 1;
1819 }
1820 if (!ui_create_window())
1821 {
1822 return 1;
1823 }
1824 ui_main_loop();
1826 ui_deinit();
1827 return 0;
1828}
int parse_parameters(int in_argc, char **in_argv)
Definition: qtwin.cpp:1723
int ui_create_window(void)
Definition: qtwin.cpp:559
void ui_destroy_window(void)
Definition: qtwin.cpp:637
void ui_main_loop(void)
Definition: qtwin.cpp:613
int ui_init(void)
Definition: qtwin.cpp:546
void ui_deinit(void)
Definition: qtwin.cpp:553
void get_username_and_hostname(void)
Definition: qtwin.cpp:1698

◆ out_params()

void out_params ( void  )

Definition at line 1556 of file qtwin.cpp.

1557{
1558 fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");
1559 fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2005 Matt Chapman.\n");
1560 fprintf(stderr, "QT uiport by Jay Sorg\n");
1561 fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
1562 fprintf(stderr, "Usage: qtrdesktop [options] server\n");
1563 fprintf(stderr, " -g WxH: desktop geometry\n");
1564 fprintf(stderr, " -4: use RDP version 4\n");
1565 fprintf(stderr, " -5: use RDP version 5 (default)\n");
1566 fprintf(stderr, " -t 3389: tcp port)\n");
1567 fprintf(stderr, " -a 8|16|24: connection colour depth\n");
1568 fprintf(stderr, " -T title: window title\n");
1569 fprintf(stderr, " -P: use persistent bitmap caching\n");
1570 fprintf(stderr, " -0: attach to console\n");
1571 fprintf(stderr, " -z: enable rdp compression\n");
1572 fprintf(stderr, " -r sound: enable sound\n");
1573 fprintf(stderr, "\n");
1574}
#define VERSION
Definition: rdesktop.h:45

Referenced by parse_parameters().

◆ parse_parameters()

int parse_parameters ( int  in_argc,
char **  in_argv 
)

Definition at line 1723 of file qtwin.cpp.

1724{
1725 int i;
1726 char * p;
1727
1728 if (in_argc <= 1)
1729 {
1730 out_params();
1731 return 0;
1732 }
1733 g_argc = in_argc;
1734 g_argv = in_argv;
1735 for (i = 1; i < in_argc; i++)
1736 {
1737 strcpy(g_servername, in_argv[i]);
1738 if (strcmp(in_argv[i], "-g") == 0)
1739 {
1740 g_width = strtol(in_argv[i + 1], &p, 10);
1741 if (g_width <= 0)
1742 {
1743 error("invalid geometry\n");
1744 return 0;
1745 }
1746 if (*p == 'x')
1747 {
1748 g_height = strtol(p + 1, NULL, 10);
1749 }
1750 if (g_height <= 0)
1751 {
1752 error("invalid geometry\n");
1753 return 0;
1754 }
1755 g_width = (g_width + 3) & ~3;
1756 }
1757 else if (strcmp(in_argv[i], "-T") == 0)
1758 {
1759 strcpy(g_title, in_argv[i + 1]);
1760 }
1761 else if (strcmp(in_argv[i], "-4") == 0)
1762 {
1763 g_use_rdp5 = 0;
1764 }
1765 else if (strcmp(in_argv[i], "-5") == 0)
1766 {
1767 g_use_rdp5 = 1;
1768 }
1769 else if (strcmp(in_argv[i], "-a") == 0)
1770 {
1771 g_server_depth = strtol(in_argv[i + 1], &p, 10);
1772 if (g_server_depth != 8 && g_server_depth != 15 &&
1773 g_server_depth != 16 && g_server_depth != 24)
1774 {
1775 error("invalid bpp\n");
1776 return 0;
1777 }
1778 }
1779 else if (strcmp(in_argv[i], "-t") == 0)
1780 {
1781 g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10);
1782 }
1783 else if (strcmp(in_argv[i], "-P") == 0)
1784 {
1786 }
1787 else if (strcmp(in_argv[i], "-0") == 0)
1788 {
1790 }
1791 else if (strcmp(in_argv[i], "-z") == 0)
1792 {
1794 }
1795 else if (strcmp(in_argv[i], "-r") == 0)
1796 {
1797 if (strcmp(in_argv[i + 1], "sound") == 0)
1798 {
1799#ifdef WITH_RDPSND
1800 g_rdpsnd = 1;
1801#endif
1802 }
1803 }
1804 }
1805 return 1;
1806}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define error(str)
Definition: mkdosfs.c:1605
#define RDP_LOGON_COMPRESSION
Definition: constants.h:263
#define RDP_LOGON_COMPRESSION2
Definition: constants.h:265
int g_server_depth
Definition: qtwin.cpp:52
int g_width
Definition: qtwin.cpp:51
int g_height
Definition: qtwin.cpp:50
int g_tcp_port_rdp
Definition: tcp.c:75
static char ** g_argv
Definition: qtwin.cpp:69
int g_use_rdp5
Definition: qtwin.cpp:47
int g_console_session
Definition: qtwin.cpp:61
static int g_argc
Definition: qtwin.cpp:68
static char g_title[128]
Definition: qtwin.cpp:75
static char g_servername[128]
Definition: qtwin.cpp:74
static int g_flags
Definition: qtwin.cpp:76
int g_bitmap_cache_persist_enable
Definition: qtwin.cpp:57
void out_params(void)
Definition: qtwin.cpp:1556

Referenced by main().

◆ rd_close_file()

void rd_close_file ( int  fd)

Definition at line 1658 of file qtwin.cpp.

1659{
1660 close(fd);
1661}

◆ rd_lock_file()

int rd_lock_file ( int  fd,
int  start,
int  len 
)

Definition at line 1682 of file qtwin.cpp.

1683{
1684 struct flock lock;
1685
1686 lock.l_type = F_WRLCK;
1687 lock.l_whence = SEEK_SET;
1688 lock.l_start = start;
1689 lock.l_len = len;
1690 if (fcntl(fd, F_SETLK, &lock) == -1)
1691 {
1692 return False;
1693 }
1694 return True;
1695}
#define False
Definition: types.h:25
#define True
Definition: types.h:24
GLuint start
Definition: gl.h:1545
#define SEEK_SET
Definition: jmemansi.c:26
rwlock_t lock
Definition: tcpcore.h:0

◆ rd_lseek_file()

int rd_lseek_file ( int  fd,
int  offset 
)

Definition at line 1676 of file qtwin.cpp.

1677{
1678 return lseek(fd, offset, SEEK_SET);
1679}
#define lseek
Definition: syshdrs.h:47

◆ rd_open_file()

int rd_open_file ( char filename)

Definition at line 1637 of file qtwin.cpp.

1638{
1639 char * home;
1640 char fn[256];
1641 int fd;
1642
1643 home = getenv("HOME");
1644 if (home == NULL)
1645 {
1646 return -1;
1647 }
1648 sprintf(fn, "%s/.rdesktop/%s", home, filename);
1650 if (fd == -1)
1651 {
1652 perror(fn);
1653 }
1654 return fd;
1655}
#define O_CREAT
Definition: acwin.h:110
#define O_RDWR
Definition: fcntl.h:36
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
const char * filename
Definition: ioapi.h:137
#define S_IRUSR
Definition: propsheet.h:29
#define S_IWUSR
Definition: propsheet.h:33
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

◆ rd_pstcache_mkdir()

int rd_pstcache_mkdir ( void  )

Definition at line 1611 of file qtwin.cpp.

1612{
1613 char * home;
1614 char bmpcache_dir[256];
1615
1616 home = getenv("HOME");
1617 if (home == NULL)
1618 {
1619 return False;
1620 }
1621 sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop");
1622 if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST)
1623 {
1624 perror(bmpcache_dir);
1625 return False;
1626 }
1627 sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop/cache");
1628 if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST)
1629 {
1630 perror(bmpcache_dir);
1631 return False;
1632 }
1633 return True;
1634}
#define EEXIST
Definition: acclib.h:88
#define mkdir
Definition: acwin.h:101
#define S_IRWXU
Definition: ext2fs.h:382
#define errno
Definition: errno.h:18

◆ rd_read_file()

int rd_read_file ( int  fd,
void ptr,
int  len 
)

Definition at line 1664 of file qtwin.cpp.

1665{
1666 return read(fd, ptr, len);
1667}
static PVOID ptr
Definition: dispmode.c:27

◆ rd_write_file()

int rd_write_file ( int  fd,
void ptr,
int  len 
)

Definition at line 1670 of file qtwin.cpp.

1671{
1672 return write(fd, ptr, len);
1673}
#define write
Definition: acwin.h:97

◆ read_keyboard_state()

uint32 read_keyboard_state ( void  )

Definition at line 1353 of file qtwin.cpp.

1354{
1355 return 0;
1356}

◆ ResetOpCode()

void ResetOpCode ( int  opcode)

Definition at line 210 of file qtwin.cpp.

211{
212 if (opcode >= 0 && opcode < 16)
213 {
214 Qt::RasterOp op = g_OpCodes[opcode];
215 if (op != Qt::CopyROP)
216 {
217 g_P1->setRasterOp(Qt::CopyROP);
218 g_P2->setRasterOp(Qt::CopyROP);
219 }
220 }
221}
UINT op
Definition: effect.c:236
static Qt::RasterOp g_OpCodes[16]
Definition: qtwin.cpp:105
static QPainter * g_P1
Definition: qtwin.cpp:92

Referenced by ui_destblt(), ui_line(), ui_memblt(), ui_patblt(), and ui_screenblt().

◆ save_licence()

void save_licence ( uint8 data,
int  length 
)

Definition at line 1411 of file qtwin.cpp.

1412{
1413 char * home, * path, * tmppath;
1414 int fd;
1415
1416 home = getenv("HOME");
1417 if (home == NULL)
1418 {
1419 return;
1420 }
1421 path = (char *) xmalloc(strlen(home) + strlen(g_hostname) +
1422 sizeof("/.rdesktop/licence."));
1423 sprintf(path, "%s/.rdesktop", home);
1424 if ((mkdir(path, 0700) == -1) && errno != EEXIST)
1425 {
1426 perror(path);
1427 return;
1428 }
1429 /* write licence to licence.hostname.new, then atomically rename to
1430 licence.hostname */
1431 sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
1432 tmppath = (char *) xmalloc(strlen(path) + sizeof(".new"));
1433 strcpy(tmppath, path);
1434 strcat(tmppath, ".new");
1435 fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
1436 if (fd == -1)
1437 {
1438 perror(tmppath);
1439 return;
1440 }
1441 if (write(fd, data, length) != length)
1442 {
1443 perror(tmppath);
1444 unlink(tmppath);
1445 }
1446 else if (rename(tmppath, path) == -1)
1447 {
1448 perror(path);
1449 unlink(tmppath);
1450 }
1451 close(fd);
1452 xfree(tmppath);
1453 xfree(path);
1454}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define O_WRONLY
Definition: acwin.h:111
#define O_TRUNC
Definition: acwin.h:112
#define unlink
Definition: syshdrs.h:54
_Check_return_ int __cdecl rename(_In_z_ const char *_OldFilename, _In_z_ const char *_NewFilename)

◆ Set1()

void Set1 ( uint8 Data,
int  X,
int  Y 
)

Definition at line 1265 of file qtwin.cpp.

1266{
1267 int Start;
1268 int Shift;
1269 Start = (Y * 32) / 8 + X / 8;
1270 Shift = X % 8;
1271 Data[Start] = Data[Start] | (0x80 >> Shift);
1272}

Referenced by ui_create_cursor().

◆ SetColorx()

void SetColorx ( QColor *  Color,
uint32  InColor 
)

Definition at line 169 of file qtwin.cpp.

170{
171 switch (g_server_depth)
172 {
173 case 8:
174 if (g_CM == NULL || InColor > 255)
175 {
176 Color->setRgb(0);
177 return;
178 }
179 Color->setRgb(g_CM->RGBColors[InColor]);
180 break;
181 case 15:
182 Color->setRgb(Color15to32(InColor));
183 break;
184 case 16:
185 Color->setRgb(Color16to32(InColor));
186 break;
187 case 24:
188 Color->setRgb(Color24to32(InColor));
189 break;
190 default:
191 Color->setRgb(0);
192 }
193}
static struct QColorMap * g_CM
Definition: qtwin.cpp:102
uint32 Color15to32(uint32 InColor)
Definition: qtwin.cpp:133
uint32 Color16to32(uint32 InColor)
Definition: qtwin.cpp:147
uint32 Color24to32(uint32 InColor)
Definition: qtwin.cpp:161

Referenced by ui_draw_text(), ui_line(), ui_patblt(), and ui_rect().

◆ SetOpCode()

void SetOpCode ( int  opcode)

Definition at line 196 of file qtwin.cpp.

197{
198 if (opcode >= 0 && opcode < 16)
199 {
200 Qt::RasterOp op = g_OpCodes[opcode];
201 if (op != Qt::CopyROP)
202 {
203 g_P1->setRasterOp(op);
204 g_P2->setRasterOp(op);
205 }
206 }
207}

Referenced by ui_destblt(), ui_line(), ui_memblt(), ui_patblt(), and ui_screenblt().

◆ ui_begin_update()

void ui_begin_update ( void  )

Definition at line 532 of file qtwin.cpp.

533{
534 g_P1->begin(g_MW);
535 g_P2->begin(g_BS);
536}
static QPixmap * g_BS
Definition: qtwin.cpp:90
static QMyMainWindow * g_MW
Definition: qtwin.cpp:88

◆ ui_bell()

void ui_bell ( void  )

Definition at line 649 of file qtwin.cpp.

650{
651}

◆ ui_create_bitmap()

HBITMAP ui_create_bitmap ( int  width,
int  height,
uint8 data 
)

Definition at line 757 of file qtwin.cpp.

758{
759 QImage * Image = NULL;
760 QPixmap * Pixmap;
761 uint32 * d = NULL;
762 uint16 * s;
763 int i;
764
765 switch (g_server_depth)
766 {
767 case 8:
768 Image = new QImage(data, width, height, 8, (QRgb*)&g_CM->RGBColors,
769 g_CM->NumColors, QImage::IgnoreEndian);
770 break;
771 case 15:
772 d = (uint32*)malloc(width * height * 4);
773 s = (uint16*)data;
774 for (i = 0; i < width * height; i++)
775 {
776 d[i] = Color15to32(s[i]);
777 }
778 Image = new QImage((uint8*)d, width, height, 32, NULL,
779 0, QImage::IgnoreEndian);
780 break;
781 case 16:
782 d = (uint32*)malloc(width * height * 4);
783 s = (uint16*)data;
784 for (i = 0; i < width * height; i++)
785 {
786 d[i] = Color16to32(s[i]);
787 }
788 Image = new QImage((uint8*)d, width, height, 32, NULL,
789 0, QImage::IgnoreEndian);
790 break;
791 case 24:
792 d = (uint32*)malloc(width * height * 4);
793 memset(d, 0, width * height * 4);
794 for (i = 0; i < width * height; i++)
795 {
796 memcpy(d + i, data + i * 3, 3);
797 }
798 Image = new QImage((uint8*)d, width, height, 32, NULL,
799 0, QImage::IgnoreEndian);
800 break;
801 }
802 if (Image == NULL)
803 {
804 return NULL;
805 }
806 Pixmap = new QPixmap();
807 Pixmap->convertFromImage(*Image);
808 delete Image;
809 if (d != NULL)
810 {
811 free(d);
812 }
813 return (HBITMAP)Pixmap;
814}
unsigned short uint16
Definition: types.h:30
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLdouble s
Definition: gl.h:2039
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define d
Definition: ke_i.h:81
static HBITMAP
Definition: button.c:44
#define memset(x, y, z)
Definition: compat.h:39

◆ ui_create_colourmap()

void * ui_create_colourmap ( COLOURMAP colours)

Definition at line 718 of file qtwin.cpp.

719{
720 QColorMap* LCM;
721 int i, r, g, b;
722 LCM = (QColorMap*)malloc(sizeof(QColorMap));
723 memset(LCM, 0, sizeof(QColorMap));
724 i = 0;
725 while (i < colours->ncolours && i < 256)
726 {
727 r = colours->colours[i].red;
728 g = colours->colours[i].green;
729 b = colours->colours[i].blue;
730 LCM->RGBColors[i] = (r << 16) | (g << 8) | b;
731 i++;
732 }
733 LCM->NumColors = colours->ncolours;
734 return LCM;
735}
uint32 RGBColors[256]
Definition: qtewin.cpp:86
uint32 NumColors
Definition: qtewin.cpp:87
uint8 red
Definition: types.h:57
uint8 blue
Definition: types.h:59
uint8 green
Definition: types.h:58
uint16 ncolours
Definition: types.h:66
COLOURENTRY * colours
Definition: types.h:67

◆ ui_create_cursor()

HCURSOR ui_create_cursor ( unsigned int  x,
unsigned int  y,
int  width,
int  height,
uint8 andmask,
uint8 xormask 
)

Definition at line 1299 of file qtwin.cpp.

1302{
1303 uint8 AData[128];
1304 uint8 AMask[128];
1305 QBitmap* DataBitmap;
1306 QBitmap* MaskBitmap;
1307 QCursor* Cursor;
1308 int I1, I2, BOn, MOn;
1309
1310 if (width != 32 || height != 32)
1311 {
1312 return 0;
1313 }
1314 memset(AData, 0, 128);
1315 memset(AMask, 0, 128);
1316 for (I1 = 0; I1 <= 31; I1++)
1317 {
1318 for (I2 = 0; I2 <= 31; I2++)
1319 {
1320 MOn = Is24On(xormask, I1, I2);
1321 BOn = Is1On(andmask, I1, I2);
1322 if (BOn ^ MOn) // xor
1323 {
1324 Set1(AData, I1, I2);
1325 if (!MOn)
1326 {
1327 Set1(AMask, I1, I2);
1328 }
1329 }
1330 if (MOn)
1331 {
1332 Set1(AMask, I1, I2);
1333 }
1334 }
1335 }
1336 FlipOver(AData);
1337 FlipOver(AMask);
1338 DataBitmap = new QBitmap(32, 32, AData);
1339 MaskBitmap = new QBitmap(32, 32, AMask);
1340 Cursor = new QCursor(*DataBitmap, *MaskBitmap, x, y);
1341 delete DataBitmap;
1342 delete MaskBitmap;
1343 return Cursor;
1344}
void Set1(uint8 *Data, int X, int Y)
Definition: qtwin.cpp:1265
int Is1On(uint8 *Data, int X, int Y)
Definition: qtwin.cpp:1255
int Is24On(uint8 *Data, int X, int Y)
Definition: qtwin.cpp:1243
void FlipOver(uint8 *Data)
Definition: qtwin.cpp:1275

◆ ui_create_glyph()

void * ui_create_glyph ( int  width,
int  height,
uint8 data 
)

Definition at line 675 of file qtwin.cpp.

676{
677 QBitmap * Bitmap;
678 Bitmap = new QBitmap(width, height, data);
679 Bitmap->setMask(*Bitmap);
680 return (HGLYPH)Bitmap;
681}

◆ ui_create_window()

int ui_create_window ( void  )

Definition at line 559 of file qtwin.cpp.

560{
561 int w, h;
562 QPainter * painter;
563 QWidget * desktop;
564
565 g_MW = new QMyMainWindow();
566 g_SV = new QMyScrollView();
567 g_SV->addChild(g_MW);
568 g_BS = new QPixmap(g_width, g_height);
569 painter = new QPainter(g_BS);
570 painter->fillRect(0, 0, g_width, g_height, QBrush(QColor("white")));
571 painter->fillRect(0, 0, g_width, g_height, QBrush(QBrush::CrossPattern));
572 delete painter;
573 g_DS = new QPixmap(480, 480);
574 g_P1 = new QPainter();
575 g_P2 = new QPainter();
576 g_ClipRect = new QRegion(0, 0, g_width, g_height);
577 desktop = QApplication::desktop();
578 w = desktop->width(); // returns screen width
579 h = desktop->height(); // returns screen height
580 g_MW->resize(g_width, g_height);
581 if (w < g_width || h < g_height)
582 {
583 g_SV->resize(w, h);
584 }
585 else
586 {
587 g_SV->resize(g_width + 4, g_height + 4);
588 }
589 g_SV->setMaximumWidth(g_width + 4);
590 g_SV->setMaximumHeight(g_height + 4);
591 g_App->setMainWidget(g_SV);
592 g_SV->show();
593 g_MW->setMouseTracking(true);
594 if (g_title[0] != 0)
595 {
596 g_SV->setCaption(g_title);
597 }
598
599/* XGrayKey(0, 64, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
600 XGrayKey(0, 113, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
601 XGrayKey(0, 37, AnyModifie, SV-winId(), 0, GrabModeAsync, GrabModeAsync);
602 XGrayKey(0, 109, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
603 XGrayKey(0, 115, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
604 XGrayKey(0, 116, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
605 XGrayKey(0, 117, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
606 XGrayKey(0, 62, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);
607 XGrayKey(0, 50, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);*/
608
609 return 1;
610}
void show()
Definition: qtewin.cpp:738
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static QApplication * g_App
Definition: qtwin.cpp:87
static QRegion * g_ClipRect
Definition: qtwin.cpp:103
static QMyScrollView * g_SV
Definition: qtwin.cpp:89
static QPixmap * g_DS
Definition: qtwin.cpp:91

Referenced by main().

◆ ui_deinit()

void ui_deinit ( void  )

Definition at line 553 of file qtwin.cpp.

554{
555 delete g_App;
556}

Referenced by main().

◆ ui_desktop_restore()

void ui_desktop_restore ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1089 of file qtwin.cpp.

1090{
1091 QPixmap * Pixmap;
1092
1093 Pixmap = new QPixmap(cx, cy);
1094 CommonDeskSave(g_DS, Pixmap, offset, 0, 0, cx, cy, 1);
1095 bitBltClip(g_MW, g_BS, x, y, Pixmap, 0, 0, cx, cy, Qt::CopyROP, true);
1096 delete Pixmap;
1097}
void CommonDeskSave(QPixmap *Pixmap1, QPixmap *Pixmap2, int Offset, int x, int y, int cx, int cy, int dir)
Definition: qtwin.cpp:1044
void bitBltClip(QPaintDevice *dst1, QPaintDevice *dst2, int dx, int dy, QPaintDevice *src, int sx, int sy, int sw, int sh, Qt::RasterOp rop, bool im)
Definition: qtwin.cpp:843

◆ ui_desktop_save()

void ui_desktop_save ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1100 of file qtwin.cpp.

1101{
1102 CommonDeskSave(g_DS, g_BS, offset, x, y, cx, cy, 0);
1103}

◆ ui_destblt()

void ui_destblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1160 of file qtwin.cpp.

1161{
1162 SetOpCode(opcode);
1163 g_P1->fillRect(x, y, cx, cy, QBrush(QColor("black")));
1164 g_P2->fillRect(x, y, cx, cy, QBrush(QColor("black")));
1165 ResetOpCode(opcode);
1166}
void SetOpCode(int opcode)
Definition: qtwin.cpp:196
void ResetOpCode(int opcode)
Definition: qtwin.cpp:210

◆ ui_destroy_bitmap()

void ui_destroy_bitmap ( void bmp)

Definition at line 692 of file qtwin.cpp.

693{
694 QPixmap * Pixmap;
695 Pixmap = (QPixmap*)bmp;
696 delete Pixmap;
697}
BITMAP bmp
Definition: alphablend.c:62

◆ ui_destroy_colourmap()

void ui_destroy_colourmap ( HCOLOURMAP  map)

Definition at line 739 of file qtwin.cpp.

740{
741 QColorMap * LCM;
742 LCM = (QColorMap*)map;
743 if (LCM == NULL)
744 return;
745 free(LCM);
746}
Definition: _map.h:48

Referenced by ui_set_colourmap().

◆ ui_destroy_cursor()

void ui_destroy_cursor ( void cursor)

Definition at line 664 of file qtwin.cpp.

665{
666 QCursor * Cursor;
667 Cursor = (QCursor*)cursor;
668 if (Cursor != NULL)
669 {
670 delete Cursor;
671 }
672}
const char cursor[]
Definition: icontest.c:13

◆ ui_destroy_glyph()

void ui_destroy_glyph ( void glyph)

Definition at line 684 of file qtwin.cpp.

685{
686 QBitmap* Bitmap;
687 Bitmap = (QBitmap*)glyph;
688 delete Bitmap;
689}

◆ ui_destroy_window()

void ui_destroy_window ( void  )

Definition at line 637 of file qtwin.cpp.

638{
639 delete g_MW;
640 delete g_SV;
641 delete g_BS;
642 delete g_DS;
643 delete g_P1;
644 delete g_P2;
645 delete g_ClipRect;
646}

Referenced by main().

◆ ui_draw_text()

void ui_draw_text ( uint8  font,
uint8  flags,
uint8  opcode,
int  mixmode,
int  x,
int  y,
int  clipx,
int  clipy,
int  clipcx,
int  clipcy,
int  boxx,
int  boxy,
int  boxcx,
int  boxcy,
BRUSH brush,
int  bgcolour,
int  fgcolour,
uint8 text,
uint8  length 
)

Definition at line 906 of file qtwin.cpp.

911{
912 FONTGLYPH * glyph;
913 int i, j, xyoffset;
914 DATABLOB * entry;
915
916 SetColorx(&g_Color1, fgcolour);
917 SetColorx(&g_Color2, bgcolour);
918 g_P2->setBackgroundColor(g_Color2);
919 g_P2->setPen(g_Color1);
920 if (boxcx > 1)
921 {
922 g_P2->fillRect(boxx, boxy, boxcx, boxcy, QBrush(g_Color2));
923 }
924 else if (mixmode == MIX_OPAQUE)
925 {
926 g_P2->fillRect(clipx, clipy, clipcx, clipcy, QBrush(g_Color2));
927 }
928
929 /* Paint text, character by character */
930 for (i = 0; i < length;)
931 {
932 switch (text[i])
933 {
934 case 0xff:
935 if (i + 2 < length)
936 {
937 cache_put_text(text[i + 1], text, text[i + 2]);
938 }
939 else
940 {
941 error("this shouldn't be happening\n");
942 exit(1);
943 }
944 /* this will move pointer from start to first character after FF
945 command */
946 length -= i + 3;
947 text = &(text[i + 3]);
948 i = 0;
949 break;
950
951 case 0xfe:
952 entry = cache_get_text(text[i + 1]);
953 if (entry != NULL)
954 {
955 if ((((uint8 *) (entry->data))[1] == 0) &&
956 (!(flags & TEXT2_IMPLICIT_X)))
957 {
958 if (flags & TEXT2_VERTICAL)
959 {
960 y += text[i + 2];
961 }
962 else
963 {
964 x += text[i + 2];
965 }
966 }
967 for (j = 0; j < entry->size; j++)
968 {
969 DO_GLYPH(((uint8 *) (entry->data)), j);
970 }
971 }
972 if (i + 2 < length)
973 {
974 i += 3;
975 }
976 else
977 {
978 i += 2;
979 }
980 length -= i;
981 /* this will move pointer from start to first character after FE
982 command */
983 text = &(text[i]);
984 i = 0;
985 break;
986
987 default:
988 DO_GLYPH(text, i);
989 i++;
990 break;
991 }
992 }
993 if (boxcx > 1)
994 {
995 bitBltClip(g_MW, NULL, boxx, boxy, g_BS, boxx, boxy, boxcx, boxcy,
996 Qt::CopyROP, true);
997 }
998 else
999 {
1000 bitBltClip(g_MW, NULL, clipx, clipy, g_BS, clipx, clipy, clipcx,
1001 clipcy, Qt::CopyROP, true);
1002 }
1003}
void cache_put_text(uint8 cache_id, void *data, int length)
Definition: cache.c:335
DATABLOB * cache_get_text(uint8 cache_id)
Definition: cache.c:325
#define MIX_OPAQUE
Definition: constants.h:273
const WCHAR * text
Definition: package.c:1799
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
uint32_t entry
Definition: isohybrid.c:63
#define DO_GLYPH(ttext, idx)
Definition: qtwin.cpp:874
static QColor g_Color2
Definition: qtwin.cpp:95
void SetColorx(QColor *Color, uint32 InColor)
Definition: qtwin.cpp:169
static QColor g_Color1
Definition: qtwin.cpp:94
#define exit(n)
Definition: config.h:202

◆ ui_ellipse()

void ui_ellipse ( uint8  opcode,
uint8  fillmode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1391 of file qtwin.cpp.

1394{
1395}

◆ ui_end_update()

void ui_end_update ( void  )

Definition at line 539 of file qtwin.cpp.

540{
541 g_P1->end();
542 g_P2->end();
543}

◆ ui_get_numlock_state()

uint16 ui_get_numlock_state ( uint32  state)

Definition at line 1347 of file qtwin.cpp.

1348{
1349 return 0;
1350}

◆ ui_init()

int ui_init ( void  )

Definition at line 546 of file qtwin.cpp.

547{
548 g_App = new QApplication(g_argc, g_argv);
549 return 1;
550}

Referenced by main().

◆ ui_line()

void ui_line ( uint8  opcode,
int  startx,
int  starty,
int  endx,
int  endy,
PEN pen 
)

Definition at line 1006 of file qtwin.cpp.

1008{
1009 SetColorx(&g_Color1, pen->colour);
1010 SetOpCode(opcode);
1011 g_P1->setPen(g_Color1);
1012 g_P1->moveTo(startx, starty);
1013 g_P1->lineTo(endx, endy);
1014 g_P2->setPen(g_Color1);
1015 g_P2->moveTo(startx, starty);
1016 g_P2->lineTo(endx, endy);
1017 ResetOpCode(opcode);
1018}
uint32 colour
Definition: types.h:86

Referenced by ui_polyline().

◆ ui_main_loop()

void ui_main_loop ( void  )

Definition at line 613 of file qtwin.cpp.

614{
615#ifdef WITH_RDPSND
616 // init sound
617 if (g_rdpsnd)
618 {
619 rdpsnd_init();
620 }
621#endif
622 // connect
623 if (!rdp_connect(g_servername, g_flags, "", "", "", ""))
624 {
625 return;
626 }
627 // start notifier
628 g_SocketNotifier = new QSocketNotifier(g_sock, QSocketNotifier::Read, g_MW);
629 g_MW->connect(g_SocketNotifier, SIGNAL(activated(int)),
630 g_MW, SLOT(dataReceived()));
631 g_UpAndRunning = 1;
632 // app main loop
633 g_App->exec();
634}
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
Definition: rdp.c:1742
RD_BOOL rdpsnd_init(char *optarg)
static UINT activated
Definition: msctf.c:70
static int g_UpAndRunning
Definition: qtwin.cpp:70
static QSocketNotifier * g_SocketNotifier
Definition: qtwin.cpp:86
static int g_sock
Definition: qtwin.cpp:71

Referenced by main().

◆ ui_memblt()

void ui_memblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy 
)

Definition at line 1029 of file qtwin.cpp.

1031{
1032 QPixmap* Pixmap;
1033 Pixmap = (QPixmap*)src;
1034 if (Pixmap != NULL)
1035 {
1036 SetOpCode(opcode);
1037 g_P1->drawPixmap(x, y, *Pixmap, srcx, srcy, cx, cy);
1038 g_P2->drawPixmap(x, y, *Pixmap, srcx, srcy, cx, cy);
1039 ResetOpCode(opcode);
1040 }
1041}

◆ ui_move_pointer()

void ui_move_pointer ( int  x,
int  y 
)

Definition at line 1169 of file qtwin.cpp.

1170{
1171}

◆ ui_paint_bitmap()

void ui_paint_bitmap ( int  x,
int  y,
int  cx,
int  cy,
int  width,
int  height,
uint8 data 
)

Definition at line 1180 of file qtwin.cpp.

1182{
1183 QImage * Image = NULL;
1184 QPixmap * Pixmap;
1185 uint32 * d = NULL;
1186 uint16 * s;
1187 int i;
1188
1189 switch (g_server_depth)
1190 {
1191 case 8:
1192 Image = new QImage(data, width, height, 8, (QRgb*)&g_CM->RGBColors,
1193 g_CM->NumColors, QImage::IgnoreEndian);
1194 break;
1195 case 15:
1196 d = (uint32*)malloc(width * height * 4);
1197 s = (uint16*)data;
1198 for (i = 0; i < width * height; i++)
1199 {
1200 d[i] = Color15to32(s[i]);
1201 }
1202 Image = new QImage((uint8*)d, width, height, 32, NULL,
1203 0, QImage::IgnoreEndian);
1204 break;
1205 case 16:
1206 d = (uint32*)malloc(width * height * 4);
1207 s = (uint16*)data;
1208 for (i = 0; i < width * height; i++)
1209 {
1210 d[i] = Color16to32(s[i]);
1211 }
1212 Image = new QImage((uint8*)d, width, height, 32, NULL,
1213 0, QImage::IgnoreEndian);
1214 break;
1215 case 24:
1216 d = (uint32*)malloc(width * height * 4);
1217 memset(d, 0, width * height * 4);
1218 for (i = 0; i < width * height; i++)
1219 {
1220 memcpy(d + i, data + i * 3, 3);
1221 }
1222 Image = new QImage((uint8*)d, width, height, 32, NULL,
1223 0, QImage::IgnoreEndian);
1224 break;
1225 }
1226 if (Image == NULL)
1227 {
1228 return;
1229 }
1230 Pixmap = new QPixmap();
1231 Pixmap->convertFromImage(*Image);
1232 g_P1->drawPixmap(x, y, *Pixmap, 0, 0, cx, cy);
1233 g_P2->drawPixmap(x, y, *Pixmap, 0, 0, cx, cy);
1234 delete Image;
1235 delete Pixmap;
1236 if (d != NULL)
1237 {
1238 free(d);
1239 }
1240}

◆ ui_patblt()

void ui_patblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1123 of file qtwin.cpp.

1125{
1126 QBitmap* Bitmap;
1127 QBrush* Brush;
1128 uint8 ipattern[8], i;
1129 SetOpCode(opcode);
1130 switch (brush->style)
1131 {
1132 case 0:
1133 SetColorx(&g_Color1, fgcolour);
1134 g_P2->fillRect(x, y, cx, cy, QBrush(g_Color1));
1135 break;
1136 case 3:
1137 SetColorx(&g_Color1, fgcolour);
1138 SetColorx(&g_Color2, bgcolour);
1139 for (i = 0; i != 8; i++)
1140 {
1141 ipattern[7 - i] = ~brush->pattern[i];
1142 }
1143 Bitmap = new QBitmap(8, 8, ipattern);
1144 Brush = new QBrush(g_Color1, *Bitmap);
1145 g_P2->setBackgroundMode(Qt::OpaqueMode);
1146 g_P2->setBrushOrigin(brush->xorigin, brush->yorigin);
1147 g_P2->setBackgroundColor(g_Color2);
1148 g_P2->fillRect(x, y, cx, cy, *Brush);
1149 delete Brush;
1150 delete Bitmap;
1151 g_P2->setBackgroundMode(Qt::TransparentMode);
1152 g_P2->setBrushOrigin(0, 0);
1153 break;
1154 }
1155 ResetOpCode(opcode);
1156 bitBltClip(g_MW, NULL, x, y, g_BS, x, y, cx, cy, Qt::CopyROP, true);
1157}

◆ ui_polygon()

void ui_polygon ( uint8  opcode,
uint8  fillmode,
POINT point,
int  npoints,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1364 of file qtwin.cpp.

1366{
1367}

◆ ui_polyline()

void ui_polyline ( uint8  opcode,
POINT points,
int  npoints,
PEN pen 
)

Definition at line 1371 of file qtwin.cpp.

1372{
1373 int i, x, y, dx, dy;
1374
1375 if (npoints > 0)
1376 {
1377 x = points[0].x;
1378 y = points[0].y;
1379 for (i = 1; i < npoints; i++)
1380 {
1381 dx = points[i].x;
1382 dy = points[i].y;
1383 ui_line(opcode, x, y, x + dx, y + dy, pen);
1384 x = x + dx;
1385 y = y + dy;
1386 }
1387 }
1388}
GLsizei const GLfloat * points
Definition: glext.h:8112
void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
Definition: qtwin.cpp:1006

◆ ui_rect()

void ui_rect ( int  x,
int  y,
int  cx,
int  cy,
int  colour 
)

Definition at line 1106 of file qtwin.cpp.

1107{
1108 SetColorx(&g_Color1, colour);
1109 g_P1->fillRect(x, y, cx, cy, QBrush(g_Color1));
1110 g_P2->fillRect(x, y, cx, cy, QBrush(g_Color1));
1111}

◆ ui_reset_clip()

void ui_reset_clip ( void  )

Definition at line 700 of file qtwin.cpp.

701{
702 g_P1->setClipRect(0, 0, g_width, g_height);
703 g_P2->setClipRect(0, 0, g_width, g_height);
704 delete g_ClipRect;
705 g_ClipRect = new QRegion(0, 0, g_width, g_height);
706}

◆ ui_resize_window()

void ui_resize_window ( void  )

Definition at line 1359 of file qtwin.cpp.

1360{
1361}

◆ ui_screenblt()

void ui_screenblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
int  srcx,
int  srcy 
)

Definition at line 1114 of file qtwin.cpp.

1116{
1117 SetOpCode(opcode);
1118 bitBltClip(g_MW, g_BS, x, y, NULL, srcx, srcy, cx, cy, Qt::CopyROP, true);
1119 ResetOpCode(opcode);
1120}

◆ ui_select()

int ui_select ( int  in_val)

Definition at line 654 of file qtwin.cpp.

655{
656 if (g_sock == 0)
657 {
658 g_sock = in_val;
659 }
660 return 1;
661}

◆ ui_set_clip()

void ui_set_clip ( int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 709 of file qtwin.cpp.

710{
711 g_P1->setClipRect(x, y, cx, cy);
712 g_P2->setClipRect(x, y, cx, cy);
713 delete g_ClipRect;
714 g_ClipRect = new QRegion(x, y, cx, cy);
715}

◆ ui_set_colourmap()

void ui_set_colourmap ( void map)

Definition at line 749 of file qtwin.cpp.

750{
751 // destoy old colormap
753 g_CM = (QColorMap*)map;
754}
void ui_destroy_colourmap(HCOLOURMAP map)
Definition: qtwin.cpp:739

◆ ui_set_cursor()

void ui_set_cursor ( HCURSOR  cursor)

Definition at line 1290 of file qtwin.cpp.

1291{
1292 QCursor* Cursor;
1293 Cursor = (QCursor*)cursor;
1294 if (Cursor != NULL)
1295 g_MW->setCursor(*Cursor);
1296}

◆ ui_set_null_cursor()

void ui_set_null_cursor ( void  )

Definition at line 1174 of file qtwin.cpp.

1175{
1176 g_MW->setCursor(10); // Qt::BlankCursor
1177}

◆ ui_triblt()

void ui_triblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1022 of file qtwin.cpp.

1025{
1026}

◆ unimpl()

void unimpl ( char format,
  ... 
)

Definition at line 1534 of file qtwin.cpp.

1535{
1536 va_list ap;
1537
1538 fprintf(stderr, "NOT IMPLEMENTED: ");
1539 va_start(ap, format);
1541 va_end(ap);
1542}

◆ warning()

void warning ( char format,
  ... 
)

Definition at line 1523 of file qtwin.cpp.

1524{
1525 va_list ap;
1526
1527 fprintf(stderr, "WARNING: ");
1528 va_start(ap, format);
1530 va_end(ap);
1531}

◆ WarpCoords()

int WarpCoords ( int x,
int y,
int cx,
int cy,
int srcx,
int srcy 
)

Definition at line 818 of file qtwin.cpp.

819{
820 int dx, dy;
821 QRect InRect(*x, *y, *cx, *cy);
822 QRect OutRect;
823 QRect CRect = g_ClipRect->boundingRect();
824 OutRect = InRect.intersect(CRect);
825 if (OutRect.isEmpty())
826 {
827 return False;
828 }
829 dx = OutRect.x() - InRect.x();
830 dy = OutRect.y() - InRect.y();
831 *x = OutRect.x();
832 *y = OutRect.y();
833 *cx = OutRect.width();
834 *cy = OutRect.height();
835 *srcx = *srcx + dx;
836 *srcy = *srcy + dy;
837 return True;
838}

Referenced by bitBltClip().

◆ xfree()

void xfree ( void in_val)

Definition at line 1502 of file qtwin.cpp.

1503{
1504 if (in_val != NULL)
1505 {
1506 free(in_val);
1507 }
1508}

Referenced by load_licence(), and save_licence().

◆ xmalloc()

void * xmalloc ( int  size)

Definition at line 1496 of file qtwin.cpp.

1497{
1498 return malloc(size);
1499}
GLsizeiptr size
Definition: glext.h:5919

Referenced by load_licence(), and save_licence().

◆ xrealloc()

void * xrealloc ( void in_val,
int  size 
)

Definition at line 1490 of file qtwin.cpp.

1491{
1492 return realloc(in_val, size);
1493}
#define realloc
Definition: debug_ros.c:6

◆ xstrdup()

char * xstrdup ( const char s)

Definition at line 1511 of file qtwin.cpp.

1512{
1513 char * mem = strdup(s);
1514 if (mem == NULL)
1515 {
1516 perror("strdup");
1517 exit(1);
1518 }
1519 return mem;
1520}
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
Definition: mem.c:156

Variable Documentation

◆ g_App

QApplication* g_App = 0
static

Definition at line 87 of file qtwin.cpp.

Referenced by ui_create_window(), ui_deinit(), ui_init(), and ui_main_loop().

◆ g_argc

int g_argc = 0
static

Definition at line 68 of file qtwin.cpp.

Referenced by parse_parameters(), and ui_init().

◆ g_argv

char** g_argv = 0
static

Definition at line 69 of file qtwin.cpp.

Referenced by parse_parameters(), and ui_init().

◆ g_bitmap_cache

int g_bitmap_cache = 1

Definition at line 56 of file qtwin.cpp.

◆ g_bitmap_cache_persist_enable

int g_bitmap_cache_persist_enable = False

Definition at line 57 of file qtwin.cpp.

Referenced by parse_parameters().

◆ g_bitmap_cache_precache

int g_bitmap_cache_precache = True

Definition at line 58 of file qtwin.cpp.

◆ g_bitmap_compression

int g_bitmap_compression = 1

Definition at line 59 of file qtwin.cpp.

◆ g_BS

◆ g_ClipRect

QRegion* g_ClipRect
static

◆ g_CM

struct QColorMap* g_CM = 0
static

Definition at line 102 of file qtwin.cpp.

Referenced by SetColorx(), ui_create_bitmap(), ui_paint_bitmap(), and ui_set_colourmap().

◆ g_Color1

QColor g_Color1
static

Definition at line 94 of file qtwin.cpp.

Referenced by ui_draw_text(), ui_line(), ui_patblt(), and ui_rect().

◆ g_Color2

QColor g_Color2
static

Definition at line 95 of file qtwin.cpp.

Referenced by ui_draw_text(), and ui_patblt().

◆ g_console_session

int g_console_session = 0

Definition at line 61 of file qtwin.cpp.

Referenced by parse_parameters().

◆ g_deactivated

int g_deactivated = 0
static

Definition at line 72 of file qtwin.cpp.

◆ g_desktop_save

int g_desktop_save = 1

Definition at line 54 of file qtwin.cpp.

◆ g_DS

QPixmap* g_DS = 0
static

Definition at line 91 of file qtwin.cpp.

Referenced by ui_create_window(), ui_desktop_restore(), ui_desktop_save(), and ui_destroy_window().

◆ g_encryption

int g_encryption = 1

Definition at line 53 of file qtwin.cpp.

◆ g_ext_disc_reason

uint32 g_ext_disc_reason = 0
static

Definition at line 73 of file qtwin.cpp.

◆ g_flags

int g_flags = RDP_LOGON_NORMAL
static

Definition at line 76 of file qtwin.cpp.

Referenced by parse_parameters(), and ui_main_loop().

◆ g_height

int g_height = 600

Definition at line 50 of file qtwin.cpp.

Referenced by parse_parameters(), ui_create_window(), and ui_reset_clip().

◆ g_hostname

char g_hostname[16]

Definition at line 48 of file qtwin.cpp.

Referenced by get_username_and_hostname(), load_licence(), and save_licence().

◆ g_keyboard_functionkeys

int g_keyboard_functionkeys = 0xc

Definition at line 65 of file qtwin.cpp.

◆ g_keyboard_subtype

int g_keyboard_subtype = 0x0

Definition at line 64 of file qtwin.cpp.

◆ g_keyboard_type

int g_keyboard_type = 0x4

Definition at line 63 of file qtwin.cpp.

◆ g_keylayout

int g_keylayout = 0x409

Definition at line 62 of file qtwin.cpp.

◆ g_MW

◆ g_OpCodes

Qt::RasterOp g_OpCodes[16]
static
Initial value:
= {
Qt::ClearROP,
Qt::NorROP,
Qt::NotAndROP,
Qt::NotCopyROP,
Qt::AndNotROP,
Qt::NotROP,
Qt::XorROP,
Qt::NandROP,
Qt::AndROP,
Qt::NotXorROP,
Qt::NopROP,
Qt::NotOrROP,
Qt::CopyROP,
Qt::OrNotROP,
Qt::OrROP,
Qt::SetROP}

Definition at line 105 of file qtwin.cpp.

Referenced by ResetOpCode(), and SetOpCode().

◆ g_P1

◆ g_P2

◆ g_polygon_ellipse_orders

int g_polygon_ellipse_orders = 0

Definition at line 55 of file qtwin.cpp.

◆ g_rdp5_performanceflags

int g_rdp5_performanceflags = 0

Definition at line 60 of file qtwin.cpp.

◆ g_redirect

BOOL g_redirect = False

Definition at line 124 of file qtwin.cpp.

◆ g_redirect_cookie

char g_redirect_cookie[128]

Definition at line 129 of file qtwin.cpp.

◆ g_redirect_domain

char g_redirect_domain[16]

Definition at line 126 of file qtwin.cpp.

◆ g_redirect_flags

uint32 g_redirect_flags = 0

Definition at line 130 of file qtwin.cpp.

◆ g_redirect_password

char g_redirect_password[64]

Definition at line 127 of file qtwin.cpp.

◆ g_redirect_server

char g_redirect_server[64]

Definition at line 125 of file qtwin.cpp.

◆ g_redirect_username

char g_redirect_username[64]

Definition at line 128 of file qtwin.cpp.

◆ g_server_depth

int g_server_depth = 8

Definition at line 52 of file qtwin.cpp.

Referenced by parse_parameters(), SetColorx(), ui_create_bitmap(), and ui_paint_bitmap().

◆ g_servername

char g_servername[128]
static

Definition at line 74 of file qtwin.cpp.

Referenced by parse_parameters(), and ui_main_loop().

◆ g_sock

int g_sock = 0
static

Definition at line 71 of file qtwin.cpp.

Referenced by ui_main_loop(), and ui_select().

◆ g_SocketNotifier

QSocketNotifier* g_SocketNotifier = 0
static

Definition at line 86 of file qtwin.cpp.

Referenced by ui_main_loop().

◆ g_SV

QMyScrollView* g_SV = 0
static

Definition at line 89 of file qtwin.cpp.

Referenced by ui_create_window(), and ui_destroy_window().

◆ g_tcp_port_rdp

int g_tcp_port_rdp
extern

Definition at line 75 of file tcp.c.

Referenced by parse_parameters().

◆ g_title

char g_title[128] = ""
static

Definition at line 75 of file qtwin.cpp.

Referenced by parse_parameters(), and ui_create_window().

◆ g_UpAndRunning

int g_UpAndRunning = 0
static

◆ g_use_rdp5

int g_use_rdp5 = 1

Definition at line 47 of file qtwin.cpp.

Referenced by parse_parameters().

◆ g_username

char g_username[64]

Definition at line 49 of file qtwin.cpp.

Referenced by get_username_and_hostname().

◆ g_width

int g_width = 800

Definition at line 51 of file qtwin.cpp.

Referenced by parse_parameters(), ui_create_window(), and ui_reset_clip().