-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverthread.h
More file actions
62 lines (42 loc) · 1.5 KB
/
serverthread.h
File metadata and controls
62 lines (42 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SERVERTHREAD_H
#define SERVERTHREAD_H
#include <boost/asio.hpp>
#include "mouse.h"
#include "vcursor.h"
#include "enforcer.h"
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
using namespace boost::interprocess;
using boost::asio::ip::tcp;
class ServerThread {
public:
ServerThread ( tcp::socket & socket );
void operator ( ) ();
private:
// Initialize the thread
void servThreadInit(tcp::socket & sock);
// Get the next event from the socket
void getNextEvent ( tcp::socket & socket, MouseEvent & event );
// Move the virtual mouse
void mouseMove ( int x, int y );
// Click the virtual mouse
void mouseClick ( int x, int y, int buttonId );
// Release a click on the virtual mouse
void mouseUp ( int x, int y, int buttonId ) ;
// Start a click on the virtual mouse
void mouseDown ( int x, int y, int buttonId ) ;
// Process one mouse event
void processEvent ( MouseEvent & event ) ;
// Socket used for communicating with the wall (server)
tcp::socket & rSocket;
// The virtual cursor associated with the thread
Vcursor * cursor;
// The reference to the enforcer module that takes care of ownership
Enforcer * enforcer;
// Whether or not the connection should be terminated
bool terminated;
// The current window being dragged
uint32_t this_win;
// The mutex used to ensure virtual cursors are acquired properly
static boost::interprocess::interprocess_semaphore mutex;
};
#endif