(svn r2141) - Fix: Keys now hopefully only activate the right windows. If console/querybox/chatbox is open, all input goes there, if closed to game itself.

This commit is contained in:
Darkvater 2005-04-03 13:35:43 +00:00
parent 83d62b1aa2
commit f00d0d8ea8
2 changed files with 9 additions and 6 deletions

View File

@ -1911,8 +1911,8 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
case 'A': ShowBuildRailToolbar(_last_built_railtype, 4); break; /* Invoke Autorail */ case 'A': ShowBuildRailToolbar(_last_built_railtype, 4); break; /* Invoke Autorail */
case 'L': ShowTerraformToolbar(); break; case 'L': ShowTerraformToolbar(); break;
default: return; default: return;
e->keypress.cont = false;
} }
e->keypress.cont = false;
} break; } break;
case WE_PLACE_OBJ: { case WE_PLACE_OBJ: {
@ -2397,14 +2397,14 @@ void SetupColorsAndInitialWindow(void)
// XXX: these are not done // XXX: these are not done
switch(_game_mode) { switch(_game_mode) {
case GM_MENU: case GM_MENU:
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL); w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL);
AssignWindowViewport(w, 0, 0, width, height, TILE_XY(32, 32), 0); AssignWindowViewport(w, 0, 0, width, height, TILE_XY(32, 32), 0);
// w = AllocateWindowDesc(&_toolb_intro_desc); // w = AllocateWindowDesc(&_toolb_intro_desc);
// w->flags4 &= ~WF_WHITE_BORDER_MASK; // w->flags4 &= ~WF_WHITE_BORDER_MASK;
ShowSelectGameWindow(); ShowSelectGameWindow();
break; break;
case GM_NORMAL: case GM_NORMAL:
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL); w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL);
AssignWindowViewport(w, 0, 0, width, height, TILE_XY(32, 32), 0); AssignWindowViewport(w, 0, 0, width, height, TILE_XY(32, 32), 0);
ShowVitalWindows(); ShowVitalWindows();
@ -2415,7 +2415,7 @@ void SetupColorsAndInitialWindow(void)
break; break;
case GM_EDITOR: case GM_EDITOR:
w = AllocateWindow(0, 0, width, height, MainWindowWndProc, 0, NULL); w = AllocateWindow(0, 0, width, height, MainWindowWndProc, WC_MAIN_WINDOW, NULL);
AssignWindowViewport(w, 0, 0, width, height, 0, 0); AssignWindowViewport(w, 0, 0, width, height, 0, 0);
w = AllocateWindowDesc(&_toolb_scen_desc); w = AllocateWindowDesc(&_toolb_scen_desc);

View File

@ -1266,19 +1266,22 @@ static void HandleKeypress(uint32 key)
we.keypress.cont = true; we.keypress.cont = true;
// check if we have a query string window open before allowing hotkeys // check if we have a query string window open before allowing hotkeys
if(FindWindowById(WC_QUERY_STRING, 0)!=NULL || FindWindowById(WC_SEND_NETWORK_MSG, 0)!=NULL) if(FindWindowById(WC_QUERY_STRING, 0)!=NULL || FindWindowById(WC_SEND_NETWORK_MSG, 0)!=NULL || FindWindowById(WC_CONSOLE, 0)!=NULL)
query_open = true; query_open = true;
// Call the event, start with the uppermost window. // Call the event, start with the uppermost window.
for(w=_last_window; w != _windows;) { for(w=_last_window; w != _windows;) {
--w; --w;
// if a query window is open, only call the event for certain window types // if a query window is open, only call the event for certain window types
if(query_open && w->window_class!=WC_QUERY_STRING && w->window_class!=WC_SEND_NETWORK_MSG && w->window_class!=WC_MAIN_TOOLBAR) if(query_open && w->window_class!=WC_QUERY_STRING && w->window_class!=WC_SEND_NETWORK_MSG && w->window_class!=WC_CONSOLE)
continue; continue;
w->wndproc(w, &we); w->wndproc(w, &we);
if (!we.keypress.cont) if (!we.keypress.cont)
break; break;
} }
if (we.keypress.cont)
FindWindowById(WC_MAIN_TOOLBAR, 0)->wndproc(w, &we);
} }
extern void UpdateTileSelection(void); extern void UpdateTileSelection(void);