/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/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/branches/seamlessrdp-branch/rdesktop/xwin.c

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

revision 64 by astrand, Thu Jul 18 16:38:31 2002 UTC revision 319 by astrand, Mon Feb 10 13:02:57 2003 UTC
# Line 1  Line 1 
1  /*  /*
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     User interface services - X Window System     User interface services - X Window System
4     Copyright (C) Matthew Chapman 1999-2001     Copyright (C) Matthew Chapman 1999-2002
5    
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 20  Line 20 
20    
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/Xutil.h>  #include <X11/Xutil.h>
 #include <X11/XKBlib.h>  
23  #include <time.h>  #include <time.h>
24  #include <errno.h>  #include <errno.h>
25  #include "rdesktop.h"  #include "rdesktop.h"
26    
 extern char keymapname[16];  
 extern int keylayout;  
27  extern int width;  extern int width;
28  extern int height;  extern int height;
29  extern BOOL sendmotion;  extern BOOL sendmotion;
30  extern BOOL fullscreen;  extern BOOL fullscreen;
31    extern BOOL grab_keyboard;
32    extern BOOL hide_decorations;
33    extern char title[];
34    extern int server_bpp;
35    BOOL enable_compose = False;
36    BOOL focused;
37    BOOL mouse_in_wnd;
38    
39  Display *display;  Display *display;
 XkbDescPtr xkb;  
40  static int x_socket;  static int x_socket;
41    static Screen *screen;
42  static Window wnd;  static Window wnd;
43  static GC gc;  static GC gc;
44  static Visual *visual;  static Visual *visual;
45  static int depth;  static int depth;
46  static int bpp;  static int bpp;
47    static XIM IM;
48    static XIC IC;
49    static XModifierKeymap *mod_map;
50    static Cursor current_cursor;
51    static Atom protocol_atom, kill_atom;
52    
53  /* endianness */  /* endianness */
54  static BOOL host_be;  static BOOL host_be;
# Line 49  static BOOL xserver_be; Line 58  static BOOL xserver_be;
58  static BOOL ownbackstore;  static BOOL ownbackstore;
59  static Pixmap backstore;  static Pixmap backstore;
60    
61  /* needed to keep track of the modifiers */  /* MWM decorations */
62  static unsigned int numlock_modifier_mask = 0;  #define MWM_HINTS_DECORATIONS   (1L << 1)
63  static unsigned int key_down_state = 0;  #define PROP_MOTIF_WM_HINTS_ELEMENTS    5
64    typedef struct
65    {
66  #define DShift1Mask   (1<<0)          uint32 flags;
67  #define DLockMask     (1<<1)          uint32 functions;
68  #define DControl1Mask (1<<2)          uint32 decorations;
69  #define DMod1Mask     (1<<3)          sint32 inputMode;
70  #define DMod2Mask     (1<<4)          uint32 status;
71  #define DMod3Mask     (1<<5)  }
72  #define DMod4Mask     (1<<6)  PropMotifWmHints;
73  #define DMod5Mask     (1<<7)  
74  #define DShift2Mask   (1<<8)  typedef struct
75  #define DControl2Mask (1<<9)  {
76  #define DNumLockMask  (1<<10)          uint32 red;
77            uint32 green;
78            uint32 blue;
79    }
80    PixelColour;
81    
82  #define FILL_RECTANGLE(x,y,cx,cy)\  #define FILL_RECTANGLE(x,y,cx,cy)\
83  { \  { \
# Line 73  static unsigned int key_down_state = 0; Line 86  static unsigned int key_down_state = 0;
86                  XFillRectangle(display, backstore, gc, x, y, cx, cy); \                  XFillRectangle(display, backstore, gc, x, y, cx, cy); \
87  }  }
88    
89    #define FILL_RECTANGLE_BACKSTORE(x,y,cx,cy)\
90    { \
91            XFillRectangle(display, ownbackstore ? backstore : wnd, gc, x, y, cx, cy); \
92    }
93    
94  /* colour maps */  /* colour maps */
95  static BOOL owncolmap;  BOOL owncolmap = False;
96  static Colormap xcolmap;  static Colormap xcolmap;
 static uint32 white;  
97  static uint32 *colmap;  static uint32 *colmap;
98    
99  #define TRANSLATE(col)          ( owncolmap ? col : translate_colour(colmap[col]) )  #define TRANSLATE(col)          ( server_bpp != 8 ? translate_colour(col) : owncolmap ? col : translate_colour(colmap[col]) )
100  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));
101  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));
102    
# Line 105  static int rop2_map[] = { Line 122  static int rop2_map[] = {
122  #define SET_FUNCTION(rop2)      { if (rop2 != ROP2_COPY) XSetFunction(display, gc, rop2_map[rop2]); }  #define SET_FUNCTION(rop2)      { if (rop2 != ROP2_COPY) XSetFunction(display, gc, rop2_map[rop2]); }
123  #define RESET_FUNCTION(rop2)    { if (rop2 != ROP2_COPY) XSetFunction(display, gc, GXcopy); }  #define RESET_FUNCTION(rop2)    { if (rop2 != ROP2_COPY) XSetFunction(display, gc, GXcopy); }
124    
125  void xwin_get_numlock_mask();  static void
126  void xwin_mod_update(uint32 state, uint32 ev_time);  mwm_hide_decorations(void)
127  void xwin_mod_release(uint32 state, uint32 ev_time, uint32 scancode);  {
128  void xwin_mod_press(uint32 state, uint32 ev_time, uint32 scancode);          PropMotifWmHints motif_hints;
129            Atom hintsatom;
130    
131            /* setup the property */
132            motif_hints.flags = MWM_HINTS_DECORATIONS;
133            motif_hints.decorations = 0;
134    
135            /* get the atom for the property */
136            hintsatom = XInternAtom(display, "_MOTIF_WM_HINTS", False);
137            if (!hintsatom)
138            {
139                    warning("Failed to get atom _MOTIF_WM_HINTS: probably your window manager does not support MWM hints\n");
140                    return;
141            }
142    
143            XChangeProperty(display, wnd, hintsatom, hintsatom, 32, PropModeReplace,
144                            (unsigned char *) &motif_hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
145    }
146    
147    static PixelColour
148    split_colour15(uint32 colour)
149    {
150            PixelColour rv;
151            rv.red = (colour & 0x7c00) >> 10;
152            rv.red = (rv.red * 0xff) / 0x1f;
153            rv.green = (colour & 0x03e0) >> 5;
154            rv.green = (rv.green * 0xff) / 0x1f;
155            rv.blue = (colour & 0x1f);
156            rv.blue = (rv.blue * 0xff) / 0x1f;
157            return rv;
158    }
159    
160    static PixelColour
161    split_colour16(uint32 colour)
162    {
163            PixelColour rv;
164            rv.red = (colour & 0xf800) >> 11;
165            rv.red = (rv.red * 0xff) / 0x1f;
166            rv.green = (colour & 0x07e0) >> 5;
167            rv.green = (rv.green * 0xff) / 0x3f;
168            rv.blue = (colour & 0x001f);
169            rv.blue = (rv.blue * 0xff) / 0x1f;
170            return rv;
171    }
172    
173    static PixelColour
174    split_colour24(uint32 colour)
175    {
176            PixelColour rv;
177            rv.blue = (colour & 0xff0000) >> 16;
178            rv.green = (colour & 0xff00) >> 8;
179            rv.red = (colour & 0xff);
180            return rv;
181    }
182    
183    static uint32
184    make_colour16(PixelColour pc)
185    {
186            pc.red = (pc.red * 0x1f) / 0xff;
187            pc.green = (pc.green * 0x3f) / 0xff;
188            pc.blue = (pc.blue * 0x1f) / 0xff;
189            return (pc.red << 11) | (pc.green << 5) | pc.blue;
190    }
191    
192    static uint32
193    make_colour24(PixelColour pc)
194    {
195            return (pc.red << 16) | (pc.green << 8) | pc.blue;
196    }
197    
198    static uint32
199    make_colour32(PixelColour pc)
200    {
201            return (pc.red << 16) | (pc.green << 8) | pc.blue;
202    }
203    
204    #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }
205    #define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | ((x >> 8) & 0xff00)); }
206    #define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \
207                            x = (x << 16) | (x >> 16); }
208    
209    static uint32
210    translate_colour(uint32 colour)
211    {
212            switch (server_bpp)
213            {
214                    case 15:
215                            switch (bpp)
216                            {
217                                    case 16:
218                                            colour = make_colour16(split_colour15(colour));
219                                            break;
220                                    case 24:
221                                            colour = make_colour24(split_colour15(colour));
222                                            break;
223                                    case 32:
224                                            colour = make_colour32(split_colour15(colour));
225                                            break;
226                            }
227                            break;
228                    case 16:
229                            switch (bpp)
230                            {
231                                    case 16:
232                                            break;
233                                    case 24:
234                                            colour = make_colour24(split_colour16(colour));
235                                            break;
236                                    case 32:
237                                            colour = make_colour32(split_colour16(colour));
238                                            break;
239                            }
240                            break;
241                    case 24:
242                            switch (bpp)
243                            {
244                                    case 16:
245                                            colour = make_colour16(split_colour24(colour));
246                                            break;
247                                    case 24:
248                                            break;
249                                    case 32:
250                                            colour = make_colour32(split_colour24(colour));
251                                            break;
252                            }
253                            break;
254            }
255            switch (bpp)
256            {
257                    case 16:
258                            if (host_be != xserver_be)
259                                    BSWAP16(colour);
260                            break;
261    
262                    case 24:
263                            if (xserver_be)
264                                    BSWAP24(colour);
265                            break;
266    
267                    case 32:
268                            if (host_be != xserver_be)
269                                    BSWAP32(colour);
270                            break;
271            }
272    
273            return colour;
274    }
275    
276  static void  static void
277  translate8(uint8 * data, uint8 * out, uint8 * end)  translate8to8(uint8 * data, uint8 * out, uint8 * end)
278  {  {
279          while (out < end)          while (out < end)
280                  *(out++) = (uint8) colmap[*(data++)];                  *(out++) = (uint8) colmap[*(data++)];
281  }  }
282    
283  static void  static void
284  translate16(uint8 * data, uint16 * out, uint16 * end)  translate8to16(uint8 * data, uint16 * out, uint16 * end)
285  {  {
286          while (out < end)          while (out < end)
287                  *(out++) = (uint16) colmap[*(data++)];                  *(out++) = (uint16) colmap[*(data++)];
# Line 126  translate16(uint8 * data, uint16 * out, Line 289  translate16(uint8 * data, uint16 * out,
289    
290  /* little endian - conversion happens when colourmap is built */  /* little endian - conversion happens when colourmap is built */
291  static void  static void
292  translate24(uint8 * data, uint8 * out, uint8 * end)  translate8to24(uint8 * data, uint8 * out, uint8 * end)
293  {  {
294          uint32 value;          uint32 value;
295    
# Line 140  translate24(uint8 * data, uint8 * out, u Line 303  translate24(uint8 * data, uint8 * out, u
303  }  }
304    
305  static void  static void
306  translate32(uint8 * data, uint32 * out, uint32 * end)  translate8to32(uint8 * data, uint32 * out, uint32 * end)
307  {  {
308          while (out < end)          while (out < end)
309                  *(out++) = colmap[*(data++)];                  *(out++) = colmap[*(data++)];
310  }  }
311    
312    /* todo the remaining translate function might need some big endian check ?? */
313    
314    static void
315    translate15to16(uint16 * data, uint16 * out, uint16 * end)
316    {
317            while (out < end)
318                    *(out++) = (uint16) make_colour16(split_colour15(*(data++)));
319    }
320    
321    static void
322    translate15to24(uint16 * data, uint8 * out, uint8 * end)
323    {
324            uint32 value;
325    
326            while (out < end)
327            {
328                    value = make_colour24(split_colour15(*(data++)));
329                    *(out++) = value;
330                    *(out++) = value >> 8;
331                    *(out++) = value >> 16;
332            }
333    }
334    
335    static void
336    translate15to32(uint16 * data, uint32 * out, uint32 * end)
337    {
338            while (out < end)
339                    *(out++) = make_colour32(split_colour15(*(data++)));
340    }
341    
342    static void
343    translate16to16(uint16 * data, uint16 * out, uint16 * end)
344    {
345            while (out < end)
346                    *(out++) = (uint16) (*(data++));
347    }
348    
349    
350    static void
351    translate16to24(uint16 * data, uint8 * out, uint8 * end)
352    {
353            uint32 value;
354    
355            while (out < end)
356            {
357                    value = make_colour24(split_colour16(*(data++)));
358                    *(out++) = value;
359                    *(out++) = value >> 8;
360                    *(out++) = value >> 16;
361            }
362    }
363    
364    static void
365    translate16to32(uint16 * data, uint32 * out, uint32 * end)
366    {
367            while (out < end)
368                    *(out++) = make_colour32(split_colour16(*(data++)));
369    }
370    
371    static void
372    translate24to16(uint8 * data, uint16 * out, uint16 * end)
373    {
374            uint32 pixel = 0;
375            while (out < end)
376            {
377                    pixel = *(data++) << 16;
378                    pixel |= *(data++) << 8;
379                    pixel |= *(data++);
380                    *(out++) = (uint16) make_colour16(split_colour24(pixel));
381            }
382    }
383    
384    static void
385    translate24to24(uint8 * data, uint8 * out, uint8 * end)
386    {
387            while (out < end)
388            {
389                    *(out++) = (*(data++));
390            }
391    }
392    
393    static void
394    translate24to32(uint8 * data, uint32 * out, uint32 * end)
395    {
396            uint32 pixel = 0;
397            while (out < end)
398            {
399                    memcpy(&pixel, data, 3);
400                    data += 3;
401                    *(out++) = pixel;
402            }
403    }
404    
405  static uint8 *  static uint8 *
406  translate_image(int width, int height, uint8 * data)  translate_image(int width, int height, uint8 * data)
407  {  {
# Line 153  translate_image(int width, int height, u Line 409  translate_image(int width, int height, u
409          uint8 *out = xmalloc(size);          uint8 *out = xmalloc(size);
410          uint8 *end = out + size;          uint8 *end = out + size;
411    
412          switch (bpp)          switch (server_bpp)
413          {          {
414                  case 8:                  case 24:
415                          translate8(data, out, end);                          switch (bpp)
416                            {
417                                    case 32:
418                                            translate24to32(data, (uint32 *) out, (uint32 *) end);
419                                            break;
420                                    case 24:
421                                            translate24to24(data, out, end);
422                                            break;
423                                    case 16:
424                                            translate24to16(data, (uint16 *) out, (uint16 *) end);
425                                            break;
426                            }
427                          break;                          break;
   
428                  case 16:                  case 16:
429                          translate16(data, (uint16 *) out, (uint16 *) end);                          switch (bpp)
430                            {
431                                    case 32:
432                                            translate16to32((uint16 *) data, (uint32 *) out,
433                                                            (uint32 *) end);
434                                            break;
435                                    case 24:
436                                            translate16to24((uint16 *) data, out, end);
437                                            break;
438                                    case 16:
439                                            translate16to16((uint16 *) data, (uint16 *) out,
440                                                            (uint16 *) end);
441                                            break;
442                            }
443                          break;                          break;
444                    case 15:
445                  case 24:                          switch (bpp)
446                          translate24(data, out, end);                          {
447                                    case 32:
448                                            translate15to32((uint16 *) data, (uint32 *) out,
449                                                            (uint32 *) end);
450                                            break;
451                                    case 24:
452                                            translate15to24((uint16 *) data, out, end);
453                                            break;
454                                    case 16:
455                                            translate15to16((uint16 *) data, (uint16 *) out,
456                                                            (uint16 *) end);
457                                            break;
458                            }
459                          break;                          break;
460                    case 8:
461                  case 32:                          switch (bpp)
462                          translate32(data, (uint32 *) out, (uint32 *) end);                          {
463                                    case 8:
464                                            translate8to8(data, out, end);
465                                            break;
466                                    case 16:
467                                            translate8to16(data, (uint16 *) out, (uint16 *) end);
468                                            break;
469                                    case 24:
470                                            translate8to24(data, out, end);
471                                            break;
472                                    case 32:
473                                            translate8to32(data, (uint32 *) out, (uint32 *) end);
474                                            break;
475                            }
476                          break;                          break;
477          }          }
   
478          return out;          return out;
479  }  }
480    
481  #define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }  BOOL
482  #define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | ((x >> 8) & 0xff00)); }  get_key_state(unsigned int state, uint32 keysym)
 #define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \  
                         x = (x << 16) | (x >> 16); }  
   
 static uint32  
 translate_colour(uint32 colour)  
483  {  {
484          switch (bpp)          int modifierpos, key, keysymMask = 0;
485          {          int offset;
                 case 16:  
                         if (host_be != xserver_be)  
                                 BSWAP16(colour);  
                         break;  
486    
487                  case 24:          KeyCode keycode = XKeysymToKeycode(display, keysym);
                         if (xserver_be)  
                                 BSWAP24(colour);  
                         break;  
488    
489                  case 32:          if (keycode == NoSymbol)
490                          if (host_be != xserver_be)                  return False;
491                                  BSWAP32(colour);  
492                          break;          for (modifierpos = 0; modifierpos < 8; modifierpos++)
493            {
494                    offset = mod_map->max_keypermod * modifierpos;
495    
496                    for (key = 0; key < mod_map->max_keypermod; key++)
497                    {
498                            if (mod_map->modifiermap[offset + key] == keycode)
499                                    keysymMask |= 1 << modifierpos;
500                    }
501          }          }
502    
503          return colour;          return (state & keysymMask) ? True : False;
504  }  }
505    
506  BOOL  BOOL
507  ui_create_window(char *title)  ui_init(void)
508  {  {
         XSetWindowAttributes attribs;  
         XClassHint *classhints;  
         XSizeHints *sizehints;  
         unsigned long input_mask;  
509          XPixmapFormatValues *pfm;          XPixmapFormatValues *pfm;
         Screen *screen;  
510          uint16 test;          uint16 test;
511          int i;          int i;
512    
513          int xkb_minor, xkb_major;          display = XOpenDisplay(NULL);
         int xkb_event, xkb_error, xkb_reason;  
   
         /* compare compiletime libs with runtime libs. */  
         xkb_major = XkbMajorVersion;  
         xkb_minor = XkbMinorVersion;  
         if (XkbLibraryVersion(&xkb_major, &xkb_minor) == False)  
         {  
                 error("please re-compile rdesktop\ncompile time version of xkb is not compatible with\nyour runtime version of the library\n");  
                 return False;  
         }  
   
   
         display =  
                 XkbOpenDisplay(NULL, &xkb_event, &xkb_error, &xkb_major,  
                                &xkb_minor, &xkb_reason);  
         switch (xkb_reason)  
         {  
                 case XkbOD_BadLibraryVersion:  
                         error("XkbOD_BadLibraryVersion: XKB extensions in server and the library rdesktop is linked against aren't compatible with each other.\n");  
                         break;  
                 case XkbOD_ConnectionRefused:  
                         error("XkbOD_ConnectionRefused\n");  
                         break;  
                 case XkbOD_BadServerVersion:  
                         error("XkbOD_BadServerVersion\n");  
                         break;  
                 case XkbOD_NonXkbServer:  
                         error("XkbOD_NonXkbServer: XKB extension not present in server\nupdate your X server.\n");  
                         break;  
                 case XkbOD_Success:  
                         DEBUG("XkbOD_Success: Connection established with display\n");  
                         break;  
         }  
   
514          if (display == NULL)          if (display == NULL)
515          {          {
516                  error("Failed to open display\n");                  error("Failed to open display: %s\n", XDisplayName(NULL));
517                  return False;                  return False;
518          }          }
519    
# Line 269  ui_create_window(char *title) Line 529  ui_create_window(char *title)
529                     desirable, e.g. 24 bits->32 bits. */                     desirable, e.g. 24 bits->32 bits. */
530                  while (i--)                  while (i--)
531                  {                  {
532                          if ((pfm[i].depth == depth)                          if ((pfm[i].depth == depth) && (pfm[i].bits_per_pixel > bpp))
                             && (pfm[i].bits_per_pixel > bpp))  
533                          {                          {
534                                  bpp = pfm[i].bits_per_pixel;                                  bpp = pfm[i].bits_per_pixel;
535                          }                          }
# Line 285  ui_create_window(char *title) Line 544  ui_create_window(char *title)
544                  return False;                  return False;
545          }          }
546    
547          if (depth <= 8)          if (owncolmap != True)
548                  owncolmap = True;          {
         else  
549                  xcolmap = DefaultColormapOfScreen(screen);                  xcolmap = DefaultColormapOfScreen(screen);
550                    if (depth <= 8)
551                            warning("Screen depth is 8 bits or lower: you may want to use -C for a private colourmap\n");
552            }
553    
554            gc = XCreateGC(display, RootWindowOfScreen(screen), 0, NULL);
555    
556            if (DoesBackingStore(screen) != Always)
557                    ownbackstore = True;
558    
559          test = 1;          test = 1;
560          host_be = !(BOOL) (*(uint8 *) (&test));          host_be = !(BOOL) (*(uint8 *) (&test));
561          xserver_be = (ImageByteOrder(display) == MSBFirst);          xserver_be = (ImageByteOrder(display) == MSBFirst);
562    
563          white = WhitePixelOfScreen(screen);          if ((width == 0) || (height == 0))
564          attribs.background_pixel = BlackPixelOfScreen(screen);          {
565          attribs.backing_store = DoesBackingStore(screen);                  /* Fetch geometry from _NET_WORKAREA */
566                    uint32 x, y, cx, cy;
567    
568          if (attribs.backing_store == NotUseful)                  if (get_current_workarea(&x, &y, &cx, &cy) == 0)
569                  ownbackstore = True;                  {
570                            width = cx;
571                            height = cy;
572                    }
573                    else
574                    {
575                            warning("Failed to get workarea: probably your window manager does not support extended hints\n");
576                            width = 800;
577                            height = 600;
578                    }
579            }
580    
581          if (fullscreen)          if (fullscreen)
582          {          {
                 attribs.override_redirect = True;  
583                  width = WidthOfScreen(screen);                  width = WidthOfScreen(screen);
584                  height = HeightOfScreen(screen);                  height = HeightOfScreen(screen);
585          }          }
586          else  
587            /* make sure width is a multiple of 4 */
588            width = (width + 3) & ~3;
589    
590            if (ownbackstore)
591          {          {
592                  attribs.override_redirect = False;                  backstore =
593                            XCreatePixmap(display, RootWindowOfScreen(screen), width, height, depth);
594    
595                    /* clear to prevent rubbish being exposed at startup */
596                    XSetForeground(display, gc, BlackPixelOfScreen(screen));
597                    XFillRectangle(display, backstore, gc, 0, 0, width, height);
598          }          }
599    
600          width = (width + 3) & ~3;       /* make width a multiple of 32 bits */          mod_map = XGetModifierMapping(display);
601    
602            if (enable_compose)
603                    IM = XOpenIM(display, NULL, NULL, NULL);
604    
605            xkeymap_init();
606    
607            /* todo take this out when high colour is done */
608            printf("server bpp %d client bpp %d depth %d\n", server_bpp, bpp, depth);
609    
610            return True;
611    }
612    
613    void
614    ui_deinit(void)
615    {
616            if (IM != NULL)
617                    XCloseIM(IM);
618    
619            XFreeModifiermap(mod_map);
620    
621            if (ownbackstore)
622                    XFreePixmap(display, backstore);
623    
624            XFreeGC(display, gc);
625            XCloseDisplay(display);
626            display = NULL;
627    }
628    
629    BOOL
630    ui_create_window(void)
631    {
632            XSetWindowAttributes attribs;
633            XClassHint *classhints;
634            XSizeHints *sizehints;
635            int wndwidth, wndheight;
636            long input_mask, ic_input_mask;
637            XEvent xevent;
638    
639            wndwidth = fullscreen ? WidthOfScreen(screen) : width;
640            wndheight = fullscreen ? HeightOfScreen(screen) : height;
641    
642            attribs.background_pixel = BlackPixelOfScreen(screen);
643            attribs.backing_store = ownbackstore ? NotUseful : Always;
644            attribs.override_redirect = fullscreen;
645    
646          wnd = XCreateWindow(display, RootWindowOfScreen(screen),          wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, wndwidth, wndheight,
647                              0, 0, width, height, 0, CopyFromParent,                              0, CopyFromParent, InputOutput, CopyFromParent,
648                              InputOutput, CopyFromParent,                              CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs);
                             CWBackingStore | CWBackPixel | CWOverrideRedirect,  
                             &attribs);  
649    
650          XStoreName(display, wnd, title);          XStoreName(display, wnd, title);
651    
652            if (hide_decorations)
653                    mwm_hide_decorations();
654    
655          classhints = XAllocClassHint();          classhints = XAllocClassHint();
656          if (classhints != NULL)          if (classhints != NULL)
657          {          {
# Line 340  ui_create_window(char *title) Line 670  ui_create_window(char *title)
670                  XFree(sizehints);                  XFree(sizehints);
671          }          }
672    
673          xkeymap_init();          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
674                    VisibilityChangeMask | FocusChangeMask;
675    
         input_mask = KeyPressMask | KeyReleaseMask |  
                 ButtonPressMask | ButtonReleaseMask |  
                 EnterWindowMask | LeaveWindowMask;  
676          if (sendmotion)          if (sendmotion)
677                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
   
678          if (ownbackstore)          if (ownbackstore)
679                  input_mask |= ExposureMask;                  input_mask |= ExposureMask;
680            if (fullscreen || grab_keyboard)
681                    input_mask |= EnterWindowMask;
682            if (grab_keyboard)
683                    input_mask |= LeaveWindowMask;
684    
685            if (IM != NULL)
686            {
687                    IC = XCreateIC(IM, XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
688                                   XNClientWindow, wnd, XNFocusWindow, wnd, NULL);
689    
690                    if ((IC != NULL)
691                        && (XGetICValues(IC, XNFilterEvents, &ic_input_mask, NULL) == NULL))
692                            input_mask |= ic_input_mask;
693            }
694    
695          XSelectInput(display, wnd, input_mask);          XSelectInput(display, wnd, input_mask);
         gc = XCreateGC(display, wnd, 0, NULL);  
   
         if (ownbackstore)  
                 backstore = XCreatePixmap(display, wnd, width, height, depth);  
   
696          XMapWindow(display, wnd);          XMapWindow(display, wnd);
697    
698          /* TODO: error texts... make them friendly. */          /* wait for VisibilityNotify */
699          xkb = XkbGetKeyboard(display, XkbAllComponentsMask, XkbUseCoreKbd);          do
         if ((int) xkb == BadAlloc || xkb == NULL)  
700          {          {
701                  error("XkbGetKeyboard failed.\n");                  XMaskEvent(display, VisibilityChangeMask, &xevent);
                 exit(0);  
702          }          }
703            while (xevent.type != VisibilityNotify);
704    
705          /* TODO: error texts... make them friendly. */          focused = False;
706          if (XkbSelectEvents          mouse_in_wnd = False;
             (display, xkb->device_spec, XkbAllEventsMask,  
              XkbAllEventsMask) == False)  
         {  
                 error("XkbSelectEvents failed.\n");  
                 exit(0);  
         }  
707    
708          xwin_get_numlock_mask();          /* handle the WM_DELETE_WINDOW protocol */
709            protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True);
710            kill_atom = XInternAtom(display, "WM_DELETE_WINDOW", True);
711            XSetWMProtocols(display, wnd, &kill_atom, 1);
712    
713          return True;          return True;
714  }  }
715    
716  void  void
717  xwin_get_numlock_mask()  ui_destroy_window(void)
718  {  {
719          KeyCode numlockcode;          if (IC != NULL)
720          KeyCode *keycode;                  XDestroyIC(IC);
         XModifierKeymap *modmap;  
         int i, j;  
   
         /* Find out if numlock is already defined as a modifier key, and if so where */  
         numlockcode = XKeysymToKeycode(display, 0xFF7F);        /* XF_Num_Lock = 0xFF7F */  
         if (numlockcode)  
         {  
                 modmap = XGetModifierMapping(display);  
                 if (modmap)  
                 {  
                         keycode = modmap->modifiermap;  
                         for (i = 0; i < 8; i++)  
                                 for (j = modmap->max_keypermod; j--;)  
                                 {  
                                         if (*keycode == numlockcode)  
                                         {  
                                                 numlock_modifier_mask =  
                                                         (1 << i);  
                                                 i = 8;  
                                                 break;  
                                         }  
                                         keycode++;  
                                 }  
                         if (!numlock_modifier_mask)  
                         {  
                                 modmap->modifiermap[7 *  
                                                     modmap->max_keypermod] =  
                                         numlockcode;  
                                 if (XSetModifierMapping(display, modmap) ==  
                                     MappingSuccess)  
                                         numlock_modifier_mask = (1 << 7);  
                                 else  
                                         printf("XSetModifierMapping failed!\n");  
                         }  
                         XFreeModifiermap(modmap);  
                 }  
         }  
   
         if (!numlock_modifier_mask)  
                 printf("WARNING: Failed to get a numlock modifier mapping.\n");  
721    
722            XDestroyWindow(display, wnd);
723  }  }
724    
725  void  void
726  ui_destroy_window()  xwin_toggle_fullscreen(void)
727  {  {
728          if (xkb != NULL)          Pixmap contents = 0;
                 XkbFreeKeyboard(xkb, XkbAllControlsMask, True);  
729    
730          if (ownbackstore)          if (!ownbackstore)
731                  XFreePixmap(display, backstore);          {
732                    /* need to save contents of window */
733                    contents = XCreatePixmap(display, wnd, width, height, depth);
734                    XCopyArea(display, wnd, contents, gc, 0, 0, width, height, 0, 0);
735            }
736    
737          XFreeGC(display, gc);          ui_destroy_window();
738          XDestroyWindow(display, wnd);          fullscreen = !fullscreen;
739          XCloseDisplay(display);          ui_create_window();
740          display = NULL;  
741            XDefineCursor(display, wnd, current_cursor);
742    
743            if (!ownbackstore)
744            {
745                    XCopyArea(display, contents, wnd, gc, 0, 0, width, height, 0, 0);
746                    XFreePixmap(display, contents);
747            }
748  }  }
749    
750  static void  /* Process all events in Xlib queue
751  xwin_process_events()     Returns 0 after user quit, 1 otherwise */
752    static int
753    xwin_process_events(void)
754  {  {
755          XEvent xevent;          XEvent xevent;
   
756          KeySym keysym;          KeySym keysym;
         uint8 scancode;  
757          uint16 button, flags;          uint16 button, flags;
758          uint32 ev_time;          uint32 ev_time;
759          uint32 tmpmods;          key_translation tr;
760            char str[256];
761            Status status;
762            unsigned int state;
763            Window wdummy;
764            int dummy;
765    
766          while (XCheckMaskEvent(display, ~0, &xevent))          while (XPending(display) > 0)
767          {          {
768                  ev_time = time(NULL);                  XNextEvent(display, &xevent);
769    
770                    if ((IC != NULL) && (XFilterEvent(&xevent, None) == True))
771                    {
772                            DEBUG_KBD(("Filtering event\n"));
773                            continue;
774                    }
775    
776                  flags = 0;                  flags = 0;
777    
778                  switch (xevent.type)                  switch (xevent.type)
779                  {                  {
780                          case KeyRelease:                          case ClientMessage:
781                                  flags = KBD_FLAG_DOWN | KBD_FLAG_UP;                                  /* the window manager told us to quit */
782                                  /* fall through */                                  if ((xevent.xclient.message_type == protocol_atom)
783                                        && (xevent.xclient.data.l[0] == kill_atom))
784                                            /* Quit */
785                                            return 0;
786                                    break;
787    
788                          case KeyPress:                          case KeyPress:
789                                  if (XkbTranslateKeyCode                                  if (IC != NULL)
790                                      (xkb, xevent.xkey.keycode,                                          /* Multi_key compatible version */
791                                       xevent.xkey.state, &tmpmods,                                  {
792                                       &keysym) == False)                                          XmbLookupString(IC,
793                                          break;                                                          (XKeyPressedEvent *) &
794                                  scancode =                                                          xevent, str, sizeof(str), &keysym, &status);
795                                          xkeymap_translate_key(keysym,                                          if (!((status == XLookupKeySym) || (status == XLookupBoth)))
796                                                                xevent.xkey.                                          {
797                                                                keycode,                                                  error("XmbLookupString failed with status 0x%x\n",
798                                                                &flags);                                                        status);
799                                                    break;
800                                  if (scancode == 0)                                          }
801                                          break;                                  }
802                                    else
803                                  /* keep track of the modifiers -- needed for stickykeys... */                                  {
804                                  if (xevent.type == KeyPress)                                          /* Plain old XLookupString */
805                                          xwin_mod_press(xevent.xkey.state,                                          DEBUG_KBD(("\nNo input context, using XLookupString\n"));
806                                                         ev_time, scancode);                                          XLookupString((XKeyEvent *) & xevent,
807                                                          str, sizeof(str), &keysym, NULL);
808                                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE,                                  }
809                                                 flags, scancode, 0);  
810                                    DEBUG_KBD(("KeyPress for (keysym 0x%lx, %s)\n", keysym,
811                                  if (xevent.type == KeyRelease)                                             get_ksname(keysym)));
812                                          xwin_mod_release(xevent.xkey.state,  
813                                                           ev_time, scancode);                                  ev_time = time(NULL);
814                                    if (handle_special_keys(keysym, xevent.xkey.state, ev_time, True))
815                                            break;
816    
817                                    tr = xkeymap_translate_key(keysym,
818                                                               xevent.xkey.keycode, xevent.xkey.state);
819    
820                                    if (tr.scancode == 0)
821                                            break;
822    
823                                    ensure_remote_modifiers(ev_time, tr);
824    
825                                    rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);
826                                    break;
827    
828                            case KeyRelease:
829                                    XLookupString((XKeyEvent *) & xevent, str,
830                                                  sizeof(str), &keysym, NULL);
831    
832                                    DEBUG_KBD(("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym,
833                                               get_ksname(keysym)));
834    
835                                    ev_time = time(NULL);
836                                    if (handle_special_keys(keysym, xevent.xkey.state, ev_time, False))
837                                            break;
838    
839                                    tr = xkeymap_translate_key(keysym,
840                                                               xevent.xkey.keycode, xevent.xkey.state);
841    
842                                    if (tr.scancode == 0)
843                                            break;
844    
845                                    rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode);
846                                  break;                                  break;
847    
848                          case ButtonPress:                          case ButtonPress:
# Line 499  xwin_process_events() Line 850  xwin_process_events()
850                                  /* fall through */                                  /* fall through */
851    
852                          case ButtonRelease:                          case ButtonRelease:
853                                  button = xkeymap_translate_button(xevent.                                  button = xkeymap_translate_button(xevent.xbutton.button);
                                                                   xbutton.  
                                                                   button);  
854                                  if (button == 0)                                  if (button == 0)
855                                          break;                                          break;
856    
857                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,                                  rdp_send_input(time(NULL), RDP_INPUT_MOUSE,
858                                                 flags | button,                                                 flags | button, xevent.xbutton.x, xevent.xbutton.y);
                                                xevent.xbutton.x,  
                                                xevent.xbutton.y);  
859                                  break;                                  break;
860    
861                          case MotionNotify:                          case MotionNotify:
862                                  rdp_send_input(ev_time, RDP_INPUT_MOUSE,                                  if (fullscreen && !focused)
863                                                 MOUSE_FLAG_MOVE,                                          XSetInputFocus(display, wnd, RevertToPointerRoot,
864                                                 xevent.xmotion.x,                                                         CurrentTime);
865                                                 xevent.xmotion.y);                                  rdp_send_input(time(NULL), RDP_INPUT_MOUSE,
866                                                   MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y);
867                                  break;                                  break;
868    
869                          case EnterNotify:                          case FocusIn:
870                                  XGrabKeyboard(display, wnd, True,                                  if (xevent.xfocus.mode == NotifyGrab)
871                                                GrabModeAsync, GrabModeAsync,                                          break;
872                                                CurrentTime);                                  focused = True;
873                                    XQueryPointer(display, wnd, &wdummy, &wdummy, &dummy, &dummy,
874                                                  &dummy, &dummy, &state);
875                                    reset_modifier_keys(state);
876                                    if (grab_keyboard && mouse_in_wnd)
877                                            XGrabKeyboard(display, wnd, True,
878                                                          GrabModeAsync, GrabModeAsync, CurrentTime);
879                                    break;
880    
881                            case FocusOut:
882                                    if (xevent.xfocus.mode == NotifyUngrab)
883                                            break;
884                                    focused = False;
885                                    if (xevent.xfocus.mode == NotifyWhileGrabbed)
886                                            XUngrabKeyboard(display, CurrentTime);
887                                    break;
888    
889                                  xwin_mod_update(xevent.xcrossing.state,                          case EnterNotify:
890                                                  ev_time);                                  /* we only register for this event when in fullscreen mode */
891                                    /* or grab_keyboard */
892                                    mouse_in_wnd = True;
893                                    if (fullscreen)
894                                    {
895                                            XSetInputFocus(display, wnd, RevertToPointerRoot,
896                                                           CurrentTime);
897                                            break;
898                                    }
899                                    if (focused)
900                                            XGrabKeyboard(display, wnd, True,
901                                                          GrabModeAsync, GrabModeAsync, CurrentTime);
902                                  break;                                  break;
903    
904                          case LeaveNotify:                          case LeaveNotify:
905                                    /* we only register for this event when grab_keyboard */
906                                    mouse_in_wnd = False;
907                                  XUngrabKeyboard(display, CurrentTime);                                  XUngrabKeyboard(display, CurrentTime);
908                                  break;                                  break;
909    
# Line 538  xwin_process_events() Line 914  xwin_process_events()
914                                            xevent.xexpose.height,                                            xevent.xexpose.height,
915                                            xevent.xexpose.x, xevent.xexpose.y);                                            xevent.xexpose.x, xevent.xexpose.y);
916                                  break;                                  break;
                 }  
         }  
 }  
   
 void  
 xwin_mod_update(uint32 state, uint32 ev_time)  
 {  
         xwin_mod_press(state, ev_time, 0);  
         xwin_mod_release(state, ev_time, 0);  
 }  
   
 void  
 xwin_mod_release(uint32 state, uint32 ev_time, uint32 scancode)  
 {  
         switch (scancode)  
         {  
                 case 0x2a:  
                         key_down_state &= ~DShift1Mask;  
                         break;  
                 case 0x36:  
                         key_down_state &= ~DShift2Mask;  
                         break;  
                 case 0x1d:  
                         key_down_state &= ~DControl1Mask;  
                         break;  
                 case 0x9d:  
                         key_down_state &= ~DControl2Mask;  
                         break;  
                 case 0x38:  
                         key_down_state &= ~DMod1Mask;  
                         break;  
                 case 0xb8:  
                         key_down_state &= ~DMod2Mask;  
                         break;  
         }  
   
         if (!(numlock_modifier_mask & state)  
             && (key_down_state & DNumLockMask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0, 0x45, 0);  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE,  
                                KBD_FLAG_DOWN | KBD_FLAG_UP, 0x45, 0);  
                 key_down_state &= ~DNumLockMask;  
         }  
   
         if (!(LockMask & state) && (key_down_state & DLockMask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0, 0x3a, 0);  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE,  
                                KBD_FLAG_DOWN | KBD_FLAG_UP, 0x3a, 0);  
                 key_down_state &= ~DLockMask;  
   
         }  
   
   
         if (!(ShiftMask & state) && (key_down_state & DShift1Mask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_UP, 0x2a,  
                                0);  
                 key_down_state &= ~DShift1Mask;  
   
         }  
   
         if (!(ControlMask & state) && (key_down_state & DControl1Mask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_UP, 0x1d,  
                                0);  
                 key_down_state &= ~DControl1Mask;  
   
         }  
   
         if (!(Mod1Mask & state) && (key_down_state & DMod1Mask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_UP, 0x38,  
                                0);  
                 key_down_state &= ~DMod1Mask;  
   
         }  
   
         if (!(Mod2Mask & state) && (key_down_state & DMod2Mask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_UP, 0xb8,  
                                0);  
                 key_down_state &= ~DMod2Mask;  
         }  
 }  
   
   
 void  
 xwin_mod_press(uint32 state, uint32 ev_time, uint32 scancode)  
 {  
   
         switch (scancode)  
         {  
                 case 0x2a:  
                         key_down_state |= DShift1Mask;  
                         break;  
                 case 0x36:  
                         key_down_state |= DShift2Mask;  
                         break;  
                 case 0x1d:  
                         key_down_state |= DControl1Mask;  
                         break;  
                 case 0x9d:  
                         key_down_state |= DControl2Mask;  
                         break;  
                 case 0x3a:  
                         key_down_state ^= DLockMask;  
                         break;  
                 case 0x45:  
                         key_down_state ^= DNumLockMask;  
                         break;  
                 case 0x38:  
                         key_down_state |= DMod1Mask;  
                         break;  
                 case 0xb8:  
                         key_down_state |= DMod2Mask;  
                         break;  
         }  
   
         if ((numlock_modifier_mask && state)  
             && !(key_down_state & DNumLockMask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0, 0x45, 0);  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE,  
                                KBD_FLAG_DOWN | KBD_FLAG_UP, 0x45, 0);  
                 key_down_state |= DNumLockMask;  
         }  
   
         if ((LockMask & state) && !(key_down_state & DLockMask))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, 0, 0x3a, 0);  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE,  
                                KBD_FLAG_DOWN | KBD_FLAG_UP, 0x3a, 0);  
                 key_down_state |= DLockMask;  
   
         }  
   
   
         if ((ShiftMask & state)  
             && !((key_down_state & DShift1Mask)  
                  || (key_down_state & DShift2Mask)))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_DOWN,  
                                0x2a, 0);  
                 key_down_state |= DShift1Mask;  
   
         }  
   
         if ((ControlMask & state)  
             && !((key_down_state & DControl1Mask)  
                  || (key_down_state & DControl2Mask)))  
         {  
                 rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_DOWN,  
                                0x1d, 0);  
                 key_down_state |= DControl1Mask;  
917    
918          }                          case MappingNotify:
919                                    /* Refresh keyboard mapping if it has changed. This is important for
920          if ((Mod1Mask & state) && !(key_down_state & DMod1Mask))                                     Xvnc, since it allocates keycodes dynamically */
921          {                                  if (xevent.xmapping.request == MappingKeyboard
922                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_DOWN,                                      || xevent.xmapping.request == MappingModifier)
923                                 0x38, 0);                                          XRefreshKeyboardMapping(&xevent.xmapping);
                 key_down_state |= DMod1Mask;  
   
         }  
924    
925          if ((Mod2Mask & state) && !(key_down_state & DMod2Mask))                                  if (xevent.xmapping.request == MappingModifier)
926          {                                  {
927                  rdp_send_input(ev_time, RDP_INPUT_SCANCODE, KBD_FLAG_DOWN,                                          XFreeModifiermap(mod_map);
928                                 0xb8, 0);                                          mod_map = XGetModifierMapping(display);
929                  key_down_state |= DMod2Mask;                                  }
930                                    break;
931    
932                    }
933          }          }
934            /* Keep going */
935            return 1;
936  }  }
937    
938  void  /* Returns 0 after user quit, 1 otherwise */
939    int
940  ui_select(int rdp_socket)  ui_select(int rdp_socket)
941  {  {
942          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
# Line 724  ui_select(int rdp_socket) Line 946  ui_select(int rdp_socket)
946    
947          while (True)          while (True)
948          {          {
949                    /* Process any events already waiting */
950                    if (!xwin_process_events())
951                            /* User quit */
952                            return 0;
953    
954                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
955                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
956                  if (display != NULL)                  FD_SET(x_socket, &rfds);
                 {  
                         FD_SET(x_socket, &rfds);  
                         XFlush(display);  
                 }  
957    
958                  switch (select(n, &rfds, NULL, NULL, NULL))                  switch (select(n, &rfds, NULL, NULL, NULL))
959                  {                  {
# Line 741  ui_select(int rdp_socket) Line 964  ui_select(int rdp_socket)
964                                  continue;                                  continue;
965                  }                  }
966    
                 if (FD_ISSET(x_socket, &rfds))  
                         xwin_process_events();  
   
967                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
968                          return;                          return 1;
969          }          }
970  }  }
971    
# Line 764  ui_create_bitmap(int width, int height, Line 984  ui_create_bitmap(int width, int height,
984    
985          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
986          bitmap = XCreatePixmap(display, wnd, width, height, depth);          bitmap = XCreatePixmap(display, wnd, width, height, depth);
987          image = XCreateImage(display, visual, depth, ZPixmap,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
988                               0, tdata, width, height, 8, 0);                               (char *) tdata, width, height, server_bpp == 8 ? 8 : bpp, 0);
989    
990          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
991    
# Line 776  ui_create_bitmap(int width, int height, Line 996  ui_create_bitmap(int width, int height,
996  }  }
997    
998  void  void
999  ui_paint_bitmap(int x, int y, int cx, int cy,  ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data)
                 int width, int height, uint8 * data)  
1000  {  {
1001          XImage *image;          XImage *image;
1002          uint8 *tdata;          uint8 *tdata;
   
1003          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
1004          image = XCreateImage(display, visual, depth, ZPixmap,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
1005                               0, tdata, width, height, 8, 0);                               (char *) tdata, width, height, server_bpp == 8 ? 8 : bpp, 0);
1006    
1007          if (ownbackstore)          if (ownbackstore)
1008          {          {
# Line 820  ui_create_glyph(int width, int height, u Line 1038  ui_create_glyph(int width, int height, u
1038          bitmap = XCreatePixmap(display, wnd, width, height, 1);          bitmap = XCreatePixmap(display, wnd, width, height, 1);
1039          gc = XCreateGC(display, bitmap, 0, NULL);          gc = XCreateGC(display, bitmap, 0, NULL);
1040    
1041          image = XCreateImage(display, visual, 1, ZPixmap, 0,          image = XCreateImage(display, visual, 1, ZPixmap, 0, (char *) data,
1042                               data, width, height, 8, scanline);                               width, height, 8, scanline);
1043          image->byte_order = MSBFirst;          image->byte_order = MSBFirst;
1044          image->bitmap_bit_order = MSBFirst;          image->bitmap_bit_order = MSBFirst;
1045          XInitImage(image);          XInitImage(image);
# Line 840  ui_destroy_glyph(HGLYPH glyph) Line 1058  ui_destroy_glyph(HGLYPH glyph)
1058  }  }
1059    
1060  HCURSOR  HCURSOR
1061  ui_create_cursor(unsigned int x, unsigned int y, int width,  ui_create_cursor(unsigned int x, unsigned int y, int width, int height,
1062                   int height, uint8 * andmask, uint8 * xormask)                   uint8 * andmask, uint8 * xormask)
1063  {  {
1064          HGLYPH maskglyph, cursorglyph;          HGLYPH maskglyph, cursorglyph;
1065          XColor bg, fg;          XColor bg, fg;
# Line 899  ui_create_cursor(unsigned int x, unsigne Line 1117  ui_create_cursor(unsigned int x, unsigne
1117          cursorglyph = ui_create_glyph(width, height, cursor);          cursorglyph = ui_create_glyph(width, height, cursor);
1118          maskglyph = ui_create_glyph(width, height, mask);          maskglyph = ui_create_glyph(width, height, mask);
1119    
1120          xcursor = XCreatePixmapCursor(display, (Pixmap) cursorglyph,          xcursor =
1121                                        (Pixmap) maskglyph, &fg, &bg, x, y);                  XCreatePixmapCursor(display, (Pixmap) cursorglyph,
1122                                        (Pixmap) maskglyph, &fg, &bg, x, y);
1123    
1124          ui_destroy_glyph(maskglyph);          ui_destroy_glyph(maskglyph);
1125          ui_destroy_glyph(cursorglyph);          ui_destroy_glyph(cursorglyph);
# Line 912  ui_create_cursor(unsigned int x, unsigne Line 1131  ui_create_cursor(unsigned int x, unsigne
1131  void  void
1132  ui_set_cursor(HCURSOR cursor)  ui_set_cursor(HCURSOR cursor)
1133  {  {
1134          XDefineCursor(display, wnd, (Cursor) cursor);          current_cursor = (Cursor) cursor;
1135            XDefineCursor(display, wnd, current_cursor);
1136  }  }
1137    
1138  void  void
# Line 927  ui_destroy_cursor(HCURSOR cursor) Line 1147  ui_destroy_cursor(HCURSOR cursor)
1147                  (xc)->blue  = ((c)->blue  << 8) | (c)->blue; \                  (xc)->blue  = ((c)->blue  << 8) | (c)->blue; \
1148                  (xc)->flags = DoRed | DoGreen | DoBlue;                  (xc)->flags = DoRed | DoGreen | DoBlue;
1149    
1150    
1151  HCOLOURMAP  HCOLOURMAP
1152  ui_create_colourmap(COLOURMAP * colours)  ui_create_colourmap(COLOURMAP * colours)
1153  {  {
1154          COLOURENTRY *entry;          COLOURENTRY *entry;
1155          int i, ncolours = colours->ncolours;          int i, ncolours = colours->ncolours;
1156            if (!owncolmap)
1157            {
1158                    uint32 *map = xmalloc(sizeof(*colmap) * ncolours);
1159                    XColor xentry;
1160                    XColor xc_cache[256];
1161                    uint32 colour;
1162                    int colLookup = 256;
1163                    for (i = 0; i < ncolours; i++)
1164                    {
1165                            entry = &colours->colours[i];
1166                            MAKE_XCOLOR(&xentry, entry);
1167    
1168                            if (XAllocColor(display, xcolmap, &xentry) == 0)
1169                            {
1170                                    /* Allocation failed, find closest match. */
1171                                    int j = 256;
1172                                    int nMinDist = 3 * 256 * 256;
1173                                    long nDist = nMinDist;
1174    
1175                                    /* only get the colors once */
1176                                    while (colLookup--)
1177                                    {
1178                                            xc_cache[colLookup].pixel = colLookup;
1179                                            xc_cache[colLookup].red = xc_cache[colLookup].green =
1180                                                    xc_cache[colLookup].blue = 0;
1181                                            xc_cache[colLookup].flags = 0;
1182                                            XQueryColor(display,
1183                                                        DefaultColormap(display,
1184                                                                        DefaultScreen(display)),
1185                                                        &xc_cache[colLookup]);
1186                                    }
1187                                    colLookup = 0;
1188    
1189                                    /* approximate the pixel */
1190                                    while (j--)
1191                                    {
1192                                            if (xc_cache[j].flags)
1193                                            {
1194                                                    nDist = ((long) (xc_cache[j].red >> 8) -
1195                                                             (long) (xentry.red >> 8)) *
1196                                                            ((long) (xc_cache[j].red >> 8) -
1197                                                             (long) (xentry.red >> 8)) +
1198                                                            ((long) (xc_cache[j].green >> 8) -
1199                                                             (long) (xentry.green >> 8)) *
1200                                                            ((long) (xc_cache[j].green >> 8) -
1201                                                             (long) (xentry.green >> 8)) +
1202                                                            ((long) (xc_cache[j].blue >> 8) -
1203                                                             (long) (xentry.blue >> 8)) *
1204                                                            ((long) (xc_cache[j].blue >> 8) -
1205                                                             (long) (xentry.blue >> 8));
1206                                            }
1207                                            if (nDist < nMinDist)
1208                                            {
1209                                                    nMinDist = nDist;
1210                                                    xentry.pixel = j;
1211                                            }
1212                                    }
1213                            }
1214                            colour = xentry.pixel;
1215    
1216                            /* update our cache */
1217                            if (xentry.pixel < 256)
1218                            {
1219                                    xc_cache[xentry.pixel].red = xentry.red;
1220                                    xc_cache[xentry.pixel].green = xentry.green;
1221                                    xc_cache[xentry.pixel].blue = xentry.blue;
1222    
1223                            }
1224    
1225    
1226          if (owncolmap)                          /* byte swap here to make translate_image faster */
1227                            map[i] = translate_colour(colour);
1228                    }
1229                    return map;
1230            }
1231            else
1232          {          {
1233                  XColor *xcolours, *xentry;                  XColor *xcolours, *xentry;
1234                  Colormap map;                  Colormap map;
# Line 953  ui_create_colourmap(COLOURMAP * colours) Line 1248  ui_create_colourmap(COLOURMAP * colours)
1248                  xfree(xcolours);                  xfree(xcolours);
1249                  return (HCOLOURMAP) map;                  return (HCOLOURMAP) map;
1250          }          }
         else  
         {  
                 uint32 *map = xmalloc(sizeof(*colmap) * ncolours);  
                 XColor xentry;  
                 uint32 colour;  
   
                 for (i = 0; i < ncolours; i++)  
                 {  
                         entry = &colours->colours[i];  
                         MAKE_XCOLOR(&xentry, entry);  
   
                         if (XAllocColor(display, xcolmap, &xentry) != 0)  
                                 colour = xentry.pixel;  
                         else  
                                 colour = white;  
   
                         /* byte swap here to make translate_image faster */  
                         map[i] = translate_colour(colour);  
                 }  
   
                 return map;  
         }  
1251  }  }
1252    
1253  void  void
1254  ui_destroy_colourmap(HCOLOURMAP map)  ui_destroy_colourmap(HCOLOURMAP map)
1255  {  {
1256          if (owncolmap)          if (!owncolmap)
                 XFreeColormap(display, (Colormap) map);  
         else  
1257                  xfree(map);                  xfree(map);
1258            else
1259                    XFreeColormap(display, (Colormap) map);
1260  }  }
1261    
1262  void  void
1263  ui_set_colourmap(HCOLOURMAP map)  ui_set_colourmap(HCOLOURMAP map)
1264  {  {
1265          if (owncolmap)          if (!owncolmap)
                 XSetWindowColormap(display, wnd, (Colormap) map);  
         else  
1266                  colmap = map;                  colmap = map;
1267            else
1268                    XSetWindowColormap(display, wnd, (Colormap) map);
1269  }  }
1270    
1271  void  void
# Line 1008  ui_set_clip(int x, int y, int cx, int cy Line 1281  ui_set_clip(int x, int y, int cx, int cy
1281  }  }
1282    
1283  void  void
1284  ui_reset_clip()  ui_reset_clip(void)
1285  {  {
1286          XRectangle rect;          XRectangle rect;
1287    
# Line 1020  ui_reset_clip() Line 1293  ui_reset_clip()
1293  }  }
1294    
1295  void  void
1296  ui_bell()  ui_bell(void)
1297  {  {
1298          XBell(display, 0);          XBell(display, 0);
1299  }  }
# Line 1060  ui_patblt(uint8 opcode, Line 1333  ui_patblt(uint8 opcode,
1333                          SET_BACKGROUND(fgcolour);                          SET_BACKGROUND(fgcolour);
1334                          XSetFillStyle(display, gc, FillOpaqueStippled);                          XSetFillStyle(display, gc, FillOpaqueStippled);
1335                          XSetStipple(display, gc, fill);                          XSetStipple(display, gc, fill);
1336                          XSetTSOrigin(display, gc, brush->xorigin,                          XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin);
                                      brush->yorigin);  
1337    
1338                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE(x, y, cx, cy);
1339    
1340                          XSetFillStyle(display, gc, FillSolid);                          XSetFillStyle(display, gc, FillSolid);
1341                            XSetTSOrigin(display, gc, 0, 0);
1342                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
1343                          break;                          break;
1344    
# Line 1084  ui_screenblt(uint8 opcode, Line 1357  ui_screenblt(uint8 opcode,
1357          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
1358          XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);          XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y);
1359          if (ownbackstore)          if (ownbackstore)
1360                  XCopyArea(display, backstore, backstore, gc, srcx, srcy,                  XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, cy, x, y);
                           cx, cy, x, y);  
1361          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
1362  }  }
1363    
# Line 1097  ui_memblt(uint8 opcode, Line 1369  ui_memblt(uint8 opcode,
1369          SET_FUNCTION(opcode);          SET_FUNCTION(opcode);
1370          XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y);          XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y);
1371          if (ownbackstore)          if (ownbackstore)
1372                  XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy,                  XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, cx, cy, x, y);
                           cx, cy, x, y);  
1373          RESET_FUNCTION(opcode);          RESET_FUNCTION(opcode);
1374  }  }
1375    
# Line 1115  ui_triblt(uint8 opcode, Line 1386  ui_triblt(uint8 opcode,
1386          {          {
1387                  case 0x69:      /* PDSxxn */                  case 0x69:      /* PDSxxn */
1388                          ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy);                          ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy);
1389                          ui_patblt(ROP2_NXOR, x, y, cx, cy,                          ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, fgcolour);
                                   brush, bgcolour, fgcolour);  
1390                          break;                          break;
1391    
1392                  case 0xb8:      /* PSDPxax */                  case 0xb8:      /* PSDPxax */
1393                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour);
                                   brush, bgcolour, fgcolour);  
1394                          ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy);                          ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy);
1395                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour);
                                   brush, bgcolour, fgcolour);  
1396                          break;                          break;
1397    
1398                  case 0xc0:      /* PSa */                  case 0xc0:      /* PSa */
1399                          ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy);                          ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy);
1400                          ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour,                          ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, fgcolour);
                                   fgcolour);  
1401                          break;                          break;
1402    
1403                  default:                  default:
# Line 1161  ui_rect( Line 1428  ui_rect(
1428          FILL_RECTANGLE(x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
1429  }  }
1430    
1431    /* warning, this function only draws on wnd or backstore, not both */
1432  void  void
1433  ui_draw_glyph(int mixmode,  ui_draw_glyph(int mixmode,
1434                /* dest */ int x, int y, int cx, int cy,                /* dest */ int x, int y, int cx, int cy,
1435                /* src */ HGLYPH glyph, int srcx, int srcy, int bgcolour,                /* src */ HGLYPH glyph, int srcx, int srcy,
1436                int fgcolour)                int bgcolour, int fgcolour)
1437  {  {
1438          SET_FOREGROUND(fgcolour);          SET_FOREGROUND(fgcolour);
1439          SET_BACKGROUND(bgcolour);          SET_BACKGROUND(bgcolour);
1440    
1441          XSetFillStyle(display, gc, (mixmode == MIX_TRANSPARENT)          XSetFillStyle(display, gc,
1442                        ? FillStippled : FillOpaqueStippled);                        (mixmode == MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled);
1443          XSetStipple(display, gc, (Pixmap) glyph);          XSetStipple(display, gc, (Pixmap) glyph);
1444          XSetTSOrigin(display, gc, x, y);          XSetTSOrigin(display, gc, x, y);
1445    
1446          FILL_RECTANGLE(x, y, cx, cy);          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
1447    
1448          XSetFillStyle(display, gc, FillSolid);          XSetFillStyle(display, gc, FillSolid);
1449  }  }
# Line 1189  ui_draw_glyph(int mixmode, Line 1457  ui_draw_glyph(int mixmode,
1457        if ((xyoffset & 0x80))\        if ((xyoffset & 0x80))\
1458          {\          {\
1459            if (flags & TEXT2_VERTICAL) \            if (flags & TEXT2_VERTICAL) \
1460              y += ttext[++idx] | (ttext[++idx] << 8);\              y += ttext[idx+1] | (ttext[idx+2] << 8);\
1461            else\            else\
1462              x += ttext[++idx] | (ttext[++idx] << 8);\              x += ttext[idx+1] | (ttext[idx+2] << 8);\
1463              idx += 2;\
1464          }\          }\
1465        else\        else\
1466          {\          {\
# Line 1203  ui_draw_glyph(int mixmode, Line 1472  ui_draw_glyph(int mixmode,
1472      }\      }\
1473    if (glyph != NULL)\    if (glyph != NULL)\
1474      {\      {\
1475        ui_draw_glyph (mixmode, x + (short) glyph->offset,\        ui_draw_glyph (mixmode, x + glyph->offset,\
1476                       y + (short) glyph->baseline,\                       y + glyph->baseline,\
1477                       glyph->width, glyph->height,\                       glyph->width, glyph->height,\
1478                       glyph->pixmap, 0, 0, bgcolour, fgcolour);\                       glyph->pixmap, 0, 0, bgcolour, fgcolour);\
1479        if (flags & TEXT2_IMPLICIT_X)\        if (flags & TEXT2_IMPLICIT_X)\
# Line 1214  ui_draw_glyph(int mixmode, Line 1483  ui_draw_glyph(int mixmode,
1483    
1484  void  void
1485  ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,  ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,
1486               int clipx, int clipy, int clipcx, int clipcy, int boxx,               int clipx, int clipy, int clipcx, int clipcy,
1487               int boxy, int boxcx, int boxcy, int bgcolour,               int boxx, int boxy, int boxcx, int boxcy, int bgcolour,
1488               int fgcolour, uint8 * text, uint8 length)               int fgcolour, uint8 * text, uint8 length)
1489  {  {
1490          FONTGLYPH *glyph;          FONTGLYPH *glyph;
# Line 1226  ui_draw_text(uint8 font, uint8 flags, in Line 1495  ui_draw_text(uint8 font, uint8 flags, in
1495    
1496          if (boxcx > 1)          if (boxcx > 1)
1497          {          {
1498                  FILL_RECTANGLE(boxx, boxy, boxcx, boxcy);                  FILL_RECTANGLE_BACKSTORE(boxx, boxy, boxcx, boxcy);
1499          }          }
1500          else if (mixmode == MIX_OPAQUE)          else if (mixmode == MIX_OPAQUE)
1501          {          {
1502                  FILL_RECTANGLE(clipx, clipy, clipcx, clipcy);                  FILL_RECTANGLE_BACKSTORE(clipx, clipy, clipcx, clipcy);
1503          }          }
1504    
1505          /* Paint text, character by character */          /* Paint text, character by character */
# Line 1240  ui_draw_text(uint8 font, uint8 flags, in Line 1509  ui_draw_text(uint8 font, uint8 flags, in
1509                  {                  {
1510                          case 0xff:                          case 0xff:
1511                                  if (i + 2 < length)                                  if (i + 2 < length)
1512                                          cache_put_text(text[i + 1], text,                                          cache_put_text(text[i + 1], text, text[i + 2]);
                                                        text[i + 2]);  
1513                                  else                                  else
1514                                  {                                  {
1515                                          error("this shouldn't be happening\n");                                          error("this shouldn't be happening\n");
1516                                          break;                                          exit(1);
1517                                  }                                  }
1518                                  /* this will move pointer from start to first character after FF command */                                  /* this will move pointer from start to first character after FF command */
1519                                  length -= i + 3;                                  length -= i + 3;
# Line 1258  ui_draw_text(uint8 font, uint8 flags, in Line 1526  ui_draw_text(uint8 font, uint8 flags, in
1526                                  if (entry != NULL)                                  if (entry != NULL)
1527                                  {                                  {
1528                                          if ((((uint8 *) (entry->data))[1] ==                                          if ((((uint8 *) (entry->data))[1] ==
1529                                               0)                                               0) && (!(flags & TEXT2_IMPLICIT_X)))
                                             && (!(flags & TEXT2_IMPLICIT_X)))  
1530                                          {                                          {
1531                                                  if (flags & TEXT2_VERTICAL)                                                  if (flags & TEXT2_VERTICAL)
1532                                                          y += text[i + 2];                                                          y += text[i + 2];
1533                                                  else                                                  else
1534                                                          x += text[i + 2];                                                          x += text[i + 2];
1535                                          }                                          }
                                         if (i + 2 < length)  
                                                 i += 3;  
                                         else  
                                                 i += 2;  
                                         length -= i;  
                                         /* this will move pointer from start to first character after FE command */  
                                         text = &(text[i]);  
                                         i = 0;  
1536                                          for (j = 0; j < entry->size; j++)                                          for (j = 0; j < entry->size; j++)
1537                                                  DO_GLYPH(((uint8 *) (entry->                                                  DO_GLYPH(((uint8 *) (entry->data)), j);
                                                                      data)),  
                                                          j);  
1538                                  }                                  }
1539                                    if (i + 2 < length)
1540                                            i += 3;
1541                                    else
1542                                            i += 2;
1543                                    length -= i;
1544                                    /* this will move pointer from start to first character after FE command */
1545                                    text = &(text[i]);
1546                                    i = 0;
1547                                  break;                                  break;
1548    
1549                          default:                          default:
# Line 1287  ui_draw_text(uint8 font, uint8 flags, in Line 1552  ui_draw_text(uint8 font, uint8 flags, in
1552                                  break;                                  break;
1553                  }                  }
1554          }          }
1555            if (ownbackstore)
1556            {
1557                    if (boxcx > 1)
1558                            XCopyArea(display, backstore, wnd, gc, boxx,
1559                                      boxy, boxcx, boxcy, boxx, boxy);
1560                    else
1561                            XCopyArea(display, backstore, wnd, gc, clipx,
1562                                      clipy, clipcx, clipcy, clipx, clipy);
1563            }
1564  }  }
1565    
1566  void  void
# Line 1299  ui_desktop_save(uint32 offset, int x, in Line 1571  ui_desktop_save(uint32 offset, int x, in
1571    
1572          if (ownbackstore)          if (ownbackstore)
1573          {          {
1574                  image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes,                  image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, ZPixmap);
                                   ZPixmap);  
1575          }          }
1576          else          else
1577          {          {
1578                  pix = XCreatePixmap(display, wnd, cx, cy, depth);                  pix = XCreatePixmap(display, wnd, cx, cy, depth);
1579                  XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0);                  XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0);
1580                  image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes,                  image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap);
                                   ZPixmap);  
1581                  XFreePixmap(display, pix);                  XFreePixmap(display, pix);
1582          }          }
1583    
1584          offset *= bpp / 8;          offset *= bpp / 8;
1585          cache_put_desktop(offset, cx, cy, image->bytes_per_line,          cache_put_desktop(offset, cx, cy, image->bytes_per_line, bpp / 8, (uint8 *) image->data);
                           bpp / 8, (uint8 *) image->data);  
1586    
1587          XDestroyImage(image);          XDestroyImage(image);
1588  }  }
# Line 1329  ui_desktop_restore(uint32 offset, int x, Line 1598  ui_desktop_restore(uint32 offset, int x,
1598          if (data == NULL)          if (data == NULL)
1599                  return;                  return;
1600    
1601          image = XCreateImage(display, visual, depth, ZPixmap,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
1602                               0, data, cx, cy, BitmapPad(display),                               (char *) data, cx, cy, BitmapPad(display), cx * bpp / 8);
                              cx * bpp / 8);  
1603    
1604          if (ownbackstore)          if (ownbackstore)
1605          {          {

Legend:
Removed from v.64  
changed lines
  Added in v.319

  ViewVC Help
Powered by ViewVC 1.1.26