X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fcrackberg.c;h=30af9633440d6e6f27c2c4cfa885583a6db5ad26;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=2d8acbd47db7afad3a7e1281ec90d37d380d8949;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/glx/crackberg.c b/hacks/glx/crackberg.c index 2d8acbd4..30af9633 100644 --- a/hacks/glx/crackberg.c +++ b/hacks/glx/crackberg.c @@ -1,7 +1,7 @@ /*************************** ** crackberg; Matus Telgarsky [ catachresis@cmu.edu ] 2005 ** */ -#ifndef HAVE_COCOA +#ifndef HAVE_JWXYZ # define XK_MISCELLANY # include #endif @@ -1211,7 +1211,9 @@ ENTRYPOINT void init_crackberg (ModeInfo *mi) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glShadeModel((flat) ? GL_FLAT : GL_SMOOTH); +# ifndef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ glPolygonMode(GL_FRONT_AND_BACK, (MI_IS_WIREFRAME(mi)) ? GL_LINE : GL_FILL); +# endif if (lit) { glEnable(GL_LIGHTING); @@ -1258,7 +1260,9 @@ ENTRYPOINT Bool crackberg_handle_event (ModeInfo *mi, XEvent *ev) if (ev->xany.type == KeyPress) { switch (keysym) { case XK_Left: cberg->motion_state |= MOTION_LROT; break; + case XK_Prior: cberg->motion_state |= MOTION_LROT; break; case XK_Right: cberg->motion_state |= MOTION_RROT; break; + case XK_Next: cberg->motion_state |= MOTION_RROT; break; case XK_Down: cberg->motion_state |= MOTION_BACK; break; case XK_Up: cberg->motion_state |= MOTION_FORW; break; case '1': cberg->motion_state |= MOTION_DEC; break; @@ -1286,7 +1290,9 @@ ENTRYPOINT Bool crackberg_handle_event (ModeInfo *mi, XEvent *ev) switch (keysym) { case XK_Left: cberg->motion_state &= ~MOTION_LROT; break; + case XK_Prior: cberg->motion_state &= ~MOTION_LROT; break; case XK_Right: cberg->motion_state &= ~MOTION_RROT; break; + case XK_Next: cberg->motion_state &= ~MOTION_RROT; break; case XK_Down: cberg->motion_state &= ~MOTION_BACK; break; case XK_Up: cberg->motion_state &= ~MOTION_FORW; break; case '1': cberg->motion_state &= ~MOTION_DEC; break; @@ -1329,6 +1335,19 @@ ENTRYPOINT Bool crackberg_handle_event (ModeInfo *mi, XEvent *ev) if (dy > 0 && dy > dx) dx = 0; if (dy < 0 && dy < dx) dx = 0; + { + int rot = current_device_rotation(); + int swap; + while (rot <= -180) rot += 360; + while (rot > 180) rot -= 360; + if (rot > 135 || rot < -135) /* 180 */ + dx = -dx, dy = -dy; + else if (rot > 45) /* 90 */ + swap = dx, dx = -dy, dy = swap; + else if (rot < -45) /* 270 */ + swap = dx, dx = dy, dy = -swap; + } + if (dx > 0) cberg->motion_state |= MOTION_LEFT; else if (dx < 0) cberg->motion_state |= MOTION_RIGHT; else if (dy > 0) cberg->motion_state |= MOTION_FORW;