/[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 17 by matty, Thu Sep 28 15:54:11 2000 UTC revision 25 by matty, Sat Jan 6 03:47:04 2001 UTC
# Line 32  static GC gc; Line 32  static GC gc;
32  static Visual *visual;  static Visual *visual;
33  static XIM IM;  static XIM IM;
34    
35  BOOL ui_create_window(char *title)  BOOL
36    ui_create_window(char *title)
37  {  {
38          Screen *screen;          Screen *screen;
39          XSetWindowAttributes attribs;          XSetWindowAttributes attribs;
# Line 41  BOOL ui_create_window(char *title) Line 42  BOOL ui_create_window(char *title)
42    
43          display = XOpenDisplay(NULL);          display = XOpenDisplay(NULL);
44          if (display == NULL)          if (display == NULL)
45            {
46                    ERROR("Failed to open display\n");
47                  return False;                  return False;
48            }
49    
50          /* Check the screen supports 8-bit depth. */          /* Check the screen supports 8-bit depth. */
51          screen = DefaultScreenOfDisplay(display);          screen = DefaultScreenOfDisplay(display);
# Line 58  BOOL ui_create_window(char *title) Line 62  BOOL ui_create_window(char *title)
62    
63          visual = DefaultVisual(display, DefaultScreen(display));          visual = DefaultVisual(display, DefaultScreen(display));
64    
65          attribs.background_pixel = BlackPixel(display, DefaultScreen(display));          attribs.background_pixel =
66                    BlackPixel(display, DefaultScreen(display));
67          attribs.backing_store = Always;          attribs.backing_store = Always;
68          wnd = XCreateWindow(display, DefaultRootWindow(display),          wnd = XCreateWindow(display, DefaultRootWindow(display),
69                          0, 0, width, height, 0, 8, InputOutput, visual,                              0, 0, width, height, 0, 8, InputOutput, visual,
70                          CWBackingStore | CWBackPixel, &attribs);                              CWBackingStore | CWBackPixel, &attribs);
71    
72          XStoreName(display, wnd, title);          XStoreName(display, wnd, title);
73          XMapWindow(display, wnd);          XMapWindow(display, wnd);
74    
75          input_mask  = KeyPressMask | KeyReleaseMask;          input_mask = KeyPressMask | KeyReleaseMask;
76          input_mask |= ButtonPressMask | ButtonReleaseMask;          input_mask |= ButtonPressMask | ButtonReleaseMask;
77          if (motion)          if (motion)
78                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
# Line 79  BOOL ui_create_window(char *title) Line 84  BOOL ui_create_window(char *title)
84          return True;          return True;
85  }  }
86    
87  void ui_destroy_window()  void
88    ui_destroy_window()
89  {  {
90          XCloseIM(IM);          XCloseIM(IM);
91          XFreeGC(display, gc);          XFreeGC(display, gc);
# Line 87  void ui_destroy_window() Line 93  void ui_destroy_window()
93          XCloseDisplay(display);          XCloseDisplay(display);
94  }  }
95    
96  static uint8 xwin_translate_key(unsigned long key)  static uint8
97    xwin_translate_key(unsigned long key)
98  {  {
99          DEBUG("KEY(code=0x%lx)\n", key);          DEBUG("KEY(code=0x%lx)\n", key);
100    
# Line 96  static uint8 xwin_translate_key(unsigned Line 103  static uint8 xwin_translate_key(unsigned
103    
104          switch (key)          switch (key)
105          {          {
106                  case 0x62: /* left arrow */                  case 0x62:      /* left arrow */
107                          return 0x48;                          return 0x48;
108                  case 0x64: /* up arrow */                  case 0x64:      /* up arrow */
109                          return 0x4b;                          return 0x4b;
110                  case 0x66: /* down arrow */                  case 0x66:      /* down arrow */
111                          return 0x4d;                          return 0x4d;
112                  case 0x68: /* right arrow */                  case 0x68:      /* right arrow */
113                          return 0x50;                          return 0x50;
114                  case 0x73: /* Windows key */                  case 0x73:      /* Windows key */
115                          DEBUG("CHECKPOINT\n");                          DEBUG("CHECKPOINT\n");
116          }          }
117    
118          return 0;          return 0;
119  }  }
120    
121  static uint16 xwin_translate_mouse(unsigned long button)  static uint16
122    xwin_translate_mouse(unsigned long button)
123  {  {
124          switch (button)          switch (button)
125          {          {
126                  case Button1: /* left */                  case Button1:   /* left */
127                          return MOUSE_FLAG_BUTTON1;                          return MOUSE_FLAG_BUTTON1;
128                  case Button2: /* middle */                  case Button2:   /* middle */
129                          return MOUSE_FLAG_BUTTON3;                          return MOUSE_FLAG_BUTTON3;
130                  case Button3: /* right */                  case Button3:   /* right */
131                          return MOUSE_FLAG_BUTTON2;                          return MOUSE_FLAG_BUTTON2;
132          }          }
133    
134          return 0;          return 0;
135  }  }
136    
137  void ui_process_events()  void
138    ui_process_events()
139  {  {
140          XEvent event;          XEvent event;
141          uint8 scancode;          uint8 scancode;
# Line 143  void ui_process_events() Line 152  void ui_process_events()
152                  switch (event.type)                  switch (event.type)
153                  {                  {
154                          case KeyPress:                          case KeyPress:
155                                  scancode = xwin_translate_key(event.xkey.keycode);                                  scancode =
156                                            xwin_translate_key(event.
157                                                               xkey.keycode);
158                                  if (scancode == 0)                                  if (scancode == 0)
159                                          break;                                          break;
160    
161                                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0,                                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0,
162                                                  scancode, 0);                                                 scancode, 0);
163                                  break;                                  break;
164    
165                          case KeyRelease:                          case KeyRelease:
166                                  scancode = xwin_translate_key(event.xkey.keycode);                                  scancode =
167                                            xwin_translate_key(event.
168                                                               xkey.keycode);
169                                  if (scancode == 0)                                  if (scancode == 0)
170                                          break;                                          break;
171    
172                                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE,                                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
173                                                  KBD_FLAG_DOWN | KBD_FLAG_UP,                                                 KBD_FLAG_DOWN | KBD_FLAG_UP,
174                                                  scancode, 0);                                                 scancode, 0);
175                                  break;                                  break;
176    
177                          case ButtonPress:                          case ButtonPress:
178                                  button = xwin_translate_mouse(event.xbutton.button);                                  button =
179                                            xwin_translate_mouse(event.
180                                                                 xbutton.button);
181    
182                                  if (button == 0)                                  if (button == 0)
183                                          break;                                          break;
184    
185                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,
186                                                  button | MOUSE_FLAG_DOWN,                                                 button | MOUSE_FLAG_DOWN,
187                                                  event.xbutton.x,                                                 event.xbutton.x,
188                                                  event.xbutton.y);                                                 event.xbutton.y);
189                                  break;                                  break;
190    
191                          case ButtonRelease:                          case ButtonRelease:
192                                  button = xwin_translate_mouse(event.xbutton.button);                                  button =
193                                            xwin_translate_mouse(event.
194                                                                 xbutton.button);
195                                  if (button == 0)                                  if (button == 0)
196                                          break;                                          break;
197    
198                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,
199                                                  button,                                                 button,
200                                                  event.xbutton.x,                                                 event.xbutton.x,
201                                                  event.xbutton.y);                                                 event.xbutton.y);
202                                  break;                                  break;
203    
204                          case MotionNotify:                          case MotionNotify:
205                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,
206                                                  MOUSE_FLAG_MOVE,                                                 MOUSE_FLAG_MOVE,
207                                                  event.xmotion.x,                                                 event.xmotion.x,
208                                                  event.xmotion.y);                                                 event.xmotion.y);
209                  }                  }
210          }          }
211  }  }
212    
213  void ui_move_pointer(int x, int y)  void
214    ui_move_pointer(int x, int y)
215  {  {
216          XWarpPointer(display, wnd, wnd, 0, 0, 0, 0, x, y);          XWarpPointer(display, wnd, wnd, 0, 0, 0, 0, x, y);
217  }  }
218    
219  HBITMAP ui_create_bitmap(int width, int height, uint8 *data)  HBITMAP
220    ui_create_bitmap(int width, int height, uint8 *data)
221  {  {
222          XImage *image;          XImage *image;
223          Pixmap bitmap;          Pixmap bitmap;
# Line 206  HBITMAP ui_create_bitmap(int width, int Line 225  HBITMAP ui_create_bitmap(int width, int
225          bitmap = XCreatePixmap(display, wnd, width, height, 8);          bitmap = XCreatePixmap(display, wnd, width, height, 8);
226    
227          image = XCreateImage(display, visual, 8, ZPixmap, 0,          image = XCreateImage(display, visual, 8, ZPixmap, 0,
228                                  data, width, height, 8, width);                               data, width, height, 8, width);
229          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
230          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
231          XFree(image);          XFree(image);
232            
233          return (HBITMAP)bitmap;          return (HBITMAP) bitmap;
234  }  }
235    
236  void ui_paint_bitmap(int x, int y, int cx, int cy,  void
237                          int width, int height, uint8 *data)  ui_paint_bitmap(int x, int y, int cx, int cy,
238                    int width, int height, uint8 *data)
239  {  {
240          XImage *image;          XImage *image;
241    
242          image = XCreateImage(display, visual, 8, ZPixmap, 0,          image = XCreateImage(display, visual, 8, ZPixmap, 0,
243                                  data, width, height, 8, width);                               data, width, height, 8, width);
244          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
245          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
246          XFree(image);          XFree(image);
247  }  }
248    
249  void ui_destroy_bitmap(HBITMAP bmp)  void
250    ui_destroy_bitmap(HBITMAP bmp)
251  {  {
252          XFreePixmap(display, (Pixmap)bmp);          XFreePixmap(display, (Pixmap) bmp);
253  }  }
254    
255  HGLYPH ui_create_glyph(int width, int height, uint8 *data)  HGLYPH
256    ui_create_glyph(int width, int height, uint8 *data)
257  {  {
258          XImage *image;          XImage *image;
259          Pixmap bitmap;          Pixmap bitmap;
# Line 244  HGLYPH ui_create_glyph(int width, int he Line 266  HGLYPH ui_create_glyph(int width, int he
266          gc = XCreateGC(display, bitmap, 0, NULL);          gc = XCreateGC(display, bitmap, 0, NULL);
267    
268          image = XCreateImage(display, visual, 1, ZPixmap, 0,          image = XCreateImage(display, visual, 1, ZPixmap, 0,
269                                  data, width, height, 8, scanline);                               data, width, height, 8, scanline);
270            image->byte_order = MSBFirst;
271            image->bitmap_bit_order = MSBFirst;
272            XInitImage(image);
273    
274          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
275          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
276          XFree(image);          XFree(image);
277          XFreeGC(display, gc);          XFreeGC(display, gc);
278            
279          return (HGLYPH)bitmap;          return (HGLYPH) bitmap;
280  }  }
281    
282  void ui_destroy_glyph(HGLYPH glyph)  void
283    ui_destroy_glyph(HGLYPH glyph)
284  {  {
285          XFreePixmap(display, (Pixmap)glyph);          XFreePixmap(display, (Pixmap) glyph);
286  }  }
287    
288  HCOLOURMAP ui_create_colourmap(COLOURMAP *colours)  HCOLOURMAP
289    ui_create_colourmap(COLOURMAP *colours)
290  {  {
291          COLOURENTRY *entry;          COLOURENTRY *entry;
292          XColor *xcolours, *xentry;          XColor *xcolours, *xentry;
# Line 282  HCOLOURMAP ui_create_colourmap(COLOURMAP Line 310  HCOLOURMAP ui_create_colourmap(COLOURMAP
310          XStoreColors(display, map, xcolours, ncolours);          XStoreColors(display, map, xcolours, ncolours);
311    
312          xfree(xcolours);          xfree(xcolours);
313          return (HCOLOURMAP)map;          return (HCOLOURMAP) map;
314  }  }
315    
316  void ui_destroy_colourmap(HCOLOURMAP map)  void
317    ui_destroy_colourmap(HCOLOURMAP map)
318  {  {
319          XFreeColormap(display, (Colormap)map);          XFreeColormap(display, (Colormap) map);
320  }  }
321    
322  void ui_set_colourmap(HCOLOURMAP map)  void
323    ui_set_colourmap(HCOLOURMAP map)
324  {  {
325          XSetWindowColormap(display, wnd, (Colormap)map);          XSetWindowColormap(display, wnd, (Colormap) map);
326  }  }
327    
328  void ui_set_clip(int x, int y, int cx, int cy)  void
329    ui_set_clip(int x, int y, int cx, int cy)
330  {  {
331          XRectangle rect;          XRectangle rect;
332    
# Line 306  void ui_set_clip(int x, int y, int cx, i Line 337  void ui_set_clip(int x, int y, int cx, i
337          XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);          XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);
338  }  }
339    
340  void ui_reset_clip()  void
341    ui_reset_clip()
342  {  {
343          XRectangle rect;          XRectangle rect;
344    
# Line 317  void ui_reset_clip() Line 349  void ui_reset_clip()
349          XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);          XSetClipRectangles(display, gc, 0, 0, &rect, 1, YXBanded);
350  }  }
351    
352  void ui_bell()  void
353    ui_bell()
354  {  {
355          XBell(display, 0);          XBell(display, 0);
356  }  }
357    
358  static int rop2_map[] = {  static int rop2_map[] = {
359          GXclear,        /* 0 */          GXclear,                /* 0 */
360          GXnor,          /* DPon */          GXnor,                  /* DPon */
361          GXandInverted,  /* DPna */          GXandInverted,          /* DPna */
362          GXcopyInverted, /* Pn */          GXcopyInverted,         /* Pn */
363          GXandReverse,   /* PDna */          GXandReverse,           /* PDna */
364          GXinvert,       /* Dn */          GXinvert,               /* Dn */
365          GXxor,          /* DPx */          GXxor,                  /* DPx */
366          GXnand,         /* DPan */          GXnand,                 /* DPan */
367          GXand,          /* DPa */          GXand,                  /* DPa */
368          GXequiv,        /* DPxn */          GXequiv,                /* DPxn */
369          GXnoop,         /* D */          GXnoop,                 /* D */
370          GXorInverted,   /* DPno */          GXorInverted,           /* DPno */
371          GXcopy,         /* P */          GXcopy,                 /* P */
372          GXorReverse,    /* PDno */          GXorReverse,            /* PDno */
373          GXor,           /* DPo */          GXor,                   /* DPo */
374          GXset           /* 1 */          GXset                   /* 1 */
375  };  };
376    
377  static void xwin_set_function(uint8 rop2)  static void
378    xwin_set_function(uint8 rop2)
379  {  {
380          XSetFunction(display, gc, rop2_map[rop2]);          XSetFunction(display, gc, rop2_map[rop2]);
381  }  }
382    
383  void ui_destblt(uint8 opcode,  void
384          /* dest */  int x, int y, int cx, int cy)  ui_destblt(uint8 opcode,
385               /* dest */ int x, int y, int cx, int cy)
386  {  {
387          xwin_set_function(opcode);          xwin_set_function(opcode);
388    
389          XFillRectangle(display, wnd, gc, x, y, cx, cy);          XFillRectangle(display, wnd, gc, x, y, cx, cy);
390  }  }
391    
392  void ui_patblt(uint8 opcode,  void
393          /* dest */  int x, int y, int cx, int cy,  ui_patblt(uint8 opcode,
394          /* brush */ BRUSH *brush, int bgcolour, int fgcolour)            /* dest */ int x, int y, int cx, int cy,
395              /* brush */ BRUSH *brush, int bgcolour, int fgcolour)
396  {  {
397          Display *dpy = display;          Display *dpy = display;
398          Pixmap fill;          Pixmap fill;
# Line 365  void ui_patblt(uint8 opcode, Line 401  void ui_patblt(uint8 opcode,
401    
402          switch (brush->style)          switch (brush->style)
403          {          {
404                  case 0: /* Solid */                  case 0: /* Solid */
405                          XSetForeground(dpy, gc, fgcolour);                          XSetForeground(dpy, gc, fgcolour);
406                          XFillRectangle(dpy, wnd, gc, x, y, cx, cy);                          XFillRectangle(dpy, wnd, gc, x, y, cx, cy);
407                          break;                          break;
408    
409                  case 3: /* Pattern */                  case 3: /* Pattern */
410                          fill = (Pixmap)ui_create_glyph(8, 8, brush->pattern);                          fill = (Pixmap) ui_create_glyph(8, 8, brush->pattern);
411    
412                          XSetForeground(dpy, gc, fgcolour);                          XSetForeground(dpy, gc, fgcolour);
413                          XSetBackground(dpy, gc, bgcolour);                          XSetBackground(dpy, gc, bgcolour);
# Line 381  void ui_patblt(uint8 opcode, Line 417  void ui_patblt(uint8 opcode,
417                          XFillRectangle(dpy, wnd, gc, x, y, cx, cy);                          XFillRectangle(dpy, wnd, gc, x, y, cx, cy);
418    
419                          XSetFillStyle(dpy, gc, FillSolid);                          XSetFillStyle(dpy, gc, FillSolid);
420                          ui_destroy_glyph((HGLYPH)fill);                          ui_destroy_glyph((HGLYPH) fill);
421                          break;                          break;
422    
423                  default:                  default:
# Line 389  void ui_patblt(uint8 opcode, Line 425  void ui_patblt(uint8 opcode,
425          }          }
426  }  }
427    
428  void ui_screenblt(uint8 opcode,  void
429                  /* dest */ int x, int y, int cx, int cy,  ui_screenblt(uint8 opcode,
430                  /* src */  int srcx, int srcy)               /* dest */ int x, int y, int cx, int cy,
431                 /* src */ int srcx, int srcy)
432  {  {
433          xwin_set_function(opcode);          xwin_set_function(opcode);
434    
435          XCopyArea(display, wnd, wnd, gc, srcx, srcy,          XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);
                         cx, cy, x, y);  
436  }  }
437    
438  void ui_memblt(uint8 opcode,  void
439          /* dest */  int x, int y, int cx, int cy,  ui_memblt(uint8 opcode,
440          /* src */   HBITMAP src, int srcx, int srcy)            /* dest */ int x, int y, int cx, int cy,
441              /* src */ HBITMAP src, int srcx, int srcy)
442  {  {
443          xwin_set_function(opcode);          xwin_set_function(opcode);
444    
445          XCopyArea(display, (Pixmap)src, wnd, gc, srcx, srcy,          XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y);
                         cx, cy, x, y);  
446  }  }
447    
448  void ui_triblt(uint8 opcode,  void
449          /* dest */  int x, int y, int cx, int cy,  ui_triblt(uint8 opcode,
450          /* src */   HBITMAP src, int srcx, int srcy,            /* dest */ int x, int y, int cx, int cy,
451          /* brush */ BRUSH *brush, int bgcolour, int fgcolour)            /* src */ HBITMAP src, int srcx, int srcy,
452              /* brush */ BRUSH *brush, int bgcolour, int fgcolour)
453  {  {
454          /* This is potentially difficult to do in general. Until someone          /* This is potentially difficult to do in general. Until someone
455             comes up with a more efficient way of doing it I am using cases. */             comes up with a more efficient way of doing it I am using cases. */
456    
457          switch (opcode)          switch (opcode)
458          {          {
459                  case 0x69: /* PDSxxn */                  case 0x69:      /* PDSxxn */
460                          ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy);                          ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy);
461                          ui_patblt(ROP2_NXOR, x, y, cx, cy,                          ui_patblt(ROP2_NXOR, x, y, cx, cy,
462                                          brush, bgcolour, fgcolour);                                    brush, bgcolour, fgcolour);
463                          break;                          break;
464    
465                  case 0xb8: /* PSDPxax */                  case 0xb8:      /* PSDPxax */
466                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy,
467                                          brush, bgcolour, fgcolour);                                    brush, bgcolour, fgcolour);
468                          ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy);                          ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy);
469                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy,
470                                          brush, bgcolour, fgcolour);                                    brush, bgcolour, fgcolour);
471                          break;                          break;
472    
473                  default:                  default:
# Line 439  void ui_triblt(uint8 opcode, Line 476  void ui_triblt(uint8 opcode,
476          }          }
477  }  }
478    
479  void ui_line(uint8 opcode,  void
480          /* dest */  int startx, int starty, int endx, int endy,  ui_line(uint8 opcode,
481          /* pen */   PEN *pen)          /* dest */ int startx, int starty, int endx, int endy,
482            /* pen */ PEN *pen)
483  {  {
484          xwin_set_function(opcode);          xwin_set_function(opcode);
485    
# Line 449  void ui_line(uint8 opcode, Line 487  void ui_line(uint8 opcode,
487          XDrawLine(display, wnd, gc, startx, starty, endx, endy);          XDrawLine(display, wnd, gc, startx, starty, endx, endy);
488  }  }
489    
490  void ui_rect(  void
491          /* dest */  int x, int y, int cx, int cy,  ui_rect(
492          /* brush */ int colour)                 /* dest */ int x, int y, int cx, int cy,
493                   /* brush */ int colour)
494  {  {
495          xwin_set_function(ROP2_COPY);          xwin_set_function(ROP2_COPY);
496    
# Line 459  void ui_rect( Line 498  void ui_rect(
498          XFillRectangle(display, wnd, gc, x, y, cx, cy);          XFillRectangle(display, wnd, gc, x, y, cx, cy);
499  }  }
500    
501  void ui_draw_glyph(int mixmode,  void
502          /* dest */ int x, int y, int cx, int cy,  ui_draw_glyph(int mixmode,
503          /* src */  HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)                /* dest */ int x, int y, int cx, int cy,
504                  /* src */ HGLYPH glyph, int srcx, int srcy, int bgcolour,
505                  int fgcolour)
506  {  {
507          Pixmap pixmap = (Pixmap)glyph;          Pixmap pixmap = (Pixmap) glyph;
508    
509          xwin_set_function(ROP2_COPY);          xwin_set_function(ROP2_COPY);
510    
# Line 475  void ui_draw_glyph(int mixmode, Line 516  void ui_draw_glyph(int mixmode,
516                          XSetStipple(display, gc, pixmap);                          XSetStipple(display, gc, pixmap);
517                          XSetFillStyle(display, gc, FillStippled);                          XSetFillStyle(display, gc, FillStippled);
518                          XSetTSOrigin(display, gc, x, y);                          XSetTSOrigin(display, gc, x, y);
519                          XFillRectangle(display, wnd, gc,                          XFillRectangle(display, wnd, gc, x, y, cx, cy);
                                         x, y, cx, cy);  
520                          XSetFillStyle(display, gc, FillSolid);                          XSetFillStyle(display, gc, FillSolid);
521                          break;                          break;
522    
523                  case MIX_OPAQUE:                  case MIX_OPAQUE:
524                          XSetBackground(display, gc, bgcolour);                          XSetBackground(display, gc, bgcolour);
525                          XCopyPlane(display, pixmap, wnd, gc,                          XCopyPlane(display, pixmap, wnd, gc,
526                                          srcx, srcy, cx, cy, x, y, 1);                                     srcx, srcy, cx, cy, x, y, 1);
527                          break;                          break;
528    
529                  default:                  default:
# Line 491  void ui_draw_glyph(int mixmode, Line 531  void ui_draw_glyph(int mixmode,
531          }          }
532  }  }
533    
534  void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,  void
535                          int clipx, int clipy, int clipcx, int clipcy,  ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,
536                          int boxx, int boxy, int boxcx, int boxcy,               int clipx, int clipy, int clipcx, int clipcy,
537                          int bgcolour, int fgcolour, uint8 *text, uint8 length)               int boxx, int boxy, int boxcx, int boxcy,
538                 int bgcolour, int fgcolour, uint8 *text, uint8 length)
539  {  {
540          FONTGLYPH *glyph;          FONTGLYPH *glyph;
541          int i;          int i;
# Line 518  void ui_draw_text(uint8 font, uint8 flag Line 559  void ui_draw_text(uint8 font, uint8 flag
559    
560                  if (glyph != NULL)                  if (glyph != NULL)
561                  {                  {
562                          ui_draw_glyph(mixmode, x,                          ui_draw_glyph(mixmode, x + (short) glyph->offset,
563                                          y + (short)glyph->baseline,                                        y + (short) glyph->baseline,
564                                          glyph->width, glyph->height,                                        glyph->width, glyph->height,
565                                          glyph->pixmap, 0, 0,                                        glyph->pixmap, 0, 0,
566                                          bgcolour, fgcolour);                                        bgcolour, fgcolour);
567    
568                          if (flags & TEXT2_IMPLICIT_X)                          if (flags & TEXT2_IMPLICIT_X)
569                                  x += glyph->width;                                  x += glyph->width;
# Line 530  void ui_draw_text(uint8 font, uint8 flag Line 571  void ui_draw_text(uint8 font, uint8 flag
571          }          }
572  }  }
573    
574  void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)  void
575    ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
576  {  {
577          XImage *image;          XImage *image;
578    
# Line 540  void ui_desktop_save(uint32 offset, int Line 582  void ui_desktop_save(uint32 offset, int
582          XFree(image);          XFree(image);
583  }  }
584    
585  void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)  void
586    ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
587  {  {
588          XImage *image;          XImage *image;
589          uint8 *data;          uint8 *data;
# Line 550  void ui_desktop_restore(uint32 offset, i Line 593  void ui_desktop_restore(uint32 offset, i
593                  return;                  return;
594    
595          image = XCreateImage(display, visual, 8, ZPixmap, 0,          image = XCreateImage(display, visual, 8, ZPixmap, 0,
596                                  data, cx, cy, 32, cx);                               data, cx, cy, 32, cx);
597          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
598          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
599          XFree(image);          XFree(image);

Legend:
Removed from v.17  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.26