summaryrefslogtreecommitdiffstats
path: root/hacks/glx/rubik.c
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-18 11:55:41 +0100
committerSimon Rettberg2019-02-18 11:55:41 +0100
commitae69a754244c4e475c8d2591772ca8e005071d83 (patch)
tree58b3fa7abc2dcfe3c23e1c0ce108950c720826ab /hacks/glx/rubik.c
parentUpdate gitignore (diff)
downloadxscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.gz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.xz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.zip
Update to 5.42
Diffstat (limited to 'hacks/glx/rubik.c')
-rw-r--r--hacks/glx/rubik.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/hacks/glx/rubik.c b/hacks/glx/rubik.c
index ed06645..e0182cf 100644
--- a/hacks/glx/rubik.c
+++ b/hacks/glx/rubik.c
@@ -1460,7 +1460,7 @@ rotateFace(rubikstruct * rp, int face, int direction)
/* DrawSquare(face, position); */
}
if (faceLoc != NULL)
- (void) free((void *) faceLoc);
+ free(faceLoc);
return True;
}
@@ -1728,7 +1728,7 @@ shuffle(ModeInfo * mi)
for (face = 0; face < MAXFACES; face++) {
if (rp->cubeLoc[face] != NULL)
- (void) free((void *) rp->cubeLoc[face]);
+ free(rp->cubeLoc[face]);
if ((rp->cubeLoc[face] = (RubikLoc *) malloc(sizeFace(rp, face) *
sizeof (RubikLoc))) == NULL) {
return False;
@@ -1740,7 +1740,7 @@ shuffle(ModeInfo * mi)
}
for (i = 0; i < MAXORIENT; i++) {
if (rp->rowLoc[i] != NULL)
- (void) free((void *) rp->rowLoc[i]);
+ free(rp->rowLoc[i]);
/* The following is reused so make it the biggest size */
if ((rp->rowLoc[i] = (RubikLoc *) malloc(MAXMAXSIZE *
sizeof (RubikLoc))) == NULL) {
@@ -1750,7 +1750,7 @@ shuffle(ModeInfo * mi)
rp->storedmoves = MI_COUNT(mi);
if (rp->storedmoves < 0) {
if (rp->moves != NULL)
- (void) free((void *) rp->moves);
+ free(rp->moves);
rp->moves = (RubikMove *) NULL;
rp->storedmoves = NRAND(-rp->storedmoves) + 1;
}
@@ -1880,18 +1880,23 @@ free_rubik(ModeInfo *mi)
rubikstruct *rp = &rubik[MI_SCREEN(mi)];
int i;
+ if (!rp->glx_context) return;
+ glXMakeCurrent (MI_DISPLAY(mi), MI_WINDOW(mi), *rp->glx_context);
+
+ if (rp->trackball) gltrackball_free (rp->trackball);
+
for (i = 0; i < MAXFACES; i++)
if (rp->cubeLoc[i] != NULL) {
- (void) free((void *) rp->cubeLoc[i]);
+ free(rp->cubeLoc[i]);
rp->cubeLoc[i] = (RubikLoc *) NULL;
}
for (i = 0; i < MAXORIENT; i++)
if (rp->rowLoc[i] != NULL) {
- (void) free((void *) rp->rowLoc[i]);
+ free(rp->rowLoc[i]);
rp->rowLoc[i] = (RubikLoc *) NULL;
}
if (rp->moves != NULL) {
- (void) free((void *) rp->moves);
+ free(rp->moves);
rp->moves = (RubikMove *) NULL;
}
}
@@ -1945,7 +1950,7 @@ draw_rubik(ModeInfo * mi)
return;
mi->polygon_count = 0;
- glXMakeCurrent(display, window, *(rp->glx_context));
+ glXMakeCurrent(display, window, *rp->glx_context);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);