1
0
Fork 0

(svn r7207) -Codechange: Pass the (unchanged) windowpointer to the console window and do it only once.

release/0.5
Darkvater 2006-11-18 17:07:05 +00:00
parent 53f954edd3
commit e614782066
3 changed files with 11 additions and 7 deletions

View File

@ -152,7 +152,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
break; break;
case WKC_CTRL | WKC_RETURN: case WKC_CTRL | WKC_RETURN:
_iconsole_mode = (_iconsole_mode == ICONSOLE_FULL) ? ICONSOLE_OPENED : ICONSOLE_FULL; _iconsole_mode = (_iconsole_mode == ICONSOLE_FULL) ? ICONSOLE_OPENED : ICONSOLE_FULL;
IConsoleResize(); IConsoleResize(w);
MarkWholeScreenDirty(); MarkWholeScreenDirty();
break; break;
case (WKC_CTRL | 'V'): case (WKC_CTRL | 'V'):
@ -283,9 +283,9 @@ void IConsoleFree(void)
CloseConsoleLogIfActive(); CloseConsoleLogIfActive();
} }
void IConsoleResize(void) void IConsoleResize(Window *w)
{ {
_iconsole_win = FindWindowById(WC_CONSOLE, 0); assert(_iconsole_win == w);
switch (_iconsole_mode) { switch (_iconsole_mode) {
case ICONSOLE_OPENED: case ICONSOLE_OPENED:

View File

@ -118,7 +118,7 @@ VARDEF IConsoleModes _iconsole_mode;
void IConsoleInit(void); void IConsoleInit(void);
void IConsoleFree(void); void IConsoleFree(void);
void IConsoleClearBuffer(void); void IConsoleClearBuffer(void);
void IConsoleResize(void); void IConsoleResize(Window *w);
void IConsoleSwitch(void); void IConsoleSwitch(void);
void IConsoleClose(void); void IConsoleClose(void);
void IConsoleOpen(void); void IConsoleOpen(void);

View File

@ -20,7 +20,7 @@ static Point _drag_delta;
static Window _windows[25]; static Window _windows[25];
Window *_z_windows[lengthof(_windows)]; Window *_z_windows[lengthof(_windows)];
Window **_last_z_window; // always points to the next free space in the z-array Window **_last_z_window; ///< always points to the next free space in the z-array
void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...) void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...)
{ {
@ -1886,8 +1886,8 @@ void RelocateAllWindows(int neww, int newh)
continue; // don't modify top,left continue; // don't modify top,left
} }
IConsoleResize(); /* XXX - this probably needs something more sane. For example specying
* in a 'backup'-desc that the window should always be centred. */
switch (w->window_class) { switch (w->window_class) {
case WC_MAIN_TOOLBAR: case WC_MAIN_TOOLBAR:
top = w->top; top = w->top;
@ -1916,6 +1916,10 @@ void RelocateAllWindows(int neww, int newh)
left = (neww - w->width) >> 1; left = (neww - w->width) >> 1;
break; break;
case WC_CONSOLE:
IConsoleResize(w);
break;
default: default:
left = w->left; left = w->left;
if (left + (w->width >> 1) >= neww) left = neww - w->width; if (left + (w->width >> 1) >= neww) left = neww - w->width;