An Esc pressed while the password window is showing will close it and resume

the screen saver.

I added this to the filter in the ScreenSaverWindow instead of the
PasswordWindow to avoid having to add another BMessageFilter. It already is
getting all keydowns anyhow.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29521 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood 2009-03-14 16:25:46 +00:00
parent e83cf52aa7
commit 0834f79c8c
4 changed files with 11 additions and 2 deletions

View File

@ -23,7 +23,7 @@ PasswordWindow::PasswordWindow()
: BWindow(BRect(100, 100, 400, 230), "Enter Password",
B_NO_BORDER_WINDOW_LOOK, kPasswordWindowFeel
/* TODO: B_MODAL_APP_WINDOW_FEEL should also behave correctly */,
B_NOT_MOVABLE | B_NOT_CLOSABLE |B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES)
{
BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW);

View File

@ -27,7 +27,6 @@
#include <syslog.h>
const static uint32 kMsgResumeSaver = 'RSSV';
const static uint32 kMsgTurnOffScreen = 'tofs';
const static uint32 kMsgSuspendScreen = 'suss';
const static uint32 kMsgStandByScreen = 'stbs';
@ -230,6 +229,7 @@ ScreenBlanker::MessageReceived(BMessage* message)
{
if (fWindow->Lock()) {
HideCursor();
fPasswordWindow->SetPassword("");
fPasswordWindow->Hide();
fRunner->Resume();

View File

@ -19,6 +19,9 @@
#include <MessageRunner.h>
const static uint32 kMsgResumeSaver = 'RSSV';
class ScreenBlanker : public BApplication {
public:
ScreenBlanker();

View File

@ -9,6 +9,7 @@
*/
#include "ScreenBlanker.h"
#include "ScreenSaverWindow.h"
#include <Application.h>
@ -51,6 +52,11 @@ ScreenSaverFilter::Filter(BMessage* message, BHandler** target)
be_app->PostMessage(B_QUIT_REQUESTED);
break;
}
} else if (message->what == B_KEY_DOWN) {
// Handle the escape key when the password window is showing
const char *string = NULL;
if (message->FindString("bytes", &string) == B_OK && string[0] == B_ESCAPE)
be_app->PostMessage(kMsgResumeSaver);
}
return B_DISPATCH_MESSAGE;