Changeset 980


Ignore:
Timestamp:
May 25, 2006, 9:58:21 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Minor cosmetic changes in the test programs.
  • Code enhancements in the ncurses driver.
  • Added a comment to explain why slang has a higher priority than ncurses.
Location:
libcaca/trunk
Files:
4 edited

Legend:

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

    r859 r980  
    162162    if(gl_install(dp) == 0) return 0;
    163163#endif
     164    /* slang has a higher priority than ncurses because though ncurses handles
     165     * color a bit better across terminals, its UTF-8 supports seems broken. */
    164166#if defined(USE_SLANG)
    165167    if(slang_install(dp) == 0) return 0;
  • libcaca/trunk/caca/driver_ncurses.c

    r974 r980  
    256256        switch(mevent.bstate)
    257257        {
    258             case BUTTON1_PRESSED:
    259                 ev->data.mouse.button = 1;
    260                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    261                 break;
    262             case BUTTON1_RELEASED:
    263                 ev->data.mouse.button = 1;
    264                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    265                 break;
    266             case BUTTON1_CLICKED:
    267                 ev->data.mouse.button = 1;
    268                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    269                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    270                 break;
    271             case BUTTON1_DOUBLE_CLICKED:
    272                 ev->data.mouse.button = 1;
    273                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    274                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    275                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    276                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    277                 break;
    278             case BUTTON1_TRIPLE_CLICKED:
    279                 ev->data.mouse.button = 1;
    280                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    281                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    282                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    283                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    284                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    285                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    286                 break;
    287             case BUTTON1_RESERVED_EVENT:
    288                 break;
    289 
    290             case BUTTON2_PRESSED:
    291                 ev->data.mouse.button = 2;
    292                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    293                 break;
    294             case BUTTON2_RELEASED:
    295                 ev->data.mouse.button = 2;
    296                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    297                 break;
    298             case BUTTON2_CLICKED:
    299                 ev->data.mouse.button = 2;
    300                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    301                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    302                 break;
    303             case BUTTON2_DOUBLE_CLICKED:
    304                 ev->data.mouse.button = 2;
    305                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    306                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    307                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    308                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    309                 break;
    310             case BUTTON2_TRIPLE_CLICKED:
    311                 ev->data.mouse.button = 2;
    312                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    313                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    314                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    315                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    316                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    317                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    318                 break;
    319             case BUTTON2_RESERVED_EVENT:
    320                 break;
    321 
    322             case BUTTON3_PRESSED:
    323                 ev->data.mouse.button = 3;
    324                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    325                 break;
    326             case BUTTON3_RELEASED:
    327                 ev->data.mouse.button = 3;
    328                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    329                 break;
    330             case BUTTON3_CLICKED:
    331                 ev->data.mouse.button = 3;
    332                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    333                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    334                 break;
    335             case BUTTON3_DOUBLE_CLICKED:
    336                 ev->data.mouse.button = 3;
    337                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    338                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    339                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    340                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    341                 break;
    342             case BUTTON3_TRIPLE_CLICKED:
    343                 ev->data.mouse.button = 3;
    344                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    345                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    346                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    347                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    348                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    349                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    350                 break;
    351             case BUTTON3_RESERVED_EVENT:
    352                 break;
    353 
    354             case BUTTON4_PRESSED:
    355                 ev->data.mouse.button = 4;
    356                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    357                 break;
    358             case BUTTON4_RELEASED:
    359                 ev->data.mouse.button = 4;
    360                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    361                 break;
    362             case BUTTON4_CLICKED:
    363                 ev->data.mouse.button = 4;
    364                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    365                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    366                 break;
    367             case BUTTON4_DOUBLE_CLICKED:
    368                 ev->data.mouse.button = 4;
    369                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    370                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    371                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    372                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    373                 break;
    374             case BUTTON4_TRIPLE_CLICKED:
    375                 ev->data.mouse.button = 4;
    376                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    377                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    378                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    379                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    380                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev);
    381                 ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev);
    382                 break;
    383             case BUTTON4_RESERVED_EVENT:
    384                 break;
     258#define PRESS(x) ev->data.mouse.button = x; \
     259                 ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev)
     260#define RELEASE(x) ev->data.mouse.button = x; \
     261                   ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev)
     262#define CLICK(x) PRESS(x); RELEASE(x)
     263            case BUTTON1_PRESSED: PRESS(1); break;
     264            case BUTTON1_RELEASED: RELEASE(1); break;
     265            case BUTTON1_CLICKED: CLICK(1); break;
     266            case BUTTON1_DOUBLE_CLICKED: CLICK(1); CLICK(1); break;
     267            case BUTTON1_TRIPLE_CLICKED: CLICK(1); CLICK(1); CLICK(1); break;
     268            case BUTTON1_RESERVED_EVENT: break;
     269
     270            case BUTTON2_PRESSED: PRESS(2); break;
     271            case BUTTON2_RELEASED: RELEASE(2); break;
     272            case BUTTON2_CLICKED: CLICK(2); break;
     273            case BUTTON2_DOUBLE_CLICKED: CLICK(2); CLICK(2); break;
     274            case BUTTON2_TRIPLE_CLICKED: CLICK(2); CLICK(2); CLICK(2); break;
     275            case BUTTON2_RESERVED_EVENT: break;
     276
     277            case BUTTON3_PRESSED: PRESS(3); break;
     278            case BUTTON3_RELEASED: RELEASE(3); break;
     279            case BUTTON3_CLICKED: CLICK(3); break;
     280            case BUTTON3_DOUBLE_CLICKED: CLICK(3); CLICK(3); break;
     281            case BUTTON3_TRIPLE_CLICKED: CLICK(3); CLICK(3); CLICK(3); break;
     282            case BUTTON3_RESERVED_EVENT: break;
     283
     284            case BUTTON4_PRESSED: PRESS(4); break;
     285            case BUTTON4_RELEASED: RELEASE(4); break;
     286            case BUTTON4_CLICKED: CLICK(4); break;
     287            case BUTTON4_DOUBLE_CLICKED: CLICK(4); CLICK(4); break;
     288            case BUTTON4_TRIPLE_CLICKED: CLICK(4); CLICK(4); CLICK(4); break;
     289            case BUTTON4_RESERVED_EVENT: break;
    385290
    386291            default:
    387292                break;
     293#undef PRESS
     294#undef RELEASE
     295#undef CLICK
    388296        }
    389297
     
    430338        case KEY_F(12): ev->data.key.ch = CACA_KEY_F12; break;
    431339
    432         default: ev->type = CACA_EVENT_NONE; return 0;
     340        default:
     341            /* Unknown key */
     342            ev->type = CACA_EVENT_NONE; return 0;
    433343    }
    434344
  • libcaca/trunk/test/colors.c

    r859 r980  
    4747            cucul_set_color(cv, i, j);
    4848            cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
    49                          "# ");
     49                         "Aa");
    5050        }
    5151    }
  • libcaca/trunk/test/input.c

    r969 r980  
    7575
    7676        /* Put the cursor on the active textentry */
    77         cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE);
     77        cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTRED);
    7878        cucul_putchar(cv, 2 + entries[e].cursor, 3 * e + 4, ' ');
    7979
Note: See TracChangeset for help on using the changeset viewer.