19 deviceCreationFlags(0)
24 int inXOrigin,
int inYOrigin,
int inXSize,
int inYSize)
42 mButtonDown{
false,
false,
false,
false,
false,
false,
false,
false},
64 XID rootWindow, childWindow;
66 unsigned int modifier;
68 &rootX, &rootY, &x, &y, &modifier);
88 if (evt.type == ButtonPress || evt.type == ButtonRelease)
91 evt.xbutton.x, evt.xbutton.y, evt.xbutton.state);
93 mButtonDown[evt.xbutton.button] = (evt.type == ButtonPress);
97 if (evt.type == MotionNotify)
108 OnMouseMotion(button, evt.xmotion.x, evt.xmotion.y, evt.xmotion.state);
112 if (evt.type == KeyPress || evt.type == KeyRelease)
114 int keysyms_per_keycode_return;
115 KeySym* pKeySym = XGetKeyboardMapping(
mDisplay,
116 evt.xkey.keycode, 1, &keysyms_per_keycode_return);
117 KeySym& keySym = *pKeySym;
118 int key = (keySym & 0x00FF);
128 if ((keySym & 0xFF00) != 0)
130 if (0x50 <= key && key <= 0x57)
135 else if (key == 0x63)
140 else if (key == 0xFF)
145 else if (key == 0xE1 || key == 0xE2)
151 else if (key == 0xE3 || key == 0xE4)
157 else if (key == 0xE9 || key == 0xEA)
163 else if (key == 0xEB || key == 0xEC)
174 if (evt.type == KeyPress)
176 OnKeyDown(key, evt.xbutton.x, evt.xbutton.y);
180 OnKeyUp(key, evt.xbutton.x, evt.xbutton.y);
185 if (evt.type == KeyPress)
188 unsigned char ucKey =
static_cast<unsigned char>(key);
189 if (
mShiftDown &&
'a' <= ucKey && ucKey <=
'z')
191 ucKey =
static_cast<unsigned char>(key - 32);
200 if (evt.type == Expose)
206 if (evt.type == ConfigureNotify)
208 OnMove(evt.xconfigure.x, evt.xconfigure.y);
209 OnResize(evt.xconfigure.width, evt.xconfigure.height);
213 if (evt.type == ClientMessage)
215 Atom* wmDelete =
nullptr;
219 if (evt.xclient.data.l[0] == *wmDelete)
static int const KEY_LEFT
virtual void OnMove(int x, int y)
std::array< bool, 8 > mButtonDown
virtual bool OnMouseClick(int button, int state, int x, int y, unsigned int modifiers)
static int const MODIFIER_SHIFT
static int const MOUSE_MIDDLE
virtual bool OnKeyDown(int key, int x, int y)
static int const MODIFIER_RBUTTON
virtual void OnClose() override
static int const KEY_COMMAND
static int const KEY_PAGE_UP
static int const MODIFIER_LBUTTON
static int const KEY_HOME
static int const KEY_RETURN
virtual void GetMousePosition(int &x, int &y) const override
Window(Parameters ¶meters)
static int const MOUSE_RIGHT
static int const MOUSE_UP
static int const MODIFIER_CONTROL
static int const KEY_BACKSPACE
static int const MOUSE_DOWN
static int const KEY_DELETE
static int const MOUSE_NONE
static int const KEY_ENTER
unsigned int deviceCreationFlags
static int const KEY_INSERT
static int const KEY_PAGE_DOWN
static int const MOUSE_LEFT
static int const KEY_RIGHT
std::shared_ptr< GraphicsEngine > mEngine
virtual bool OnKeyUp(int key, int x, int y)
virtual bool OnResize(int xSize, int ySize)
virtual void SetMousePosition(int x, int y) override
static int const KEY_ESCAPE
static int const KEY_SHIFT
virtual bool OnMouseMotion(int button, int x, int y, unsigned int modifiers)
static int const KEY_DOWN
static int const KEY_CONTROL
std::shared_ptr< BaseEngine > mBaseEngine
static int const MODIFIER_MBUTTON
virtual bool OnCharPress(unsigned char key, int x, int y)