136 if(((control_key_state & LEFT_ALT_PRESSED) == LEFT_ALT_PRESSED) || ((control_key_state & RIGHT_ALT_PRESSED) == RIGHT_ALT_PRESSED)) toAdd +=
Term::MetaKey::Value::Alt;
137 if(((control_key_state & LEFT_CTRL_PRESSED) == LEFT_CTRL_PRESSED) || ((control_key_state & RIGHT_CTRL_PRESSED) == RIGHT_CTRL_PRESSED)) toAdd +=
Term::MetaKey::Value::Ctrl;
139 switch(virtual_key_code)
215 GetNumberOfConsoleInputEvents(
Private::in.handle(), &to_read);
216 if(to_read == 0)
return;
218 std::vector<INPUT_RECORD> events{to_read};
219 if(!ReadConsoleInputW(
Private::in.handle(), &events[0], to_read, &read) || read != to_read)
Term::Exception(
"ReadFile() failed");
221 bool need_windows_size{
false};
222 for(std::size_t i = 0; i != read; ++i)
224 switch(events[i].EventType)
228 if(events[i].
Event.KeyEvent.bKeyDown)
230 if(events[i].
Event.KeyEvent.uChar.UnicodeChar == 0) read_windows_key(events[i].
Event.KeyEvent.wVirtualKeyCode, events[i].
Event.KeyEvent.dwControlKeyState, events[i].Event.KeyEvent.wRepeatCount);
250 static MOUSE_EVENT_RECORD old_state;
251 if(events[i].
Event.MouseEvent.dwEventFlags == MOUSE_WHEELED || events[i].
Event.MouseEvent.dwEventFlags == MOUSE_HWHEELED)
253 else if(old_state.dwButtonState == events[i].Event.MouseEvent.dwButtonState && old_state.dwMousePosition.X == events[i].Event.MouseEvent.dwMousePosition.X && old_state.dwMousePosition.Y == events[i].Event.MouseEvent.dwMousePosition.Y && old_state.dwEventFlags == events[i].Event.MouseEvent.dwEventFlags)
255 std::int32_t state{
static_cast<std::int32_t
>(events[i].Event.MouseEvent.dwButtonState)};
256 switch(events[i].
Event.MouseEvent.dwEventFlags)
260 m_events.push(
Term::Mouse(
setButton(
static_cast<std::int32_t
>(old_state.dwButtonState), state),
static_cast<std::uint16_t
>(events[i].Event.MouseEvent.dwMousePosition.Y),
static_cast<std::uint16_t
>(events[i].Event.MouseEvent.dwMousePosition.X)));
266 m_events.push(
Term::Mouse(
setButton(
static_cast<std::int32_t
>(old_state.dwButtonState), state),
static_cast<std::uint16_t
>(events[i].Event.MouseEvent.dwMousePosition.Y),
static_cast<std::uint16_t
>(events[i].Event.MouseEvent.dwMousePosition.X)));
291 old_state = events[i].Event.MouseEvent;
294 case WINDOW_BUFFER_SIZE_EVENT:
296 need_windows_size =
true;
304 if(need_windows_size ==
true) { m_events.push(
screen_size()); }
309 if(!ret.empty()) m_events.push(
Event(ret.c_str()));