CVS: rdesktop/uiports qterdesktopbuild.sh,1.3,1.4 qtewin.cpp,1.4,1.5 qtwin.cpp,1.5,1.6

Jay Sorg <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop/uiports
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9243

Modified Files:
	qterdesktopbuild.sh qtewin.cpp qtwin.cpp 
Log Message:
added optimizes to qtewin.cpp

Index: qterdesktopbuild.sh
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/uiports/qterdesktopbuild.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** qterdesktopbuild.sh	30 Oct 2004 17:02:54 -0000	1.3
--- qterdesktopbuild.sh	3 Nov 2004 03:27:53 -0000	1.4
***************
*** 7,11 ****
  
  cc="g++"
! cflags="-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -Os -fno-default-inline -DNO_DEBUG -DWITH_OPENSSL"
  # uncomment the following line to turn on debug
  #cflags=$cflags" -DWITH_DEBUG"
--- 7,11 ----
  
  cc="g++"
! cflags="-pipe -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -fno-exceptions -fno-rtti -Wall -O2 -fno-default-inline -DNO_DEBUG -DWITH_OPENSSL"
  # uncomment the following line to turn on debug
  #cflags=$cflags" -DWITH_DEBUG"

Index: qtewin.cpp
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/uiports/qtewin.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** qtewin.cpp	30 Oct 2004 17:02:54 -0000	1.4
--- qtewin.cpp	3 Nov 2004 03:27:53 -0000	1.5
***************
*** 49,52 ****
--- 49,54 ----
  #include "qtewin.h"
  
+ #define QT_OPTI
+ 
  /* types */
  struct QColorMap
***************
*** 86,89 ****
--- 88,93 ----
  char g_username[100] = "";
  
+ static int g_client_width = 640;
+ static int g_client_height = 480;
  static uint32 g_flags = RDP_LOGON_NORMAL;
  static char g_server[64] = "";
***************
*** 741,744 ****
--- 745,750 ----
      g_width = d->Width;
      g_height = d->Height;
+     g_client_width = g_width;
+     g_client_height = g_height;
      g_fullscreen = d->FullScreen;
      sprintf(g_server, "%s", (const char*)d->ServerIP);
***************
*** 761,765 ****
      g_CM->NumColors = 256;
      g_MW = new QMyMainWindow();
!     g_MW->resize(g_width, g_height);
      g_MW->show();
      g_SV->addChild(g_MW);
--- 767,771 ----
      g_CM->NumColors = 256;
      g_MW = new QMyMainWindow();
!     g_MW->resize(g_client_width, g_client_height);
      g_MW->show();
      g_SV->addChild(g_MW);
***************
*** 775,780 ****
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_width && dh == g_height)
!         g_MW->resize(g_width - 4, g_height - 4);
        g_SV->showFullScreen();
      }
--- 781,786 ----
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_client_width && dh == g_client_height)
!         g_MW->resize(g_client_width - 4, g_client_height - 4);
        g_SV->showFullScreen();
      }
***************
*** 806,809 ****
--- 812,839 ----
  
  /******************************************************************************/
+ int rd(double in)
+ {
+   return (int)(in + 0.50);
+ }
+ 
+ /******************************************************************************/
+ int c2sx(int cx)
+ {
+   double sx;
+ 
+   sx = (double)g_client_width / (double)g_width;
+   return rd(cx / sx);
+ }
+ 
+ /******************************************************************************/
+ int c2sy(int cy)
+ {
+   double sy;
+ 
+   sy = (double)g_client_height / (double)g_height;
+   return rd(cy / sy);
+ }
+ 
+ /******************************************************************************/
  void QMyMainWindow::timerEvent(QTimerEvent * e)
  {
***************
*** 812,816 ****
    {
      // send mouse up
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, mx, my);
      // if in fullscreen, take it out or the menu won't work
      if (g_fullscreen)
--- 842,847 ----
    {
      // send mouse up
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1,
!                    rd(c2sx(mx)), rd(c2sy(my)));
      // if in fullscreen, take it out or the menu won't work
      if (g_fullscreen)
***************
*** 835,840 ****
    if (MenuID == 1) // right click
    {
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, mx, my);
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, mx, my);
    }
    else if (MenuID == 2) // toggle full screen
--- 866,873 ----
    if (MenuID == 1) // right click
    {
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2,
!                    rd(c2sx(mx)), rd(c2sy(my)));
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2,
!                    rd(c2sx(mx)), rd(c2sy(my)));
    }
    else if (MenuID == 2) // toggle full screen
***************
*** 846,851 ****
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_width && dh == g_height)
!         g_MW->resize(g_width - 4, g_height - 4);
        g_SV->showFullScreen();
      }
--- 879,884 ----
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_client_width && dh == g_client_height)
!         g_MW->resize(g_client_width - 4, g_client_height - 4);
        g_SV->showFullScreen();
      }
***************
*** 854,858 ****
        g_SV->showNormal();
        g_SV->showMaximized();
!       g_MW->resize(g_width, g_height);
      }
    }
--- 887,891 ----
        g_SV->showNormal();
        g_SV->showMaximized();
!       g_MW->resize(g_client_width, g_client_height);
      }
    }
***************
*** 865,872 ****
    else if (MenuID == 4) // double click
    {
!     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, mx, my);
!     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, mx, my);
    }
  }
--- 898,909 ----
    else if (MenuID == 4) // double click
    {
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1,
!                    rd(c2sx(mx)), rd(c2sy(my)));
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1,
!                    rd(c2sx(mx)), rd(c2sy(my)));
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1,
!                    rd(c2sx(mx)), rd(c2sy(my)));
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1,
!                    rd(c2sx(mx)), rd(c2sy(my)));
    }
  }
***************
*** 875,884 ****
  void QMyMainWindow::mouseMoveEvent(QMouseEvent* e)
  {
!   int x;
!   int y;
  
    x = e->x();
    y = e->y();
- 
    if (timer_id)
    {
--- 912,919 ----
  void QMyMainWindow::mouseMoveEvent(QMouseEvent* e)
  {
!   int x, y;
  
    x = e->x();
    y = e->y();
    if (timer_id)
    {
***************
*** 891,895 ****
      }
    }
!   rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, e->x(), e->y());
  }
  
--- 926,931 ----
      }
    }
!   rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, c2sx(e->x()),
!                  c2sy(e->y()));
  }
  
***************
*** 901,909 ****
    my = e->y();
    if (e->button() == LeftButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, e->x(), e->y());
    else if (e->button() == RightButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, e->x(), e->y());
    else if (e->button() == MidButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, e->x(), e->y());
  }
  
--- 937,948 ----
    my = e->y();
    if (e->button() == LeftButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1,
!                    c2sx(e->x()), c2sy(e->y()));
    else if (e->button() == RightButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2,
!                    c2sx(e->x()), c2sy(e->y()));
    else if (e->button() == MidButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3,
!                    c2sx(e->x()), c2sy(e->y()));
  }
  
***************
*** 914,922 ****
    timer_id = 0;
    if (e->button() == LeftButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, e->x(), e->y());
    else if (e->button() == RightButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, e->x(), e->y());
    else if (e->button() == MidButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, e->x(), e->y());
  }
  
--- 953,964 ----
    timer_id = 0;
    if (e->button() == LeftButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, c2sx(e->x()),
!                    c2sy(e->y()));
    else if (e->button() == RightButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, c2sx(e->x()),
!                    c2sy(e->y()));
    else if (e->button() == MidButton)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, c2sx(e->x()),
!                    c2sy(e->y()));
  }
  
***************
*** 925,931 ****
  {
    if (e->delta() > 0)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, e->x(), e->y());
    else if (e->delta() < 0)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, e->x(), e->y());
  }
  
--- 967,975 ----
  {
    if (e->delta() > 0)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, c2sx(e->x()),
!                    c2sy(e->y()));
    else if (e->delta() < 0)
!     rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, c2sx(e->x()),
!                    c2sy(e->y()));
  }
  
***************
*** 963,971 ****
    {
      if (g_server_bpp == 8)
!       return g_BS[y * g_width + x];
      else if (g_server_bpp == 16)
!       return *(((uint16*)g_BS) + (y * g_width + x));
      else if (g_server_bpp == 24)
!       return *(((uint32*)g_BS) + (y * g_width + x));
      else
        return 0;
--- 1007,1015 ----
    {
      if (g_server_bpp == 8)
!       return GETPIXEL8(g_BS, x, y, g_width);
      else if (g_server_bpp == 16)
!       return GETPIXEL16(g_BS, x, y, g_width);
      else if (g_server_bpp == 24)
!       return GETPIXEL32(g_BS, x, y, g_width);
      else
        return 0;
***************
*** 978,982 ****
  void set_pixel(int x, int y, int pixel, int op = 0xc)
  {
!   uint32 p;
  
    if (x >= g_clipx && x < (g_clipx + g_clipcx) &&
--- 1022,1026 ----
  void set_pixel(int x, int y, int pixel, int op = 0xc)
  {
!   int p;
  
    if (x >= g_clipx && x < (g_clipx + g_clipcx) &&
***************
*** 1050,1073 ****
  
  /******************************************************************************/
- 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);
- }
- 
- /******************************************************************************/
- uint32 color24to32(uint32 colour)
- {
-   uint32 r, g, b;
-   r = (colour >> 0) & 0xff;
-   g = (colour >> 8) & 0xff;
-   b = (colour >> 16) & 0xff;
-   return ((r << 16) | (g << 8) | b);
- }
- 
- /******************************************************************************/
  void QMyMainWindow::paintEvent(QPaintEvent * pe)
  {
--- 1094,1097 ----
***************
*** 1075,1081 ****
    QPainter * Painter;
    QRect Rect;
!   int i, j, w, h, l, t;
!   int pixel;
    uint8 * data;
  
    Image = 0;
--- 1099,1105 ----
    QPainter * Painter;
    QRect Rect;
!   int i, j, w, h, l, t, pixel, r, g, b;
    uint8 * data;
+   double sx, sy;
  
    Image = 0;
***************
*** 1085,1093 ****
    if (g_CM != NULL || g_server_bpp > 8)
    {
      Rect = pe->rect();
!     l = Rect.left();
!     t = Rect.top();
!     w = Rect.width();
!     h = Rect.height();
      if (w > 0 && h > 0)
      {
--- 1109,1119 ----
    if (g_CM != NULL || g_server_bpp > 8)
    {
+     sx = (double)g_client_width / (double)g_width;
+     sy = (double)g_client_height / (double)g_height;
      Rect = pe->rect();
!     l = rd(Rect.left() / sx);
!     t = rd(Rect.top() / sy);
!     w = rd(Rect.width() / sx);
!     h = rd(Rect.height() / sy);
      if (w > 0 && h > 0)
      {
***************
*** 1098,1102 ****
          for (i = 0; i < h; i++)
            for (j = 0; j < w; j++)
!             data[i * w + j] = get_pixel(l + j, t + i);
          Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors,
                             g_CM->NumColors, QImage::IgnoreEndian);
--- 1124,1128 ----
          for (i = 0; i < h; i++)
            for (j = 0; j < w; j++)
!             data[i * w + j] = GETPIXEL8(g_BS, l + j, t + i, g_width);
          Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors,
                             g_CM->NumColors, QImage::IgnoreEndian);
***************
*** 1110,1114 ****
            {
              pixel = GETPIXEL16(g_BS, l + j, t + i, g_width);
!             pixel = color16to32(pixel);
              SETPIXEL32(data, j, i, w, pixel);
            }
--- 1136,1143 ----
            {
              pixel = GETPIXEL16(g_BS, l + j, t + i, g_width);
!             r = ((pixel >> 8) & 0xf8) | ((pixel >> 13) & 0x7);
!             g = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x3);
!             b = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x7);
!             pixel = ((r << 16) | (g << 8) | b);
              SETPIXEL32(data, j, i, w, pixel);
            }
***************
*** 1124,1128 ****
            {
              pixel = GETPIXEL32(g_BS, l + j, t + i, g_width);
!             pixel = color24to32(pixel);
              SETPIXEL32(data, j, i, w, pixel);
            }
--- 1153,1160 ----
            {
              pixel = GETPIXEL32(g_BS, l + j, t + i, g_width);
!             r = (pixel >> 0) & 0xff;
!             g = (pixel >> 8) & 0xff;
!             b = (pixel >> 16) & 0xff;
!             pixel = ((r << 16) | (g << 8) | b);
              SETPIXEL32(data, j, i, w, pixel);
            }
***************
*** 1133,1136 ****
--- 1165,1169 ----
        {
          Painter = new QPainter(this);
+         Painter->scale(sx, sy);
          Painter->drawImage(l, t, *Image, 0, 0, w, h);
          delete Painter;
***************
*** 1186,1191 ****
--- 1219,1232 ----
  void redraw(int x, int y, int cx, int cy)
  {
+   double sx, sy;
+ 
    if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL))
    {
+     sx = (double)g_client_width / (double)g_width;
+     sy = (double)g_client_height / (double)g_height;
+     x = rd(x * sx);
+     y = rd(y * sy);
+     cx = rd(cx * sx);
+     cy = rd(cy * sy);
      g_MW->update(x, y, cx, cy);
    }
***************
*** 1485,1491 ****
    if (y + cy > g_height)
      cy = g_height - y;
!   for (i = 0; i < cy; i++)
!     for (j = 0; j < cx; j++)
!       set_pixel(x + j, y + i, colour, opcode);
  }
  
--- 1526,1561 ----
    if (y + cy > g_height)
      cy = g_height - y;
! #ifdef QT_OPTI
!   if (opcode == 0xc) /* optimize */
!   {
!     if (WarpCoords(&x, &y, &cx, &cy, 0, 0))
!     {
!       if (g_server_bpp == 8)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!             SETPIXEL8(g_BS, x + j, y + i, g_width, colour);
!       }
!       else if (g_server_bpp == 16)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!             SETPIXEL16(g_BS, x + j, y + i, g_width, colour);
!       }
!       else if (g_server_bpp == 24)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!             SETPIXEL32(g_BS, x + j, y + i, g_width, colour);
!       }
!     }
!   }
!   else
! #endif
!   {
!     for (i = 0; i < cy; i++)
!       for (j = 0; j < cx; j++)
!         set_pixel(x + j, y + i, colour, opcode);
!   }
  }
  
***************
*** 1528,1535 ****
                    int srcx, int srcy)
  {
!   int i, j;
    uint8 * temp;
  
!   temp = (uint8*)xmalloc(cx * cy * (BPP + 1));
    if (g_server_bpp == 8)
    {
--- 1598,1605 ----
                    int srcx, int srcy)
  {
!   int i, j, pixel;
    uint8 * temp;
  
!   temp = (uint8*)xmalloc(cx * cy * 4);
    if (g_server_bpp == 8)
    {
***************
*** 1545,1552 ****
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!         *(((uint16*)temp) + (i * cx + j)) = get_pixel(srcx + j, srcy + i);
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!         set_pixel(x + j, y + i, *(((uint16*)temp) + (i * cx + j)), opcode);
    }
    else if (g_server_bpp == 24)
--- 1615,1628 ----
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!       {
!         pixel = get_pixel(srcx + j, srcy + i);
!         SETPIXEL16(temp, j, i, cx, pixel);
!       }
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!       {
!         pixel = GETPIXEL16(temp, j, i, cx);
!         set_pixel(x + j, y + i, pixel, opcode);
!       }
    }
    else if (g_server_bpp == 24)
***************
*** 1567,1571 ****
                 HBITMAP src, int srcx, int srcy)
  {
!   int i, j;
    struct bitmap * the_bitmap;
  
--- 1643,1647 ----
                 HBITMAP src, int srcx, int srcy)
  {
!   int i, j, p;
    struct bitmap * the_bitmap;
  
***************
*** 1573,1602 ****
    if (the_bitmap == NULL)
      return;
!   if (g_server_bpp == 8)
!   {
!     for (i = 0; i < cy; i++)
!       for (j = 0; j < cx; j++)
!         if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!           set_pixel(x + j, y + i,
!                     the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)],
!                     opcode);
!   }
!   else if (g_server_bpp == 16)
    {
!     for (i = 0; i < cy; i++)
!       for (j = 0; j < cx; j++)
!         if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!           set_pixel(x + j, y + i,
!                     *(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))),
!                     opcode);
    }
!   else if (g_server_bpp == 24)
    {
!     for (i = 0; i < cy; i++)
!       for (j = 0; j < cx; j++)
!         if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!           set_pixel(x + j, y + i,
!                     *(((uint32*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))),
!                     opcode);
    }
    redraw(x, y, cx, cy);
--- 1649,1716 ----
    if (the_bitmap == NULL)
      return;
! #ifdef QT_OPTI
!   if (opcode == 0xc) /* optimize */
    {
!     if (WarpCoords(&x, &y, &cx, &cy, &srcx, &srcy))
!     {
!       if (g_server_bpp == 8)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!           {
!             p = GETPIXEL8(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w);
!             SETPIXEL8(g_BS, x + j, y + i, g_width, p);
!           }
!       }
!       else if (g_server_bpp == 16)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!           {
!             p = GETPIXEL16(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w);
!             SETPIXEL16(g_BS, x + j, y + i, g_width, p);
!           }
!       }
!       else if (g_server_bpp == 24)
!       {
!         for (i = 0; i < cy; i++)
!           for (j = 0; j < cx; j++)
!           {
!             p = GETPIXEL32(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w);
!             SETPIXEL32(g_BS, x + j, y + i, g_width, p);
!           }
!       }
!     }
    }
!   else
! #endif
    {
!     if (g_server_bpp == 8)
!     {
!       for (i = 0; i < cy; i++)
!         for (j = 0; j < cx; j++)
!           if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!             set_pixel(x + j, y + i,
!                       the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)],
!                       opcode);
!     }
!     else if (g_server_bpp == 16)
!     {
!       for (i = 0; i < cy; i++)
!         for (j = 0; j < cx; j++)
!           if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!             set_pixel(x + j, y + i,
!                       *(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))),
!                       opcode);
!     }
!     else if (g_server_bpp == 24)
!     {
!       for (i = 0; i < cy; i++)
!         for (j = 0; j < cx; j++)
!           if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w)
!             set_pixel(x + j, y + i,
!                       *(((uint32*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))),
!                       opcode);
!     }
    }
    redraw(x, y, cx, cy);
***************
*** 1743,1749 ****
                    int fgcolour, uint8 * text, uint8 length)
  {
!   FONTGLYPH *glyph;
    int i, j, xyoffset;
!   DATABLOB *entry;
  
    if (boxcx > 1)
--- 1857,1868 ----
                    int fgcolour, uint8 * text, uint8 length)
  {
!   FONTGLYPH * glyph;
    int i, j, xyoffset;
!   DATABLOB * entry;
! 
!   if (boxx + boxcx > g_width)
!     boxcx = g_width - boxx;
!   if (boxy + boxcy > g_height)
!     boxcy = g_height - boxy;
  
    if (boxcx > 1)
***************
*** 1811,1816 ****
  {
    uint8 * data;
!   int i, j;
!   int Bpp;
  
    Bpp = 4;
--- 1930,1934 ----
  {
    uint8 * data;
!   int i, j, Bpp, pixel;
  
    Bpp = 4;
***************
*** 1826,1830 ****
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!         data[i * cx + j] = get_pixel(x + j, y + i);
    }
    else if (g_server_bpp == 16)
--- 1944,1951 ----
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!       {
!         pixel = get_pixel(x + j, y + i);
!         SETPIXEL8(data, j, i, cx, pixel);
!       }
    }
    else if (g_server_bpp == 16)
***************
*** 1832,1836 ****
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!         *(((uint16*)data) + (i * cx + j)) = get_pixel(x + j, y + i);
    }
    else if (g_server_bpp == 24)
--- 1953,1960 ----
      for (i = 0; i < cy; i++)
        for (j = 0; j < cx; j++)
!       {
!         pixel = get_pixel(x + j, y + i);
!         SETPIXEL16(data, j, i, cx, pixel);
!       }
    }
    else if (g_server_bpp == 24)
***************
*** 1848,1852 ****
  void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
  {
!   uint8* data;
    int i, j;
    int Bpp;
--- 1972,1976 ----
  void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
  {
!   uint8 * data;
    int i, j;
    int Bpp;
***************
*** 1883,1887 ****
  
  /*****************************************************************************/
! void* xrealloc(void *in_val, int size)
  {
    if (size < 1)
--- 2007,2011 ----
  
  /*****************************************************************************/
! void* xrealloc(void * in_val, int size)
  {
    if (size < 1)
***************
*** 2034,2039 ****
  {
    char fullhostname[64];
!   char* p;
!   struct passwd* pw;
  
    STRNCPY(g_username, "unknown", sizeof(g_username));
--- 2158,2163 ----
  {
    char fullhostname[64];
!   char * p;
!   struct passwd * pw;
  
    STRNCPY(g_username, "unknown", sizeof(g_username));
***************
*** 2072,2075 ****
--- 2196,2200 ----
    fprintf(stderr, "   -p: password (- to prompt)\n");
    fprintf(stderr, "   -n: client hostname\n");
+   fprintf(stderr, "   -f: full screen\n");
  
    fprintf(stderr, "\n");
***************
*** 2093,2109 ****
      {
        g_width = strtol(in_argv[i + 1], &p, 10);
-       if (g_width <= 0)
-       {
-         error("invalid geometry\n");
-         return 0;
-       }
        if (*p == 'x')
!         g_height = strtol(p + 1, NULL, 10);
!       if (g_height <= 0)
        {
!         error("invalid geometry\n");
!         return 0;
        }
        g_width = (g_width + 3) & ~3;
      }
      else if (strcmp(in_argv[i], "-4") == 0)
--- 2218,2237 ----
      {
        g_width = strtol(in_argv[i + 1], &p, 10);
        if (*p == 'x')
!         g_height = strtol(p + 1, &p, 10);
!       if (*p == '-')
!         g_client_width = strtol(p + 1, &p, 10);
!       else
        {
!         g_client_width = g_width;
!         g_client_height = g_height;
        }
+       if (*p == 'x')
+         g_client_height = strtol(p + 1, NULL, 10);
        g_width = (g_width + 3) & ~3;
+       g_height = (g_height + 3) & ~3;
+       g_client_width = (g_client_width + 3) & ~3;
+       g_client_height = (g_client_height + 3) & ~3;
+       //printf("%d %d %d %d\n", g_width, g_height, g_client_width, g_client_height);
      }
      else if (strcmp(in_argv[i], "-4") == 0)
***************
*** 2114,2118 ****
      {
        g_server_bpp = strtol(in_argv[i + 1], &p, 10);
!       if (g_server_bpp != 8 && g_server_bpp != 15 &&
            g_server_bpp != 16 && g_server_bpp != 24)
        {
--- 2242,2246 ----
      {
        g_server_bpp = strtol(in_argv[i + 1], &p, 10);
!       if (g_server_bpp != 8 &&
            g_server_bpp != 16 && g_server_bpp != 24)
        {
***************
*** 2149,2152 ****
--- 2277,2284 ----
        STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname));
      }
+     else if (strcmp(in_argv[i], "-f") == 0)
+     {
+       g_fullscreen = 1;
+     }
    }
    return 1;
***************
*** 2175,2179 ****
      g_CM->NumColors = 256;
      g_MW = new QMyMainWindow();
!     g_MW->resize(g_width, g_height);
      g_MW->show();
      g_SV->addChild(g_MW);
--- 2307,2311 ----
      g_CM->NumColors = 256;
      g_MW = new QMyMainWindow();
!     g_MW->resize(g_client_width, g_client_height);
      g_MW->show();
      g_SV->addChild(g_MW);
***************
*** 2189,2194 ****
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_width && dh == g_height)
!         g_MW->resize(g_width - 4, g_height - 4);
        g_SV->showFullScreen();
      }
--- 2321,2326 ----
        dw = Desktop->width();
        dh = Desktop->height();
!       if (dw == g_client_width && dh == g_client_height)
!         g_MW->resize(g_client_width - 4, g_client_height - 4);
        g_SV->showFullScreen();
      }
***************
*** 2205,2209 ****
    g_App = new QPEApplication(argc, argv);
  #else
!   g_App = new QApplication(argc, argv, QApplication::GuiServer);
  #endif
    g_SV = new QMyScrollView();
--- 2337,2342 ----
    g_App = new QPEApplication(argc, argv);
  #else
!   //g_App = new QApplication(argc, argv, QApplication::GuiServer);
!   g_App = new QApplication(argc, argv);
  #endif
    g_SV = new QMyScrollView();

Index: qtwin.cpp
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/uiports/qtwin.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** qtwin.cpp	30 Oct 2004 17:02:54 -0000	1.5
--- qtwin.cpp	3 Nov 2004 03:27:53 -0000	1.6
***************
*** 1006,1010 ****
  void ui_set_null_cursor(void)
  {
!   g_MW->setCursor(Qt::BlankCursor);
  }
  
--- 1006,1010 ----
  void ui_set_null_cursor(void)
  {
!   g_MW->setCursor(10); // Qt::BlankCursor
  }
  



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.