usb_ecm: Use the current configuration instead of a fixed one.
[haiku.git] / src / servers / app / EventStream.h
blob23a33b9f9619e2df4743aed15fff0d5943e866ce
1 /*
2 * Copyright 2005, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 */
8 #ifndef EVENT_STREAM_H
9 #define EVENT_STREAM_H
12 #include <LinkReceiver.h>
13 #include <MessageQueue.h>
14 #include <Messenger.h>
17 struct shared_cursor;
20 class EventStream {
21 public:
22 EventStream();
23 virtual ~EventStream();
25 virtual bool IsValid() = 0;
26 virtual void SendQuit() = 0;
28 virtual bool SupportsCursorThread() const;
30 virtual void UpdateScreenBounds(BRect bounds) = 0;
32 virtual bool GetNextEvent(BMessage** _event) = 0;
33 virtual status_t GetNextCursorPosition(BPoint& where,
34 bigtime_t timeout = B_INFINITE_TIMEOUT);
36 virtual status_t InsertEvent(BMessage* event) = 0;
38 virtual BMessage* PeekLatestMouseMoved() = 0;
42 class InputServerStream : public EventStream {
43 public:
44 InputServerStream(BMessenger& inputServerMessenger);
45 #if TEST_MODE
46 InputServerStream();
47 #endif
49 virtual ~InputServerStream();
51 virtual bool IsValid();
52 virtual void SendQuit();
54 virtual bool SupportsCursorThread() const { return fCursorSemaphore >= B_OK; }
56 virtual void UpdateScreenBounds(BRect bounds);
58 virtual bool GetNextEvent(BMessage** _event);
59 virtual status_t GetNextCursorPosition(BPoint& where,
60 bigtime_t timeout = B_INFINITE_TIMEOUT);
62 virtual status_t InsertEvent(BMessage* event);
64 virtual BMessage* PeekLatestMouseMoved();
66 private:
67 status_t _MessageFromPort(BMessage** _message,
68 bigtime_t timeout = B_INFINITE_TIMEOUT);
70 BMessenger fInputServer;
71 BMessageQueue fEvents;
72 port_id fPort;
73 bool fQuitting;
74 sem_id fCursorSemaphore;
75 area_id fCursorArea;
76 shared_cursor* fCursorBuffer;
77 BMessage* fLatestMouseMoved;
80 #endif /* EVENT_STREAM_H */