--- dvtm.c.orig 2008-05-31 13:37:04.884264616 +0200 +++ dvtm.c 2008-05-31 13:35:22.185846371 +0200 @@ -108,6 +108,7 @@ void setlayout(const char *args[]); void redraw(const char *args[]); void zoom(const char *args[]); +void lock(const char *key[]); #if defined(HANDLE_MOUSE) void mouse_focus(const char *args[]); @@ -466,13 +467,6 @@ } void -draw(Client *c){ - draw_content(c); - draw_border(c); - wrefresh(c->window); -} - -void clear_workspace(){ unsigned int y; for(y = 0; y < wah; y++) @@ -545,6 +539,39 @@ } } +/* + * Lock the screen until the key is typed + * + * NOTE: this function doesn't handle the input from clients. All + * foreground operations are temporarly suspended since the + * function doesn't return (screen is unlocked). Also there + * is no password enc/dec handling (needed?). +*/ +void +lock(const char *key[]) +{ + size_t size = strlen(key[0]); + int i = 0; + + if( ! size ) + return; + + erase(); + curs_set(0); + mvprintw(LINES / 2, COLS / 2 - 7, "Screen locked!"); + + while( i != (int)size ) { + + for(i = 0; i < (int)size; i++) { + if( getch() != key[0][i] ) + break; + } + } + + arrange(); + +} /* eof lock() */ + void killclient(const char *args[]){ if(!sel) --- config.h.orig 2008-05-31 13:37:04.884264616 +0200 +++ config.h 2008-05-31 13:35:22.197847122 +0200 @@ -56,6 +56,7 @@ /* you can at most specifiy MAX_ARGS (2) number of arguments */ Key keys[] = { + { MOD, 'X', { lock, { "test" } } }, { MOD, 'c', { create, { NULL } } }, { MOD, 'x', { killclient, { NULL } } }, { MOD, 'j', { focusnext, { NULL } } },