955307393f
that solves most app_server locking headaches: it now works asynchronously, and therefore doesn't need to lock the EventDispatcher anymore. * EventStreams now allow to inject messages into the stream to allow the above functionality. * InputServerStream::GetNextEvent() no longer returns when there is no event. * Desktop::ActivateWindow() now locks all windows before checking the workspaces of the windows, fixing a race condition that could lead to Window::Foremost() being called for a window that isn't on the current workspace, leading to a crash. * I currently cannot access Trac, but I recall there should be an open bug report about this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28224 a95241bf-73f2-0310-859d-f6bbb57e9c96
79 lines
1.6 KiB
C++
79 lines
1.6 KiB
C++
/*
|
|
* 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_STREAM_H
|
|
#define EVENT_STREAM_H
|
|
|
|
|
|
#include <LinkReceiver.h>
|
|
#include <MessageQueue.h>
|
|
#include <Messenger.h>
|
|
|
|
|
|
struct shared_cursor;
|
|
|
|
|
|
class EventStream {
|
|
public:
|
|
EventStream();
|
|
virtual ~EventStream();
|
|
|
|
virtual bool IsValid() = 0;
|
|
virtual void SendQuit() = 0;
|
|
|
|
virtual bool SupportsCursorThread() const;
|
|
|
|
virtual void UpdateScreenBounds(BRect bounds) = 0;
|
|
|
|
virtual bool GetNextEvent(BMessage** _event) = 0;
|
|
virtual bool GetNextCursorPosition(BPoint& where);
|
|
|
|
virtual status_t InsertEvent(BMessage* event) = 0;
|
|
|
|
virtual BMessage* PeekLatestMouseMoved() = 0;
|
|
};
|
|
|
|
|
|
class InputServerStream : public EventStream {
|
|
public:
|
|
InputServerStream(BMessenger& inputServerMessenger);
|
|
#if TEST_MODE
|
|
InputServerStream();
|
|
#endif
|
|
|
|
virtual ~InputServerStream();
|
|
|
|
virtual bool IsValid();
|
|
virtual void SendQuit();
|
|
|
|
virtual bool SupportsCursorThread() const { return fCursorSemaphore >= B_OK; }
|
|
|
|
virtual void UpdateScreenBounds(BRect bounds);
|
|
|
|
virtual bool GetNextEvent(BMessage** _event);
|
|
virtual bool GetNextCursorPosition(BPoint& where);
|
|
|
|
virtual status_t InsertEvent(BMessage* event);
|
|
|
|
virtual BMessage* PeekLatestMouseMoved();
|
|
|
|
private:
|
|
status_t _MessageFromPort(BMessage** _message,
|
|
bigtime_t timeout = B_INFINITE_TIMEOUT);
|
|
|
|
BMessenger fInputServer;
|
|
BMessageQueue fEvents;
|
|
port_id fPort;
|
|
bool fQuitting;
|
|
sem_id fCursorSemaphore;
|
|
area_id fCursorArea;
|
|
shared_cursor* fCursorBuffer;
|
|
BMessage* fLatestMouseMoved;
|
|
};
|
|
|
|
#endif /* EVENT_STREAM_H */
|