X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fquasicrystal.c;h=d2d3f5c16b0b3c73c5787a9f9244bf2cb14ca375;hp=be2e0c164c8ac6f1fb86a30dc09ec33ebcb4c1c3;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hpb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e diff --git a/hacks/glx/quasicrystal.c b/hacks/glx/quasicrystal.c index be2e0c16..d2d3f5c1 100644 --- a/hacks/glx/quasicrystal.c +++ b/hacks/glx/quasicrystal.c @@ -121,6 +121,24 @@ quasicrystal_handle_event (ModeInfo *mi, XEvent *event) bp->button_down_p = False; return True; } + else if (event->xany.type == ButtonPress && /* wheel up or right */ + (event->xbutton.button == Button4 || + event->xbutton.button == Button7)) + { + UP: + if (bp->contrast <= 0) return False; + bp->contrast--; + return True; + } + else if (event->xany.type == ButtonPress && /* wheel down or left */ + (event->xbutton.button == Button5 || + event->xbutton.button == Button6)) + { + DOWN: + if (bp->contrast >= 100) return False; + bp->contrast++; + return True; + } else if (event->xany.type == MotionNotify && bp->button_down_p) { @@ -140,6 +158,24 @@ quasicrystal_handle_event (ModeInfo *mi, XEvent *event) bp->mousey = event->xmotion.y; return True; } + else + { + if (event->xany.type == KeyPress) + { + KeySym keysym; + char c = 0; + XLookupString (&event->xkey, &c, 1, &keysym, 0); + if (c == '<' || c == ',' || c == '-' || c == '_' || + keysym == XK_Left || keysym == XK_Up || keysym == XK_Prior) + goto UP; + else if (c == '>' || c == '.' || c == '=' || c == '+' || + keysym == XK_Right || keysym == XK_Down || + keysym == XK_Next) + goto DOWN; + } + + return screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event); + } return False; } @@ -289,6 +325,11 @@ draw_quasicrystal (ModeInfo *mi) glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDisable (GL_LIGHTING); + if (!wire) + { + glEnable (GL_TEXTURE_1D); + glEnable (GL_TEXTURE_2D); /* jwzgles needs this too, bleh. */ + } glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -346,10 +387,7 @@ draw_quasicrystal (ModeInfo *mi) glColor4f (1, 1, 1, (wire ? 0.5 : 1.0 / bp->count)); if (!wire) - { - glEnable (GL_TEXTURE_1D); - glBindTexture (GL_TEXTURE_1D, p->texid); - } + glBindTexture (GL_TEXTURE_1D, p->texid); glBegin (wire ? GL_LINE_LOOP : GL_QUADS); glNormal3f (0, 0, 1);