Ignore:
Timestamp:
Mar 8, 2006, 8:41:53 PM (14 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_ncurses.c

    r551 r553  
    200200}
    201201
    202 static void ncurses_handle_resize(caca_t *kk, unsigned int *new_width,
    203                                               unsigned int *new_height)
     202static void ncurses_handle_resize(caca_t *kk)
    204203{
    205204    struct winsize size;
    206205
    207     *new_width = kk->qq->width;
    208     *new_height = kk->qq->height;
    209 
    210206    if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0)
    211207    {
    212         *new_width = size.ws_col;
    213         *new_height = size.ws_row;
     208        kk->resize.w = size.ws_col;
     209        kk->resize.h = size.ws_row;
    214210#if defined(HAVE_RESIZE_TERM)
    215         resize_term(*new_height, *new_width);
     211        resize_term(kk->resize.h, kk->resize.w);
    216212#else
    217         resizeterm(*new_height, *new_width);
     213        resizeterm(*kk->resize.h, *kk->resize.w);
    218214#endif
    219215        wrefresh(curscr);
    220     }
     216        return;
     217    }
     218
     219    /* Fallback */
     220    kk->resize.w = kk->qq->width;
     221    kk->resize.h = kk->qq->height;
    221222}
    222223
     
    225226    unsigned int event;
    226227    int intkey;
    227 
    228     if(kk->resize_event)
    229     {
    230         kk->resize_event = 0;
    231         kk->resize = 1;
    232         return CACA_EVENT_RESIZE;
    233     }
    234228
    235229    intkey = getch();
     
    411405static RETSIGTYPE sigwinch_handler(int sig)
    412406{
    413     sigwinch_kk->resize_event = 1;
     407    sigwinch_kk->resize.resized = 1;
    414408
    415409    signal(SIGWINCH, sigwinch_handler);;
Note: See TracChangeset for help on using the changeset viewer.