FVTerm code cleanup
This commit is contained in:
parent
e0cc130074
commit
61eb8b8166
|
@ -653,9 +653,9 @@ inline void FApplication::findKeyboardWidget() const
|
|||
inline bool FApplication::isKeyPressed() const
|
||||
{
|
||||
if ( mouse && mouse->isGpmMouseEnabled() )
|
||||
return mouse->getGpmKeyPressed(keyboard->unprocessedInput());
|
||||
return mouse->getGpmKeyPressed(keyboard->hasUnprocessedInput());
|
||||
|
||||
return keyboard->isKeyPressed();
|
||||
return (keyboard->isKeyPressed() || keyboard->hasPendingInput());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -690,7 +690,7 @@ inline void FApplication::performKeyboardAction()
|
|||
{
|
||||
FKeyboard::keybuffer& buffer = keyboard->getKeyBuffer();
|
||||
mouse->setRawData (FMouse::x11, buffer);
|
||||
keyboard->unprocessedInput() = mouse->isInputDataPending();
|
||||
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
|
||||
processMouseEvent();
|
||||
}
|
||||
break;
|
||||
|
@ -700,7 +700,7 @@ inline void FApplication::performKeyboardAction()
|
|||
{
|
||||
FKeyboard::keybuffer& buffer = keyboard->getKeyBuffer();
|
||||
mouse->setRawData (FMouse::sgr, buffer);
|
||||
keyboard->unprocessedInput() = mouse->isInputDataPending();
|
||||
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
|
||||
processMouseEvent();
|
||||
}
|
||||
break;
|
||||
|
@ -710,7 +710,7 @@ inline void FApplication::performKeyboardAction()
|
|||
{
|
||||
FKeyboard::keybuffer& buffer = keyboard->getKeyBuffer();
|
||||
mouse->setRawData (FMouse::urxvt, buffer);
|
||||
keyboard->unprocessedInput() = mouse->isInputDataPending();
|
||||
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
|
||||
processMouseEvent();
|
||||
}
|
||||
break;
|
||||
|
@ -875,7 +875,7 @@ bool FApplication::getMouseEvent() const
|
|||
{
|
||||
struct timeval* time_keypressed = keyboard->getKeyPressedTime();
|
||||
mouse->processEvent (time_keypressed);
|
||||
keyboard->unprocessedInput() = mouse->isInputDataPending();
|
||||
keyboard->hasUnprocessedInput() = mouse->hasUnprocessedInput();
|
||||
mouse_event_occurred = mouse->hasEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,15 +142,15 @@ void FKeyboard::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool& FKeyboard::unprocessedInput()
|
||||
bool& FKeyboard::hasUnprocessedInput()
|
||||
{
|
||||
return input_data_pending;
|
||||
return unprocessed_buffer_data;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FKeyboard::isKeyPressed() const
|
||||
bool FKeyboard::isKeyPressed ( uInt64 blocking_time)
|
||||
{
|
||||
if ( ! isIntervalTimeout() )
|
||||
if ( has_pending_input || ! isIntervalTimeout() )
|
||||
return false;
|
||||
|
||||
fd_set ifds{};
|
||||
|
@ -160,14 +160,15 @@ bool FKeyboard::isKeyPressed() const
|
|||
FD_ZERO(&ifds);
|
||||
FD_SET(stdin_no, &ifds);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = suseconds_t(read_blocking_time); // preset to 100 ms
|
||||
tv.tv_usec = suseconds_t(blocking_time); // preset to 100 ms
|
||||
FObject::getCurrentTime (&time_last_request);
|
||||
const int result = select (stdin_no + 1, &ifds, nullptr, nullptr, &tv);
|
||||
has_pending_input = bool( result > 0 );
|
||||
|
||||
if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
|
||||
if ( has_pending_input && FD_ISSET(stdin_no, &ifds) )
|
||||
FD_CLR (stdin_no, &ifds);
|
||||
|
||||
return ( result > 0 );
|
||||
return has_pending_input;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -205,7 +206,7 @@ void FKeyboard::escapeKeyHandling()
|
|||
fifo_offset = 0;
|
||||
fifo_buf[0] = 0x00;
|
||||
fifo_in_use = false;
|
||||
input_data_pending = false;
|
||||
unprocessed_buffer_data = false;
|
||||
escapeKeyPressed();
|
||||
}
|
||||
|
||||
|
@ -268,7 +269,7 @@ inline FKey FKeyboard::getTermcapKey()
|
|||
for (n = n - len; n < FIFO_BUF_SIZE; n++) // Fill rest with '\0'
|
||||
fifo_buf[n] = '\0';
|
||||
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
unprocessed_buffer_data = bool(fifo_buf[0] != '\0');
|
||||
return entry.num;
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +308,7 @@ inline FKey FKeyboard::getMetaKey()
|
|||
for (n = n - len; n < FIFO_BUF_SIZE; n++) // Fill rest with '\0'
|
||||
fifo_buf[n] = '\0';
|
||||
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
unprocessed_buffer_data = bool(fifo_buf[0] != '\0');
|
||||
return entry.num;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ inline FKey FKeyboard::getSingleKey()
|
|||
for (n = n - len; n < FIFO_BUF_SIZE; n++) // Fill the rest with '\0' bytes
|
||||
fifo_buf[n] = '\0';
|
||||
|
||||
input_data_pending = bool(fifo_buf[0] != '\0');
|
||||
unprocessed_buffer_data = bool(fifo_buf[0] != '\0');
|
||||
|
||||
if ( keycode == 0 ) // Ctrl+Space or Ctrl+@
|
||||
keycode = fc::Fckey_space;
|
||||
|
@ -441,6 +442,8 @@ void FKeyboard::parseKeyBuffer()
|
|||
|
||||
while ( (bytesread = readKey()) > 0 )
|
||||
{
|
||||
has_pending_input = false;
|
||||
|
||||
if ( bytesread + fifo_offset <= int(FIFO_BUF_SIZE) )
|
||||
{
|
||||
fifo_buf[fifo_offset] = char(read_character);
|
||||
|
@ -539,7 +542,7 @@ void FKeyboard::substringKeyHandling()
|
|||
fifo_offset = 0;
|
||||
fifo_buf[0] = 0x00;
|
||||
fifo_in_use = false;
|
||||
input_data_pending = false;
|
||||
unprocessed_buffer_data = false;
|
||||
|
||||
if ( fifo_buf[1] == 'O' )
|
||||
key = fc::Fmkey_O;
|
||||
|
|
|
@ -173,9 +173,9 @@ inline bool FMouse::isMoved()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMouse::isInputDataPending() const
|
||||
inline bool FMouse::hasUnprocessedInput() const
|
||||
{
|
||||
return input_data_pending;
|
||||
return unprocessed_buffer_data;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -238,7 +238,7 @@ void FMouse::setNewPos (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
void FMouse::setPending (bool is_pending)
|
||||
{
|
||||
input_data_pending = is_pending;
|
||||
unprocessed_buffer_data = is_pending;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1434,14 +1434,14 @@ bool FMouseControl::isMoved()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMouseControl::isInputDataPending()
|
||||
bool FMouseControl::hasUnprocessedInput()
|
||||
{
|
||||
return std::any_of ( std::begin(mouse_protocol)
|
||||
, std::end(mouse_protocol)
|
||||
, [] (FMouseProtocol::const_reference m)
|
||||
{
|
||||
return m.second
|
||||
&& m.second->isInputDataPending();
|
||||
&& m.second->hasUnprocessedInput();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -277,18 +277,25 @@ void FVTerm::updateTerminal() const
|
|||
return;
|
||||
}
|
||||
|
||||
if ( (keyboard->isInputDataPending() || keyboard->isKeyPressed())
|
||||
skipped_terminal_update = 0;
|
||||
std::size_t changedlines = 0;
|
||||
static constexpr int check_interval = 5;
|
||||
|
||||
for (uInt y{0}; y < uInt(vterm->height); y++)
|
||||
{
|
||||
if ( updateTerminalLine(y) )
|
||||
changedlines++;
|
||||
|
||||
if ( changedlines % check_interval == 0
|
||||
&& (keyboard->hasUnprocessedInput() || keyboard->isKeyPressed(0))
|
||||
&& skipped_terminal_update <= max_skip )
|
||||
{
|
||||
// Skipping terminal updates if there is unprocessed inputs
|
||||
skipped_terminal_update++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
skipped_terminal_update = 0;
|
||||
|
||||
for (uInt y{0}; y < uInt(vterm->height); y++)
|
||||
updateTerminalLine (y);
|
||||
|
||||
vterm->has_changes = false;
|
||||
|
||||
|
@ -1124,7 +1131,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const
|
|||
|
||||
// insert a new line below
|
||||
FChar nc{}; // next character
|
||||
std::size_t bottom_right = (y_max * total_width) - area->right_shadow - 1;
|
||||
auto bottom_right = std::size_t((y_max * total_width) - area->right_shadow - 1);
|
||||
const auto& lc = area->data[bottom_right]; // last character
|
||||
std::memcpy (&nc, &lc, sizeof(nc));
|
||||
nc.ch = ' ';
|
||||
|
@ -1438,8 +1445,8 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedColor ( const FChar& area_char
|
||||
, FChar&& over_char
|
||||
inline void FVTerm::updateOverlappedColor ( const FChar& area_char
|
||||
, const FChar& over_char
|
||||
, FChar& vterm_char )
|
||||
{
|
||||
// Add the overlapping color to this character
|
||||
|
@ -1465,7 +1472,7 @@ void FVTerm::updateOverlappedColor ( const FChar& area_char
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateOverlappedCharacter ( FChar&& cover_char
|
||||
inline void FVTerm::updateOverlappedCharacter ( FChar& cover_char
|
||||
, FChar& vterm_char )
|
||||
{
|
||||
// Restore one character on vterm
|
||||
|
@ -1476,8 +1483,8 @@ void FVTerm::updateOverlappedCharacter ( FChar&& cover_char
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateShadedCharacter ( const FChar& area_char
|
||||
, FChar&& cover_char
|
||||
inline void FVTerm::updateShadedCharacter ( const FChar& area_char
|
||||
, FChar& cover_char
|
||||
, FChar& vterm_char )
|
||||
{
|
||||
// Get covered character + add the current color
|
||||
|
@ -1501,8 +1508,8 @@ void FVTerm::updateShadedCharacter ( const FChar& area_char
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateInheritBackground ( const FChar& area_char
|
||||
, FChar&& cover_char
|
||||
inline void FVTerm::updateInheritBackground ( const FChar& area_char
|
||||
, const FChar& cover_char
|
||||
, FChar& vterm_char )
|
||||
{
|
||||
// Add the covered background to this character
|
||||
|
@ -1517,7 +1524,7 @@ void FVTerm::updateInheritBackground ( const FChar& area_char
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateCharacter (const FChar& area_char, FChar& vterm_char)
|
||||
inline void FVTerm::updateCharacter (const FChar& area_char, FChar& vterm_char)
|
||||
{
|
||||
// Copy a area character to the virtual terminal
|
||||
|
||||
|
@ -1553,13 +1560,13 @@ bool FVTerm::updateVTermCharacter ( const FTermArea* area
|
|||
{
|
||||
// Overlapped character
|
||||
auto oc = getOverlappedCharacter (terminal_pos, area);
|
||||
updateOverlappedColor (ac, std::move(oc), tc);
|
||||
updateOverlappedColor (ac, oc, tc);
|
||||
}
|
||||
else if ( ac.attr.bit.transparent ) // Transparent
|
||||
{
|
||||
// Covered character
|
||||
auto cc = getCoveredCharacter (terminal_pos, area);
|
||||
updateOverlappedCharacter (std::move(cc), tc);
|
||||
updateOverlappedCharacter (cc, tc);
|
||||
}
|
||||
else // Not transparent
|
||||
{
|
||||
|
@ -1567,13 +1574,13 @@ bool FVTerm::updateVTermCharacter ( const FTermArea* area
|
|||
{
|
||||
// Covered character
|
||||
auto cc = getCoveredCharacter (terminal_pos, area);
|
||||
updateShadedCharacter (ac, std::move(cc), tc);
|
||||
updateShadedCharacter (ac, cc, tc);
|
||||
}
|
||||
else if ( ac.attr.bit.inherit_background )
|
||||
{
|
||||
// Covered character
|
||||
auto cc = getCoveredCharacter (terminal_pos, area);
|
||||
updateInheritBackground (ac, std::move(cc), tc);
|
||||
updateInheritBackground (ac, cc, tc);
|
||||
}
|
||||
else // Default
|
||||
{
|
||||
|
@ -1775,9 +1782,8 @@ FChar FVTerm::getCharacter ( character_type char_type
|
|||
if ( ! area || ! FWidget::getWindowList() || FWidget::getWindowList()->empty() )
|
||||
return *cc;
|
||||
|
||||
// Get the window layer of this object
|
||||
const auto& w = static_cast<FWidget*>(area->widget);
|
||||
const int layer = FWindow::getWindowLayer(w);
|
||||
// Get the window layer of this widget object
|
||||
const int layer = FWindow::getWindowLayer(area->widget);
|
||||
|
||||
for (auto&& win_obj : *FWidget::getWindowList())
|
||||
{
|
||||
|
@ -1813,14 +1819,14 @@ FChar FVTerm::getCharacter ( character_type char_type
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FChar FVTerm::getCoveredCharacter (const FPoint& pos, const FTermArea* area)
|
||||
inline FChar FVTerm::getCoveredCharacter (const FPoint& pos, const FTermArea* area)
|
||||
{
|
||||
// Gets the covered character for a given position
|
||||
return getCharacter (covered_character, pos, area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FChar FVTerm::getOverlappedCharacter (const FPoint& pos, const FTermArea* area)
|
||||
inline FChar FVTerm::getOverlappedCharacter (const FPoint& pos, const FTermArea* area)
|
||||
{
|
||||
// Gets the overlapped character for a given position
|
||||
return getCharacter (overlapped_character, pos, area);
|
||||
|
@ -2310,13 +2316,13 @@ inline void FVTerm::replaceNonPrintableFullwidth ( uInt x
|
|||
// Replace non-printable full-width characters that are truncated
|
||||
// from the right or left terminal side
|
||||
|
||||
if ( x == 0 && isFullWidthPaddingChar(print_char) )
|
||||
if ( x == 0 && isFullWidthPaddingChar(*print_char) )
|
||||
{
|
||||
print_char->ch = fc::SingleLeftAngleQuotationMark; // ‹
|
||||
print_char->attr.bit.fullwidth_padding = false;
|
||||
}
|
||||
else if ( x == uInt(vterm->width - 1)
|
||||
&& isFullWidthChar(print_char) )
|
||||
&& isFullWidthChar(*print_char) )
|
||||
{
|
||||
print_char->ch = fc::SingleRightAngleQuotationMark; // ›
|
||||
print_char->attr.bit.char_width = 1;
|
||||
|
@ -2329,12 +2335,12 @@ void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max
|
|||
{
|
||||
// General character output on terminal
|
||||
|
||||
if ( x < uInt(vterm->width - 1) && isFullWidthChar(print_char) )
|
||||
if ( x < uInt(vterm->width - 1) && isFullWidthChar(*print_char) )
|
||||
{
|
||||
printFullWidthCharacter (x, y, print_char);
|
||||
}
|
||||
else if ( x > 0 && x < uInt(vterm->width - 1)
|
||||
&& isFullWidthPaddingChar(print_char) )
|
||||
&& isFullWidthPaddingChar(*print_char) )
|
||||
{
|
||||
printFullWidthPaddingCharacter (x, y, print_char);
|
||||
}
|
||||
|
@ -2361,8 +2367,8 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
|
|||
&& print_char->attr.byte[1] == next_char->attr.byte[1]
|
||||
&& print_char->fg_color == next_char->fg_color
|
||||
&& print_char->bg_color == next_char->bg_color
|
||||
&& isFullWidthChar(print_char)
|
||||
&& isFullWidthPaddingChar(next_char) )
|
||||
&& isFullWidthChar(*print_char)
|
||||
&& isFullWidthPaddingChar(*next_char) )
|
||||
{
|
||||
// Print a full-width character
|
||||
appendCharacter (print_char);
|
||||
|
@ -2377,7 +2383,7 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
|
|||
term_pos->x_ref()++;
|
||||
markAsPrinted (x, y);
|
||||
|
||||
if ( isFullWidthPaddingChar(next_char) )
|
||||
if ( isFullWidthPaddingChar(*next_char) )
|
||||
{
|
||||
// Print ellipses for the 2nd full-width character column
|
||||
x++;
|
||||
|
@ -2400,8 +2406,8 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
|
|||
&& print_char->attr.byte[1] == prev_char->attr.byte[1]
|
||||
&& print_char->fg_color == prev_char->fg_color
|
||||
&& print_char->bg_color == prev_char->bg_color
|
||||
&& isFullWidthChar(prev_char)
|
||||
&& isFullWidthPaddingChar(print_char) )
|
||||
&& isFullWidthChar(*prev_char)
|
||||
&& isFullWidthPaddingChar(*print_char) )
|
||||
{
|
||||
// Move cursor one character to the left
|
||||
const auto& le = TCAP(fc::t_cursor_left);
|
||||
|
@ -2441,7 +2447,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
|
|||
const auto vt = vterm;
|
||||
auto prev_char = &vt->data[y * uInt(vt->width) + x - 1];
|
||||
|
||||
if ( isFullWidthChar(prev_char) && ! isFullWidthPaddingChar(print_char) )
|
||||
if ( isFullWidthChar(*prev_char) && ! isFullWidthPaddingChar(*print_char) )
|
||||
{
|
||||
// Move cursor one character to the left
|
||||
const auto& le = TCAP(fc::t_cursor_left);
|
||||
|
@ -2474,7 +2480,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
|
|||
inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y
|
||||
, const FChar* const& print_char ) const
|
||||
{
|
||||
if ( isFullWidthChar(print_char) ) // full-width character
|
||||
if ( isFullWidthChar(*print_char) ) // full-width character
|
||||
{
|
||||
x++; // Skip the following padding character
|
||||
term_pos->x_ref()++;
|
||||
|
@ -2565,9 +2571,9 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
|
|||
|
||||
for (uInt i = x + 1; i <= xmax; i++)
|
||||
{
|
||||
auto ch = &vt->data[y * uInt(vt->width) + i];
|
||||
const auto& ch = vt->data[y * uInt(vt->width) + i];
|
||||
|
||||
if ( *print_char == *ch )
|
||||
if ( *print_char == ch )
|
||||
repetitions++;
|
||||
else
|
||||
break;
|
||||
|
@ -2610,15 +2616,15 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::isFullWidthChar (const FChar* const& ch) const
|
||||
inline bool FVTerm::isFullWidthChar (const FChar& ch) const
|
||||
{
|
||||
return bool(ch->attr.bit.char_width == 2);
|
||||
return bool(ch.attr.bit.char_width == 2);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch) const
|
||||
inline bool FVTerm::isFullWidthPaddingChar (const FChar& ch) const
|
||||
{
|
||||
return ch->attr.bit.fullwidth_padding;
|
||||
return ch.attr.bit.fullwidth_padding;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2747,16 +2753,18 @@ void FVTerm::printPaddingCharacter (FTermArea* area, const FChar& term_char)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::updateTerminalLine (uInt y) const
|
||||
bool FVTerm::updateTerminalLine (uInt y) const
|
||||
{
|
||||
// Updates pending changes from line y to the terminal
|
||||
|
||||
bool ret{};
|
||||
const auto& vt = vterm;
|
||||
uInt& xmin = vt->changes[y].xmin;
|
||||
uInt& xmax = vt->changes[y].xmax;
|
||||
|
||||
if ( xmin <= xmax ) // Line has changes
|
||||
{
|
||||
ret = true;
|
||||
bool draw_leading_ws = false;
|
||||
bool draw_trailing_ws = false;
|
||||
const auto& ce = TCAP(fc::t_clr_eol);
|
||||
|
@ -2808,8 +2816,11 @@ void FVTerm::updateTerminalLine (uInt y) const
|
|||
xmin = uInt(vt->width);
|
||||
xmax = 0;
|
||||
}
|
||||
else
|
||||
ret = false;
|
||||
|
||||
cursorWrap();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -507,10 +507,7 @@ int FWindow::getWindowLayer (FWidget* obj)
|
|||
|
||||
const FWidget* window;
|
||||
|
||||
if ( ! getWindowList() )
|
||||
return -1;
|
||||
|
||||
if ( getWindowList()->empty() )
|
||||
if ( ! getWindowList() || getWindowList()->empty() )
|
||||
return -1;
|
||||
|
||||
if ( ! obj->isWindowWidget() )
|
||||
|
|
|
@ -129,12 +129,12 @@ class FKeyboard final
|
|||
void setEscPressedCommand (const FKeyboardCommand&);
|
||||
|
||||
// Inquiry
|
||||
bool isInputDataPending() const;
|
||||
bool hasPendingInput() const;
|
||||
|
||||
// Methods
|
||||
static void init();
|
||||
bool& unprocessedInput();
|
||||
bool isKeyPressed() const;
|
||||
bool& hasUnprocessedInput();
|
||||
bool isKeyPressed (uInt64 = read_blocking_time);
|
||||
void clearKeyBuffer();
|
||||
void clearKeyBufferOnTimeout();
|
||||
void fetchKeyCode();
|
||||
|
@ -189,8 +189,9 @@ class FKeyboard final
|
|||
char fifo_buf[FIFO_BUF_SIZE]{'\0'};
|
||||
int fifo_offset{0};
|
||||
int stdin_status_flags{0};
|
||||
bool has_pending_input{false};
|
||||
bool fifo_in_use{false};
|
||||
bool input_data_pending{false};
|
||||
bool unprocessed_buffer_data{false};
|
||||
bool utf8_input{false};
|
||||
bool mouse_support{true};
|
||||
bool non_blocking_stdin{false};
|
||||
|
@ -243,8 +244,8 @@ inline bool FKeyboard::unsetNonBlockingInput()
|
|||
{ return setNonBlockingInput(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FKeyboard::isInputDataPending() const
|
||||
{ return input_data_pending; }
|
||||
inline bool FKeyboard::hasPendingInput() const
|
||||
{ return has_pending_input; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FKeyboard::enableUTF8()
|
||||
|
|
|
@ -127,7 +127,7 @@ class FMouse
|
|||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending() const;
|
||||
bool hasUnprocessedInput() const;
|
||||
|
||||
// Methods
|
||||
template <typename ClassT>
|
||||
|
@ -183,7 +183,7 @@ class FMouse
|
|||
// Data members
|
||||
FMouseButton b_state{};
|
||||
bool mouse_event_occurred{false};
|
||||
bool input_data_pending{false};
|
||||
bool unprocessed_buffer_data{false};
|
||||
uInt16 max_width{80};
|
||||
uInt16 max_height{25};
|
||||
uInt64 dblclick_interval{500000}; // 500 ms
|
||||
|
@ -494,7 +494,7 @@ class FMouseControl
|
|||
bool isWheelUp();
|
||||
bool isWheelDown();
|
||||
bool isMoved();
|
||||
bool isInputDataPending();
|
||||
bool hasUnprocessedInput();
|
||||
bool isGpmMouseEnabled();
|
||||
|
||||
// Methods
|
||||
|
|
|
@ -352,10 +352,10 @@ class FVTerm
|
|||
static bool reallocateTextArea ( FTermArea*
|
||||
, std::size_t );
|
||||
static covered_state isCovered (const FPoint&, const FTermArea*);
|
||||
static void updateOverlappedColor (const FChar&, FChar&&, FChar&);
|
||||
static void updateOverlappedCharacter (FChar&&, FChar&);
|
||||
static void updateShadedCharacter (const FChar&, FChar&&, FChar&);
|
||||
static void updateInheritBackground (const FChar&, FChar&&, FChar&);
|
||||
static void updateOverlappedColor (const FChar&, const FChar&, FChar&);
|
||||
static void updateOverlappedCharacter (FChar&, FChar&);
|
||||
static void updateShadedCharacter (const FChar&, FChar&, FChar&);
|
||||
static void updateInheritBackground (const FChar&, const FChar&, FChar&);
|
||||
static void updateCharacter (const FChar&, FChar&);
|
||||
static bool updateVTermCharacter ( const FTermArea*
|
||||
, const FPoint&
|
||||
|
@ -395,8 +395,8 @@ class FVTerm
|
|||
void skipPaddingCharacter (uInt&, uInt, const FChar* const&) const;
|
||||
exit_state eraseCharacters (uInt&, uInt, uInt, bool) const;
|
||||
exit_state repeatCharacter (uInt&, uInt, uInt) const;
|
||||
bool isFullWidthChar (const FChar* const&) const;
|
||||
bool isFullWidthPaddingChar (const FChar* const&) const;
|
||||
bool isFullWidthChar (const FChar&) const;
|
||||
bool isFullWidthPaddingChar (const FChar&) const;
|
||||
static void cursorWrap();
|
||||
bool printWrap (FTermArea*) const;
|
||||
void printCharacterOnCoordinate ( FTermArea*
|
||||
|
@ -404,7 +404,7 @@ class FVTerm
|
|||
, const int&
|
||||
, const FChar&) const;
|
||||
void printPaddingCharacter (FTermArea*, const FChar&);
|
||||
void updateTerminalLine (uInt) const;
|
||||
bool updateTerminalLine (uInt) const;
|
||||
bool updateTerminalCursor() const;
|
||||
bool isInsideTerminal (const FPoint&) const;
|
||||
bool isTermSizeChanged() const;
|
||||
|
|
|
@ -359,8 +359,7 @@ void FKeyboardTest::noArgumentTest()
|
|||
CPPUNIT_ASSERT ( time->tv_sec == 0);
|
||||
CPPUNIT_ASSERT ( time->tv_usec == 0);
|
||||
|
||||
CPPUNIT_ASSERT ( ! keyboard->isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! keyboard->unprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! keyboard->hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! keyboard->isKeyPressed() );
|
||||
|
||||
keyboard->clearKeyBufferOnTimeout();
|
||||
|
|
|
@ -172,7 +172,7 @@ void FMouseTest::noArgumentTest()
|
|||
CPPUNIT_ASSERT ( ! mouse.isWheelUp() );
|
||||
CPPUNIT_ASSERT ( ! mouse.isWheelDown() );
|
||||
CPPUNIT_ASSERT ( ! mouse.isMoved() );
|
||||
CPPUNIT_ASSERT ( ! mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse.hasUnprocessedInput() );
|
||||
|
||||
#ifdef F_HAVE_LIBGPM
|
||||
finalcut::FMouseGPM gpm_mouse;
|
||||
|
@ -263,7 +263,7 @@ void FMouseTest::x11MouseTest()
|
|||
{ 0x1b, '[', 'M', 0x23, 0x50, 0x32, 0x40, 0x40 };
|
||||
x11_mouse.setRawData (rawdata1);
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( std::strcmp(rawdata1, "@@") == 0 );
|
||||
|
||||
timeval tv;
|
||||
|
@ -298,7 +298,7 @@ void FMouseTest::x11MouseTest()
|
|||
{ 0x1b, '[', 'M', 0x20, 0x21, 0x21 };
|
||||
x11_mouse.setRawData (rawdata2);
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.getPos() == finalcut::FPoint(1, 1) );
|
||||
|
@ -323,7 +323,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata3);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.getPos() == finalcut::FPoint(1, 1) );
|
||||
|
@ -348,7 +348,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata4);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -376,7 +376,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata5);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -398,7 +398,7 @@ void FMouseTest::x11MouseTest()
|
|||
|
||||
x11_mouse.setRawData (rawdata5);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isMiddleButtonPressed() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isMiddleButtonReleased() );
|
||||
|
||||
|
@ -409,7 +409,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata6);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -431,7 +431,7 @@ void FMouseTest::x11MouseTest()
|
|||
|
||||
x11_mouse.setRawData (rawdata6);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isRightButtonPressed() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isRightButtonReleased() );
|
||||
|
||||
|
@ -442,7 +442,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata7);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -464,7 +464,7 @@ void FMouseTest::x11MouseTest()
|
|||
|
||||
x11_mouse.setRawData (rawdata7);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isWheelDown() );
|
||||
|
||||
// Mouse move
|
||||
|
@ -475,7 +475,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata8);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -514,7 +514,7 @@ void FMouseTest::x11MouseTest()
|
|||
x11_mouse.setRawData (rawdata9);
|
||||
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( x11_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
x11_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! x11_mouse.hasData() );
|
||||
|
@ -578,7 +578,7 @@ void FMouseTest::sgrMouseTest()
|
|||
, '3', ';', '4', 'M', '@', '@' };
|
||||
sgr_mouse.setRawData (rawdata1);
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( std::strcmp(rawdata1, "@@") == 0 );
|
||||
|
||||
timeval tv;
|
||||
|
@ -614,7 +614,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata2);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasUnprocessedInput() );
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.getPos() == finalcut::FPoint(73, 4) );
|
||||
|
@ -639,7 +639,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata4);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -666,7 +666,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata5);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -688,7 +688,7 @@ void FMouseTest::sgrMouseTest()
|
|||
|
||||
sgr_mouse.setRawData (rawdata5);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isMiddleButtonPressed() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isMiddleButtonReleased() );
|
||||
|
||||
|
@ -699,7 +699,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata6);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -722,7 +722,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata6);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( sgr_mouse.getPos() == finalcut::FPoint(3, 4) );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isRightButtonPressed() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isRightButtonReleased() );
|
||||
|
||||
|
@ -733,7 +733,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata7);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -755,7 +755,7 @@ void FMouseTest::sgrMouseTest()
|
|||
|
||||
sgr_mouse.setRawData (rawdata7);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isWheelDown() );
|
||||
|
||||
// Mouse move
|
||||
|
@ -766,7 +766,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata8);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -805,7 +805,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.setRawData (rawdata9);
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasData() );
|
||||
|
@ -876,7 +876,7 @@ void FMouseTest::sgrMouseTest()
|
|||
sgr_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! sgr_mouse.hasEvent() );
|
||||
|
||||
CPPUNIT_ASSERT ( sgr_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( sgr_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( std::strcmp(rawdata11, "@") == 0 );
|
||||
}
|
||||
|
||||
|
@ -892,7 +892,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
, '9', ';', '6', 'M', '@', '@' };
|
||||
urxvt_mouse.setRawData (rawdata1);
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( std::strcmp(rawdata1, "@@") == 0 );
|
||||
|
||||
timeval tv;
|
||||
|
@ -927,7 +927,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata2);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasUnprocessedInput() );
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.getPos() == finalcut::FPoint(49, 6) );
|
||||
|
@ -952,7 +952,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata4);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -979,7 +979,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata5);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -1001,7 +1001,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
|
||||
urxvt_mouse.setRawData (rawdata5);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isMiddleButtonPressed() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isMiddleButtonReleased() );
|
||||
|
||||
|
@ -1012,7 +1012,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata6);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -1035,7 +1035,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata6);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.getPos() == finalcut::FPoint(3, 4) );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isRightButtonPressed() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isRightButtonReleased() );
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata7);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -1068,7 +1068,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
|
||||
urxvt_mouse.setRawData (rawdata7);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isWheelDown() );
|
||||
|
||||
// Mouse move
|
||||
|
@ -1079,7 +1079,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata8);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -1118,7 +1118,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.setRawData (rawdata9);
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
|
@ -1189,7 +1189,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasEvent() );
|
||||
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( std::strcmp(rawdata11, "@") == 0 );
|
||||
|
||||
// Negative values
|
||||
|
@ -1198,7 +1198,7 @@ void FMouseTest::urxvtMouseTest()
|
|||
, 0x1b, '[', '3', '2', ';', '3', ';', '-', '3', 'M' };
|
||||
urxvt_mouse.setRawData (rawdata12);
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.hasUnprocessedInput() );
|
||||
urxvt_mouse.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! urxvt_mouse.hasData() );
|
||||
CPPUNIT_ASSERT ( urxvt_mouse.getPos() != finalcut::FPoint(-5, 5) );
|
||||
|
@ -1255,7 +1255,7 @@ void FMouseTest::mouseControlTest()
|
|||
CPPUNIT_ASSERT ( ! mouse_control.isWheelUp() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isWheelDown() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isMoved() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasUnprocessedInput() );
|
||||
|
||||
if ( mouse_control.isGpmMouseEnabled() )
|
||||
{
|
||||
|
@ -1270,7 +1270,7 @@ void FMouseTest::mouseControlTest()
|
|||
mouse_control.setRawData (finalcut::FMouse::x11, rawdata1);
|
||||
|
||||
CPPUNIT_ASSERT ( mouse_control.hasData() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
timeval tv;
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
mouse_control.processEvent (&tv);
|
||||
|
@ -1290,11 +1290,11 @@ void FMouseTest::mouseControlTest()
|
|||
CPPUNIT_ASSERT ( ! mouse_control.isWheelUp() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isWheelDown() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isMoved() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
|
||||
mouse_control.setRawData (finalcut::FMouse::x11, rawdata1);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isLeftButtonPressed() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isLeftButtonReleased() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isLeftButtonDoubleClick() );
|
||||
|
@ -1305,7 +1305,7 @@ void FMouseTest::mouseControlTest()
|
|||
, 0x1b, '[', '<', '1', ';', '1', ';', '1', 'm' };
|
||||
mouse_control.setRawData (finalcut::FMouse::sgr, rawdata2);
|
||||
CPPUNIT_ASSERT ( mouse_control.hasData() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasData() );
|
||||
|
@ -1327,7 +1327,7 @@ void FMouseTest::mouseControlTest()
|
|||
|
||||
mouse_control.setRawData (finalcut::FMouse::sgr, rawdata2);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isMiddleButtonPressed() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isMiddleButtonReleased() );
|
||||
|
||||
|
@ -1336,7 +1336,7 @@ void FMouseTest::mouseControlTest()
|
|||
, 0x1b, '[', '3', '5', ';', '3', ';', '4', 'M' };
|
||||
mouse_control.setRawData (finalcut::FMouse::urxvt, rawdata3);
|
||||
CPPUNIT_ASSERT ( mouse_control.hasData() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasData() );
|
||||
|
@ -1359,7 +1359,7 @@ void FMouseTest::mouseControlTest()
|
|||
mouse_control.setRawData (finalcut::FMouse::urxvt, rawdata3);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( mouse_control.getPos() == finalcut::FPoint(3, 4) );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isRightButtonPressed() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isRightButtonReleased() );
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ void FMouseTest::mouseControlTest()
|
|||
, 0x1b, '[', 'M', 0x61, 0x70, 0x39 };
|
||||
mouse_control.setRawData (finalcut::FMouse::x11, rawdata4);
|
||||
CPPUNIT_ASSERT ( mouse_control.hasData() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasData() );
|
||||
|
@ -1391,7 +1391,7 @@ void FMouseTest::mouseControlTest()
|
|||
|
||||
mouse_control.setRawData (finalcut::FMouse::x11, rawdata4);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasUnprocessedInput() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isWheelDown() );
|
||||
|
||||
// Mouse move on an SGR mouse
|
||||
|
@ -1401,7 +1401,7 @@ void FMouseTest::mouseControlTest()
|
|||
, 0x1b, '[', '<', '0', ';', '3', ';', '4', 'm' };
|
||||
mouse_control.setRawData (finalcut::FMouse::sgr, rawdata5);
|
||||
CPPUNIT_ASSERT ( mouse_control.hasData() );
|
||||
CPPUNIT_ASSERT ( mouse_control.isInputDataPending() );
|
||||
CPPUNIT_ASSERT ( mouse_control.hasUnprocessedInput() );
|
||||
finalcut::FObject::getCurrentTime(&tv);
|
||||
mouse_control.processEvent (&tv);
|
||||
CPPUNIT_ASSERT ( ! mouse_control.hasData() );
|
||||
|
|
Loading…
Reference in New Issue