Ignore:
Timestamp:
Apr 17, 2006, 10:09:42 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Implemented CACA_EVENT_QUIT. Unused yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_gl.c

    r780 r799  
    5252static void gl_handle_mouse(int, int, int, int);
    5353static void gl_handle_mouse_motion(int, int);
     54#ifdef HAVE_GLUTCLOSEFUNC
     55static void gl_handle_close(void);
     56#endif
    5457static void _display(void);
    5558
     
    6265    float incx, incy;
    6366    int id[128 - 32];
     67    unsigned char close;
    6468    unsigned char bit;
    6569    unsigned char mouse_changed, mouse_clicked;
     
    101105    kk->drv.p->height = kk->qq->height * kk->drv.p->font_height;
    102106
     107#ifdef HAVE_GLUTCLOSEFUNC
     108    kk->drv.p->close = 0;
     109#endif
    103110    kk->drv.p->bit = 0;
    104111
     
    128135    glutDisplayFunc(_display);
    129136
     137#ifdef HAVE_GLUTCLOSEFUNC
     138    glutCloseFunc(gl_handle_close);
     139#endif
    130140
    131141    glutMouseFunc(gl_handle_mouse);
     
    208218    return kk->drv.p->height;
    209219}
    210 
    211220
    212221static void gl_display(caca_t *kk)
     
    311320#else
    312321    glutMainLoopEvent();
     322#endif
     323
     324#ifdef HAVE_GLUTCLOSEFUNC
     325    if(kk->drv.p->close)
     326    {
     327        kk->drv.p->close = 0;
     328        ev->type = CACA_EVENT_QUIT;
     329        return 1;
     330    }
    313331#endif
    314332
     
    454472}
    455473
    456 
     474#ifdef HAVE_GLUTCLOSEFUNC
     475static void gl_handle_close(void)
     476{
     477    caca_t *kk = gl_kk;
     478    kk->drv.p->close = 1;
     479}
     480#endif
    457481
    458482static void _display(void)
Note: See TracChangeset for help on using the changeset viewer.