2001-10-08 23:24:46 +04:00
|
|
|
#ifndef CXWINDOWSSECONDARYSCREEN_H
|
|
|
|
#define CXWINDOWSSECONDARYSCREEN_H
|
|
|
|
|
2001-11-12 00:15:30 +03:00
|
|
|
#include "CXWindowsScreen.h"
|
2001-10-08 23:24:46 +04:00
|
|
|
#include "ISecondaryScreen.h"
|
2002-05-27 20:22:59 +04:00
|
|
|
#include <map>
|
2002-04-26 21:38:01 +04:00
|
|
|
#include <vector>
|
2001-10-08 23:24:46 +04:00
|
|
|
|
2001-11-12 00:15:30 +03:00
|
|
|
class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-08 23:24:46 +04:00
|
|
|
CXWindowsSecondaryScreen();
|
|
|
|
virtual ~CXWindowsSecondaryScreen();
|
|
|
|
|
|
|
|
// ISecondaryScreen overrides
|
2001-11-19 03:33:36 +03:00
|
|
|
virtual void run();
|
|
|
|
virtual void stop();
|
2001-10-08 23:24:46 +04:00
|
|
|
virtual void open(CClient*);
|
|
|
|
virtual void close();
|
2002-04-30 21:48:11 +04:00
|
|
|
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute,
|
|
|
|
KeyModifierMask mask);
|
2001-10-08 23:24:46 +04:00
|
|
|
virtual void leave();
|
2001-10-26 01:40:29 +04:00
|
|
|
virtual void keyDown(KeyID, KeyModifierMask);
|
|
|
|
virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
|
|
|
virtual void keyUp(KeyID, KeyModifierMask);
|
|
|
|
virtual void mouseDown(ButtonID);
|
|
|
|
virtual void mouseUp(ButtonID);
|
|
|
|
virtual void mouseMove(SInt32 xAbsolute, SInt32 yAbsolute);
|
|
|
|
virtual void mouseWheel(SInt32 delta);
|
2002-04-27 18:19:53 +04:00
|
|
|
virtual void setClipboard(ClipboardID, const IClipboard*);
|
|
|
|
virtual void grabClipboard(ClipboardID);
|
2002-05-24 21:54:28 +04:00
|
|
|
virtual void getMousePos(SInt32* x, SInt32* y) const;
|
2001-10-08 23:24:46 +04:00
|
|
|
virtual void getSize(SInt32* width, SInt32* height) const;
|
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2002-04-27 18:19:53 +04:00
|
|
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
2001-10-08 23:24:46 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
protected:
|
2001-11-12 00:15:30 +03:00
|
|
|
// CXWindowsScreen overrides
|
|
|
|
virtual void onOpenDisplay();
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual CXWindowsClipboard*
|
|
|
|
createClipboard(ClipboardID);
|
2001-11-12 00:15:30 +03:00
|
|
|
virtual void onCloseDisplay();
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual void onLostClipboard(ClipboardID);
|
2001-11-12 00:15:30 +03:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-05-03 15:26:44 +04:00
|
|
|
enum EKeyAction { kPress, kRelease, kRepeat };
|
|
|
|
class KeyCodeMask {
|
2002-04-26 21:38:01 +04:00
|
|
|
public:
|
2002-05-03 15:26:44 +04:00
|
|
|
KeyCode m_keycode;
|
|
|
|
unsigned int m_keyMask;
|
|
|
|
unsigned int m_keyMaskMask;
|
|
|
|
};
|
|
|
|
class Keystroke {
|
|
|
|
public:
|
|
|
|
KeyCode m_keycode;
|
|
|
|
Bool m_press;
|
|
|
|
bool m_repeat;
|
2002-04-26 21:38:01 +04:00
|
|
|
};
|
|
|
|
typedef std::vector<Keystroke> Keystrokes;
|
|
|
|
typedef std::vector<KeyCode> KeyCodes;
|
|
|
|
typedef std::map<KeyID, KeyCodeMask> KeyCodeMap;
|
|
|
|
typedef std::map<KeyCode, unsigned int> ModifierMap;
|
|
|
|
|
2001-11-12 00:15:30 +03:00
|
|
|
void leaveNoLock(Display*);
|
2001-10-08 23:24:46 +04:00
|
|
|
unsigned int mapButton(ButtonID button) const;
|
|
|
|
|
2002-04-26 21:38:01 +04:00
|
|
|
unsigned int mapKey(Keystrokes&, KeyCode&, KeyID,
|
2002-05-03 15:26:44 +04:00
|
|
|
KeyModifierMask, EKeyAction) const;
|
2002-04-26 21:38:01 +04:00
|
|
|
bool findKeyCode(KeyCode&, unsigned int&,
|
|
|
|
KeyID id, unsigned int) const;
|
2002-05-03 15:26:44 +04:00
|
|
|
void doKeystrokes(const Keystrokes&, SInt32 count);
|
2002-04-26 21:38:01 +04:00
|
|
|
unsigned int maskToX(KeyModifierMask) const;
|
|
|
|
|
|
|
|
void updateKeys(Display* display);
|
|
|
|
void updateKeycodeMap(Display* display);
|
|
|
|
void updateModifiers(Display* display);
|
|
|
|
void updateModifierMap(Display* display);
|
2002-04-30 21:48:11 +04:00
|
|
|
void toggleKey(Display*, KeySym, unsigned int mask);
|
2002-04-26 21:38:01 +04:00
|
|
|
static bool isToggleKeysym(KeySym);
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-08 23:24:46 +04:00
|
|
|
CClient* m_client;
|
|
|
|
Window m_window;
|
2002-04-26 21:38:01 +04:00
|
|
|
|
2002-05-04 22:31:54 +04:00
|
|
|
// note toggle keys that toggles on up/down (false) or on
|
2002-04-30 20:25:29 +04:00
|
|
|
// transition (true)
|
2002-05-04 22:31:54 +04:00
|
|
|
bool m_numLockHalfDuplex;
|
2002-04-30 20:25:29 +04:00
|
|
|
bool m_capsLockHalfDuplex;
|
|
|
|
|
2002-04-26 21:38:01 +04:00
|
|
|
// set entries indicate keys that are pressed. indexed by keycode.
|
|
|
|
bool m_keys[256];
|
|
|
|
|
|
|
|
// current active modifiers (X key masks)
|
|
|
|
unsigned int m_mask;
|
|
|
|
|
|
|
|
// maps key IDs to X keycodes and the X modifier key mask needed
|
|
|
|
// to generate the right keysym
|
|
|
|
KeyCodeMap m_keycodeMap;
|
|
|
|
|
|
|
|
// the modifiers that have keys bound to them
|
|
|
|
unsigned int m_modifierMask;
|
|
|
|
|
|
|
|
// set bits indicate modifiers that toggle (e.g. caps-lock)
|
|
|
|
unsigned int m_toggleModifierMask;
|
|
|
|
|
2002-04-30 21:48:11 +04:00
|
|
|
// masks that indicate which modifier bits are for toggle keys
|
2002-04-26 21:38:01 +04:00
|
|
|
unsigned int m_numLockMask;
|
|
|
|
unsigned int m_capsLockMask;
|
2002-04-30 21:48:11 +04:00
|
|
|
unsigned int m_scrollLockMask;
|
2002-04-26 21:38:01 +04:00
|
|
|
|
|
|
|
// map X modifier key indices to the key codes bound to them
|
|
|
|
unsigned int m_keysPerModifier;
|
|
|
|
KeyCodes m_modifierToKeycode;
|
|
|
|
|
|
|
|
// maps keycodes to modifier indices
|
|
|
|
ModifierMap m_keycodeToModifier;
|
2001-10-08 23:24:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|