40 |
|
|
41 |
/* rdesktop globals */ |
/* rdesktop globals */ |
42 |
extern int g_tcp_port_rdp; |
extern int g_tcp_port_rdp; |
43 |
int g_use_rdp5 = 0; |
int g_use_rdp5 = 1; |
44 |
char g_hostname[16]; |
char g_hostname[16]; |
45 |
char g_username[64]; |
char g_username[64]; |
46 |
int g_height = 600; |
int g_height = 600; |
47 |
int g_width = 800; |
int g_width = 800; |
48 |
int g_server_bpp = 8; |
int g_server_bpp = 8; |
49 |
int g_encryption = 1; |
int g_encryption = 1; |
50 |
int g_desktop_save =1; |
int g_desktop_save = 1; |
51 |
int g_bitmap_cache = 1; |
int g_bitmap_cache = 1; |
52 |
int g_bitmap_cache_persist_enable = False; |
int g_bitmap_cache_persist_enable = False; |
53 |
int g_bitmap_cache_precache = True; |
int g_bitmap_cache_precache = True; |
69 |
/* qt globals */ |
/* qt globals */ |
70 |
QSocketNotifier* SocketNotifier; |
QSocketNotifier* SocketNotifier; |
71 |
QApplication* App; |
QApplication* App; |
72 |
QMyMainWindow* MW; |
QMyMainWindow* g_MW; |
73 |
QMyScrollView* SV; |
QMyScrollView* SV; |
74 |
QPixmap* BS; |
QPixmap* BS; |
75 |
QPixmap* DS; |
QPixmap* DS; |
428 |
//***************************************************************************** |
//***************************************************************************** |
429 |
void QMyScrollView::keyPressEvent(QKeyEvent* e) |
void QMyScrollView::keyPressEvent(QKeyEvent* e) |
430 |
{ |
{ |
431 |
MW->keyPressEvent(e); |
g_MW->keyPressEvent(e); |
432 |
} |
} |
433 |
|
|
434 |
//***************************************************************************** |
//***************************************************************************** |
435 |
void QMyScrollView::keyReleaseEvent(QKeyEvent* e) |
void QMyScrollView::keyReleaseEvent(QKeyEvent* e) |
436 |
{ |
{ |
437 |
MW->keyReleaseEvent(e); |
g_MW->keyReleaseEvent(e); |
438 |
} |
} |
439 |
|
|
440 |
|
|
441 |
//***************************************************************************** |
//***************************************************************************** |
442 |
void ui_begin_update(void) |
void ui_begin_update(void) |
443 |
{ |
{ |
444 |
P1->begin(MW); |
P1->begin(g_MW); |
445 |
P2->begin(BS); |
P2->begin(BS); |
446 |
} |
} |
447 |
|
|
469 |
int ui_create_window(void) |
int ui_create_window(void) |
470 |
{ |
{ |
471 |
int w, h; |
int w, h; |
472 |
MW = new QMyMainWindow(); |
g_MW = new QMyMainWindow(); |
473 |
SV = new QMyScrollView(); |
SV = new QMyScrollView(); |
474 |
SV->addChild(MW); |
SV->addChild(g_MW); |
475 |
BS = new QPixmap(g_width, g_height); |
BS = new QPixmap(g_width, g_height); |
476 |
QPainter* P = new QPainter(BS); |
QPainter* P = new QPainter(BS); |
477 |
P->fillRect(0, 0, g_width, g_height, QBrush(QColor("white"))); |
P->fillRect(0, 0, g_width, g_height, QBrush(QColor("white"))); |
484 |
QWidget* d = QApplication::desktop(); |
QWidget* d = QApplication::desktop(); |
485 |
w = d->width(); // returns screen width |
w = d->width(); // returns screen width |
486 |
h = d->height(); // returns screen height |
h = d->height(); // returns screen height |
487 |
MW->resize(g_width, g_height); |
g_MW->resize(g_width, g_height); |
488 |
if (w < g_width || h < g_height) |
if (w < g_width || h < g_height) |
489 |
SV->resize(w, h); |
SV->resize(w, h); |
490 |
else |
else |
493 |
SV->setMaximumHeight(g_height + 4); |
SV->setMaximumHeight(g_height + 4); |
494 |
App->setMainWidget(SV); |
App->setMainWidget(SV); |
495 |
SV->show(); |
SV->show(); |
496 |
MW->setMouseTracking(true); |
g_MW->setMouseTracking(true); |
497 |
if (g_title[0] != 0) |
if (g_title[0] != 0) |
498 |
SV->setCaption(g_title); |
SV->setCaption(g_title); |
499 |
|
|
517 |
if (!rdp_connect(g_servername, RDP_LOGON_NORMAL, "", "", "", "")) |
if (!rdp_connect(g_servername, RDP_LOGON_NORMAL, "", "", "", "")) |
518 |
return; |
return; |
519 |
// start notifier |
// start notifier |
520 |
SocketNotifier = new QSocketNotifier(g_sock, QSocketNotifier::Read, MW); |
SocketNotifier = new QSocketNotifier(g_sock, QSocketNotifier::Read, g_MW); |
521 |
MW->connect(SocketNotifier, SIGNAL(activated(int)), MW, SLOT(dataReceived())); |
g_MW->connect(SocketNotifier, SIGNAL(activated(int)), g_MW, SLOT(dataReceived())); |
522 |
UpAndRunning = 1; |
UpAndRunning = 1; |
523 |
// app main loop |
// app main loop |
524 |
App->exec(); |
App->exec(); |
527 |
//***************************************************************************** |
//***************************************************************************** |
528 |
void ui_destroy_window(void) |
void ui_destroy_window(void) |
529 |
{ |
{ |
530 |
delete MW; |
delete g_MW; |
531 |
delete SV; |
delete SV; |
532 |
delete BS; |
delete BS; |
533 |
delete DS; |
delete DS; |
833 |
} |
} |
834 |
} |
} |
835 |
if (boxcx > 1) |
if (boxcx > 1) |
836 |
bitBltClip(MW, NULL, boxx, boxy, BS, boxx, boxy, boxcx, boxcy, Qt::CopyROP, true); |
bitBltClip(g_MW, NULL, boxx, boxy, BS, boxx, boxy, boxcx, boxcy, Qt::CopyROP, true); |
837 |
else |
else |
838 |
bitBltClip(MW, NULL, clipx, clipy, BS, clipx, clipy, clipcx, clipcy, Qt::CopyROP, true); |
bitBltClip(g_MW, NULL, clipx, clipy, BS, clipx, clipy, clipcx, clipcy, Qt::CopyROP, true); |
839 |
} |
} |
840 |
|
|
841 |
/*****************************************************************************/ |
/*****************************************************************************/ |
926 |
QPixmap* Pixmap; |
QPixmap* Pixmap; |
927 |
Pixmap = new QPixmap(cx, cy); |
Pixmap = new QPixmap(cx, cy); |
928 |
CommonDeskSave(DS, Pixmap, offset, 0, 0, cx, cy, 1); |
CommonDeskSave(DS, Pixmap, offset, 0, 0, cx, cy, 1); |
929 |
bitBltClip(MW, BS, x, y, Pixmap, 0, 0, cx, cy, Qt::CopyROP, true); |
bitBltClip(g_MW, BS, x, y, Pixmap, 0, 0, cx, cy, Qt::CopyROP, true); |
930 |
delete Pixmap; |
delete Pixmap; |
931 |
} |
} |
932 |
|
|
949 |
int srcx, int srcy) |
int srcx, int srcy) |
950 |
{ |
{ |
951 |
SetOpCode(opcode); |
SetOpCode(opcode); |
952 |
bitBltClip(MW, BS, x, y, NULL, srcx, srcy, cx, cy, Qt::CopyROP, true); |
bitBltClip(g_MW, BS, x, y, NULL, srcx, srcy, cx, cy, Qt::CopyROP, true); |
953 |
ResetOpCode(opcode); |
ResetOpCode(opcode); |
954 |
} |
} |
955 |
|
|
985 |
break; |
break; |
986 |
} |
} |
987 |
ResetOpCode(opcode); |
ResetOpCode(opcode); |
988 |
bitBltClip(MW, NULL, x, y, BS, x, y, cx, cy, Qt::CopyROP, true); |
bitBltClip(g_MW, NULL, x, y, BS, x, y, cx, cy, Qt::CopyROP, true); |
989 |
} |
} |
990 |
|
|
991 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1005 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1006 |
void ui_set_null_cursor(void) |
void ui_set_null_cursor(void) |
1007 |
{ |
{ |
1008 |
|
g_MW->setCursor(Qt::BlankCursor); |
1009 |
} |
} |
1010 |
|
|
1011 |
/*****************************************************************************/ |
/*****************************************************************************/ |
1112 |
QCursor* Cursor; |
QCursor* Cursor; |
1113 |
Cursor = (QCursor*)cursor; |
Cursor = (QCursor*)cursor; |
1114 |
if (Cursor != NULL) |
if (Cursor != NULL) |
1115 |
MW->setCursor(*Cursor); |
g_MW->setCursor(*Cursor); |
1116 |
} |
} |
1117 |
|
|
1118 |
/*****************************************************************************/ |
/*****************************************************************************/ |