RemoteDrawingEngine: Reduce RP_READ_BITMAP result timeout.
[haiku.git] / src / apps / remotedesktop / RemoteView.h
blob04d0d7b2a17d24b2b08d5a9351fdd5a749fe7ceb
1 /*
2 * Copyright 2009, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Lotz <mmlr@mlotz.ch>
7 */
8 #ifndef REMOTE_VIEW_H
9 #define REMOTE_VIEW_H
11 #include <Cursor.h>
12 #include <NetEndpoint.h>
13 #include <ObjectList.h>
14 #include <View.h>
16 class BBitmap;
17 class NetReceiver;
18 class NetSender;
19 class StreamingRingBuffer;
21 struct engine_state;
23 class RemoteView : public BView {
24 public:
25 RemoteView(BRect frame,
26 const char *remoteHost,
27 uint16 remotePort);
28 virtual ~RemoteView();
30 status_t InitCheck();
32 virtual void AttachedToWindow();
34 virtual void Draw(BRect updateRect);
36 virtual void MouseMoved(BPoint where, uint32 code,
37 const BMessage *dragMessage);
38 virtual void MouseDown(BPoint where);
39 virtual void MouseUp(BPoint where);
41 virtual void KeyDown(const char *bytes, int32 numBytes);
42 virtual void KeyUp(const char *bytes, int32 numBytes);
44 virtual void MessageReceived(BMessage *message);
46 private:
47 void _SendMouseMessage(uint16 code,
48 BPoint where);
49 void _SendKeyMessage(uint16 code,
50 const char *bytes, int32 numBytes);
52 static int _StateCompareByKey(const uint32 *key,
53 const engine_state *state);
54 engine_state * _CreateState(uint32 token);
55 void _DeleteState(uint32 token);
56 engine_state * _FindState(uint32 token);
58 static int32 _DrawEntry(void *data);
59 void _DrawThread();
61 BRect _BuildInvalidateRect(BPoint *points,
62 int32 pointCount);
64 status_t fInitStatus;
65 bool fIsConnected;
67 StreamingRingBuffer * fReceiveBuffer;
68 StreamingRingBuffer * fSendBuffer;
69 BNetEndpoint * fEndpoint;
70 NetReceiver * fReceiver;
71 NetSender * fSender;
73 bool fStopThread;
74 thread_id fDrawThread;
76 BBitmap * fOffscreenBitmap;
77 BView * fOffscreen;
79 BCursor fViewCursor;
80 BBitmap * fCursorBitmap;
81 BRect fCursorFrame;
82 bool fCursorVisible;
84 BObjectList<engine_state> fStates;
87 #endif // REMOTE_VIEW_H