/[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 609 by stargo, Mon Feb 16 20:28:09 2004 UTC revision 801 by astrand, Tue Nov 23 13:29:12 2004 UTC
# Line 30  Line 30 
30    
31  extern int g_width;  extern int g_width;
32  extern int g_height;  extern int g_height;
33    extern int g_xpos;
34    extern int g_ypos;
35  extern BOOL g_sendmotion;  extern BOOL g_sendmotion;
36  extern BOOL g_fullscreen;  extern BOOL g_fullscreen;
37  extern BOOL g_grab_keyboard;  extern BOOL g_grab_keyboard;
# Line 43  Time g_last_gesturetime; Line 45  Time g_last_gesturetime;
45  static int g_x_socket;  static int g_x_socket;
46  static Screen *g_screen;  static Screen *g_screen;
47  Window g_wnd;  Window g_wnd;
48    extern uint32 g_embed_wnd;
49  BOOL g_enable_compose = False;  BOOL g_enable_compose = False;
50    BOOL g_Unobscured;              /* used for screenblt */
51  static GC g_gc = NULL;  static GC g_gc = NULL;
52    static GC g_create_bitmap_gc = NULL;
53    static GC g_create_glyph_gc = NULL;
54  static Visual *g_visual;  static Visual *g_visual;
55  static int g_depth;  static int g_depth;
56  static int g_bpp;  static int g_bpp;
# Line 56  static HCURSOR g_null_cursor = NULL; Line 62  static HCURSOR g_null_cursor = NULL;
62  static Atom g_protocol_atom, g_kill_atom;  static Atom g_protocol_atom, g_kill_atom;
63  static BOOL g_focused;  static BOOL g_focused;
64  static BOOL g_mouse_in_wnd;  static BOOL g_mouse_in_wnd;
65    static BOOL g_arch_match = False;       /* set to True if RGB XServer and little endian */
66    
67  /* endianness */  /* endianness */
68  static BOOL g_host_be;  static BOOL g_host_be;
# Line 64  static int g_red_shift_r, g_blue_shift_r Line 71  static int g_red_shift_r, g_blue_shift_r
71  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;
72    
73  /* software backing store */  /* software backing store */
74  BOOL g_ownbackstore = True;     /* We can't rely on external BackingStore */  extern BOOL g_ownbackstore;
75  static Pixmap g_backstore = 0;  static Pixmap g_backstore = 0;
76    
77  /* Moving in single app mode */  /* Moving in single app mode */
# Line 113  PixelColour; Line 120  PixelColour;
120  }  }
121    
122  /* colour maps */  /* colour maps */
123  BOOL g_owncolmap = False;  extern BOOL g_owncolmap;
124  static Colormap g_xcolmap;  static Colormap g_xcolmap;
125  static uint32 *g_colmap = NULL;  static uint32 *g_colmap = NULL;
126    
# Line 169  static PixelColour Line 176  static PixelColour
176  split_colour15(uint32 colour)  split_colour15(uint32 colour)
177  {  {
178          PixelColour rv;          PixelColour rv;
179          rv.red = (colour & 0x7c00) >> 10;          rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7);
180          rv.red = (rv.red * 0xff) / 0x1f;          rv.green = ((colour >> 2) & 0xf8) | ((colour >> 8) & 0x7);
181          rv.green = (colour & 0x03e0) >> 5;          rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7);
         rv.green = (rv.green * 0xff) / 0x1f;  
         rv.blue = (colour & 0x1f);  
         rv.blue = (rv.blue * 0xff) / 0x1f;  
182          return rv;          return rv;
183  }  }
184    
# Line 182  static PixelColour Line 186  static PixelColour
186  split_colour16(uint32 colour)  split_colour16(uint32 colour)
187  {  {
188          PixelColour rv;          PixelColour rv;
189          rv.red = (colour & 0xf800) >> 11;          rv.red = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7);
190          rv.red = (rv.red * 0xff) / 0x1f;          rv.green = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3);
191          rv.green = (colour & 0x07e0) >> 5;          rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7);
         rv.green = (rv.green * 0xff) / 0x3f;  
         rv.blue = (colour & 0x001f);  
         rv.blue = (rv.blue * 0xff) / 0x1f;  
192          return rv;          return rv;
193  }  }
194    
# Line 196  split_colour24(uint32 colour) Line 197  split_colour24(uint32 colour)
197  {  {
198          PixelColour rv;          PixelColour rv;
199          rv.blue = (colour & 0xff0000) >> 16;          rv.blue = (colour & 0xff0000) >> 16;
200          rv.green = (colour & 0xff00) >> 8;          rv.green = (colour & 0x00ff00) >> 8;
201          rv.red = (colour & 0xff);          rv.red = (colour & 0x0000ff);
202          return rv;          return rv;
203  }  }
204    
# Line 233  translate_colour(uint32 colour) Line 234  translate_colour(uint32 colour)
234          return make_colour(pc);          return make_colour(pc);
235  }  }
236    
237    /* indent is confused by UNROLL8 */
238    /* *INDENT-OFF* */
239    
240    /* repeat and unroll, similar to bitmap.c */
241    /* potentialy any of the following translate */
242    /* functions can use repeat but just doing */
243    /* the most common ones */
244    
245    #define UNROLL8(stm) { stm stm stm stm stm stm stm stm }
246    /* 2 byte output repeat */
247    #define REPEAT2(stm) \
248    { \
249            while (out <= end - 8 * 2) \
250                    UNROLL8(stm) \
251            while (out < end) \
252                    { stm } \
253    }
254    /* 4 byte output repeat */
255    #define REPEAT4(stm) \
256    { \
257            while (out <= end - 8 * 4) \
258                    UNROLL8(stm) \
259            while (out < end) \
260                    { stm } \
261    }
262    
263  static void  static void
264  translate8to8(uint8 * data, uint8 * out, uint8 * end)  translate8to8(uint8 * data, uint8 * out, uint8 * end)
265  {  {
# Line 245  translate8to16(uint8 * data, uint8 * out Line 272  translate8to16(uint8 * data, uint8 * out
272  {  {
273          uint16 value;          uint16 value;
274    
275          while (out < end)          if (g_arch_match)
276          {          {
277                  value = (uint16) g_colmap[*(data++)];                  REPEAT2
278                    (
279                  if (g_xserver_be)                          *((uint16 *) out) = g_colmap[*(data++)];
280                            out += 2;
281                    )
282            }
283            else if (g_xserver_be)
284            {
285                    while (out < end)
286                  {                  {
287                            value = (uint16) g_colmap[*(data++)];
288                          *(out++) = value >> 8;                          *(out++) = value >> 8;
289                          *(out++) = value;                          *(out++) = value;
290                  }                  }
291                  else          }
292            else
293            {
294                    while (out < end)
295                  {                  {
296                            value = (uint16) g_colmap[*(data++)];
297                          *(out++) = value;                          *(out++) = value;
298                          *(out++) = value >> 8;                          *(out++) = value >> 8;
299                  }                  }
# Line 268  translate8to24(uint8 * data, uint8 * out Line 306  translate8to24(uint8 * data, uint8 * out
306  {  {
307          uint32 value;          uint32 value;
308    
309          while (out < end)          if (g_xserver_be)
310          {          {
311                  value = g_colmap[*(data++)];                  while (out < end)
   
                 if (g_xserver_be)  
312                  {                  {
313                            value = g_colmap[*(data++)];
314                          *(out++) = value >> 16;                          *(out++) = value >> 16;
315                          *(out++) = value >> 8;                          *(out++) = value >> 8;
316                          *(out++) = value;                          *(out++) = value;
317                  }                  }
318                  else          }
319            else
320            {
321                    while (out < end)
322                  {                  {
323                            value = g_colmap[*(data++)];
324                          *(out++) = value;                          *(out++) = value;
325                          *(out++) = value >> 8;                          *(out++) = value >> 8;
326                          *(out++) = value >> 16;                          *(out++) = value >> 16;
# Line 292  translate8to32(uint8 * data, uint8 * out Line 333  translate8to32(uint8 * data, uint8 * out
333  {  {
334          uint32 value;          uint32 value;
335    
336          while (out < end)          if (g_arch_match)
337          {          {
338                  value = g_colmap[*(data++)];                  REPEAT4
339                    (
340                  if (g_xserver_be)                          *((uint32 *) out) = g_colmap[*(data++)];
341                            out += 4;
342                    )
343            }
344            else if (g_xserver_be)
345            {
346                    while (out < end)
347                  {                  {
348                            value = g_colmap[*(data++)];
349                          *(out++) = value >> 24;                          *(out++) = value >> 24;
350                          *(out++) = value >> 16;                          *(out++) = value >> 16;
351                          *(out++) = value >> 8;                          *(out++) = value >> 8;
352                          *(out++) = value;                          *(out++) = value;
353                  }                  }
354                  else          }
355            else
356            {
357                    while (out < end)
358                  {                  {
359                            value = g_colmap[*(data++)];
360                          *(out++) = value;                          *(out++) = value;
361                          *(out++) = value >> 8;                          *(out++) = value >> 8;
362                          *(out++) = value >> 16;                          *(out++) = value >> 16;
# Line 313  translate8to32(uint8 * data, uint8 * out Line 365  translate8to32(uint8 * data, uint8 * out
365          }          }
366  }  }
367    
368    /* *INDENT-ON* */
369    
370  static void  static void
371  translate15to16(uint16 * data, uint8 * out, uint8 * end)  translate15to16(uint16 * data, uint8 * out, uint8 * end)
372  {  {
# Line 593  translate24to32(uint8 * data, uint8 * ou Line 647  translate24to32(uint8 * data, uint8 * ou
647  static uint8 *  static uint8 *
648  translate_image(int width, int height, uint8 * data)  translate_image(int width, int height, uint8 * data)
649  {  {
650          int size = width * height * g_bpp / 8;          int size;
651          uint8 *out = (uint8 *) xmalloc(size);          uint8 *out;
652          uint8 *end = out + size;          uint8 *end;
653    
654            /* if server and xserver bpp match, */
655            /* and arch(endian) matches, no need to translate */
656            /* just return data */
657            if (g_arch_match)
658            {
659                    if (g_depth == 15 && g_server_bpp == 15)
660                            return data;
661                    if (g_depth == 16 && g_server_bpp == 16)
662                            return data;
663            }
664    
665            size = width * height * (g_bpp / 8);
666            out = (uint8 *) xmalloc(size);
667            end = out + size;
668    
669          switch (g_server_bpp)          switch (g_server_bpp)
670          {          {
# Line 733  ui_init(void) Line 802  ui_init(void)
802                  TrueColorVisual = True;                  TrueColorVisual = True;
803          }          }
804    
805            test = 1;
806            g_host_be = !(BOOL) (*(uint8 *) (&test));
807            g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
808    
809          if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8)))          if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8)))
810          {          {
811                  /* we use a colourmap, so the default visual should do */                  /* we use a colourmap, so the default visual should do */
# Line 759  ui_init(void) Line 832  ui_init(void)
832                  calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l);                  calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l);
833                  calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l);                  calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l);
834                  calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l);                  calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l);
835    
836                    /* if RGB video and averything is little endian */
837                    if (vi.red_mask > vi.green_mask && vi.green_mask > vi.blue_mask)
838                            if (!g_xserver_be && !g_host_be)
839                                    g_arch_match = True;
840          }          }
841    
842          pfm = XListPixmapFormats(g_display, &i);          pfm = XListPixmapFormats(g_display, &i);
# Line 798  ui_init(void) Line 876  ui_init(void)
876                  g_ownbackstore = True;                  g_ownbackstore = True;
877          }          }
878    
         test = 1;  
         g_host_be = !(BOOL) (*(uint8 *) (&test));  
         g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);  
   
879          /*          /*
880           * Determine desktop size           * Determine desktop size
881           */           */
# Line 874  BOOL Line 948  BOOL
948  ui_create_window(void)  ui_create_window(void)
949  {  {
950          uint8 null_pointer_mask[1] = { 0x80 };          uint8 null_pointer_mask[1] = { 0x80 };
951          uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 };          uint8 null_pointer_data[24] = { 0x00 };
952    
953          XSetWindowAttributes attribs;          XSetWindowAttributes attribs;
954          XClassHint *classhints;          XClassHint *classhints;
955          XSizeHints *sizehints;          XSizeHints *sizehints;
# Line 891  ui_create_window(void) Line 966  ui_create_window(void)
966          attribs.override_redirect = g_fullscreen;          attribs.override_redirect = g_fullscreen;
967          attribs.colormap = g_xcolmap;          attribs.colormap = g_xcolmap;
968    
969          g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, wndwidth, wndheight,          g_wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), g_xpos, g_ypos, wndwidth,
970                                0, g_depth, InputOutput, g_visual,                                wndheight, 0, g_depth, InputOutput, g_visual,
971                                CWBackPixel | CWBackingStore | CWOverrideRedirect |                                CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
972                                CWColormap | CWBorderPixel, &attribs);                                CWBorderPixel, &attribs);
973    
974          if (g_gc == NULL)          if (g_gc == NULL)
975                  g_gc = XCreateGC(g_display, g_wnd, 0, NULL);                  g_gc = XCreateGC(g_display, g_wnd, 0, NULL);
976    
977            if (g_create_bitmap_gc == NULL)
978                    g_create_bitmap_gc = XCreateGC(g_display, g_wnd, 0, NULL);
979    
980          if ((g_ownbackstore) && (g_backstore == 0))          if ((g_ownbackstore) && (g_backstore == 0))
981          {          {
982                  g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth);                  g_backstore = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth);
# Line 931  ui_create_window(void) Line 1009  ui_create_window(void)
1009                  XFree(sizehints);                  XFree(sizehints);
1010          }          }
1011    
1012            if (g_embed_wnd)
1013            {
1014                    XReparentWindow(g_display, g_wnd, (Window) g_embed_wnd, 0, 0);
1015            }
1016    
1017          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
1018                  VisibilityChangeMask | FocusChangeMask;                  VisibilityChangeMask | FocusChangeMask;
1019    
# Line 962  ui_create_window(void) Line 1045  ui_create_window(void)
1045                  XMaskEvent(g_display, VisibilityChangeMask, &xevent);                  XMaskEvent(g_display, VisibilityChangeMask, &xevent);
1046          }          }
1047          while (xevent.type != VisibilityNotify);          while (xevent.type != VisibilityNotify);
1048            g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1049    
1050          g_focused = False;          g_focused = False;
1051          g_mouse_in_wnd = False;          g_mouse_in_wnd = False;
# Line 979  ui_create_window(void) Line 1063  ui_create_window(void)
1063  }  }
1064    
1065  void  void
1066    ui_resize_window()
1067    {
1068            XSizeHints *sizehints;
1069            Pixmap bs;
1070    
1071            sizehints = XAllocSizeHints();
1072            if (sizehints)
1073            {
1074                    sizehints->flags = PMinSize | PMaxSize;
1075                    sizehints->min_width = sizehints->max_width = g_width;
1076                    sizehints->min_height = sizehints->max_height = g_height;
1077                    XSetWMNormalHints(g_display, g_wnd, sizehints);
1078                    XFree(sizehints);
1079            }
1080    
1081            if (!(g_fullscreen || g_embed_wnd))
1082            {
1083                    XResizeWindow(g_display, g_wnd, g_width, g_height);
1084            }
1085    
1086            /* create new backstore pixmap */
1087            if (g_backstore != 0)
1088            {
1089                    bs = XCreatePixmap(g_display, g_wnd, g_width, g_height, g_depth);
1090                    XSetForeground(g_display, g_gc, BlackPixelOfScreen(g_screen));
1091                    XFillRectangle(g_display, bs, g_gc, 0, 0, g_width, g_height);
1092                    XCopyArea(g_display, g_backstore, bs, g_gc, 0, 0, g_width, g_height, 0, 0);
1093                    XFreePixmap(g_display, g_backstore);
1094                    g_backstore = bs;
1095            }
1096    }
1097    
1098    void
1099  ui_destroy_window(void)  ui_destroy_window(void)
1100  {  {
1101          if (g_IC != NULL)          if (g_IC != NULL)
# Line 1039  xwin_process_events(void) Line 1156  xwin_process_events(void)
1156    
1157                  switch (xevent.type)                  switch (xevent.type)
1158                  {                  {
1159                            case VisibilityNotify:
1160                                    g_Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1161                                    break;
1162                          case ClientMessage:                          case ClientMessage:
1163                                  /* the window manager told us to quit */                                  /* the window manager told us to quit */
1164                                  if ((xevent.xclient.message_type == g_protocol_atom)                                  if ((xevent.xclient.message_type == g_protocol_atom)
# Line 1317  ui_select(int rdp_socket) Line 1437  ui_select(int rdp_socket)
1437                                  error("select: %s\n", strerror(errno));                                  error("select: %s\n", strerror(errno));
1438    
1439                          case 0:                          case 0:
1440                                  /* TODO: if tv.tv_sec just times out                                  /* Abort serial read calls */
1441                                   * we will segfault.                                  if (s_timeout)
1442                                   * FIXME:                                          rdpdr_check_fds(&rfds, &wfds, (BOOL) True);
                                  */  
                                 //s_timeout = True;  
                                 //rdpdr_check_fds(&rfds, &wfds, (BOOL) True);  
1443                                  continue;                                  continue;
1444                  }                  }
1445    
# Line 1369  ui_create_bitmap(int width, int height, Line 1486  ui_create_bitmap(int width, int height,
1486          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,          image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
1487                               (char *) tdata, width, height, bitmap_pad, 0);                               (char *) tdata, width, height, bitmap_pad, 0);
1488    
1489          XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height);          XPutImage(g_display, bitmap, g_create_bitmap_gc, image, 0, 0, 0, 0, width, height);
1490    
1491          XFree(image);          XFree(image);
1492          if (!g_owncolmap)          if (tdata != data)
1493                  xfree(tdata);                  xfree(tdata);
1494          return (HBITMAP) bitmap;          return (HBITMAP) bitmap;
1495  }  }
# Line 1411  ui_paint_bitmap(int x, int y, int cx, in Line 1528  ui_paint_bitmap(int x, int y, int cx, in
1528          }          }
1529    
1530          XFree(image);          XFree(image);
1531          if (!g_owncolmap)          if (tdata != data)
1532                  xfree(tdata);                  xfree(tdata);
1533  }  }
1534    
# Line 1427  ui_create_glyph(int width, int height, u Line 1544  ui_create_glyph(int width, int height, u
1544          XImage *image;          XImage *image;
1545          Pixmap bitmap;          Pixmap bitmap;
1546          int scanline;          int scanline;
         GC gc;  
1547    
1548          scanline = (width + 7) / 8;          scanline = (width + 7) / 8;
1549    
1550          bitmap = XCreatePixmap(g_display, g_wnd, width, height, 1);          bitmap = XCreatePixmap(g_display, g_wnd, width, height, 1);
1551          gc = XCreateGC(g_display, bitmap, 0, NULL);          if (g_create_glyph_gc == 0)
1552                    g_create_glyph_gc = XCreateGC(g_display, bitmap, 0, NULL);
1553    
1554          image = XCreateImage(g_display, g_visual, 1, ZPixmap, 0, (char *) data,          image = XCreateImage(g_display, g_visual, 1, ZPixmap, 0, (char *) data,
1555                               width, height, 8, scanline);                               width, height, 8, scanline);
# Line 1440  ui_create_glyph(int width, int height, u Line 1557  ui_create_glyph(int width, int height, u
1557          image->bitmap_bit_order = MSBFirst;          image->bitmap_bit_order = MSBFirst;
1558          XInitImage(image);          XInitImage(image);
1559    
1560          XPutImage(g_display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height);
1561    
1562          XFree(image);          XFree(image);
         XFreeGC(g_display, gc);  
1563          return (HGLYPH) bitmap;          return (HGLYPH) bitmap;
1564  }  }
1565    
# Line 1735  ui_patblt(uint8 opcode, Line 1851  ui_patblt(uint8 opcode,
1851          {          {
1852                  case 0: /* Solid */                  case 0: /* Solid */
1853                          SET_FOREGROUND(fgcolour);                          SET_FOREGROUND(fgcolour);
1854                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1855                          break;                          break;
1856    
1857                  case 2: /* Hatch */                  case 2: /* Hatch */
# Line 1746  ui_patblt(uint8 opcode, Line 1862  ui_patblt(uint8 opcode,
1862                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1863                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1864                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
1865                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1866                          XSetFillStyle(g_display, g_gc, FillSolid);                          XSetFillStyle(g_display, g_gc, FillSolid);
1867                          XSetTSOrigin(g_display, g_gc, 0, 0);                          XSetTSOrigin(g_display, g_gc, 0, 0);
1868                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
# Line 1756  ui_patblt(uint8 opcode, Line 1872  ui_patblt(uint8 opcode,
1872                          for (i = 0; i != 8; i++)                          for (i = 0; i != 8; i++)
1873                                  ipattern[7 - i] = brush->pattern[i];                                  ipattern[7 - i] = brush->pattern[i];
1874                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
   
1875                          SET_FOREGROUND(bgcolour);                          SET_FOREGROUND(bgcolour);
1876                          SET_BACKGROUND(fgcolour);                          SET_BACKGROUND(fgcolour);
1877                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
1878                          XSetStipple(g_display, g_gc, fill);                          XSetStipple(g_display, g_gc, fill);
1879                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
1880                            FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
                         FILL_RECTANGLE(x, y, cx, cy);  
   
1881                          XSetFillStyle(g_display, g_gc, FillSolid);                          XSetFillStyle(g_display, g_gc, FillSolid);
1882                          XSetTSOrigin(g_display, g_gc, 0, 0);                          XSetTSOrigin(g_display, g_gc, 0, 0);
1883                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
# Line 1775  ui_patblt(uint8 opcode, Line 1888  ui_patblt(uint8 opcode,
1888          }          }
1889    
1890          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
1891    
1892            if (g_ownbackstore)
1893                    XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y);
1894  }  }
1895    
1896  void  void
# Line 1785  ui_screenblt(uint8 opcode, Line 1901  ui_screenblt(uint8 opcode,
1901          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
1902          if (g_ownbackstore)          if (g_ownbackstore)
1903          {          {
1904                  XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);                  if (g_Unobscured)
1905                  XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x, y);                  {
1906                            XCopyArea(g_display, g_wnd, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1907                            XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x,
1908                                      y);
1909                    }
1910                    else
1911                    {
1912                            XCopyArea(g_display, g_backstore, g_wnd, g_gc, srcx, srcy, cx, cy, x, y);
1913                            XCopyArea(g_display, g_backstore, g_backstore, g_gc, srcx, srcy, cx, cy, x,
1914                                      y);
1915                    }
1916          }          }
1917          else          else
1918          {          {
# Line 1928  ui_draw_text(uint8 font, uint8 flags, in Line 2054  ui_draw_text(uint8 font, uint8 flags, in
2054    
2055          SET_FOREGROUND(bgcolour);          SET_FOREGROUND(bgcolour);
2056    
2057            /* Sometimes, the boxcx value is something really large, like
2058               32691. This makes XCopyArea fail with Xvnc. The code below
2059               is a quick fix. */
2060            if (boxx + boxcx > g_width)
2061                    boxcx = g_width - boxx;
2062    
2063          if (boxcx > 1)          if (boxcx > 1)
2064          {          {
2065                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);
# Line 2055  ui_desktop_restore(uint32 offset, int x, Line 2187  ui_desktop_restore(uint32 offset, int x,
2187    
2188          XFree(image);          XFree(image);
2189  }  }
2190    
2191    /* these do nothing here but are used in uiports */
2192    void
2193    ui_begin_update(void)
2194    {
2195    }
2196    
2197    void
2198    ui_end_update(void)
2199    {
2200    }

Legend:
Removed from v.609  
changed lines
  Added in v.801

  ViewVC Help
Powered by ViewVC 1.1.26