--- screen-4.0.2/process.c 2003-09-18 14:53:54.000000000 +0200 +++ screen-4.0.2.new/process.c 2005-08-27 15:16:41.569724038 +0200 @@ -393,6 +393,18 @@ char *noargs[1]; +#ifdef UTMPOK +void +RenewUtmp(p) +struct win *p; +{ + if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0 )) { + RemoveUtmp(p); + SetUtmp(p); + } +} +#endif + void InitKeytab() { @@ -2774,18 +2786,24 @@ #endif #ifdef UTMPOK /* exchange the utmp-slots for these windows */ - if ((fore->w_slot != (slot_t) -1) && (fore->w_slot != (slot_t) 0)) + RenewUtmp(fore); + RenewUtmp(p); + +/* if ((fore->w_slot != (slot_t) -1) && (fore->w_slot != (slot_t) 0)) { RemoveUtmp(fore); SetUtmp(fore); - } + }*/ if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0)) { + /* XXX: first display wins? */ display = fore->w_layer.l_cvlist ? fore->w_layer.l_cvlist->c_display : 0; - RemoveUtmp(p); + } +/* RemoveUtmp(p); SetUtmp(p); } + */ #endif WindowChanged(fore, 'n'); --- screen-4.0.2/screen.h 2003-08-22 14:28:43.000000000 +0200 +++ screen-4.0.2.new/screen.h 2005-08-27 15:13:12.578560397 +0200 @@ -293,3 +293,8 @@ */ #define WLIST_NUM 0 #define WLIST_MRU 1 + +#ifdef UTMPOK +/* don't know exactly what it does, but... */ +void RenewUtmp(struct win *p); +#endif --- screen-4.0.2/help.c 2003-09-08 16:25:33.000000000 +0200 +++ screen-4.0.2.new/help.c 2005-08-27 15:08:23.162263373 +0200 @@ -37,6 +37,7 @@ extern struct mchar mchar_blank, mchar_so; extern unsigned char *blank; extern struct win *wtab[]; +extern int maxwin; static void PadStr __P((char *, int, int, int)); @@ -895,6 +896,70 @@ return 0; } +/* Renumber current window: move its position by offset */ +/* greatly inspired by RC_NUMBER part in process.c */ +static void +WRenumber(wlistdata, offset) +struct wlistdata *wlistdata; +int offset; +{ + int pos = wlistdata->pos; + int new = pos+offset; + int nextpos = WListNext(wlistdata, pos, offset); + struct win *firstwin; + + /* my way of asserting + XXX find a real way to assert in screen */ + if ( wtab[pos] == NULL ) { + LMsg(0, "WTAB[pos] == NULL BIG PROBLEM !"); + return; + } + /* Exit if we are not in the limits */ + if (new < 0 || new >= maxwin ) { return; } + firstwin = wtab[pos]; + + wtab[pos] = wtab[new]; + wtab[new] = firstwin; + wtab[new]->w_number = new; + if (wtab[pos]) { + wtab[pos]->w_number = pos; + } + +#ifdef MULTIUSER + /* exchange the acls for these windows. */ + AclWinSwap(pos, new); +#endif +#ifdef UTMPOK + /* TODO put this in a function and in process.c */ +/* struct win *p = wtab[pos]; */ + // LMsg(0, "UTMPOK !"); + RenewUtmp(wtab[pos]); + RenewUtmp(wtab[new]); +/* if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0 )) { + RemoveUtmp(p); + SetUtmp(p); + } + p = wtab[new]; + if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0 )) { + RemoveUtmp(p); + SetUtmp(p); + } + */ +#endif + /* refresh the screen */ + if (new == nextpos ) { + WListMove(offset, -1); + } + else { + wlistdata->pos = new; + if (wlistdata != (struct wlistdata *)flayer->l_data) { + LMsg(0, "wlistdata != flayer->l_data"); + } + /* XXX ok, may find a way not to redraw all the screen... */ + wlistpage(); + } +} + static void WListProcess(ppbuf, plen) char **ppbuf; @@ -955,6 +1020,18 @@ case 0205: /* end */ WListMove(MAXWIN, -1); break; + + /* change the order of the windows */ + /* todo: find shift up / shift down keycodes */ + case 'N': + case 'J': + WRenumber(wlistdata, 1); + break; + case 'P': + case 'K': + WRenumber(wlistdata, -1); + break; + case '\r': case '\n': case ' ':