25 |
#else |
#else |
26 |
#include <qapplication.h> |
#include <qapplication.h> |
27 |
#endif |
#endif |
28 |
|
#include <qcursor.h> |
29 |
#include <qmainwindow.h> |
#include <qmainwindow.h> |
30 |
#include <qwidget.h> |
#include <qwidget.h> |
31 |
#include <qpainter.h> |
#include <qpainter.h> |
48 |
#include "../rdesktop.h" |
#include "../rdesktop.h" |
49 |
#include "qtewin.h" |
#include "qtewin.h" |
50 |
|
|
51 |
|
#define QT_OPTI |
52 |
|
|
53 |
/* types */ |
/* types */ |
54 |
struct QColorMap |
struct QColorMap |
55 |
{ |
{ |
87 |
char g_hostname[16] = ""; |
char g_hostname[16] = ""; |
88 |
char g_username[100] = ""; |
char g_username[100] = ""; |
89 |
|
|
90 |
|
static int g_client_width = 640; |
91 |
|
static int g_client_height = 480; |
92 |
static uint32 g_flags = RDP_LOGON_NORMAL; |
static uint32 g_flags = RDP_LOGON_NORMAL; |
93 |
static char g_server[64] = ""; |
static char g_server[64] = ""; |
94 |
static char g_domain[16] = ""; |
static char g_domain[16] = ""; |
124 |
#define SETPIXEL16(d, x, y, w, v) *(((uint16*)d) + ((y) * (w) + (x))) = v |
#define SETPIXEL16(d, x, y, w, v) *(((uint16*)d) + ((y) * (w) + (x))) = v |
125 |
#define SETPIXEL32(d, x, y, w, v) *(((uint32*)d) + ((y) * (w) + (x))) = v |
#define SETPIXEL32(d, x, y, w, v) *(((uint32*)d) + ((y) * (w) + (x))) = v |
126 |
|
|
127 |
//***************************************************************************** |
/******************************************************************************/ |
128 |
void CleanString(QString * Item) |
void CleanString(QString * Item) |
129 |
{ |
{ |
130 |
int i; |
int i; |
138 |
} |
} |
139 |
} |
} |
140 |
|
|
141 |
//***************************************************************************** |
/******************************************************************************/ |
142 |
QMyDialog::QMyDialog(QWidget * parent) : QDialog(parent, "Settings", true) |
QMyDialog::QMyDialog(QWidget * parent) : QDialog(parent, "Settings", true) |
143 |
{ |
{ |
144 |
int i, j; |
int i, j; |
252 |
if (home != NULL) |
if (home != NULL) |
253 |
{ |
{ |
254 |
sprintf(Text, "%s/rdesktop.ini", home); |
sprintf(Text, "%s/rdesktop.ini", home); |
255 |
QFile* File = new QFile(Text); |
QFile * File = new QFile(Text); |
256 |
if (File->open(IO_ReadOnly)) |
if (File->open(IO_ReadOnly)) |
257 |
{ |
{ |
258 |
i = -1; |
i = -1; |
289 |
} |
} |
290 |
} |
} |
291 |
|
|
292 |
//***************************************************************************** |
/******************************************************************************/ |
293 |
QMyDialog::~QMyDialog() |
QMyDialog::~QMyDialog() |
294 |
{ |
{ |
295 |
QMyConnectionItem* Item; |
QMyConnectionItem * Item; |
296 |
int i; |
int i; |
297 |
|
|
298 |
for (i = 0; i < 10; i++) |
for (i = 0; i < 10; i++) |
302 |
} |
} |
303 |
} |
} |
304 |
|
|
305 |
//***************************************************************************** |
/******************************************************************************/ |
306 |
void QMyDialog::ComboChanged(int index) |
void QMyDialog::ComboChanged(int index) |
307 |
{ |
{ |
308 |
if (index == 0) |
if (index == 0) |
322 |
} |
} |
323 |
} |
} |
324 |
|
|
325 |
//***************************************************************************** |
/******************************************************************************/ |
326 |
void QMyDialog::OKClicked() |
void QMyDialog::OKClicked() |
327 |
{ |
{ |
328 |
ServerName = ServerNameEdit->text(); |
ServerName = ServerNameEdit->text(); |
334 |
done(1); |
done(1); |
335 |
} |
} |
336 |
|
|
337 |
//***************************************************************************** |
/******************************************************************************/ |
338 |
void QMyDialog::CancelClicked() |
void QMyDialog::CancelClicked() |
339 |
{ |
{ |
340 |
done(0); |
done(0); |
341 |
} |
} |
342 |
|
|
343 |
//***************************************************************************** |
/******************************************************************************/ |
344 |
void QMyDialog::AddClicked() |
void QMyDialog::AddClicked() |
345 |
{ |
{ |
346 |
int i; |
int i; |
360 |
} |
} |
361 |
} |
} |
362 |
|
|
363 |
//***************************************************************************** |
/******************************************************************************/ |
364 |
void QMyDialog::EditClicked() |
void QMyDialog::EditClicked() |
365 |
{ |
{ |
366 |
int i; |
int i; |
380 |
} |
} |
381 |
} |
} |
382 |
|
|
383 |
//***************************************************************************** |
/******************************************************************************/ |
384 |
void WriteString(QFile* File, QString* Line) |
void WriteString(QFile* File, QString* Line) |
385 |
{ |
{ |
386 |
File->writeBlock((const char*)(*Line), Line->length()); |
File->writeBlock((const char*)(*Line), Line->length()); |
387 |
} |
} |
388 |
|
|
389 |
//***************************************************************************** |
/******************************************************************************/ |
390 |
void QMyDialog::SaveClicked() |
void QMyDialog::SaveClicked() |
391 |
{ |
{ |
392 |
int i, j; |
int i, j; |
444 |
} |
} |
445 |
} |
} |
446 |
|
|
447 |
//***************************************************************************** |
/******************************************************************************/ |
448 |
void QMyDialog::RemoveClicked() |
void QMyDialog::RemoveClicked() |
449 |
{ |
{ |
450 |
int i, j, c; |
int i, j, c; |
470 |
} |
} |
471 |
} |
} |
472 |
|
|
473 |
//***************************************************************************** |
/******************************************************************************/ |
474 |
void QMyDialog::ListBoxChanged() |
void QMyDialog::ListBoxChanged() |
475 |
{ |
{ |
476 |
int i; |
int i; |
492 |
} |
} |
493 |
} |
} |
494 |
|
|
495 |
//***************************************************************************** |
/******************************************************************************/ |
496 |
void QMyDialog::ListBoxSelected(int /*index*/) |
void QMyDialog::ListBoxSelected(int /*index*/) |
497 |
{ |
{ |
498 |
} |
} |
499 |
|
|
500 |
//***************************************************************************** |
/******************************************************************************/ |
501 |
void GetScanCode(QKeyEvent * e, int * ScanCode, int * code) |
void GetScanCode(QKeyEvent * e, int * ScanCode, int * code) |
502 |
{ |
{ |
503 |
int key; |
int key; |
665 |
|
|
666 |
} |
} |
667 |
|
|
668 |
//***************************************************************************** |
/******************************************************************************/ |
669 |
QMyScrollView::QMyScrollView() : QScrollView() |
QMyScrollView::QMyScrollView() : QScrollView() |
670 |
{ |
{ |
671 |
} |
} |
672 |
|
|
673 |
//***************************************************************************** |
/******************************************************************************/ |
674 |
QMyScrollView::~QMyScrollView() |
QMyScrollView::~QMyScrollView() |
675 |
{ |
{ |
676 |
} |
} |
677 |
|
|
678 |
//***************************************************************************** |
/******************************************************************************/ |
679 |
void QMyScrollView::keyPressEvent(QKeyEvent* e) |
void QMyScrollView::keyPressEvent(QKeyEvent* e) |
680 |
{ |
{ |
681 |
int ScanCode, code; |
int ScanCode, code; |
693 |
} |
} |
694 |
} |
} |
695 |
|
|
696 |
//***************************************************************************** |
/******************************************************************************/ |
697 |
void QMyScrollView::keyReleaseEvent(QKeyEvent* e) |
void QMyScrollView::keyReleaseEvent(QKeyEvent* e) |
698 |
{ |
{ |
699 |
int ScanCode, code; |
int ScanCode, code; |
711 |
} |
} |
712 |
} |
} |
713 |
|
|
714 |
//***************************************************************************** |
/******************************************************************************/ |
715 |
void QMyScrollView::showEvent(QShowEvent* e) |
void QMyScrollView::showEvent(QShowEvent* e) |
716 |
{ |
{ |
717 |
QScrollView::showEvent(e); |
QScrollView::showEvent(e); |
718 |
} |
} |
719 |
|
|
720 |
//***************************************************************************** |
/******************************************************************************/ |
721 |
void QMyScrollView::show() |
void QMyScrollView::show() |
722 |
{ |
{ |
723 |
QScrollView::show(); |
QScrollView::show(); |
724 |
} |
} |
725 |
|
|
726 |
//***************************************************************************** |
/******************************************************************************/ |
727 |
void QMyScrollView::polish() |
void QMyScrollView::polish() |
728 |
{ |
{ |
729 |
QScrollView::polish(); |
QScrollView::polish(); |
730 |
} |
} |
731 |
|
|
732 |
//***************************************************************************** |
/******************************************************************************/ |
733 |
void QMyScrollView::timerEvent(QTimerEvent * e) |
void QMyScrollView::timerEvent(QTimerEvent * e) |
734 |
{ |
{ |
735 |
QScrollView::timerEvent(e); |
QScrollView::timerEvent(e); |
744 |
{ |
{ |
745 |
g_width = d->Width; |
g_width = d->Width; |
746 |
g_height = d->Height; |
g_height = d->Height; |
747 |
|
g_client_width = g_width; |
748 |
|
g_client_height = g_height; |
749 |
g_fullscreen = d->FullScreen; |
g_fullscreen = d->FullScreen; |
750 |
sprintf(g_server, "%s", (const char*)d->ServerIP); |
sprintf(g_server, "%s", (const char*)d->ServerIP); |
751 |
sprintf(g_username, "%s", (const char*)d->UserName); |
sprintf(g_username, "%s", (const char*)d->UserName); |
766 |
memset(g_CM, 0, sizeof(struct QColorMap)); |
memset(g_CM, 0, sizeof(struct QColorMap)); |
767 |
g_CM->NumColors = 256; |
g_CM->NumColors = 256; |
768 |
g_MW = new QMyMainWindow(); |
g_MW = new QMyMainWindow(); |
769 |
g_MW->resize(g_width, g_height); |
g_MW->resize(g_client_width, g_client_height); |
770 |
g_MW->show(); |
g_MW->show(); |
771 |
g_SV->addChild(g_MW); |
g_SV->addChild(g_MW); |
772 |
g_MW->setMouseTracking(true); |
g_MW->setMouseTracking(true); |
773 |
|
g_MW->setCursor((int)10); /* Qt::BlankCursor */ |
774 |
g_SocketNotifier = new QSocketNotifier(g_global_sock, |
g_SocketNotifier = new QSocketNotifier(g_global_sock, |
775 |
QSocketNotifier::Read, |
QSocketNotifier::Read, |
776 |
g_MW); |
g_MW); |
781 |
Desktop = g_App->desktop(); |
Desktop = g_App->desktop(); |
782 |
dw = Desktop->width(); |
dw = Desktop->width(); |
783 |
dh = Desktop->height(); |
dh = Desktop->height(); |
784 |
if (dw == g_width && dh == g_height) |
if (dw == g_client_width && dh == g_client_height) |
785 |
g_MW->resize(g_width - 4, g_height - 4); |
g_MW->resize(g_client_width - 4, g_client_height - 4); |
786 |
g_SV->showFullScreen(); |
g_SV->showFullScreen(); |
787 |
} |
} |
788 |
delete d; |
delete d; |
794 |
} |
} |
795 |
} |
} |
796 |
|
|
797 |
//***************************************************************************** |
/******************************************************************************/ |
798 |
QMyMainWindow::QMyMainWindow() : QWidget(g_SV->viewport()) |
QMyMainWindow::QMyMainWindow() : QWidget(g_SV->viewport()) |
799 |
{ |
{ |
800 |
PopupMenu = new QPopupMenu(this); |
PopupMenu = new QPopupMenu(this); |
805 |
connect(PopupMenu, SIGNAL(activated(int)), this, SLOT(MemuClicked(int))); |
connect(PopupMenu, SIGNAL(activated(int)), this, SLOT(MemuClicked(int))); |
806 |
} |
} |
807 |
|
|
808 |
//***************************************************************************** |
/******************************************************************************/ |
809 |
QMyMainWindow::~QMyMainWindow() |
QMyMainWindow::~QMyMainWindow() |
810 |
{ |
{ |
811 |
delete PopupMenu; |
delete PopupMenu; |
812 |
} |
} |
813 |
|
|
814 |
//***************************************************************************** |
/******************************************************************************/ |
815 |
|
int rd(double in) |
816 |
|
{ |
817 |
|
return (int)(in + 0.50); |
818 |
|
} |
819 |
|
|
820 |
|
/******************************************************************************/ |
821 |
|
int c2sx(int cx) |
822 |
|
{ |
823 |
|
double sx; |
824 |
|
|
825 |
|
sx = (double)g_client_width / (double)g_width; |
826 |
|
return rd(cx / sx); |
827 |
|
} |
828 |
|
|
829 |
|
/******************************************************************************/ |
830 |
|
int c2sy(int cy) |
831 |
|
{ |
832 |
|
double sy; |
833 |
|
|
834 |
|
sy = (double)g_client_height / (double)g_height; |
835 |
|
return rd(cy / sy); |
836 |
|
} |
837 |
|
|
838 |
|
/******************************************************************************/ |
839 |
void QMyMainWindow::timerEvent(QTimerEvent * e) |
void QMyMainWindow::timerEvent(QTimerEvent * e) |
840 |
{ |
{ |
841 |
QWidget::timerEvent(e); |
QWidget::timerEvent(e); |
842 |
if (e->timerId() == timer_id) |
if (e->timerId() == timer_id) |
843 |
{ |
{ |
844 |
// send mouse up |
// send mouse up |
845 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, mx, my); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, |
846 |
|
rd(c2sx(mx)), rd(c2sy(my))); |
847 |
// if in fullscreen, take it out or the menu won't work |
// if in fullscreen, take it out or the menu won't work |
848 |
if (g_fullscreen) |
if (g_fullscreen) |
849 |
{ |
{ |
857 |
killTimer(timer_id); |
killTimer(timer_id); |
858 |
} |
} |
859 |
|
|
860 |
//***************************************************************************** |
/******************************************************************************/ |
861 |
void QMyMainWindow::MemuClicked(int MenuID) |
void QMyMainWindow::MemuClicked(int MenuID) |
862 |
{ |
{ |
863 |
QWidget * Desktop; |
QWidget * Desktop; |
866 |
|
|
867 |
if (MenuID == 1) // right click |
if (MenuID == 1) // right click |
868 |
{ |
{ |
869 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, mx, my); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, |
870 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, mx, my); |
rd(c2sx(mx)), rd(c2sy(my))); |
871 |
|
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, |
872 |
|
rd(c2sx(mx)), rd(c2sy(my))); |
873 |
} |
} |
874 |
else if (MenuID == 2) // toggle full screen |
else if (MenuID == 2) // toggle full screen |
875 |
{ |
{ |
879 |
Desktop = g_App->desktop(); |
Desktop = g_App->desktop(); |
880 |
dw = Desktop->width(); |
dw = Desktop->width(); |
881 |
dh = Desktop->height(); |
dh = Desktop->height(); |
882 |
if (dw == g_width && dh == g_height) |
if (dw == g_client_width && dh == g_client_height) |
883 |
g_MW->resize(g_width - 4, g_height - 4); |
g_MW->resize(g_client_width - 4, g_client_height - 4); |
884 |
g_SV->showFullScreen(); |
g_SV->showFullScreen(); |
885 |
} |
} |
886 |
else |
else |
887 |
{ |
{ |
888 |
g_SV->showNormal(); |
g_SV->showNormal(); |
889 |
g_SV->showMaximized(); |
g_SV->showMaximized(); |
890 |
g_MW->resize(g_width, g_height); |
g_MW->resize(g_client_width, g_client_height); |
891 |
} |
} |
892 |
} |
} |
893 |
else if (MenuID == 3) // reset keyboard |
else if (MenuID == 3) // reset keyboard |
898 |
} |
} |
899 |
else if (MenuID == 4) // double click |
else if (MenuID == 4) // double click |
900 |
{ |
{ |
901 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, mx, my); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, |
902 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, mx, my); |
rd(c2sx(mx)), rd(c2sy(my))); |
903 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, mx, my); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, |
904 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, mx, my); |
rd(c2sx(mx)), rd(c2sy(my))); |
905 |
|
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, |
906 |
|
rd(c2sx(mx)), rd(c2sy(my))); |
907 |
|
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, |
908 |
|
rd(c2sx(mx)), rd(c2sy(my))); |
909 |
} |
} |
910 |
} |
} |
911 |
|
|
912 |
//***************************************************************************** |
/******************************************************************************/ |
913 |
void QMyMainWindow::mouseMoveEvent(QMouseEvent* e) |
void QMyMainWindow::mouseMoveEvent(QMouseEvent* e) |
914 |
{ |
{ |
915 |
int x; |
int x, y; |
|
int y; |
|
916 |
|
|
917 |
x = e->x(); |
x = e->x(); |
918 |
y = e->y(); |
y = e->y(); |
|
|
|
919 |
if (timer_id) |
if (timer_id) |
920 |
{ |
{ |
921 |
x = x - mx; |
x = x - mx; |
926 |
timer_id = 0; |
timer_id = 0; |
927 |
} |
} |
928 |
} |
} |
929 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, c2sx(e->x()), |
930 |
|
c2sy(e->y())); |
931 |
} |
} |
932 |
|
|
933 |
//***************************************************************************** |
/******************************************************************************/ |
934 |
void QMyMainWindow::mousePressEvent(QMouseEvent* e) |
void QMyMainWindow::mousePressEvent(QMouseEvent* e) |
935 |
{ |
{ |
936 |
timer_id = startTimer(1000); |
timer_id = startTimer(1000); |
937 |
mx = e->x(); |
mx = e->x(); |
938 |
my = e->y(); |
my = e->y(); |
939 |
if (e->button() == LeftButton) |
if (e->button() == LeftButton) |
940 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, |
941 |
|
c2sx(e->x()), c2sy(e->y())); |
942 |
else if (e->button() == RightButton) |
else if (e->button() == RightButton) |
943 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, |
944 |
|
c2sx(e->x()), c2sy(e->y())); |
945 |
else if (e->button() == MidButton) |
else if (e->button() == MidButton) |
946 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, |
947 |
|
c2sx(e->x()), c2sy(e->y())); |
948 |
} |
} |
949 |
|
|
950 |
//***************************************************************************** |
/******************************************************************************/ |
951 |
void QMyMainWindow::mouseReleaseEvent(QMouseEvent* e) |
void QMyMainWindow::mouseReleaseEvent(QMouseEvent* e) |
952 |
{ |
{ |
953 |
killTimer(timer_id); |
killTimer(timer_id); |
954 |
timer_id = 0; |
timer_id = 0; |
955 |
if (e->button() == LeftButton) |
if (e->button() == LeftButton) |
956 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, c2sx(e->x()), |
957 |
|
c2sy(e->y())); |
958 |
else if (e->button() == RightButton) |
else if (e->button() == RightButton) |
959 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, c2sx(e->x()), |
960 |
|
c2sy(e->y())); |
961 |
else if (e->button() == MidButton) |
else if (e->button() == MidButton) |
962 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, c2sx(e->x()), |
963 |
|
c2sy(e->y())); |
964 |
} |
} |
965 |
|
|
966 |
//***************************************************************************** |
/******************************************************************************/ |
967 |
void QMyMainWindow::wheelEvent(QWheelEvent* e) |
void QMyMainWindow::wheelEvent(QWheelEvent* e) |
968 |
{ |
{ |
969 |
if (e->delta() > 0) |
if (e->delta() > 0) |
970 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, c2sx(e->x()), |
971 |
|
c2sy(e->y())); |
972 |
else if (e->delta() < 0) |
else if (e->delta() < 0) |
973 |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, e->x(), e->y()); |
rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, c2sx(e->x()), |
974 |
|
c2sy(e->y())); |
975 |
} |
} |
976 |
|
|
977 |
#define NOT(x) (~x) |
#define NOT(x) (~x) |
978 |
|
|
979 |
//***************************************************************************** |
/******************************************************************************/ |
980 |
int rop(int rop, int src, int dst) |
int rop(int rop, int src, int dst) |
981 |
{ |
{ |
982 |
switch (rop) |
switch (rop) |
1007 |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
if (x >= 0 && x < g_width && y >= 0 && y < g_height) |
1008 |
{ |
{ |
1009 |
if (g_server_bpp == 8) |
if (g_server_bpp == 8) |
1010 |
return g_BS[y * g_width + x]; |
return GETPIXEL8(g_BS, x, y, g_width); |
1011 |
else if (g_server_bpp == 16) |
else if (g_server_bpp == 16) |
1012 |
return *(((uint16*)g_BS) + (y * g_width + x)); |
return GETPIXEL16(g_BS, x, y, g_width); |
1013 |
|
else if (g_server_bpp == 24) |
1014 |
|
return GETPIXEL32(g_BS, x, y, g_width); |
1015 |
else |
else |
1016 |
return 0; |
return 0; |
1017 |
} |
} |
1019 |
return 0; |
return 0; |
1020 |
} |
} |
1021 |
|
|
1022 |
//***************************************************************************** |
/******************************************************************************/ |
1023 |
void set_pixel(int x, int y, int pixel, int op = 0xc) |
void set_pixel(int x, int y, int pixel, int op = 0xc) |
1024 |
{ |
{ |
1025 |
uint32 p; |
int p; |
1026 |
|
|
1027 |
if (x >= g_clipx && x < (g_clipx + g_clipcx) && |
if (x >= g_clipx && x < (g_clipx + g_clipcx) && |
1028 |
y >= g_clipy && y < (g_clipy + g_clipcy)) |
y >= g_clipy && y < (g_clipy + g_clipcy)) |
1039 |
{ |
{ |
1040 |
SETPIXEL16(g_BS, x, y, g_width, pixel); |
SETPIXEL16(g_BS, x, y, g_width, pixel); |
1041 |
} |
} |
1042 |
|
else if (g_server_bpp == 24) |
1043 |
|
{ |
1044 |
|
SETPIXEL32(g_BS, x, y, g_width, pixel); |
1045 |
|
} |
1046 |
} |
} |
1047 |
else |
else |
1048 |
{ |
{ |
1058 |
p = rop(op, pixel, p); |
p = rop(op, pixel, p); |
1059 |
SETPIXEL16(g_BS, x, y, g_width, p); |
SETPIXEL16(g_BS, x, y, g_width, p); |
1060 |
} |
} |
1061 |
|
else if (g_server_bpp == 24) |
1062 |
|
{ |
1063 |
|
p = GETPIXEL32(g_BS, x, y, g_width); |
1064 |
|
p = rop(op, pixel, p); |
1065 |
|
SETPIXEL32(g_BS, x, y, g_width, p); |
1066 |
|
} |
1067 |
} |
} |
1068 |
} |
} |
1069 |
} |
} |
1070 |
} |
} |
1071 |
|
|
1072 |
//****************************************************************************** |
/******************************************************************************/ |
1073 |
// adjust coordinates for cliping rect |
// adjust coordinates for cliping rect |
1074 |
bool WarpCoords(int * x, int * y, int * cx, int * cy, int * srcx, int * srcy) |
bool WarpCoords(int * x, int * y, int * cx, int * cy, int * srcx, int * srcy) |
1075 |
{ |
{ |
1093 |
return true; |
return true; |
1094 |
} |
} |
1095 |
|
|
1096 |
//***************************************************************************** |
/******************************************************************************/ |
|
uint32 color16to32(uint32 colour) |
|
|
{ |
|
|
uint32 r, g, b; |
|
|
r = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7); |
|
|
g = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3); |
|
|
b = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); |
|
|
return ((r << 16) | (g << 8) | b); |
|
|
} |
|
|
|
|
|
//***************************************************************************** |
|
1097 |
void QMyMainWindow::paintEvent(QPaintEvent * pe) |
void QMyMainWindow::paintEvent(QPaintEvent * pe) |
1098 |
{ |
{ |
1099 |
QImage * Image; |
QImage * Image; |
1100 |
QPainter * Painter; |
QPainter * Painter; |
1101 |
QRect Rect; |
QRect Rect; |
1102 |
int i, j, w, h, l, t; |
int i, j, w, h, l, t, pixel, r, g, b; |
1103 |
uint8 * data; |
uint8 * data; |
1104 |
|
double sx, sy; |
1105 |
|
|
1106 |
Image = 0; |
Image = 0; |
1107 |
data = 0; |
data = 0; |
1109 |
setWFlags(WRepaintNoErase); |
setWFlags(WRepaintNoErase); |
1110 |
if (g_CM != NULL || g_server_bpp > 8) |
if (g_CM != NULL || g_server_bpp > 8) |
1111 |
{ |
{ |
1112 |
|
sx = (double)g_client_width / (double)g_width; |
1113 |
|
sy = (double)g_client_height / (double)g_height; |
1114 |
Rect = pe->rect(); |
Rect = pe->rect(); |
1115 |
l = Rect.left(); |
l = rd(Rect.left() / sx); |
1116 |
t = Rect.top(); |
t = rd(Rect.top() / sy); |
1117 |
w = Rect.width(); |
w = rd(Rect.width() / sx); |
1118 |
h = Rect.height(); |
h = rd(Rect.height() / sy); |
1119 |
if (w > 0 && h > 0) |
if (w > 0 && h > 0) |
1120 |
{ |
{ |
1121 |
if (g_server_bpp == 8 && g_CM->NumColors > 0) |
if (g_server_bpp == 8 && g_CM->NumColors > 0) |
1124 |
data = (uint8*)xmalloc(w * h); |
data = (uint8*)xmalloc(w * h); |
1125 |
for (i = 0; i < h; i++) |
for (i = 0; i < h; i++) |
1126 |
for (j = 0; j < w; j++) |
for (j = 0; j < w; j++) |
1127 |
data[i * w + j] = get_pixel(l + j, t + i); |
data[i * w + j] = GETPIXEL8(g_BS, l + j, t + i, g_width); |
1128 |
Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors, |
Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors, |
1129 |
g_CM->NumColors, QImage::IgnoreEndian); |
g_CM->NumColors, QImage::IgnoreEndian); |
1130 |
} |
} |
1134 |
data = (uint8*)xmalloc(w * h * 4); |
data = (uint8*)xmalloc(w * h * 4); |
1135 |
for (i = 0; i < h; i++) |
for (i = 0; i < h; i++) |
1136 |
for (j = 0; j < w; j++) |
for (j = 0; j < w; j++) |
1137 |
*(((uint32*)data) + (i * w + j)) = color16to32(get_pixel(l + j, t + i)); |
{ |
1138 |
|
pixel = GETPIXEL16(g_BS, l + j, t + i, g_width); |
1139 |
|
r = ((pixel >> 8) & 0xf8) | ((pixel >> 13) & 0x7); |
1140 |
|
g = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x3); |
1141 |
|
b = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x7); |
1142 |
|
pixel = ((r << 16) | (g << 8) | b); |
1143 |
|
SETPIXEL32(data, j, i, w, pixel); |
1144 |
|
} |
1145 |
|
Image = new QImage(data, w, h, 32, NULL, |
1146 |
|
0, QImage::IgnoreEndian); |
1147 |
|
} |
1148 |
|
else if (g_server_bpp == 24) |
1149 |
|
{ |
1150 |
|
w = (w + 3) & ~3; |
1151 |
|
data = (uint8*)xmalloc(w * h * 4); |
1152 |
|
for (i = 0; i < h; i++) |
1153 |
|
for (j = 0; j < w; j++) |
1154 |
|
{ |
1155 |
|
pixel = GETPIXEL32(g_BS, l + j, t + i, g_width); |
1156 |
|
r = (pixel >> 0) & 0xff; |
1157 |
|
g = (pixel >> 8) & 0xff; |
1158 |
|
b = (pixel >> 16) & 0xff; |
1159 |
|
pixel = ((r << 16) | (g << 8) | b); |
1160 |
|
SETPIXEL32(data, j, i, w, pixel); |
1161 |
|
} |
1162 |
Image = new QImage(data, w, h, 32, NULL, |
Image = new QImage(data, w, h, 32, NULL, |
1163 |
0, QImage::IgnoreEndian); |
0, QImage::IgnoreEndian); |
1164 |
} |
} |
1165 |
if (Image != 0) |
if (Image != 0) |
1166 |
{ |
{ |
1167 |
Painter = new QPainter(this); |
Painter = new QPainter(this); |
1168 |
|
Painter->scale(sx, sy); |
1169 |
Painter->drawImage(l, t, *Image, 0, 0, w, h); |
Painter->drawImage(l, t, *Image, 0, 0, w, h); |
1170 |
delete Painter; |
delete Painter; |
1171 |
delete Image; |
delete Image; |
1175 |
} |
} |
1176 |
} |
} |
1177 |
|
|
1178 |
//***************************************************************************** |
/******************************************************************************/ |
1179 |
void QMyMainWindow::closeEvent(QCloseEvent * e) |
void QMyMainWindow::closeEvent(QCloseEvent * e) |
1180 |
{ |
{ |
1181 |
e->accept(); |
e->accept(); |
1182 |
} |
} |
1183 |
|
|
1184 |
//***************************************************************************** |
/******************************************************************************/ |
1185 |
void QMyMainWindow::dataReceived() |
void QMyMainWindow::dataReceived() |
1186 |
{ |
{ |
1187 |
if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) |
if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) |
1205 |
#endif |
#endif |
1206 |
} |
} |
1207 |
|
|
1208 |
//***************************************************************************** |
/******************************************************************************/ |
1209 |
void QMyMainWindow::soundSend() |
void QMyMainWindow::soundSend() |
1210 |
{ |
{ |
1211 |
g_SoundNotifier->setEnabled(false); |
g_SoundNotifier->setEnabled(false); |
1216 |
#endif |
#endif |
1217 |
} |
} |
1218 |
|
|
1219 |
//***************************************************************************** |
/******************************************************************************/ |
1220 |
void redraw(int x, int y, int cx, int cy) |
void redraw(int x, int y, int cx, int cy) |
1221 |
{ |
{ |
1222 |
|
double sx, sy; |
1223 |
|
|
1224 |
if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL)) |
if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL)) |
1225 |
{ |
{ |
1226 |
|
sx = (double)g_client_width / (double)g_width; |
1227 |
|
sy = (double)g_client_height / (double)g_height; |
1228 |
|
x = rd(x * sx); |
1229 |
|
y = rd(y * sy); |
1230 |
|
cx = rd(cx * sx); |
1231 |
|
cy = rd(cy * sy); |
1232 |
g_MW->update(x, y, cx, cy); |
g_MW->update(x, y, cx, cy); |
1233 |
} |
} |
1234 |
} |
} |
1235 |
|
|
1236 |
//***************************************************************************** |
/******************************************************************************/ |
1237 |
/* Returns 0 after user quit, 1 otherwise */ |
/* Returns 0 after user quit, 1 otherwise */ |
1238 |
int ui_select(int rdp_socket) |
int ui_select(int rdp_socket) |
1239 |
{ |
{ |
1242 |
return 1; |
return 1; |
1243 |
} |
} |
1244 |
|
|
1245 |
//***************************************************************************** |
/******************************************************************************/ |
1246 |
void ui_move_pointer(int /*x*/, int /*y*/) |
void ui_move_pointer(int /*x*/, int /*y*/) |
1247 |
{ |
{ |
1248 |
} |
} |
1249 |
|
|
1250 |
/*****************************************************************************/ |
/******************************************************************************/ |
1251 |
void ui_set_null_cursor(void) |
void ui_set_null_cursor(void) |
1252 |
{ |
{ |
1253 |
} |
} |
1254 |
|
|
1255 |
//***************************************************************************** |
/******************************************************************************/ |
1256 |
HBITMAP ui_create_bitmap(int width, int height, uint8 * data) |
HBITMAP ui_create_bitmap(int width, int height, uint8 * data) |
1257 |
{ |
{ |
1258 |
struct bitmap * the_bitmap; |
struct bitmap * the_bitmap; |
1259 |
uint8 * bitmap_data; |
uint8 * bitmap_data; |
1260 |
int i, j; |
int i, j; |
1261 |
|
int r, g, b, pixel; |
1262 |
|
|
1263 |
bitmap_data = (uint8*)xmalloc(width * height * BPP); |
bitmap_data = (uint8*)xmalloc(width * height * 4); |
1264 |
the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); |
the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); |
1265 |
the_bitmap->w = width; |
the_bitmap->w = width; |
1266 |
the_bitmap->h = height; |
the_bitmap->h = height; |
1275 |
{ |
{ |
1276 |
for (i = 0; i < height; i++) |
for (i = 0; i < height; i++) |
1277 |
for (j = 0; j < width; j++) |
for (j = 0; j < width; j++) |
1278 |
*(((uint16*)bitmap_data) + (i * width + j)) = *(((uint16*)data) + (i * width + j)); |
*(((uint16*)bitmap_data) + (i * width + j)) = |
1279 |
|
*(((uint16*)data) + (i * width + j)); |
1280 |
|
} |
1281 |
|
else if (g_server_bpp == 24) |
1282 |
|
{ |
1283 |
|
for (i = 0; i < height; i++) |
1284 |
|
for (j = 0; j < width; j++) |
1285 |
|
{ |
1286 |
|
r = data[(i * width + j) * 3 + 0]; |
1287 |
|
g = data[(i * width + j) * 3 + 1]; |
1288 |
|
b = data[(i * width + j) * 3 + 2]; |
1289 |
|
pixel = (r << 16) | (g << 8) | b; |
1290 |
|
SETPIXEL32(bitmap_data, j, i, width, pixel); |
1291 |
|
} |
1292 |
} |
} |
1293 |
return the_bitmap; |
return the_bitmap; |
1294 |
} |
} |
1295 |
|
|
1296 |
//***************************************************************************** |
/******************************************************************************/ |
1297 |
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, |
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, |
1298 |
int height, uint8 * data) |
int height, uint8 * data) |
1299 |
{ |
{ |
1300 |
int i, j; |
int i, j; |
1301 |
|
int r, g, b, pixel; |
1302 |
|
|
1303 |
if (g_server_bpp == 8) |
if (g_server_bpp == 8) |
1304 |
{ |
{ |
1316 |
if (j < width) |
if (j < width) |
1317 |
set_pixel(x + j, y + i, *(((uint16*)data) + (i * width + j))); |
set_pixel(x + j, y + i, *(((uint16*)data) + (i * width + j))); |
1318 |
} |
} |
1319 |
|
else if (g_server_bpp == 24) |
1320 |
|
{ |
1321 |
|
for (i = 0; i < cy; i++) |
1322 |
|
for (j = 0; j < cx; j++) |
1323 |
|
if (i < height) |
1324 |
|
if (j < width) |
1325 |
|
{ |
1326 |
|
r = data[(i * width + j) * 3 + 0]; |
1327 |
|
g = data[(i * width + j) * 3 + 1]; |
1328 |
|
b = data[(i * width + j) * 3 + 2]; |
1329 |
|
pixel = (r << 16) | (g << 8) | b; |
1330 |
|
set_pixel(x + j, y + i, pixel); |
1331 |
|
} |
1332 |
|
} |
1333 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1334 |
} |
} |
1335 |
|
|
1336 |
//***************************************************************************** |
/******************************************************************************/ |
1337 |
void ui_destroy_bitmap(HBITMAP bmp) |
void ui_destroy_bitmap(HBITMAP bmp) |
1338 |
{ |
{ |
1339 |
struct bitmap* the_bitmap; |
struct bitmap* the_bitmap; |
1347 |
} |
} |
1348 |
} |
} |
1349 |
|
|
1350 |
//***************************************************************************** |
/******************************************************************************/ |
1351 |
bool is_pixel_on(uint8* data, int x, int y, int width, int bpp) |
bool is_pixel_on(uint8 * data, int x, int y, int width, int bpp) |
1352 |
{ |
{ |
1353 |
int start, shift; |
int start, shift; |
1354 |
|
|
1365 |
return false; |
return false; |
1366 |
} |
} |
1367 |
|
|
1368 |
//***************************************************************************** |
/******************************************************************************/ |
1369 |
void set_pixel_on(uint8* data, int x, int y, int width, int bpp, uint8 pixel) |
void set_pixel_on(uint8 * data, int x, int y, int width, int bpp, uint8 pixel) |
1370 |
{ |
{ |
1371 |
if (bpp == 8) |
if (bpp == 8) |
1372 |
data[y * width + x] = pixel; |
data[y * width + x] = pixel; |
1373 |
} |
} |
1374 |
|
|
1375 |
//***************************************************************************** |
/******************************************************************************/ |
1376 |
HGLYPH ui_create_glyph(int width, int height, uint8 * data) |
HGLYPH ui_create_glyph(int width, int height, uint8 * data) |
1377 |
{ |
{ |
1378 |
int i, j; |
int i, j; |
1392 |
return the_glyph; |
return the_glyph; |
1393 |
} |
} |
1394 |
|
|
1395 |
//***************************************************************************** |
/******************************************************************************/ |
1396 |
void ui_destroy_glyph(HGLYPH glyph) |
void ui_destroy_glyph(HGLYPH glyph) |
1397 |
{ |
{ |
1398 |
struct bitmap* the_glyph; |
struct bitmap* the_glyph; |
1406 |
} |
} |
1407 |
} |
} |
1408 |
|
|
1409 |
//***************************************************************************** |
/******************************************************************************/ |
1410 |
HCURSOR ui_create_cursor(uint32 x, uint32 y, |
HCURSOR ui_create_cursor(uint32 x, uint32 y, |
1411 |
int width, int height, |
int width, int height, |
1412 |
uint8 * andmask, uint8 * xormask) |
uint8 * andmask, uint8 * xormask) |
1414 |
return (void*)1; |
return (void*)1; |
1415 |
} |
} |
1416 |
|
|
1417 |
//***************************************************************************** |
/******************************************************************************/ |
1418 |
void ui_set_cursor(HCURSOR /*cursor*/) |
void ui_set_cursor(HCURSOR /*cursor*/) |
1419 |
{ |
{ |
1420 |
} |
} |
1435 |
void ui_resize_window(void) |
void ui_resize_window(void) |
1436 |
{ |
{ |
1437 |
} |
} |
1438 |
//***************************************************************************** |
|
1439 |
|
/******************************************************************************/ |
1440 |
void ui_destroy_cursor(HCURSOR /*cursor*/) |
void ui_destroy_cursor(HCURSOR /*cursor*/) |
1441 |
{ |
{ |
1442 |
} |
} |
1443 |
|
|
1444 |
//***************************************************************************** |
/******************************************************************************/ |
1445 |
HCOLOURMAP ui_create_colourmap(COLOURMAP * colours) |
HCOLOURMAP ui_create_colourmap(COLOURMAP * colours) |
1446 |
{ |
{ |
1447 |
int i; |
int i; |
1461 |
return g_CM; |
return g_CM; |
1462 |
} |
} |
1463 |
|
|
1464 |
//***************************************************************************** |
/******************************************************************************/ |
1465 |
void ui_set_colourmap(HCOLOURMAP map) |
void ui_set_colourmap(HCOLOURMAP map) |
1466 |
{ |
{ |
1467 |
} |
} |
1468 |
|
|
1469 |
//***************************************************************************** |
/******************************************************************************/ |
1470 |
void ui_destroy_colourmap(HCOLOURMAP map) |
void ui_destroy_colourmap(HCOLOURMAP map) |
1471 |
{ |
{ |
1472 |
} |
} |
1473 |
|
|
1474 |
//***************************************************************************** |
/******************************************************************************/ |
1475 |
void ui_begin_update(void) |
void ui_begin_update(void) |
1476 |
{ |
{ |
1477 |
} |
} |
1478 |
|
|
1479 |
//***************************************************************************** |
/******************************************************************************/ |
1480 |
void ui_end_update(void) |
void ui_end_update(void) |
1481 |
{ |
{ |
1482 |
} |
} |
1483 |
|
|
1484 |
//***************************************************************************** |
/******************************************************************************/ |
1485 |
void ui_set_clip(int x, int y, int cx, int cy) |
void ui_set_clip(int x, int y, int cx, int cy) |
1486 |
{ |
{ |
1487 |
g_clipx = x; |
g_clipx = x; |
1490 |
g_clipcy = cy; |
g_clipcy = cy; |
1491 |
} |
} |
1492 |
|
|
1493 |
//***************************************************************************** |
/******************************************************************************/ |
1494 |
void ui_reset_clip(void) |
void ui_reset_clip(void) |
1495 |
{ |
{ |
1496 |
g_clipx = 0; |
g_clipx = 0; |
1499 |
g_clipcy = g_height; |
g_clipcy = g_height; |
1500 |
} |
} |
1501 |
|
|
1502 |
//***************************************************************************** |
/******************************************************************************/ |
1503 |
void ui_bell(void) |
void ui_bell(void) |
1504 |
{ |
{ |
1505 |
g_App->beep(); |
g_App->beep(); |
1506 |
} |
} |
1507 |
|
|
1508 |
//***************************************************************************** |
/******************************************************************************/ |
1509 |
void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) |
void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) |
1510 |
{ |
{ |
1511 |
int i, j; |
int i, j; |
1512 |
|
|
1513 |
for (i = 0; i < cy; i++) |
|
1514 |
for (j = 0; j < cx; j++) |
if (opcode == 0x0) /* black */ |
1515 |
set_pixel(x + j, y + i, get_pixel(x + j, y + i), opcode); |
{ |
1516 |
|
for (i = 0; i < cy; i++) |
1517 |
|
for (j = 0; j < cx; j++) |
1518 |
|
set_pixel(x + j, y + i, 0, 0xc); |
1519 |
|
} |
1520 |
|
else if (opcode == 0xf) /* white */ |
1521 |
|
{ |
1522 |
|
for (i = 0; i < cy; i++) |
1523 |
|
for (j = 0; j < cx; j++) |
1524 |
|
set_pixel(x + j, y + i, 0xffffff, 0xc); |
1525 |
|
} |
1526 |
|
else |
1527 |
|
{ |
1528 |
|
for (i = 0; i < cy; i++) |
1529 |
|
for (j = 0; j < cx; j++) |
1530 |
|
set_pixel(x + j, y + i, get_pixel(x + j, y + i), opcode); |
1531 |
|
} |
1532 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1533 |
} |
} |
1534 |
|
|
1535 |
//***************************************************************************** |
/******************************************************************************/ |
1536 |
// does not repaint |
// does not repaint |
1537 |
void fill_rect(int x, int y, int cx, int cy, int colour, int opcode = 0xc) |
void fill_rect(int x, int y, int cx, int cy, int colour, int opcode = 0xc) |
1538 |
{ |
{ |
1542 |
cx = g_width - x; |
cx = g_width - x; |
1543 |
if (y + cy > g_height) |
if (y + cy > g_height) |
1544 |
cy = g_height - y; |
cy = g_height - y; |
1545 |
for (i = 0; i < cy; i++) |
#ifdef QT_OPTI |
1546 |
for (j = 0; j < cx; j++) |
if (opcode == 0xc) /* optimize */ |
1547 |
set_pixel(x + j, y + i, colour, opcode); |
{ |
1548 |
|
if (WarpCoords(&x, &y, &cx, &cy, 0, 0)) |
1549 |
|
{ |
1550 |
|
if (g_server_bpp == 8) |
1551 |
|
{ |
1552 |
|
for (i = 0; i < cy; i++) |
1553 |
|
for (j = 0; j < cx; j++) |
1554 |
|
SETPIXEL8(g_BS, x + j, y + i, g_width, colour); |
1555 |
|
} |
1556 |
|
else if (g_server_bpp == 16) |
1557 |
|
{ |
1558 |
|
for (i = 0; i < cy; i++) |
1559 |
|
for (j = 0; j < cx; j++) |
1560 |
|
SETPIXEL16(g_BS, x + j, y + i, g_width, colour); |
1561 |
|
} |
1562 |
|
else if (g_server_bpp == 24) |
1563 |
|
{ |
1564 |
|
for (i = 0; i < cy; i++) |
1565 |
|
for (j = 0; j < cx; j++) |
1566 |
|
SETPIXEL32(g_BS, x + j, y + i, g_width, colour); |
1567 |
|
} |
1568 |
|
} |
1569 |
|
} |
1570 |
|
else |
1571 |
|
#endif |
1572 |
|
{ |
1573 |
|
for (i = 0; i < cy; i++) |
1574 |
|
for (j = 0; j < cx; j++) |
1575 |
|
set_pixel(x + j, y + i, colour, opcode); |
1576 |
|
} |
1577 |
} |
} |
1578 |
|
|
1579 |
//***************************************************************************** |
/******************************************************************************/ |
1580 |
void ui_rect(int x, int y, int cx, int cy, int colour) |
void ui_rect(int x, int y, int cx, int cy, int colour) |
1581 |
{ |
{ |
1582 |
fill_rect(x, y, cx, cy, colour); |
fill_rect(x, y, cx, cy, colour); |
1583 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1584 |
} |
} |
1585 |
|
|
1586 |
//***************************************************************************** |
/******************************************************************************/ |
1587 |
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, |
void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, |
1588 |
BRUSH * brush, int bgcolour, int fgcolour) |
BRUSH * brush, int bgcolour, int fgcolour) |
1589 |
{ |
{ |
1610 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1611 |
} |
} |
1612 |
|
|
1613 |
//***************************************************************************** |
/******************************************************************************/ |
1614 |
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, |
void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, |
1615 |
int srcx, int srcy) |
int srcx, int srcy) |
1616 |
{ |
{ |
1617 |
int i, j; |
int i, j, pixel; |
1618 |
uint8* temp; |
uint8 * temp; |
1619 |
|
|
1620 |
temp = (uint8*)xmalloc(cx * cy * BPP); |
temp = (uint8*)xmalloc(cx * cy * 4); |
1621 |
if (g_server_bpp == 8) |
#ifdef QT_OPTI |
1622 |
|
if (opcode == 0xc) |
1623 |
{ |
{ |
1624 |
for (i = 0; i < cy; i++) |
if (WarpCoords(&x, &y, &cx, &cy, &srcx, &srcy)) |
1625 |
for (j = 0; j < cx; j++) |
{ |
1626 |
temp[i * cx + j] = get_pixel(srcx + j, srcy + i); |
if (g_server_bpp == 8) |
1627 |
for (i = 0; i < cy; i++) |
{ |
1628 |
for (j = 0; j < cx; j++) |
for (i = 0; i < cy; i++) |
1629 |
set_pixel(x + j, y + i, temp[i * cx + j], opcode); |
for (j = 0; j < cx; j++) |
1630 |
|
{ |
1631 |
|
pixel = GETPIXEL8(g_BS, srcx + j, srcy + i, g_width); |
1632 |
|
SETPIXEL8(temp, j, i, cx, pixel); |
1633 |
|
} |
1634 |
|
for (i = 0; i < cy; i++) |
1635 |
|
for (j = 0; j < cx; j++) |
1636 |
|
{ |
1637 |
|
pixel = GETPIXEL8(temp, j, i, cx); |
1638 |
|
SETPIXEL8(g_BS, x + j, y + i, g_width, pixel); |
1639 |
|
} |
1640 |
|
} |
1641 |
|
else if (g_server_bpp == 16) |
1642 |
|
{ |
1643 |
|
for (i = 0; i < cy; i++) |
1644 |
|
for (j = 0; j < cx; j++) |
1645 |
|
{ |
1646 |
|
pixel = GETPIXEL16(g_BS, srcx + j, srcy + i, g_width); |
1647 |
|
SETPIXEL16(temp, j, i, cx, pixel); |
1648 |
|
} |
1649 |
|
for (i = 0; i < cy; i++) |
1650 |
|
for (j = 0; j < cx; j++) |
1651 |
|
{ |
1652 |
|
pixel = GETPIXEL16(temp, j, i, cx); |
1653 |
|
SETPIXEL16(g_BS, x + j, y + i, g_width, pixel); |
1654 |
|
} |
1655 |
|
} |
1656 |
|
else if (g_server_bpp == 24) |
1657 |
|
{ |
1658 |
|
for (i = 0; i < cy; i++) |
1659 |
|
for (j = 0; j < cx; j++) |
1660 |
|
{ |
1661 |
|
pixel = GETPIXEL32(g_BS, srcx + j, srcy + i, g_width); |
1662 |
|
SETPIXEL32(temp, j, i, cx, pixel); |
1663 |
|
} |
1664 |
|
for (i = 0; i < cy; i++) |
1665 |
|
for (j = 0; j < cx; j++) |
1666 |
|
{ |
1667 |
|
pixel = GETPIXEL32(temp, j, i, cx); |
1668 |
|
SETPIXEL32(g_BS, x + j, y + i, g_width, pixel); |
1669 |
|
} |
1670 |
|
} |
1671 |
|
} |
1672 |
} |
} |
1673 |
else if (g_server_bpp == 16) |
else |
1674 |
|
#endif |
1675 |
{ |
{ |
1676 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1677 |
for (j = 0; j < cx; j++) |
{ |
1678 |
*(((uint16*)temp) + (i * cx + j)) = get_pixel(srcx + j, srcy + i); |
for (i = 0; i < cy; i++) |
1679 |
for (i = 0; i < cy; i++) |
for (j = 0; j < cx; j++) |
1680 |
for (j = 0; j < cx; j++) |
temp[i * cx + j] = get_pixel(srcx + j, srcy + i); |
1681 |
set_pixel(x + j, y + i, *(((uint16*)temp) + (i * cx + j)), opcode); |
for (i = 0; i < cy; i++) |
1682 |
|
for (j = 0; j < cx; j++) |
1683 |
|
set_pixel(x + j, y + i, temp[i * cx + j], opcode); |
1684 |
|
} |
1685 |
|
else if (g_server_bpp == 16) |
1686 |
|
{ |
1687 |
|
for (i = 0; i < cy; i++) |
1688 |
|
for (j = 0; j < cx; j++) |
1689 |
|
{ |
1690 |
|
pixel = get_pixel(srcx + j, srcy + i); |
1691 |
|
SETPIXEL16(temp, j, i, cx, pixel); |
1692 |
|
} |
1693 |
|
for (i = 0; i < cy; i++) |
1694 |
|
for (j = 0; j < cx; j++) |
1695 |
|
{ |
1696 |
|
pixel = GETPIXEL16(temp, j, i, cx); |
1697 |
|
set_pixel(x + j, y + i, pixel, opcode); |
1698 |
|
} |
1699 |
|
} |
1700 |
|
else if (g_server_bpp == 24) |
1701 |
|
{ |
1702 |
|
for (i = 0; i < cy; i++) |
1703 |
|
for (j = 0; j < cx; j++) |
1704 |
|
*(((uint32*)temp) + (i * cx + j)) = get_pixel(srcx + j, srcy + i); |
1705 |
|
for (i = 0; i < cy; i++) |
1706 |
|
for (j = 0; j < cx; j++) |
1707 |
|
set_pixel(x + j, y + i, *(((uint32*)temp) + (i * cx + j)), opcode); |
1708 |
|
} |
1709 |
} |
} |
1710 |
xfree(temp); |
xfree(temp); |
1711 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1712 |
} |
} |
1713 |
|
|
1714 |
//***************************************************************************** |
/******************************************************************************/ |
1715 |
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, |
void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, |
1716 |
HBITMAP src, int srcx, int srcy) |
HBITMAP src, int srcx, int srcy) |
1717 |
{ |
{ |
1718 |
int i, j; |
int i, j, p; |
1719 |
struct bitmap* the_bitmap; |
struct bitmap * the_bitmap; |
1720 |
|
|
1721 |
the_bitmap = (struct bitmap*)src; |
the_bitmap = (struct bitmap*)src; |
1722 |
if (the_bitmap == NULL) |
if (the_bitmap == NULL) |
1723 |
return; |
return; |
1724 |
if (g_server_bpp == 8) |
#ifdef QT_OPTI |
1725 |
|
if (opcode == 0xc) /* optimize */ |
1726 |
{ |
{ |
1727 |
for (i = 0; i < cy; i++) |
if (WarpCoords(&x, &y, &cx, &cy, &srcx, &srcy)) |
1728 |
for (j = 0; j < cx; j++) |
{ |
1729 |
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
if (g_server_bpp == 8) |
1730 |
set_pixel(x + j, y + i, |
{ |
1731 |
the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)], |
for (i = 0; i < cy; i++) |
1732 |
opcode); |
for (j = 0; j < cx; j++) |
1733 |
|
{ |
1734 |
|
p = GETPIXEL8(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); |
1735 |
|
SETPIXEL8(g_BS, x + j, y + i, g_width, p); |
1736 |
|
} |
1737 |
|
} |
1738 |
|
else if (g_server_bpp == 16) |
1739 |
|
{ |
1740 |
|
for (i = 0; i < cy; i++) |
1741 |
|
for (j = 0; j < cx; j++) |
1742 |
|
{ |
1743 |
|
p = GETPIXEL16(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); |
1744 |
|
SETPIXEL16(g_BS, x + j, y + i, g_width, p); |
1745 |
|
} |
1746 |
|
} |
1747 |
|
else if (g_server_bpp == 24) |
1748 |
|
{ |
1749 |
|
for (i = 0; i < cy; i++) |
1750 |
|
for (j = 0; j < cx; j++) |
1751 |
|
{ |
1752 |
|
p = GETPIXEL32(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); |
1753 |
|
SETPIXEL32(g_BS, x + j, y + i, g_width, p); |
1754 |
|
} |
1755 |
|
} |
1756 |
|
} |
1757 |
} |
} |
1758 |
else if (g_server_bpp == 16) |
else |
1759 |
|
#endif |
1760 |
{ |
{ |
1761 |
for (i = 0; i < cy; i++) |
if (g_server_bpp == 8) |
1762 |
for (j = 0; j < cx; j++) |
{ |
1763 |
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
for (i = 0; i < cy; i++) |
1764 |
set_pixel(x + j, y + i, |
for (j = 0; j < cx; j++) |
1765 |
*(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), |
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
1766 |
opcode); |
set_pixel(x + j, y + i, |
1767 |
|
the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)], |
1768 |
|
opcode); |
1769 |
|
} |
1770 |
|
else if (g_server_bpp == 16) |
1771 |
|
{ |
1772 |
|
for (i = 0; i < cy; i++) |
1773 |
|
for (j = 0; j < cx; j++) |
1774 |
|
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
1775 |
|
set_pixel(x + j, y + i, |
1776 |
|
*(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), |
1777 |
|
opcode); |
1778 |
|
} |
1779 |
|
else if (g_server_bpp == 24) |
1780 |
|
{ |
1781 |
|
for (i = 0; i < cy; i++) |
1782 |
|
for (j = 0; j < cx; j++) |
1783 |
|
if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) |
1784 |
|
set_pixel(x + j, y + i, |
1785 |
|
*(((uint32*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), |
1786 |
|
opcode); |
1787 |
|
} |
1788 |
} |
} |
1789 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
1790 |
} |
} |
1791 |
|
|
1792 |
//***************************************************************************** |
/******************************************************************************/ |
1793 |
// not used |
// not used |
1794 |
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, |
void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, |
1795 |
HBITMAP src, int srcx, int srcy, BRUSH * brush, |
HBITMAP src, int srcx, int srcy, BRUSH * brush, |
1797 |
{ |
{ |
1798 |
} |
} |
1799 |
|
|
1800 |
//***************************************************************************** |
/******************************************************************************/ |
1801 |
// Bresenham's line drawing algorithm |
/* Bresenham's line drawing algorithm */ |
1802 |
void ui_line(uint8 opcode, int startx, int starty, int endx, |
void ui_line(uint8 opcode, int startx, int starty, int endx, |
1803 |
int endy, PEN * pen) |
int endy, PEN * pen) |
1804 |
{ |
{ |
1877 |
redraw(left, top, (right - left) + 1, (bottom - top) + 1); |
redraw(left, top, (right - left) + 1, (bottom - top) + 1); |
1878 |
} |
} |
1879 |
|
|
1880 |
//***************************************************************************** |
/******************************************************************************/ |
1881 |
void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) |
void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) |
1882 |
{ |
{ |
1883 |
struct bitmap *the_glyph; |
struct bitmap *the_glyph; |
1922 |
}\ |
}\ |
1923 |
} |
} |
1924 |
|
|
1925 |
//***************************************************************************** |
/******************************************************************************/ |
1926 |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, |
void ui_draw_text(uint8 font, uint8 flags, int mixmode, |
1927 |
int x, int y, int clipx, int clipy, |
int x, int y, int clipx, int clipy, |
1928 |
int clipcx, int clipcy, int boxx, |
int clipcx, int clipcy, int boxx, |
1929 |
int boxy, int boxcx, int boxcy, int bgcolour, |
int boxy, int boxcx, int boxcy, int bgcolour, |
1930 |
int fgcolour, uint8 * text, uint8 length) |
int fgcolour, uint8 * text, uint8 length) |
1931 |
{ |
{ |
1932 |
FONTGLYPH *glyph; |
FONTGLYPH * glyph; |
1933 |
int i, j, xyoffset; |
int i, j, xyoffset; |
1934 |
DATABLOB *entry; |
DATABLOB * entry; |
1935 |
|
|
1936 |
|
if (boxx + boxcx > g_width) |
1937 |
|
boxcx = g_width - boxx; |
1938 |
|
if (boxy + boxcy > g_height) |
1939 |
|
boxcy = g_height - boxy; |
1940 |
|
|
1941 |
if (boxcx > 1) |
if (boxcx > 1) |
1942 |
fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); |
1998 |
redraw(clipx, clipy, clipcx, clipcy); |
redraw(clipx, clipy, clipcx, clipcy); |
1999 |
} |
} |
2000 |
|
|
2001 |
//***************************************************************************** |
/******************************************************************************/ |
2002 |
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) |
2003 |
{ |
{ |
2004 |
uint8* data; |
uint8 * data; |
2005 |
int i, j; |
int i, j, Bpp, pixel; |
2006 |
|
|
2007 |
data = (uint8*)xmalloc(cx * cy * BPP); |
Bpp = 4; |
2008 |
|
switch (g_server_bpp) |
2009 |
|
{ |
2010 |
|
case 8: Bpp = 1; break; |
2011 |
|
case 15: Bpp = 2; break; |
2012 |
|
case 16: Bpp = 2; break; |
2013 |
|
} |
2014 |
|
data = (uint8*)xmalloc(cx * cy * Bpp); |
2015 |
if (g_server_bpp == 8) |
if (g_server_bpp == 8) |
2016 |
{ |
{ |
2017 |
for (i = 0; i < cy; i++) |
for (i = 0; i < cy; i++) |
2018 |
for (j = 0; j < cx; j++) |
for (j = 0; j < cx; j++) |
2019 |
data[i * cx + j] = get_pixel(x + j, y + i); |
{ |
2020 |
|
pixel = get_pixel(x + j, y + i); |
2021 |
|
SETPIXEL8(data, j, i, cx, pixel); |
2022 |
|
} |
2023 |
} |
} |
2024 |
else if (g_server_bpp == 16) |
else if (g_server_bpp == 16) |
2025 |
{ |
{ |
2026 |
for (i = 0; i < cy; i++) |
for (i = 0; i < cy; i++) |
2027 |
for (j = 0; j < cx; j++) |
for (j = 0; j < cx; j++) |
2028 |
*(((uint16*)data) + (i * cx + j)) = get_pixel(x + j, y + i); |
{ |
2029 |
|
pixel = get_pixel(x + j, y + i); |
2030 |
|
SETPIXEL16(data, j, i, cx, pixel); |
2031 |
|
} |
2032 |
} |
} |
2033 |
offset *= BPP; |
else if (g_server_bpp == 24) |
2034 |
cache_put_desktop(offset, cx, cy, cx * BPP, BPP, data); |
{ |
2035 |
|
for (i = 0; i < cy; i++) |
2036 |
|
for (j = 0; j < cx; j++) |
2037 |
|
*(((uint32*)data) + (i * cx + j)) = get_pixel(x + j, y + i); |
2038 |
|
} |
2039 |
|
offset *= Bpp; |
2040 |
|
cache_put_desktop(offset, cx, cy, cx * Bpp, Bpp, data); |
2041 |
xfree(data); |
xfree(data); |
2042 |
} |
} |
2043 |
|
|
2044 |
//***************************************************************************** |
/******************************************************************************/ |
2045 |
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) |
2046 |
{ |
{ |
2047 |
uint8* data; |
uint8 * data; |
2048 |
int i, j; |
int i, j; |
2049 |
|
int Bpp; |
2050 |
|
|
2051 |
offset *= BPP; |
Bpp = 4; |
2052 |
data = cache_get_desktop(offset, cx, cy, BPP); |
switch (g_server_bpp) |
2053 |
|
{ |
2054 |
|
case 8: Bpp = 1; break; |
2055 |
|
case 15: Bpp = 2; break; |
2056 |
|
case 16: Bpp = 2; break; |
2057 |
|
} |
2058 |
|
offset *= Bpp; |
2059 |
|
data = cache_get_desktop(offset, cx, cy, Bpp); |
2060 |
if (g_server_bpp == 8) |
if (g_server_bpp == 8) |
2061 |
{ |
{ |
2062 |
for (i = 0; i < cy; i++) |
for (i = 0; i < cy; i++) |
2069 |
for (j = 0; j < cx; j++) |
for (j = 0; j < cx; j++) |
2070 |
set_pixel(x + j, y + i, *(((uint16*)data) + (i * cx + j))); |
set_pixel(x + j, y + i, *(((uint16*)data) + (i * cx + j))); |
2071 |
} |
} |
2072 |
|
else if (g_server_bpp == 24) |
2073 |
|
{ |
2074 |
|
for (i = 0; i < cy; i++) |
2075 |
|
for (j = 0; j < cx; j++) |
2076 |
|
set_pixel(x + j, y + i, *(((uint32*)data) + (i * cx + j))); |
2077 |
|
} |
2078 |
redraw(x, y, cx, cy); |
redraw(x, y, cx, cy); |
2079 |
} |
} |
2080 |
|
|
2081 |
/*****************************************************************************/ |
/*****************************************************************************/ |
2082 |
void* xrealloc(void *in_val, int size) |
void* xrealloc(void * in_val, int size) |
2083 |
{ |
{ |
2084 |
if (size < 1) |
if (size < 1) |
2085 |
size = 1; |
size = 1; |
2230 |
void get_username_and_hostname(void) |
void get_username_and_hostname(void) |
2231 |
{ |
{ |
2232 |
char fullhostname[64]; |
char fullhostname[64]; |
2233 |
char* p; |
char * p; |
2234 |
struct passwd* pw; |
struct passwd * pw; |
2235 |
|
|
2236 |
STRNCPY(g_username, "unknown", sizeof(g_username)); |
STRNCPY(g_username, "unknown", sizeof(g_username)); |
2237 |
STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); |
STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); |
2268 |
fprintf(stderr, " -c: working directory\n"); |
fprintf(stderr, " -c: working directory\n"); |
2269 |
fprintf(stderr, " -p: password (- to prompt)\n"); |
fprintf(stderr, " -p: password (- to prompt)\n"); |
2270 |
fprintf(stderr, " -n: client hostname\n"); |
fprintf(stderr, " -n: client hostname\n"); |
2271 |
|
fprintf(stderr, " -f: full screen\n"); |
2272 |
|
|
2273 |
fprintf(stderr, "\n"); |
fprintf(stderr, "\n"); |
2274 |
} |
} |
2290 |
else if (strcmp(in_argv[i], "-g") == 0) |
else if (strcmp(in_argv[i], "-g") == 0) |
2291 |
{ |
{ |
2292 |
g_width = strtol(in_argv[i + 1], &p, 10); |
g_width = strtol(in_argv[i + 1], &p, 10); |
|
if (g_width <= 0) |
|
|
{ |
|
|
error("invalid geometry\n"); |
|
|
return 0; |
|
|
} |
|
2293 |
if (*p == 'x') |
if (*p == 'x') |
2294 |
g_height = strtol(p + 1, NULL, 10); |
g_height = strtol(p + 1, &p, 10); |
2295 |
if (g_height <= 0) |
if (*p == '-') |
2296 |
|
g_client_width = strtol(p + 1, &p, 10); |
2297 |
|
else |
2298 |
{ |
{ |
2299 |
error("invalid geometry\n"); |
g_client_width = g_width; |
2300 |
return 0; |
g_client_height = g_height; |
2301 |
} |
} |
2302 |
|
if (*p == 'x') |
2303 |
|
g_client_height = strtol(p + 1, NULL, 10); |
2304 |
g_width = (g_width + 3) & ~3; |
g_width = (g_width + 3) & ~3; |
2305 |
|
g_height = (g_height + 3) & ~3; |
2306 |
|
g_client_width = (g_client_width + 3) & ~3; |
2307 |
|
g_client_height = (g_client_height + 3) & ~3; |
2308 |
|
//printf("%d %d %d %d\n", g_width, g_height, g_client_width, g_client_height); |
2309 |
} |
} |
2310 |
else if (strcmp(in_argv[i], "-4") == 0) |
else if (strcmp(in_argv[i], "-4") == 0) |
2311 |
g_use_rdp5 = 0; |
g_use_rdp5 = 0; |
2314 |
else if (strcmp(in_argv[i], "-a") == 0) |
else if (strcmp(in_argv[i], "-a") == 0) |
2315 |
{ |
{ |
2316 |
g_server_bpp = strtol(in_argv[i + 1], &p, 10); |
g_server_bpp = strtol(in_argv[i + 1], &p, 10); |
2317 |
if (g_server_bpp != 8 && g_server_bpp != 15 && |
if (g_server_bpp != 8 && |
2318 |
g_server_bpp != 16 && g_server_bpp != 24) |
g_server_bpp != 16 && g_server_bpp != 24) |
2319 |
{ |
{ |
2320 |
error("invalid bpp\n"); |
error("invalid bpp\n"); |
2349 |
{ |
{ |
2350 |
STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); |
STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); |
2351 |
} |
} |
2352 |
|
else if (strcmp(in_argv[i], "-f") == 0) |
2353 |
|
{ |
2354 |
|
g_fullscreen = 1; |
2355 |
|
} |
2356 |
} |
} |
2357 |
return 1; |
return 1; |
2358 |
} |
} |
2359 |
|
|
2360 |
//***************************************************************************** |
/******************************************************************************/ |
2361 |
int param_connect(void) |
int param_connect(void) |
2362 |
{ |
{ |
2363 |
QWidget * Desktop; |
QWidget * Desktop; |
2379 |
memset(g_CM, 0, sizeof(struct QColorMap)); |
memset(g_CM, 0, sizeof(struct QColorMap)); |
2380 |
g_CM->NumColors = 256; |
g_CM->NumColors = 256; |
2381 |
g_MW = new QMyMainWindow(); |
g_MW = new QMyMainWindow(); |
2382 |
g_MW->resize(g_width, g_height); |
g_MW->resize(g_client_width, g_client_height); |
2383 |
g_MW->show(); |
g_MW->show(); |
2384 |
g_SV->addChild(g_MW); |
g_SV->addChild(g_MW); |
2385 |
g_MW->setMouseTracking(true); |
g_MW->setMouseTracking(true); |
2393 |
Desktop = g_App->desktop(); |
Desktop = g_App->desktop(); |
2394 |
dw = Desktop->width(); |
dw = Desktop->width(); |
2395 |
dh = Desktop->height(); |
dh = Desktop->height(); |
2396 |
if (dw == g_width && dh == g_height) |
if (dw == g_client_width && dh == g_client_height) |
2397 |
g_MW->resize(g_width - 4, g_height - 4); |
g_MW->resize(g_client_width - 4, g_client_height - 4); |
2398 |
g_SV->showFullScreen(); |
g_SV->showFullScreen(); |
2399 |
} |
} |
2400 |
g_MW->setCursor(BlankCursor); |
g_MW->setCursor((int)10); /* Qt::BlankCursor */ |
2401 |
g_App->exec(); |
g_App->exec(); |
2402 |
} |
} |
2403 |
return 0; |
return 0; |
2404 |
} |
} |
2405 |
|
|
2406 |
//***************************************************************************** |
/******************************************************************************/ |
2407 |
int main(int argc, char ** argv) |
int main(int argc, char ** argv) |
2408 |
{ |
{ |
2409 |
#ifdef SHARP |
#ifdef SHARP |
2410 |
g_App = new QPEApplication(argc, argv); |
g_App = new QPEApplication(argc, argv); |
2411 |
#else |
#else |
2412 |
g_App = new QApplication(argc, argv, QApplication::GuiServer); |
//g_App = new QApplication(argc, argv, QApplication::GuiServer); |
2413 |
|
g_App = new QApplication(argc, argv); |
2414 |
#endif |
#endif |
2415 |
g_SV = new QMyScrollView(); |
g_SV = new QMyScrollView(); |
2416 |
g_App->setMainWidget(g_SV); |
g_App->setMainWidget(g_SV); |
2424 |
else |
else |
2425 |
{ |
{ |
2426 |
g_SV->timer_id = g_SV->startTimer(1000); /* one sec delay, then dialog */ |
g_SV->timer_id = g_SV->startTimer(1000); /* one sec delay, then dialog */ |
|
g_MW->setCursor(BlankCursor); |
|
2427 |
g_App->exec(); |
g_App->exec(); |
2428 |
} |
} |
2429 |
delete g_SV; |
delete g_SV; |