Make sure the root window always has focus, so that hpcboot can be

operated using only the keyboard.  It should now be possible to boot
NetBSD on HPC devices with broken touchscreens.
This commit is contained in:
uwe 2004-02-27 03:23:12 +00:00
parent 873f4a20f5
commit 6212a368a7
2 changed files with 29 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* -*-C++-*- $NetBSD: rootwindow.cpp,v 1.13 2004/02/23 05:20:48 uwe Exp $ */
/* -*-C++-*- $NetBSD: rootwindow.cpp,v 1.14 2004/02/27 03:23:12 uwe Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -116,6 +116,18 @@ RootWindow::proc(HWND w, UINT msg, WPARAM wparam, LPARAM lparam)
case WM_PAINT:
WMPaint(w, aux);
break;
case WM_ENTERMENULOOP:
SaveFocus();
break;
case WM_EXITMENULOOP:
RestoreFocus();
break;
case WM_ACTIVATE:
if ((UINT)LOWORD(wparam) == WA_INACTIVE)
SaveFocus();
else
RestoreFocus();
break;
case WM_NOTIFY:
{
NMHDR *notify = reinterpret_cast <NMHDR *>(lparam);
@ -187,6 +199,17 @@ RootWindow::proc(HWND w, UINT msg, WPARAM wparam, LPARAM lparam)
return TRUE;
}
void
RootWindow::SaveFocus() {
_saved_focus = GetFocus();
}
void
RootWindow::RestoreFocus() {
SetFocus(IsWindowEnabled(_saved_focus) ?
_saved_focus : _boot_button->_window);
}
void
RootWindow::WMPaint(HWND w, LPCREATESTRUCT aux)
{
@ -234,6 +257,7 @@ RootWindow::WMCreate(HWND w, LPCREATESTRUCT aux)
_console = _base->boot(IDC_BASE_CONSOLE);
_main->show();
SetFocus(_boot_button->_window);
return;
}

View File

@ -1,4 +1,4 @@
/* -*-C++-*- $NetBSD: rootwindow.h,v 1.3 2004/02/23 05:20:48 uwe Exp $ */
/* -*-C++-*- $NetBSD: rootwindow.h,v 1.4 2004/02/27 03:23:12 uwe Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -55,6 +55,9 @@ public:
int _cmdbar_height;
private:
HWND _saved_focus;
void SaveFocus();
void RestoreFocus();
void WMCreate(HWND, LPCREATESTRUCT);
void WMPaint(HWND, LPCREATESTRUCT);