vfs: check userland buffers before reading them.
[haiku.git] / src / bin / screen_blanker / ScreenSaverWindow.h
blob7ad6dda95685fcd199705fddac438566ba8439b4
1 /*
2 * Copyright 2003, Michael Phipps. All rights reserved.
3 * Copyright 2014, Puck Meerburg.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef SCREEN_SAVER_WINDOW_H
7 #define SCREEN_SAVER_WINDOW_H
10 #include "ScreenSaver.h"
12 #include <DirectWindow.h>
13 #include <MessageFilter.h>
15 #include "ScreenSaverRunner.h"
18 const static uint32 kMsgEnableFilter = 'eflt';
21 class ScreenSaverFilter : public BMessageFilter {
22 public:
23 ScreenSaverFilter(bool test)
25 BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
26 fEnabled(true),
27 fTestMode(test) {}
29 virtual filter_result Filter(BMessage* message, BHandler** target);
31 void SetEnabled(bool enabled)
32 { fEnabled = enabled; };
34 private:
35 bool fEnabled;
36 bool fTestMode;
40 class ScreenSaverWindow : public BDirectWindow {
41 public:
42 ScreenSaverWindow(BRect frame, bool test);
43 ~ScreenSaverWindow();
45 virtual void MessageReceived(BMessage* message);
46 virtual bool QuitRequested();
47 virtual void DirectConnected(direct_buffer_info* info);
49 void SetSaverRunner(ScreenSaverRunner* runner);
50 BScreenSaver* _ScreenSaver();
52 private:
53 BView* fTopView;
54 ScreenSaverRunner* fSaverRunner;
55 ScreenSaverFilter* fFilter;
59 #endif // SCREEN_SAVER_WINDOW_H