+
+
+ENTRYPOINT void
+draw_stonerview (ModeInfo *mi)
+{
+ stonerview_configuration *bp = &bps[MI_SCREEN(mi)];
+
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
+
+ glPushMatrix ();
+ glRotatef( current_device_rotation(), 0, 0, 1);
+ gltrackball_rotate (bp->trackball);
+
+# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
+ {
+ GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
+ int o = (int) current_device_rotation();
+ if (o != 0 && o != 180 && o != -180)
+ glScalef (h, h, h);
+ }
+# endif
+
+ stonerview_win_draw(bp->st);
+ if (! bp->button_down_p)
+ stonerview_move_increment(bp->st);
+ glPopMatrix ();
+
+ mi->polygon_count = NUM_ELS;
+ if (mi->fps_p) do_fps (mi);
+ glFinish();
+
+ glXSwapBuffers(MI_DISPLAY (mi), MI_WINDOW(mi));
+}
+
+ENTRYPOINT void
+release_stonerview (ModeInfo *mi)
+{
+ if (bps) {
+ int screen;
+ for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
+ stonerview_configuration *bp = &bps[screen];
+ if (bp->st)
+ stonerview_win_release (bp->st);
+ }
+ free (bps);
+ bps = 0;
+ }
+ FreeAllGL(mi);
+}
+
+ENTRYPOINT Bool
+stonerview_handle_event (ModeInfo *mi, XEvent *event)
+{
+ stonerview_configuration *bp = &bps[MI_SCREEN(mi)];
+
+ if (gltrackball_event_handler (event, bp->trackball,
+ MI_WIDTH (mi), MI_HEIGHT (mi),
+ &bp->button_down_p))
+ return True;
+
+ return False;
+}
+
+XSCREENSAVER_MODULE ("StonerView", stonerview)
+
+#endif /* USE_GL */