]> cvs.zerfleddert.de Git - micropolis/blobdiff - src/sim/w_x.c
include xpm.h from X11/ (from Deanna Phillips' OpenBSD repository)
[micropolis] / src / sim / w_x.c
index 0d682094675b13e28de1152fccb63366e3eb0487..ef42536588ef0d8d535c104d17f5fd017fbb8f9d 100644 (file)
@@ -327,28 +327,43 @@ FindXDisplay(Tk_Window tkwin)
              color->pixel; \
            break; \
          case 15: \
+           if (xd->visual->red_mask == 0x7c00) { \
            xd->pixels[i] = \
              (((color->red >> (8 + 3)) & 0x1f) << (5 + 5)) | \
              (((color->green >> (8 + 2)) & 0x1f) << (5)) | \
              (((color->blue >> (8 + 3)) & 0x1f) << (0)); \
+           } else { \
+             (((color->blue >> (8 + 3)) & 0x1f) << (5 + 5)) | \
+             (((color->green >> (8 + 2)) & 0x1f) << (5)) | \
+             (((color->red >> (8 + 3)) & 0x1f) << (0)); \
+           } \
            break; \
          case 16: \
+           if (xd->visual->red_mask == 0xf800) { \
            xd->pixels[i] = \
              (((color->red >> (8 + 3)) & 0x1f) << (6 + 5)) | \
              (((color->green >> (8 + 2)) & 0x3f) << (5)) | \
              (((color->blue >> (8 + 3)) & 0x1f) << (0)); \
+           } else { \
+           xd->pixels[i] = \
+             (((color->blue >> (8 + 3)) & 0x1f) << (6 + 5)) | \
+             (((color->green >> (8 + 2)) & 0x3f) << (5)) | \
+             (((color->red >> (8 + 3)) & 0x1f) << (0)); \
+           } \
            break; \
          case 24: \
+         case 32: \
+           if (xd->visual->red_mask == 0xff0000) { \
            xd->pixels[i] = \
              ((color->red & 0xff) << 16) | \
              ((color->green & 0xff) << 8) | \
              ((color->blue & 0xff) << 0); \
-           break; \
-         case 32: \
+           } else { \
            xd->pixels[i] = \
-             ((color->red & 0xff) << 16) | \
+             ((color->blue & 0xff) << 16) | \
              ((color->green & 0xff) << 8) | \
-             ((color->blue & 0xff) << 0); \
+             ((color->red & 0xff) << 0); \
+           } \
            break; \
          } \
        } \
@@ -441,9 +456,7 @@ FindXDisplay(Tk_Window tkwin)
        } else {
          fprintf(stderr,
                  "Cool, I found the shared memory extension!\n");
-         fprintf(stderr,
-                 "Disabled SHM, because it is currently broken!\n");
-         xd->shared = 0;
+         xd->shared = 1;
        }
       }
     }
@@ -585,8 +598,8 @@ InitNewView(SimView *view, char *title, int class, int w, int h)
     view->type = X_Mem_View;
   }
 
-  /* XXX: Find cases where transaltion is needed */
-  view->x->needs_swap = 0;
+  view->x->needs_swap = !(*(unsigned char*) (&test));
+  view->x->x_big_endian = (ImageByteOrder(view->x->dpy) == MSBFirst);
 
 
   GetPixmaps(view->x);
@@ -598,8 +611,6 @@ InitNewView(SimView *view, char *title, int class, int w, int h)
   view->pan_x = w / 2; view->pan_y = h / 2;
   DoResizeView(view, w, h);
 
-  GetViewTiles(view);
-
   return (view);
 }
 
@@ -1231,6 +1242,9 @@ DoResizeView(SimView *view, int w, int h)
       }
     }
   }
+
+  GetViewTiles(view);
+
 }
 
 
Impressum, Datenschutz