source: trunk/synergy/lib/arch/CArchConsoleWindows.h@ 3003

Last change on this file since 3003 was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 1.9 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef CARCHCONSOLEWINDOWS_H
16#define CARCHCONSOLEWINDOWS_H
17
18#define WIN32_LEAN_AND_MEAN
19
20#include "IArchConsole.h"
21#include "IArchMultithread.h"
22#include "stddeque.h"
23#include <windows.h>
24
25#define ARCH_CONSOLE CArchConsoleWindows
26
27//! Win32 implementation of IArchConsole
28class CArchConsoleWindows : public IArchConsole {
29public:
30 CArchConsoleWindows(void*);
31 virtual ~CArchConsoleWindows();
32
33 // IArchConsole overrides
34 virtual void openConsole(const char* title);
35 virtual void closeConsole();
36 virtual void showConsole(bool showIfEmpty);
37 virtual void writeConsole(const char*);
38 virtual const char* getNewlineForConsole();
39
40private:
41 void clearBuffer();
42 void appendBuffer(const char*);
43 void setSize(int width, int height);
44
45 LRESULT wndProc(HWND, UINT, WPARAM, LPARAM);
46 static LRESULT CALLBACK
47 staticWndProc(HWND, UINT, WPARAM, LPARAM);
48 void threadMainLoop();
49 static void* threadEntry(void*);
50
51private:
52 typedef std::deque<std::string> MessageBuffer;
53
54 static CArchConsoleWindows* s_instance;
55 static HINSTANCE s_appInstance;
56
57 // multithread data
58 CArchMutex m_mutex;
59 CArchCond m_condVar;
60 bool m_ready;
61 CArchThread m_thread;
62
63 // child thread data
64 HWND m_frame;
65 HWND m_hwnd;
66 LONG m_wChar;
67 LONG m_hChar;
68 bool m_show;
69
70 // messages
71 size_t m_maxLines;
72 size_t m_maxCharacters;
73 size_t m_numCharacters;
74 MessageBuffer m_buffer;
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.