Press 'b' to switch box on/off

reverse-branch
Benoît Zugmeyer 16 years ago
parent 3594e6276b
commit 8502f635db
  1. 35
      ttyclock.c
  2. 1
      ttyclock.h

@ -258,8 +258,10 @@ clock_move(int x, int y, int w, int h)
ttyclock->geo.y + (ttyclock->geo.w / 2) - (strlen(ttyclock->date.datestr) / 2) - 1);
wresize(ttyclock->datewin, DATEWINH, strlen(ttyclock->date.datestr) + 2);
box(ttyclock->framewin, 0, 0);
box(ttyclock->datewin, 0, 0);
if(ttyclock->option.box) {
box(ttyclock->framewin, 0, 0);
box(ttyclock->datewin, 0, 0);
}
wrefresh(ttyclock->datewin);
wrefresh(ttyclock->framewin);
@ -322,6 +324,29 @@ set_center(Bool b)
return;
}
void
set_box(Bool b)
{
ttyclock->option.box = b;
wbkgdset(ttyclock->framewin, COLOR_PAIR(0));
wbkgdset(ttyclock->datewin, COLOR_PAIR(0));
if(ttyclock->option.box) {
wbkgdset(ttyclock->framewin, COLOR_PAIR(0));
wbkgdset(ttyclock->datewin, COLOR_PAIR(0));
box(ttyclock->framewin, 0, 0);
box(ttyclock->datewin, 0, 0);
}
else {
wborder(ttyclock->framewin, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wborder(ttyclock->datewin, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
}
wrefresh(ttyclock->datewin);
wrefresh(ttyclock->framewin);
}
void
key_event(void)
{
@ -392,6 +417,12 @@ key_event(void)
if(ttyclock->option.rebound && ttyclock->option.center)
ttyclock->option.center = False;
break;
case 'b':
case 'B':
set_box(!ttyclock->option.box);
break;
default:
nanosleep(&length, NULL);
for(i = 0; i < 8; ++i)

@ -107,6 +107,7 @@ void draw_clock(void);
void clock_move(int x, int y, int w, int h);
void set_second(void);
void set_center(Bool b);
void set_box(Bool b);
void key_event(void);
/* Global variable */

Loading…
Cancel
Save