/[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 679 by jsorg71, Mon Apr 26 23:00:25 2004 UTC revision 708 by jsorg71, Fri Jun 4 15:01:36 2004 UTC
# Line 45  static Screen *g_screen; Line 45  static Screen *g_screen;
45  Window g_wnd;  Window g_wnd;
46  extern uint32 g_embed_wnd;  extern uint32 g_embed_wnd;
47  BOOL g_enable_compose = False;  BOOL g_enable_compose = False;
48    BOOL g_Unobscured;              /* used for screenblt */
49  static GC g_gc = NULL;  static GC g_gc = NULL;
50  static Visual *g_visual;  static Visual *g_visual;
51  static int g_depth;  static int g_depth;
# Line 171  static PixelColour Line 172  static PixelColour
172  split_colour15(uint32 colour)  split_colour15(uint32 colour)
173  {  {
174          PixelColour rv;          PixelColour rv;
175          rv.red = (colour & 0x7c00) >> 7;          rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7);
176          rv.green = (colour & 0x03e0) >> 2;          rv.green = ((colour >> 2) & 0xf8) | ((colour >> 8) & 0x7);
177          rv.blue = (colour & 0x001f) << 3;          rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7);
178          return rv;          return rv;
179  }  }
180    
# Line 181  static PixelColour Line 182  static PixelColour
182  split_colour16(uint32 colour)  split_colour16(uint32 colour)
183  {  {
184          PixelColour rv;          PixelColour rv;
185          rv.red = (colour & 0xf800) >> 8;          rv.red = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7);
186          rv.green = (colour & 0x07e0) >> 3;          rv.green = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3);
187          rv.blue = (colour & 0x001f) << 3;          rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7);
188          return rv;          return rv;
189  }  }
190    
# Line 251  translate8to16(uint8 * data, uint8 * out Line 252  translate8to16(uint8 * data, uint8 * out
252          uint16 value;          uint16 value;
253    
254          if (g_arch_match)          if (g_arch_match)
255                  REPEAT(*(((uint16*)out)++) = g_colmap[*(data++)];)                  REPEAT(*((uint16 *) out) = g_colmap[*(data++)];
256          else if (g_xserver_be)                         out += 2;)
257            else
258    if (g_xserver_be)
259    {
260            while (out < end)
261          {          {
262                  while (out < end)                  value = (uint16) g_colmap[*(data++)];
263                  {                  *(out++) = value >> 8;
264                          value = (uint16) g_colmap[*(data++)];                  *(out++) = value;
                         *(out++) = value >> 8;  
                         *(out++) = value;  
                 }  
265          }          }
266          else  }
267    else
268    {
269            while (out < end)
270          {          {
271                  while (out < end)                  value = (uint16) g_colmap[*(data++)];
272                  {                  *(out++) = value;
273                          value = (uint16) g_colmap[*(data++)];                  *(out++) = value >> 8;
                         *(out++) = value;  
                         *(out++) = value >> 8;  
                 }  
274          }          }
275  }  }
276    }
277    
278  /* little endian - conversion happens when colourmap is built */  /* little endian - conversion happens when colourmap is built */
279  static void  static void
# Line 306  translate8to32(uint8 * data, uint8 * out Line 309  translate8to32(uint8 * data, uint8 * out
309          uint32 value;          uint32 value;
310    
311          if (g_arch_match)          if (g_arch_match)
312                  REPEAT(*(((uint32*)out)++) = g_colmap[*(data++)];)                  REPEAT(*((uint32 *) out) = g_colmap[*(data++)];
313          else if (g_xserver_be)                         out += 4;)
314            else
315    if (g_xserver_be)
316    {
317            while (out < end)
318          {          {
319                  while (out < end)                  value = g_colmap[*(data++)];
320                  {                  *(out++) = value >> 24;
321                          value = g_colmap[*(data++)];                  *(out++) = value >> 16;
322                          *(out++) = value >> 24;                  *(out++) = value >> 8;
323                          *(out++) = value >> 16;                  *(out++) = value;
                         *(out++) = value >> 8;  
                         *(out++) = value;  
                 }  
324          }          }
325          else  }
326    else
327    {
328            while (out < end)
329          {          {
330                  while (out < end)                  value = g_colmap[*(data++)];
331                  {                  *(out++) = value;
332                          value = g_colmap[*(data++)];                  *(out++) = value >> 8;
333                          *(out++) = value;                  *(out++) = value >> 16;
334                          *(out++) = value >> 8;                  *(out++) = value >> 24;
                         *(out++) = value >> 16;  
                         *(out++) = value >> 24;  
                 }  
335          }          }
336  }  }
337    }
338    
339  static void  static void
340  translate15to16(uint16 * data, uint8 * out, uint8 * end)  translate15to16(uint16 * data, uint8 * out, uint8 * end)
# Line 1005  ui_create_window(void) Line 1010  ui_create_window(void)
1010                  XMaskEvent(g_display, VisibilityChangeMask, &xevent);                  XMaskEvent(g_display, VisibilityChangeMask, &xevent);
1011          }          }
1012          while (xevent.type != VisibilityNotify);          while (xevent.type != VisibilityNotify);
1013            g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1014    
1015          g_focused = False;          g_focused = False;
1016          g_mouse_in_wnd = False;          g_mouse_in_wnd = False;
# Line 1025  void Line 1031  void
1031  ui_resize_window()  ui_resize_window()
1032  {  {
1033          XSizeHints *sizehints;          XSizeHints *sizehints;
1034            Pixmap bs;
1035    
1036          sizehints = XAllocSizeHints();          sizehints = XAllocSizeHints();
1037          if (sizehints)          if (sizehints)
# Line 1040  ui_resize_window() Line 1047  ui_resize_window()
1047          {          {
1048                  XResizeWindow(g_display, g_wnd, g_width, g_height);                  XResizeWindow(g_display, g_wnd, g_width, g_height);
1049          }          }
1050    
1051            /* create new backstore pixmap */
1052            if (g_backstore != 0)
1053            {
1054                    bs = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth);
1055                    XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
1056                    XFillRectangle(g_display, bs, g_gc, 0, 0, g_width, g_height);
1057                    XCopyArea(g_display, g_backstore, bs, g_gc, 0, 0, g_width, g_height, 0, 0);
1058                    XFreePixmap(g_display, g_backstore);
1059                    g_backstore = bs;
1060            }
1061  }  }
1062    
1063  void  void
# Line 1103  xwin_process_events(void) Line 1121  xwin_process_events(void)
1121    
1122                  switch (xevent.type)                  switch (xevent.type)
1123                  {                  {
1124                            case VisibilityNotify:
1125                                    g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1126                                    break;
1127                          case ClientMessage:                          case ClientMessage:
1128                                  /* the window manager told us to quit */                                  /* the window manager told us to quit */
1129                                  if ((xevent.xclient.message_type == g_protocol_atom)                                  if ((xevent.xclient.message_type == g_protocol_atom)
# Line 1799  ui_patblt(uint8 opcode, Line 1820  ui_patblt(uint8 opcode,
1820          {          {
1821                  case 0: /* Solid */                  case 0: /* Solid */
1822                          SET_FOREGROUND(fgcolour);                          SET_FOREGROUND(fgcolour);
1823                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1824                          break;                          break;
1825    
1826                  case 2: /* Hatch */                  case 2: /* Hatch */
# Line 1810  ui_patblt(uint8 opcode, Line 1831  ui_patblt(uint8 opcode,
1831                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1832                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1833                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
1834                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1835                          XSetFillStyle(g_display, g_gc, FillSolid);                          XSetFillStyle(g_display, g_gc, FillSolid);
1836                          XSetTSOrigin(g_display, g_gc, 0, 0);                          XSetTSOrigin(g_display, g_gc, 0, 0);
1837                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
# Line 1820  ui_patblt(uint8 opcode, Line 1841  ui_patblt(uint8 opcode,
1841                          for (i = 0; i != 8; i++)                          for (i = 0; i != 8; i++)
1842                                  ipattern[7 - i] = brush->pattern[i];                                  ipattern[7 - i] = brush->pattern[i];
1843                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
   
1844                          SET_FOREGROUND(bgcolour);                          SET_FOREGROUND(bgcolour);
1845                          SET_BACKGROUND(fgcolour);                          SET_BACKGROUND(fgcolour);
1846                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1847                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1848                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
1849                            FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
                         FILL_RECTANGLE(x, y, cx, cy);  
   
1850                          XSetFillStyle(g_display, g_gc, FillSolid);                          XSetFillStyle(g_display, g_gc, FillSolid);
1851                          XSetTSOrigin(g_display, g_gc, 0, 0);                          XSetTSOrigin(g_display, g_gc, 0, 0);
1852                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
# Line 1839  ui_patblt(uint8 opcode, Line 1857  ui_patblt(uint8 opcode,
1857          }          }
1858    
1859          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
1860    
1861            if (g_ownbackstore)
1862                    XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y);
1863  }  }
1864    
1865  void  void
# Line 1849  ui_screenblt(uint8 opcode, Line 1870  ui_screenblt(uint8 opcode,
1870          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
1871          if (g_ownbackstore)          if (g_ownbackstore)
1872          {          {
1873                  XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);                  if (g_Unobscured)
1874                  XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y);                  {
1875                            XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1876                            XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x,
1877                                      y);
1878                    }
1879                    else
1880                    {
1881                            XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1882                            XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x,
1883                                      y);
1884                    }
1885          }          }
1886          else          else
1887          {          {

Legend:
Removed from v.679  
changed lines
  Added in v.708

  ViewVC Help
Powered by ViewVC 1.1.26