2005-11-17 17:58:19 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2005, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef EVENT_DISPATCHER_H
|
|
|
|
#define EVENT_DISPATCHER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Locker.h>
|
2005-11-17 19:08:04 +03:00
|
|
|
#include <Messenger.h>
|
2005-11-17 17:58:19 +03:00
|
|
|
|
|
|
|
class BMessageFilter;
|
|
|
|
|
|
|
|
class EventStream;
|
|
|
|
class HWInterface;
|
|
|
|
|
|
|
|
|
|
|
|
class EventDispatcher : public BLocker {
|
|
|
|
public:
|
|
|
|
EventDispatcher();
|
|
|
|
~EventDispatcher();
|
|
|
|
|
|
|
|
status_t SetTo(EventStream& stream);
|
|
|
|
status_t InitCheck();
|
|
|
|
|
|
|
|
void SetFocus(BMessenger* messenger);
|
|
|
|
|
|
|
|
void SetMouseFilter(BMessageFilter* filter);
|
|
|
|
void SetKeyFilter(BMessageFilter* filter);
|
|
|
|
|
|
|
|
bool HasCursorThread();
|
|
|
|
void SetHWInterface(HWInterface* interface);
|
|
|
|
|
|
|
|
EventStream* Stream();
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t _Run();
|
|
|
|
void _Unset();
|
|
|
|
|
2005-11-17 19:08:04 +03:00
|
|
|
void _SendMessage(BMessenger& messenger, BMessage* message, float importance);
|
2005-11-17 17:58:19 +03:00
|
|
|
void _SetTransit(BMessage* message, int32 transit);
|
|
|
|
|
|
|
|
void _EventLoop();
|
|
|
|
void _CursorLoop();
|
|
|
|
|
|
|
|
static status_t _event_looper(void* dispatcher);
|
|
|
|
static status_t _cursor_looper(void* dispatcher);
|
|
|
|
|
|
|
|
private:
|
|
|
|
EventStream* fStream;
|
|
|
|
thread_id fThread;
|
|
|
|
thread_id fCursorThread;
|
|
|
|
|
2005-11-17 19:08:04 +03:00
|
|
|
BMessenger fFocus;
|
|
|
|
BMessenger fLastFocus;
|
|
|
|
bool fHasFocus;
|
|
|
|
bool fHasLastFocus;
|
2005-11-17 17:58:19 +03:00
|
|
|
bool fTransit;
|
|
|
|
BMessageFilter* fMouseFilter;
|
|
|
|
BMessageFilter* fKeyFilter;
|
|
|
|
|
|
|
|
BLocker fCursorLock;
|
|
|
|
HWInterface* fHWInterface;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* EVENT_DISPATCHER_H */
|