-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslot_terminal.hpp
59 lines (43 loc) · 1.43 KB
/
slot_terminal.hpp
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
#ifndef slot_terminal_hpp
#define slot_terminal_hpp
#include "interface.hpp"
#include "slot.hpp"
#include "types.hpp"
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <string>
#include <deque>
#include "termemu.h"
#include "pty.h"
namespace dfterm
{
class TerminalGlue : public Slot
{
private:
bool alive;
boost::recursive_mutex glue_mutex;
SP<boost::thread> glue_thread;
Terminal game_terminal;
boost::recursive_mutex game_terminal_mutex;
std::map<std::string, UnicodeString> parameters;
std::deque<trankesbel::KeyPress> input_queue;
void flushInput(Pty* program_pty);
trankesbel::ui32 terminal_w, terminal_h;
trankesbel::ui32 old_w, old_h;
bool try_resize_again;
volatile bool close_thread;
static void static_thread_function(TerminalGlue* self);
void thread_function();
static void pushEscapeSequence(trankesbel::KeyCode special_key, std::string &input_buf);
public:
TerminalGlue();
~TerminalGlue();
void setParameter(std::string key, UnicodeString value);
void getSize(trankesbel::ui32* width, trankesbel::ui32* height);
bool isAlive();
void unloadToWindow(SP<trankesbel::Interface2DWindow> target_window);
void feedInput(const trankesbel::KeyPress &kp);
};
}; /* namespace */
#endif