/[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 30 by matty, Fri Sep 14 13:51:38 2001 UTC revision 31 by matty, Sat Sep 15 03:16:05 2001 UTC
# Line 34  static GC gc; Line 34  static GC gc;
34  static Visual *visual;  static Visual *visual;
35  static int depth;  static int depth;
36  static int bpp;  static int bpp;
37  static BOOL backpixmap;  
38    static BOOL ownbackstore;
39    static Pixmap backstore;
40    
41    #define FILL_RECTANGLE(x,y,cx,cy)\
42    { \
43            XFillRectangle(display, wnd, gc, x, y, cx, cy); \
44            if (ownbackstore) \
45                    XFillRectangle(display, backstore, gc, x, y, cx, cy); \
46    }
47    
48  static BOOL owncolmap;  static BOOL owncolmap;
49  static Colormap xcolmap;  static Colormap xcolmap;
# Line 192  ui_create_window(char *title) Line 201  ui_create_window(char *title)
201          attribs.backing_store = DoesBackingStore(screen);          attribs.backing_store = DoesBackingStore(screen);
202    
203          if (attribs.backing_store == NotUseful)          if (attribs.backing_store == NotUseful)
204                  backpixmap = True;                  ownbackstore = True;
205    
206          if (fullscreen)          if (fullscreen)
207          {          {
# Line 240  ui_create_window(char *title) Line 249  ui_create_window(char *title)
249          if (sendmotion)          if (sendmotion)
250                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
251    
252            if (ownbackstore)
253                    input_mask |= ExposureMask;
254    
255          XSelectInput(display, wnd, input_mask);          XSelectInput(display, wnd, input_mask);
256          gc = XCreateGC(display, wnd, 0, NULL);          gc = XCreateGC(display, wnd, 0, NULL);
257    
258            if (ownbackstore)
259                    backstore = XCreatePixmap(display, wnd, width, height, depth);
260    
261          XMapWindow(display, wnd);          XMapWindow(display, wnd);
262          return True;          return True;
263  }  }
# Line 250  ui_create_window(char *title) Line 265  ui_create_window(char *title)
265  void  void
266  ui_destroy_window()  ui_destroy_window()
267  {  {
268            if (ownbackstore)
269                    XFreePixmap(display, backstore);
270    
271          XFreeGC(display, gc);          XFreeGC(display, gc);
272          XDestroyWindow(display, wnd);          XDestroyWindow(display, wnd);
273          XCloseDisplay(display);          XCloseDisplay(display);
# Line 398  ui_process_events() Line 416  ui_process_events()
416                          case LeaveNotify:                          case LeaveNotify:
417                                  XUngrabKeyboard(display, CurrentTime);                                  XUngrabKeyboard(display, CurrentTime);
418                                  break;                                  break;
419    
420                            case Expose:
421                                    XCopyArea(display, backstore, wnd, gc,
422                                              event.xexpose.x, event.xexpose.y,
423                                              event.xexpose.width, event.xexpose.height,
424                                              event.xexpose.x, event.xexpose.y);
425                                    break;
426                  }                  }
427          }          }
428  }  }
# Line 439  ui_paint_bitmap(int x, int y, int cx, in Line 464  ui_paint_bitmap(int x, int y, int cx, in
464          image = XCreateImage(display, visual, depth, ZPixmap,          image = XCreateImage(display, visual, depth, ZPixmap,
465                               0, tdata, width, height, 8, 0);                               0, tdata, width, height, 8, 0);
466    
467          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);          if (ownbackstore)
468            {
469                    XPutImage(display, backstore, gc, image, 0, 0, x, y, cx, cy);
470                    XCopyArea(display, backstore, wnd, gc, x, y, cx, cy, x, y);
471            }
472            else
473            {
474                    XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
475            }
476    
477          XFree(image);          XFree(image);
478          if (!owncolmap)          if (!owncolmap)
# Line 671  ui_destblt(uint8 opcode, Line 704  ui_destblt(uint8 opcode,
704             /* dest */ int x, int y, int cx, int cy)             /* dest */ int x, int y, int cx, int cy)
705  {  {
706          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
707          XFillRectangle(display, wnd, gc, x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
708          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
709  }  }
710    
# Line 688  ui_patblt(uint8 opcode, Line 721  ui_patblt(uint8 opcode,
721          {          {
722                  case 0: /* Solid */                  case 0: /* Solid */
723                          SET_FOREGROUND(fgcolour);                          SET_FOREGROUND(fgcolour);
724                          XFillRectangle(display, wnd, gc, x, y, cx, cy);                          FILL_RECTANGLE(x, y, cx, cy);
725                          break;                          break;
726    
727                  case 3: /* Pattern */                  case 3: /* Pattern */
# Line 700  ui_patblt(uint8 opcode, Line 733  ui_patblt(uint8 opcode,
733                          XSetStipple(display, gc, fill);                          XSetStipple(display, gc, fill);
734                          XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin);                          XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin);
735    
736                          XFillRectangle(display, wnd, gc, x, y, cx, cy);                          FILL_RECTANGLE(x, y, cx, cy);
737    
738                          XSetFillStyle(display, gc, FillSolid);                          XSetFillStyle(display, gc, FillSolid);
739                          ui_destroy_glyph((HGLYPH)fill);                          ui_destroy_glyph((HGLYPH)fill);
# Line 720  ui_screenblt(uint8 opcode, Line 753  ui_screenblt(uint8 opcode,
753  {  {
754          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
755          XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);          XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);
756            if (ownbackstore)
757                    XCopyArea(display, backstore, backstore, gc, srcx, srcy,
758                              cx, cy, x, y);
759          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
760  }  }
761    
# Line 730  ui_memblt(uint8 opcode, Line 766  ui_memblt(uint8 opcode,
766  {  {
767          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
768          XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy, cx, cy, x, y);          XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy, cx, cy, x, y);
769            if (ownbackstore)
770                    XCopyArea(display, (Pixmap)src, backstore, gc, srcx, srcy,
771                              cx, cy, x, y);
772          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
773  }  }
774    
# Line 778  ui_line(uint8 opcode, Line 817  ui_line(uint8 opcode,
817          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
818          SET_FOREGROUND(pen->colour);          SET_FOREGROUND(pen->colour);
819          XDrawLine(display, wnd, gc, startx, starty, endx, endy);          XDrawLine(display, wnd, gc, startx, starty, endx, endy);
820            if (ownbackstore)
821                    XDrawLine(display, backstore, gc, startx, starty, endx, endy);
822          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
823  }  }
824    
# Line 787  ui_rect( Line 828  ui_rect(
828                 /* brush */ int colour)                 /* brush */ int colour)
829  {  {
830          SET_FOREGROUND(colour);          SET_FOREGROUND(colour);
831          XFillRectangle(display, wnd, gc, x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
832  }  }
833    
834  void  void
# Line 804  ui_draw_glyph(int mixmode, Line 845  ui_draw_glyph(int mixmode,
845          XSetStipple(display, gc, (Pixmap)glyph);          XSetStipple(display, gc, (Pixmap)glyph);
846          XSetTSOrigin(display, gc, x, y);          XSetTSOrigin(display, gc, x, y);
847    
848          XFillRectangle(display, wnd, gc, x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
849    
850          XSetFillStyle(display, gc, FillSolid);          XSetFillStyle(display, gc, FillSolid);
851  }  }
# Line 821  ui_draw_text(uint8 font, uint8 flags, in Line 862  ui_draw_text(uint8 font, uint8 flags, in
862          SET_FOREGROUND(bgcolour);          SET_FOREGROUND(bgcolour);
863    
864          if (boxcx > 1)          if (boxcx > 1)
865                  XFillRectangle(display, wnd, gc, boxx, boxy, boxcx, boxcy);          {
866                    FILL_RECTANGLE(boxx, boxy, boxcx, boxcy);
867            }
868          else if (mixmode == MIX_OPAQUE)          else if (mixmode == MIX_OPAQUE)
869                  XFillRectangle(display, wnd, gc, clipx, clipy, clipcx, clipcy);          {
870                    FILL_RECTANGLE(clipx, clipy, clipcx, clipcy);
871            }
872    
873          /* Paint text, character by character */          /* Paint text, character by character */
874          for (i = 0; i < length; i++)          for (i = 0; i < length; i++)
# Line 862  ui_desktop_save(uint32 offset, int x, in Line 907  ui_desktop_save(uint32 offset, int x, in
907          Pixmap pix;          Pixmap pix;
908          XImage *image;          XImage *image;
909    
910          pix = XCreatePixmap(display, wnd, cx, cy, depth);          if (ownbackstore)
911          XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0);          {
912                    image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes,
913          image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap);                                    ZPixmap);
914            }
915            else
916            {
917                    pix = XCreatePixmap(display, wnd, cx, cy, depth);
918                    XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0);
919                    image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes,
920                                      ZPixmap);
921                    XFreePixmap(display, pix);
922            }
923    
924          offset *= bpp/8;          offset *= bpp/8;
925          cache_put_desktop(offset, cx, cy, image->bytes_per_line,          cache_put_desktop(offset, cx, cy, image->bytes_per_line,
926                            bpp/8, image->data);                            bpp/8, image->data);
927    
928          XDestroyImage(image);          XDestroyImage(image);
         XFreePixmap(display, pix);  
929  }  }
930    
931  void  void
# Line 890  ui_desktop_restore(uint32 offset, int x, Line 943  ui_desktop_restore(uint32 offset, int x,
943                               0, data, cx, cy, BitmapPad(display),                               0, data, cx, cy, BitmapPad(display),
944                               cx * bpp/8);                               cx * bpp/8);
945    
946          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);          if (ownbackstore)
947            {
948                    XPutImage(display, backstore, gc, image, 0, 0, x, y, cx, cy);
949                    XCopyArea(display, backstore, wnd, gc, x, y, cx, cy, x, y);
950            }
951            else
952            {
953                    XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
954            }
955    
956          XFree(image);          XFree(image);
957  }  }
   

Legend:
Removed from v.30  
changed lines
  Added in v.31

  ViewVC Help
Powered by ViewVC 1.1.26