Ignore:
Timestamp:
Mar 8, 2006, 8:41:53 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Fixed async issues between the driver and libcaca when resizing windows, and simplified the handle_resize() API. Still can be polished.
File:
1 edited

Legend:

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

    r551 r553  
    7676    int window;
    7777    unsigned int width, height;
     78    unsigned int new_width, new_height;
    7879    float font_width, font_height;
    7980    float incx, incy;
    8081    int id[94];
    81     unsigned char resized, bit;
     82    unsigned char bit;
    8283    unsigned char mouse_changed, mouse_clicked;
    8384    unsigned int mouse_x, mouse_y;
     
    8687    unsigned char key;
    8788    int special_key;
    88     int new_width;
    89     int new_height;
    9089
    9190    float sw, sh;
     
    118117    kk->drv.p->height = kk->qq->height * kk->drv.p->font_height;
    119118
    120     kk->drv.p->resized = 0;
    121119    kk->drv.p->bit = 0;
    122120
     
    294292}
    295293
    296 static void gl_handle_resize(caca_t *kk, unsigned int *new_width,
    297                                          unsigned int *new_height)
     294static void gl_handle_resize(caca_t *kk)
    298295{
    299296    kk->drv.p->width = kk->drv.p->new_width;
    300297    kk->drv.p->height = kk->drv.p->new_height;
    301 
    302     *new_width = kk->drv.p->width / kk->drv.p->font_width;
    303     *new_height = (kk->drv.p->height / kk->drv.p->font_height) + 1;
    304298
    305299    glMatrixMode(GL_PROJECTION);
     
    318312    glutMainLoopEvent();
    319313
    320     if(kk->drv.p->resized && !kk->resize)
    321     {
    322         kk->resize = 1;
    323         kk->drv.p->resized = 0;
     314    if(kk->resize.resized)
    324315        return CACA_EVENT_RESIZE;
    325     }
    326316
    327317    if(kk->drv.p->mouse_changed)
     
    401391        kk->drv.p->new_height = h;
    402392
    403         kk->drv.p->resized = 1;
     393        kk->resize.w = w / kk->drv.p->font_width;
     394        kk->resize.h = (h / kk->drv.p->font_height) + 1;
     395
     396        kk->resize.resized = 1;
    404397    }
    405398    else
Note: See TracChangeset for help on using the changeset viewer.