Small improvements

This commit is contained in:
Markus Gans 2020-11-01 22:15:44 +01:00
parent 0ee09aad2c
commit ff70abd073
4 changed files with 13 additions and 6 deletions

View File

@ -716,7 +716,7 @@ inline void FApplication::performKeyboardAction()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FApplication::performMouseAction() inline void FApplication::performMouseAction() const
{ {
if ( ! mouse ) if ( ! mouse )
return; return;
@ -736,6 +736,9 @@ inline void FApplication::performMouseAction()
case fc::Fkey_urxvt_mouse: case fc::Fkey_urxvt_mouse:
mouse->setRawData (FMouse::urxvt, buffer); mouse->setRawData (FMouse::urxvt, buffer);
break; break;
default:
return;
} }
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput(); keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();

View File

@ -84,6 +84,7 @@ FKeyboard::~FKeyboard() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FKeyboard::fetchKeyCode() void FKeyboard::fetchKeyCode()
{ {
if ( fkey_queue.size() < MAX_QUEUE_SIZE )
parseKeyBuffer(); parseKeyBuffer();
} }
@ -471,8 +472,7 @@ void FKeyboard::parseKeyBuffer()
ssize_t bytesread{}; ssize_t bytesread{};
FObject::getCurrentTime (&time_keypressed); FObject::getCurrentTime (&time_keypressed);
while ( fkey_queue.size() < MAX_QUEUE_SIZE while ( (bytesread = readKey()) > 0 )
&& (bytesread = readKey()) > 0 )
{ {
has_pending_input = false; has_pending_input = false;
@ -509,6 +509,9 @@ void FKeyboard::parseKeyBuffer()
} }
fkey = 0; fkey = 0;
if ( fkey_queue.size() >= MAX_QUEUE_SIZE )
break;
} }
read_character = 0; read_character = 0;

View File

@ -1576,7 +1576,8 @@ void FMouseControl::processEvent (struct timeval* time)
if ( mouse_object ) if ( mouse_object )
{ {
mouse_object->processEvent(time); mouse_object->processEvent(time);
fmousedata_queue.emplace(new FMouseData(std::move(*mouse_object))); const auto& md = static_cast<FMouseData>(*mouse_object);
fmousedata_queue.emplace(new FMouseData(std::move(md)));
} }
} }

View File

@ -184,7 +184,7 @@ class FApplication : public FWidget
void escapeKeyPressed() const; void escapeKeyPressed() const;
void mouseTracking(); void mouseTracking();
void performKeyboardAction(); void performKeyboardAction();
void performMouseAction(); void performMouseAction() const;
void mouseEvent (const FMouseData&); void mouseEvent (const FMouseData&);
void sendEscapeKeyPressEvent() const; void sendEscapeKeyPressEvent() const;
bool sendKeyDownEvent (FWidget*) const; bool sendKeyDownEvent (FWidget*) const;