/[rdesktop]/sourceforge.net/trunk/rdesktop/xwin.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/xwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 603 by stargo, Sat Feb 7 18:47:06 2004 UTC revision 620 by astrand, Wed Mar 3 10:46:35 2004 UTC
# Line 21  Line 21 
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/Xutil.h>  #include <X11/Xutil.h>
23  #include <unistd.h>  #include <unistd.h>
24    #include <sys/time.h>
25  #include <time.h>  #include <time.h>
26  #include <errno.h>  #include <errno.h>
27  #include <strings.h>  #include <strings.h>
# Line 63  static int g_red_shift_r, g_blue_shift_r Line 64  static int g_red_shift_r, g_blue_shift_r
64  static int g_red_shift_l, g_blue_shift_l, g_green_shift_l;  static int g_red_shift_l, g_blue_shift_l, g_green_shift_l;
65    
66  /* software backing store */  /* software backing store */
67  static BOOL g_ownbackstore;  BOOL g_ownbackstore = True;     /* We can't rely on external BackingStore */
68  static Pixmap g_backstore = 0;  static Pixmap g_backstore = 0;
69    
70  /* Moving in single app mode */  /* Moving in single app mode */
# Line 168  static PixelColour Line 169  static PixelColour
169  split_colour15(uint32 colour)  split_colour15(uint32 colour)
170  {  {
171          PixelColour rv;          PixelColour rv;
172          rv.red = (colour & 0x7c00) >> 10;          rv.red = (colour & 0x7c00) >> 7;
173          rv.red = (rv.red * 0xff) / 0x1f;          rv.green = (colour & 0x03e0) >> 2;
174          rv.green = (colour & 0x03e0) >> 5;          rv.blue = (colour & 0x001f) << 3;
         rv.green = (rv.green * 0xff) / 0x1f;  
         rv.blue = (colour & 0x1f);  
         rv.blue = (rv.blue * 0xff) / 0x1f;  
175          return rv;          return rv;
176  }  }
177    
# Line 181  static PixelColour Line 179  static PixelColour
179  split_colour16(uint32 colour)  split_colour16(uint32 colour)
180  {  {
181          PixelColour rv;          PixelColour rv;
182          rv.red = (colour & 0xf800) >> 11;          rv.red = (colour & 0xf800) >> 8;
183          rv.red = (rv.red * 0xff) / 0x1f;          rv.green = (colour & 0x07e0) >> 3;
184          rv.green = (colour & 0x07e0) >> 5;          rv.blue = (colour & 0x001f) << 3;
         rv.green = (rv.green * 0xff) / 0x3f;  
         rv.blue = (colour & 0x001f);  
         rv.blue = (rv.blue * 0xff) / 0x1f;  
185          return rv;          return rv;
186  }  }
187    
# Line 195  split_colour24(uint32 colour) Line 190  split_colour24(uint32 colour)
190  {  {
191          PixelColour rv;          PixelColour rv;
192          rv.blue = (colour & 0xff0000) >> 16;          rv.blue = (colour & 0xff0000) >> 16;
193          rv.green = (colour & 0xff00) >> 8;          rv.green = (colour & 0x00ff00) >> 8;
194          rv.red = (colour & 0xff);          rv.red = (colour & 0x0000ff);
195          return rv;          return rv;
196  }  }
197    
# Line 791  ui_init(void) Line 786  ui_init(void)
786                          warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");                          warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
787          }          }
788    
789          if (DoesBackingStore(g_screen) != Always)          if ((!g_ownbackstore) && (DoesBackingStore(g_screen) != Always))
790            {
791                    warning("External BackingStore not available, using internal\n");
792                  g_ownbackstore = True;                  g_ownbackstore = True;
793            }
794    
795          test = 1;          test = 1;
796          g_host_be = !(BOOL) (*(uint8 *) (&test));          g_host_be = !(BOOL) (*(uint8 *) (&test));
# Line 1272  xwin_process_events(void) Line 1270  xwin_process_events(void)
1270  int  int
1271  ui_select(int rdp_socket)  ui_select(int rdp_socket)
1272  {  {
1273          int n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket;          int n;
1274          fd_set rfds, wfds;          fd_set rfds, wfds;
1275          struct timeval tv;          struct timeval tv;
1276          BOOL s_timeout = False;          BOOL s_timeout = False;
1277    
1278          while (True)          while (True)
1279          {          {
1280                    n = (rdp_socket > g_x_socket) ? rdp_socket : g_x_socket;
1281                  /* Process any events already waiting */                  /* Process any events already waiting */
1282                  if (!xwin_process_events())                  if (!xwin_process_events())
1283                          /* User quit */                          /* User quit */
# Line 1778  ui_screenblt(uint8 opcode, Line 1777  ui_screenblt(uint8 opcode,
1777               /* src */ int srcx, int srcy)               /* src */ int srcx, int srcy)
1778  {  {
1779          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
         XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);  
1780          if (g_ownbackstore)          if (g_ownbackstore)
1781            {
1782                    XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1783                  XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y);                  XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y);
1784            }
1785            else
1786            {
1787                    XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1788            }
1789          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
1790  }  }
1791    
# Line 1917  ui_draw_text(uint8 font, uint8 flags, in Line 1922  ui_draw_text(uint8 font, uint8 flags, in
1922    
1923          SET_FOREGROUND(bgcolour);          SET_FOREGROUND(bgcolour);
1924    
1925            /* Sometimes, the boxcx value is something really large, like
1926               32691. This makes XCopyArea fail with Xvnc. The code below
1927               is a quick fix. */
1928            if (boxx + boxcx > g_width)
1929                    boxcx = g_width - boxx;
1930    
1931          if (boxcx > 1)          if (boxcx > 1)
1932          {          {
1933                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);

Legend:
Removed from v.603  
changed lines
  Added in v.620

  ViewVC Help
Powered by ViewVC 1.1.26