-#ifdef HAVE_XSHM_EXTENSION
- if (use_shm) {
- printf("p=%X\n", p);
- free(p);
- image = XShmCreateImage(dpy, xgwa.visual, vdepth,
- ZPixmap, 0, &shm_info, width, height);
- shm_info.shmid = shmget(IPC_PRIVATE,
- image->bytes_per_line * image->height,
- IPC_CREAT | 0777);
- if (shm_info.shmid == -1)
- printf ("shmget failed!");
- shm_info.readOnly = False;
- p = shmat(shm_info.shmid, 0, 0);
- printf("p=%X %d\n", p, image->bytes_per_line);
- XShmAttach(dpy, &shm_info);
- XSync(dpy, False);
- } else
-#endif
- image = XCreateImage(dpy, xgwa.visual, vdepth,
- ZPixmap, 0, p,
- width, height, 8, 0);
-
- while (1) {
- int i, j;
- pixack_frame(p);
- for (i = 0; i < array_width; i += width)
- for (j = 0; j < array_height; j += height)
-#ifdef HAVE_XSHM_EXTENSION
- if (use_shm)
- XShmPutImage(dpy, win, gc, image, 0, 0, i, j,
- width, height, False);
- else
-#endif
- XPutImage(dpy, win, gc, image, 0, 0, i+array_x, j+array_y, width, height);
-
- array_x += array_dx;
- array_y += array_dy;
- if (array_x < 0) {
- array_x = 0;
- array_dx = -array_dx;
- } else if (array_x > (xgwa.width - array_width)) {
- array_x = (xgwa.width - array_width);
- array_dx = -array_dx;
- }
- if (array_y < 0) {
- array_y = 0;
- array_dy = -array_dy;
- } else if (array_y > (xgwa.height - array_height)) {
- array_y = (xgwa.height - array_height);
- array_dy = -array_dy;