Skipping the print of characters without changes

This commit is contained in:
Markus Gans 2016-12-18 23:34:11 +01:00
parent fedb5f64f3
commit b9f3be782f
42 changed files with 670 additions and 623 deletions

View File

@ -1,3 +1,9 @@
2016-12-18 Markus Gans <guru.mail@muenster.de>
* Only perform VTerm updates on terminal updates
* Skipping the print of characters without changes
* Combined scrollAreaForward and scrollAreaReverse
with terminal scroll sequences
2016-12-15 Markus Gans <guru.mail@muenster.de> 2016-12-15 Markus Gans <guru.mail@muenster.de>
* Reduce the character output by using character erase * Reduce the character output by using character erase
and character repeat and character repeat

View File

@ -53,7 +53,7 @@ FApplication::FApplication (int& _argc, char* _argv[])
, new_mouse_position() , new_mouse_position()
{ {
assert ( ! rootObj assert ( ! rootObj
&& "FApplication: There should be only one application object" ); && "FApplication: There should be only one application object" );
rootObj = this; rootObj = this;
if ( ! (_argc && _argv) ) if ( ! (_argc && _argv) )
@ -177,8 +177,8 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
// block events for widgets in non modal windows // block events for widgets in non modal windows
if ( window if ( window
&& (window->getFlags() & fc::modal) == 0 && (window->getFlags() & fc::modal) == 0
&& ! window->isMenuWidget() ) && ! window->isMenuWidget() )
{ {
switch ( event->type() ) switch ( event->type() )
{ {
@ -202,9 +202,9 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
} }
// throw away mouse events to disabled widgets // throw away mouse events to disabled widgets
if ( event->type() >= fc::MouseDown_Event if ( event->type() >= fc::MouseDown_Event
&& event->type() <= fc::MouseMove_Event && event->type() <= fc::MouseMove_Event
&& ! widget->isEnabled() ) && ! widget->isEnabled() )
return false; return false;
// sends event event directly to receiver // sends event event directly to receiver
@ -540,9 +540,9 @@ void FApplication::processKeyboardEvent()
} }
// read the rest from the fifo buffer // read the rest from the fifo buffer
while ( ! widget->isKeyTimeout(&time_keypressed, key_timeout) while ( ! widget->isKeyTimeout(&time_keypressed, key_timeout)
&& fifo_offset > 0 && fifo_offset > 0
&& key != NEED_MORE_DATA ) && key != NEED_MORE_DATA )
{ {
key = FTerm::parseKeyString(fifo_buf, fifo_buf_size, &time_keypressed); key = FTerm::parseKeyString(fifo_buf, fifo_buf_size, &time_keypressed);
@ -649,8 +649,8 @@ void FApplication::processKeyboardEvent()
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
if ( ! open_menu if ( ! open_menu
&& ! k_press_ev.isAccepted() && ! k_press_ev.isAccepted()
&& ! k_down_ev.isAccepted() ) && ! k_down_ev.isAccepted() )
{ {
// switch to a specific dialog with Meta + 1..9 // switch to a specific dialog with Meta + 1..9
bool accpt = processDialogSwitchAccelerator(); bool accpt = processDialogSwitchAccelerator();
@ -692,11 +692,11 @@ void FApplication::processKeyboardEvent()
} }
// special case: Esc key // special case: Esc key
if ( fifo_in_use if ( fifo_in_use
&& fifo_offset == 1 && fifo_offset == 1
&& fifo_buf[0] == 0x1b && fifo_buf[0] == 0x1b
&& fifo_buf[1] == 0x00 && fifo_buf[1] == 0x00
&& isKeyTimeout(&time_keypressed, key_timeout) ) && isKeyTimeout(&time_keypressed, key_timeout) )
{ {
FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape); FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
@ -1017,8 +1017,8 @@ bool FApplication::processAccelerator (FWidget*& widget)
bool accpt = false; bool accpt = false;
if ( widget if ( widget
&& widget->accelerator_list && widget->accelerator_list
&& ! widget->accelerator_list->empty() ) && ! widget->accelerator_list->empty() )
{ {
FWidget::Accelerators::const_iterator iter, end; FWidget::Accelerators::const_iterator iter, end;
iter = widget->accelerator_list->begin(); iter = widget->accelerator_list->begin();
@ -1083,8 +1083,8 @@ void FApplication::getX11ButtonState (int button)
case button1_pressed: case button1_pressed:
case button1_pressed_move: case button1_pressed_move:
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& x11_button_state == all_buttons_released && x11_button_state == all_buttons_released
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) ) && ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
{ {
time_mousepressed.tv_sec = 0; time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0; time_mousepressed.tv_usec = 0;
@ -1190,20 +1190,20 @@ bool FApplication::parseX11Mouse()
if ( (x11_mouse[0] & key_ctrl) == key_ctrl ) if ( (x11_mouse[0] & key_ctrl) == key_ctrl )
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (x11_mouse[0] & button_mask) >= button1_pressed_move if ( (x11_mouse[0] & button_mask) >= button1_pressed_move
&& (x11_mouse[0] & button_mask) <= button3_pressed_move && (x11_mouse[0] & button_mask) <= button3_pressed_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
getX11ButtonState (x11_mouse[0] & button_mask); getX11ButtonState (x11_mouse[0] & button_mask);
if ( uChar(x11_mouse[1]) == mouse_position.getX() + 0x20 if ( uChar(x11_mouse[1]) == mouse_position.getX() + 0x20
&& uChar(x11_mouse[2]) == mouse_position.getY() + 0x20 && uChar(x11_mouse[2]) == mouse_position.getY() + 0x20
&& b_state.wheel_up != Pressed && b_state.wheel_up != Pressed
&& b_state.wheel_down != Pressed && b_state.wheel_down != Pressed
&& uChar(x11_mouse[0]) == x11_button_state ) && uChar(x11_mouse[0]) == x11_button_state )
{ {
return false; return false;
} }
@ -1285,9 +1285,9 @@ bool FApplication::parseSGRMouse()
if ( (button & key_ctrl) == key_ctrl ) if ( (button & key_ctrl) == key_ctrl )
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (button & button_mask) >= button1_move if ( (button & button_mask) >= button1_move
&& (button & button_mask) <= button3_move && (button & button_mask) <= button3_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
@ -1299,8 +1299,8 @@ bool FApplication::parseSGRMouse()
case button1: case button1:
case button1_move: case button1_move:
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& (((x11_button_state & 0x80) >> 2) + 'M') == released && (((x11_button_state & 0x80) >> 2) + 'M') == released
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) ) && ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
{ {
time_mousepressed.tv_sec = 0; time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0; time_mousepressed.tv_usec = 0;
@ -1483,9 +1483,9 @@ bool FApplication::parseUrxvtMouse()
if ( (button & key_ctrl) == key_ctrl ) if ( (button & key_ctrl) == key_ctrl )
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (button & button_mask) >= button1_pressed_move if ( (button & button_mask) >= button1_pressed_move
&& (button & button_mask) <= button3_pressed_move && (button & button_mask) <= button3_pressed_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
@ -1599,17 +1599,17 @@ void FApplication::processMouseEvent()
bool Event = false; bool Event = false;
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
if ( ! gpmMouseEvent if ( ! gpmMouseEvent
&& x11_mouse[0] == '\0' && x11_mouse[0] == '\0'
&& sgr_mouse[0] == '\0' && sgr_mouse[0] == '\0'
&& urxvt_mouse[0] == '\0' ) && urxvt_mouse[0] == '\0' )
{ {
return; return;
} }
#else #else
if ( x11_mouse[0] == '\0' if ( x11_mouse[0] == '\0'
&& sgr_mouse[0] == '\0' && sgr_mouse[0] == '\0'
&& urxvt_mouse[0] == '\0' ) && urxvt_mouse[0] == '\0' )
{ {
return; return;
} }
@ -1634,13 +1634,13 @@ void FApplication::processMouseEvent()
const FPoint& mouse_position = getMousePos(); const FPoint& mouse_position = getMousePos();
if ( ! clicked_widget if ( ! clicked_widget
&& ( b_state.left_button == Pressed && ( b_state.left_button == Pressed
|| b_state.left_button == DoubleClick || b_state.left_button == DoubleClick
|| b_state.right_button == Pressed || b_state.right_button == Pressed
|| b_state.middle_button == Pressed || b_state.middle_button == Pressed
|| b_state.wheel_up == Pressed || b_state.wheel_up == Pressed
|| b_state.wheel_down == Pressed ) ) || b_state.wheel_down == Pressed ) )
{ {
// determine the window object on the current click position // determine the window object on the current click position
FWidget* window = FWindow::getWindowWidgetAt (mouse_position); FWidget* window = FWindow::getWindowWidgetAt (mouse_position);
@ -1694,9 +1694,9 @@ void FApplication::processMouseEvent()
} }
// unselected menu bar item // unselected menu bar item
if ( ! open_menu && getMenuBar() if ( ! open_menu && getMenuBar()
&& getMenuBar()->hasSelectedItem() && getMenuBar()->hasSelectedItem()
&& ! b_state.mouse_moved ) && ! b_state.mouse_moved )
{ {
if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) ) if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) )
{ {
@ -1789,8 +1789,8 @@ void FApplication::processMouseEvent()
, fc::LeftButton | key_state ); , fc::LeftButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
clicked_widget = 0; clicked_widget = 0;
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
@ -1812,8 +1812,8 @@ void FApplication::processMouseEvent()
, fc::RightButton | key_state ); , fc::RightButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.left_button != Pressed if ( b_state.left_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
clicked_widget = 0; clicked_widget = 0;
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
@ -1839,8 +1839,8 @@ void FApplication::processMouseEvent()
, fc::MiddleButton | key_state ); , fc::MiddleButton | key_state );
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.left_button != Pressed ) && b_state.left_button != Pressed )
{ {
clicked_widget = 0; clicked_widget = 0;
} }
@ -1915,9 +1915,9 @@ int FApplication::processTimerEvent()
while ( iter != end ) while ( iter != end )
{ {
if ( ! (*iter).id if ( ! (*iter).id
|| ! (*iter).object || ! (*iter).object
|| currentTime < (*iter).timeout ) // no timer expired || currentTime < (*iter).timeout ) // no timer expired
break; break;
(*iter).timeout += (*iter).interval; (*iter).timeout += (*iter).interval;

View File

@ -197,8 +197,8 @@ bool FButton::setFlat (bool on)
bool FButton::setShadow (bool on) bool FButton::setShadow (bool on)
{ {
if ( on if ( on
&& (Encoding != fc::VT100 || isTeraTerm() ) && (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII ) && Encoding != fc::ASCII )
flags |= fc::shadow; flags |= fc::shadow;
else else
flags &= ~fc::shadow; flags &= ~fc::shadow;
@ -526,7 +526,6 @@ void FButton::draw()
is_Flat = isFlat(); is_Flat = isFlat();
is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow); is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow);
is_NoUnderline = ((flags & fc::no_underline) != 0); is_NoUnderline = ((flags & fc::no_underline) != 0);
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -610,9 +609,9 @@ void FButton::draw()
if ( is_Flat && ! button_down ) if ( is_Flat && ! button_down )
drawFlatBorder(); drawFlatBorder();
if ( ! button_down if ( ! button_down
&& ! isNewFont() && ! isNewFont()
&& (is_Flat || ! hasShadow() || isMonochron()) ) && (is_Flat || ! hasShadow() || isMonochron()) )
{ {
// clear the right █ from button down // clear the right █ from button down
if ( parent_widget ) if ( parent_widget )
@ -725,7 +724,6 @@ void FButton::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
delete[] ButtonText; delete[] ButtonText;
if ( is_Focus && getStatusBar() ) if ( is_Focus && getStatusBar() )

View File

@ -382,9 +382,9 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, void*)
while ( iter != end ) while ( iter != end )
{ {
if ( (*iter) != button if ( (*iter) != button
&& (*iter)->isChecked() && (*iter)->isChecked()
&& isRadioButton(*iter) ) && isRadioButton(*iter) )
{ {
(*iter)->unsetChecked(); (*iter)->unsetChecked();
@ -447,8 +447,6 @@ void FButtonGroup::setHotkeyAccelerator()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButtonGroup::draw() void FButtonGroup::draw()
{ {
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -461,8 +459,6 @@ void FButtonGroup::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -40,10 +40,8 @@ void FCheckBox::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FCheckBox::draw() void FCheckBox::draw()
{ {
updateVTerm(false);
drawCheckButton(); drawCheckButton();
drawLabel(); drawLabel();
updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
} }

View File

@ -279,9 +279,9 @@ void FDialog::setPos (int x, int y, bool)
// set the cursor to the focus widget // set the cursor to the focus widget
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus_widget = FWidget::getFocusWidget();
if ( focus_widget if ( focus_widget
&& focus_widget->isVisible() && focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() ) && focus_widget->hasVisibleCursor() )
{ {
FPoint cursor_pos = focus_widget->getCursorPos(); FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos); focus_widget->setCursorPos(cursor_pos);
@ -361,9 +361,9 @@ void FDialog::setSize (int w, int h, bool adjust)
// set the cursor to the focus widget // set the cursor to the focus widget
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus_widget = FWidget::getFocusWidget();
if ( focus_widget if ( focus_widget
&& focus_widget->isVisible() && focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() ) && focus_widget->hasVisibleCursor() )
{ {
FPoint cursor_pos = focus_widget->getCursorPos(); FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos); focus_widget->setCursorPos(cursor_pos);
@ -522,8 +522,8 @@ void FDialog::onKeyPress (FKeyEvent* ev)
if ( this == getMainWidget() ) if ( this == getMainWidget() )
return; return;
if ( ev->key() == fc::Fkey_escape if ( ev->key() == fc::Fkey_escape
|| ev->key() == fc::Fkey_escape_mintty ) || ev->key() == fc::Fkey_escape_mintty )
{ {
ev->accept(); ev->accept();
@ -574,7 +574,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
redraw(); redraw();
// click on titlebar menu button // click on titlebar menu button
if ( mouse_x < 4 && mouse_y == 1 ) if ( mouse_x < 4 && mouse_y == 1 )
openMenu(); openMenu();
else if ( mouse_x > getWidth()-zoom_btn && mouse_y == 1 ) else if ( mouse_x > getWidth()-zoom_btn && mouse_y == 1 )
{ {
@ -585,9 +585,9 @@ void FDialog::onMouseDown (FMouseEvent* ev)
// click on the lower right resize corner // click on the lower right resize corner
if ( isResizeable() if ( isResizeable()
&& ( (mouse_x == getWidth() && mouse_y == getHeight()) && ( (mouse_x == getWidth() && mouse_y == getHeight())
|| (mouse_x == getWidth()-1 && mouse_y == getHeight()) || (mouse_x == getWidth()-1 && mouse_y == getHeight())
|| (mouse_x == getWidth() && mouse_y == getHeight()-1) ) ) || (mouse_x == getWidth() && mouse_y == getHeight()-1) ) )
{ {
resize_click_pos = ev->getTermPos(); resize_click_pos = ev->getTermPos();
FPoint lower_right_pos = getTermGeometry().getLowerRightPos(); FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
@ -608,7 +608,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
else // ev->getButton() != fc::LeftButton else // ev->getButton() != fc::LeftButton
{ {
// click on titlebar menu button // click on titlebar menu button
if ( mouse_x < 4 && mouse_y == 1 && dialog_menu->isVisible() ) if ( mouse_x < 4 && mouse_y == 1 && dialog_menu->isVisible() )
leaveMenu(); // close menu leaveMenu(); // close menu
// cancel resize // cancel resize
@ -664,10 +664,10 @@ void FDialog::onMouseUp (FMouseEvent* ev)
int titlebar_x = titlebar_click_pos.getX(); int titlebar_x = titlebar_click_pos.getX();
int titlebar_y = titlebar_click_pos.getY(); int titlebar_y = titlebar_click_pos.getY();
if ( ! titlebar_click_pos.isNull() if ( ! titlebar_click_pos.isNull()
&& titlebar_x > getTermX() + 3 && titlebar_x > getTermX() + 3
&& titlebar_x < getTermX() + getWidth() && titlebar_x < getTermX() + getWidth()
&& titlebar_y == getTermY() ) && titlebar_y == getTermY() )
{ {
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos; FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
move (deltaPos); move (deltaPos);
@ -675,17 +675,17 @@ void FDialog::onMouseUp (FMouseEvent* ev)
} }
// click on titlebar menu button // click on titlebar menu button
if ( mouse_x < 4 if ( mouse_x < 4
&& mouse_y == 1 && mouse_y == 1
&& dialog_menu->isVisible() && dialog_menu->isVisible()
&& ! dialog_menu->hasSelectedItem() ) && ! dialog_menu->hasSelectedItem() )
{ {
// Sets focus to the first item // Sets focus to the first item
selectFirstMenuItem(); selectFirstMenuItem();
} }
else if ( mouse_x > getWidth() - zoom_btn else if ( mouse_x > getWidth() - zoom_btn
&& mouse_y == 1 && mouse_y == 1
&& zoom_button_pressed ) && zoom_button_pressed )
{ {
// zoom to maximum or restore the window size // zoom to maximum or restore the window size
zoomWindow(); zoomWindow();
@ -772,8 +772,8 @@ void FDialog::onMouseMove (FMouseEvent* ev)
// Mouse event handover to the menu // Mouse event handover to the menu
const FRect& menu_geometry = dialog_menu->getTermGeometry(); const FRect& menu_geometry = dialog_menu->getTermGeometry();
if ( dialog_menu->getCount() > 0 if ( dialog_menu->getCount() > 0
&& menu_geometry.contains(ev->getTermPos()) ) && menu_geometry.contains(ev->getTermPos()) )
{ {
const FPoint& g = ev->getTermPos(); const FPoint& g = ev->getTermPos();
const FPoint& p = dialog_menu->termToWidgetPos(g); const FPoint& p = dialog_menu->termToWidgetPos(g);
@ -795,7 +795,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
// resize the dialog // resize the dialog
if ( isResizeable() && ! resize_click_pos.isNull() if ( isResizeable() && ! resize_click_pos.isNull()
&& ev->getTermPos() != getTermGeometry().getLowerRightPos() ) && ev->getTermPos() != getTermGeometry().getLowerRightPos() )
{ {
FWidget* r = getRootWidget(); FWidget* r = getRootWidget();
resize_click_pos = ev->getTermPos(); resize_click_pos = ev->getTermPos();
@ -872,9 +872,9 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
close(); close();
} }
else if ( isResizeable() else if ( isResizeable()
&& mouse_x >= 4 && mouse_x >= 4
&& mouse_x <= getWidth() - zoom_btn && mouse_x <= getWidth() - zoom_btn
&& mouse_y == 1 ) && mouse_y == 1 )
{ {
// double click on titlebar // double click on titlebar
zoomWindow(); // window zoom/unzoom zoomWindow(); // window zoom/unzoom
@ -908,8 +908,8 @@ void FDialog::onWindowActive (FEvent*)
FWidget* win_focus = getWindowFocusWidget(); FWidget* win_focus = getWindowFocusWidget();
if ( win_focus if ( win_focus
&& win_focus->isVisible() && win_focus->isVisible()
&& win_focus->isShown() ) && win_focus->isShown() )
{ {
win_focus->setFocus(); win_focus->setFocus();
win_focus->redraw(); win_focus->redraw();
@ -1007,7 +1007,6 @@ void FDialog::draw()
tooltip = 0; tooltip = 0;
} }
updateVTerm(false);
// fill the background // fill the background
setColor(); setColor();
@ -1024,8 +1023,6 @@ void FDialog::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1138,7 +1135,7 @@ void FDialog::drawBorder()
int y2 = 1 + getHeight() - 1; int y2 = 1 + getHeight() - 1;
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull()) if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull())
&& ! isZoomed() ) && ! isZoomed() )
setColor (wc.dialog_resize_fg, getBackgroundColor()); setColor (wc.dialog_resize_fg, getBackgroundColor());
else else
setColor(); setColor();

View File

@ -260,10 +260,10 @@ int FFileDialog::readDir()
if ( next->d_name[0] == '.' && next->d_name[1] == '\0' ) if ( next->d_name[0] == '.' && next->d_name[1] == '\0' )
continue; continue;
if ( ! show_hidden if ( ! show_hidden
&& next->d_name[0] == '.' && next->d_name[0] == '.'
&& next->d_name[1] != '\0' && next->d_name[1] != '\0'
&& next->d_name[1] != '.' ) && next->d_name[1] != '.' )
{ {
continue; continue;
} }
@ -721,8 +721,8 @@ void FFileDialog::printPath (const FString& txt)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFileDialog::cb_processActivate (FWidget*, void*) void FFileDialog::cb_processActivate (FWidget*, void*)
{ {
if ( filename->getText().includes('*') if ( filename->getText().includes('*')
|| filename->getText().includes('?') ) || filename->getText().includes('?') )
{ {
setFilter(filename->getText()); setFilter(filename->getText());
readDir(); readDir();
@ -734,9 +734,9 @@ void FFileDialog::cb_processActivate (FWidget*, void*)
readDir(); readDir();
filebrowser->redraw(); filebrowser->redraw();
} }
else if ( filename->getText().trim() == FString("..") else if ( filename->getText().trim() == FString("..")
|| filename->getText().includes('/') || filename->getText().includes('/')
|| filename->getText().includes('~') ) || filename->getText().includes('~') )
{ {
changeDir(filename->getText().trim()); changeDir(filename->getText().trim());
} }

View File

@ -68,9 +68,9 @@ void FLabel::setAccelWidget (FWidget* widget)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLabel::setAlignment (uInt align) void FLabel::setAlignment (uInt align)
{ {
if ( align != fc::alignLeft if ( align != fc::alignLeft
&& align != fc::alignCenter && align != fc::alignCenter
&& align != fc::alignRight ) && align != fc::alignRight )
alignment = fc::alignLeft; alignment = fc::alignLeft;
else else
alignment = align; alignment = align;
@ -397,8 +397,8 @@ void FLabel::printLine ( wchar_t*& line
{ {
if ( ! std::iswprint(wint_t(line[z])) ) if ( ! std::iswprint(wint_t(line[z])) )
{ {
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2 if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|| int(line[z]) > fc::NF_check_mark ) ) || int(line[z]) > fc::NF_check_mark ) )
{ {
line[z] = L' '; line[z] = L' ';
} }
@ -452,8 +452,6 @@ void FLabel::draw()
if ( text.isNull() || text.isEmpty() ) if ( text.isNull() || text.isEmpty() )
return; return;
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
{ {
setReverse(true); setReverse(true);
@ -529,6 +527,4 @@ void FLabel::draw()
if ( hasEmphasis() ) if ( hasEmphasis() )
setBold(false); setBold(false);
} }
updateVTerm(true);
} }

View File

@ -136,9 +136,9 @@ bool FLineEdit::setFocus (bool on)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FLineEdit::setShadow (bool on) bool FLineEdit::setShadow (bool on)
{ {
if ( on if ( on
&& (Encoding != fc::VT100 || isTeraTerm() ) && (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII ) && Encoding != fc::ASCII )
flags |= fc::shadow; flags |= fc::shadow;
else else
flags &= ~fc::shadow; flags &= ~fc::shadow;
@ -373,9 +373,9 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
} }
// end of switch // end of switch
if ( ev->isAccepted() if ( ev->isAccepted()
&& key != fc::Fkey_return && key != fc::Fkey_return
&& key != fc::Fkey_enter ) && key != fc::Fkey_enter )
{ {
drawInputField(); drawInputField();
updateTerminal(); updateTerminal();
@ -654,8 +654,8 @@ void FLineEdit::adjustLabel()
if ( hasHotkey() ) if ( hasHotkey() )
label_length--; label_length--;
assert ( label_orientation == label_above assert ( label_orientation == label_above
|| label_orientation == label_left ); || label_orientation == label_left );
switch ( label_orientation ) switch ( label_orientation )
{ {
@ -748,8 +748,6 @@ void FLineEdit::drawInputField()
int active_focus = fc::active + fc::focus; int active_focus = fc::active + fc::focus;
isActiveFocus = ((flags & active_focus) == active_focus); isActiveFocus = ((flags & active_focus) == active_focus);
isShadow = ((flags & fc::shadow) != 0 ); isShadow = ((flags & fc::shadow) != 0 );
updateVTerm(false);
setPrintPos (1, 1); setPrintPos (1, 1);
if ( isMonochron() ) if ( isMonochron() )
@ -807,8 +805,6 @@ void FLineEdit::drawInputField()
// set the cursor to the first pos. // set the cursor to the first pos.
setCursorPos (2+cursor_pos-text_offset, 1); setCursorPos (2+cursor_pos-text_offset, 1);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -537,9 +537,9 @@ void FListBox::onKeyPress (FKeyEvent* ev)
for (uInt i=0; i < end; i++) for (uInt i=0; i < end; i++)
{ {
if ( ! inc_found if ( ! inc_found
&& inc_search.toLower() && inc_search.toLower()
== data[i].getText().left(inc_len+1).toLower() ) == data[i].getText().left(inc_len+1).toLower() )
{ {
setCurrentItem(int(i+1)); setCurrentItem(int(i+1));
inc_found = true; inc_found = true;
@ -624,9 +624,9 @@ void FListBox::onKeyPress (FKeyEvent* ev)
for (uInt i=0; i < end; i++) for (uInt i=0; i < end; i++)
{ {
if ( ! inc_found if ( ! inc_found
&& inc_search.toLower() && inc_search.toLower()
== data[i].getText().left(inc_len).toLower() ) == data[i].getText().left(inc_len).toLower() )
{ {
setCurrentItem(int(i+1)); setCurrentItem(int(i+1));
inc_found = true; inc_found = true;
@ -683,8 +683,8 @@ void FListBox::onMouseDown (FMouseEvent* ev)
{ {
int yoffset_before, mouse_x, mouse_y; int yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
@ -710,8 +710,8 @@ void FListBox::onMouseDown (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
current = yoffset + mouse_y - 1; current = yoffset + mouse_y - 1;
@ -768,8 +768,8 @@ void FListBox::onMouseUp (FMouseEvent* ev)
int mouse_x = ev->getX(); int mouse_x = ev->getX();
int mouse_y = ev->getY(); int mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
processChanged(); processChanged();
@ -784,8 +784,8 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
int current_before, yoffset_before, mouse_x, mouse_y; int current_before, yoffset_before, mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
@ -798,8 +798,8 @@ void FListBox::onMouseMove (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
current = yoffset + mouse_y - 1; current = yoffset + mouse_y - 1;
@ -809,9 +809,9 @@ void FListBox::onMouseMove (FMouseEvent* ev)
inc_search.clear(); inc_search.clear();
// handle multiple selections // handle multiple selections
if ( ev->getButton() == fc::RightButton if ( ev->getButton() == fc::RightButton
&& isMultiSelection() && isMultiSelection()
&& current_before != current ) && current_before != current )
{ {
int from, to; int from, to;
@ -859,7 +859,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
// drag up // drag up
if ( drag_scroll != FListBox::noScroll if ( drag_scroll != FListBox::noScroll
&& scroll_distance < getHeight()-2 ) && scroll_distance < getHeight()-2 )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current > 1 ) if ( ! scroll_timer && current > 1 )
@ -883,7 +883,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
// drag down // drag down
if ( drag_scroll != FListBox::noScroll if ( drag_scroll != FListBox::noScroll
&& scroll_distance < getHeight()-2 ) && scroll_distance < getHeight()-2 )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current < int(getCount()) ) if ( ! scroll_timer && current < int(getCount()) )
@ -924,8 +924,8 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
if ( yoffset + mouse_y - 1 > int(getCount()) ) if ( yoffset + mouse_y - 1 > int(getCount()) )
return; return;
@ -1242,8 +1242,8 @@ void FListBox::cb_VBarChange (FWidget*, void*)
if ( isVisible() ) if ( isVisible() )
drawList(); drawList();
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward ) && scrollType <= FScrollbar::scrollPageForward )
{ {
vbar->setValue (yoffset); vbar->setValue (yoffset);
@ -1340,8 +1340,8 @@ void FListBox::cb_HBarChange (FWidget*, void*)
flush_out(); flush_out();
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown ) && scrollType <= FScrollbar::scrollWheelDown )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);
@ -1453,7 +1453,6 @@ void FListBox::draw()
if ( current < 1 ) if ( current < 1 )
current = 1; current = 1;
updateVTerm(false);
setColor(); setColor();
if ( isMonochron() ) if ( isMonochron() )
@ -1480,8 +1479,6 @@ void FListBox::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
if ( vbar->isVisible() ) if ( vbar->isVisible() )
vbar->redraw(); vbar->redraw();
@ -1550,9 +1547,9 @@ void FListBox::drawList()
if ( end > getCount() ) if ( end > getCount() )
end = getCount(); end = getCount();
if ( last_yoffset >= 0 if ( last_yoffset >= 0
&& last_yoffset == yoffset && last_yoffset == yoffset
&& last_current != current ) && last_current != current )
{ {
// speed up: redraw only the changed rows // speed up: redraw only the changed rows
uInt last_pos = uInt(current - yoffset) - 1; uInt last_pos = uInt(current - yoffset) - 1;
@ -1561,8 +1558,6 @@ void FListBox::drawList()
end = std::max(last_pos, current_pos)+1; end = std::max(last_pos, current_pos)+1;
} }
updateVTerm(false);
for (uInt y=start; y < end; y++) for (uInt y=start; y < end; y++)
{ {
setPrintPos (2, 2 + int(y)); setPrintPos (2, 2 + int(y));
@ -1784,7 +1779,6 @@ void FListBox::drawList()
setReverse(false); setReverse(false);
unsetBold(); unsetBold();
updateVTerm(true);
last_yoffset = yoffset; last_yoffset = yoffset;
last_current = current; last_current = current;
} }

View File

@ -329,17 +329,17 @@ void FMenu::onMouseDown (FMouseEvent* ev)
mouse_x = mouse_pos.getX(); mouse_x = mouse_pos.getX();
mouse_y = mouse_pos.getY(); mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( hasSelectedItem() ) if ( hasSelectedItem() )
{ {
FMenuItem* sel_item = getSelectedItem(); FMenuItem* sel_item = getSelectedItem();
if ( sel_item if ( sel_item
&& sel_item->hasMenu() && sel_item->hasMenu()
&& sel_item->getMenu() == open_sub_menu ) && sel_item->getMenu() == open_sub_menu )
{ {
if ( sel_item != *iter ) if ( sel_item != *iter )
hideSubMenus(); hideSubMenus();
@ -437,9 +437,9 @@ void FMenu::onMouseUp (FMouseEvent* ev)
int mouse_x = mouse_pos.getX(); int mouse_x = mouse_pos.getX();
int mouse_y = mouse_pos.getY(); int mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( (*iter)->hasMenu() ) if ( (*iter)->hasMenu() )
@ -531,9 +531,9 @@ void FMenu::onMouseMove (FMouseEvent* ev)
mouse_over_supermenu = true; mouse_over_supermenu = true;
} }
if ( getMenuBar() if ( getMenuBar()
&& isMenuBar(getMenuBar()) && isMenuBar(getMenuBar())
&& getMenuBar()->getTermGeometry().contains(ev->getTermPos()) ) && getMenuBar()->getTermGeometry().contains(ev->getTermPos()) )
{ {
mouse_over_menubar = true; mouse_over_menubar = true;
} }
@ -547,13 +547,13 @@ void FMenu::onMouseMove (FMouseEvent* ev)
mouse_x = mouse_pos.getX(); mouse_x = mouse_pos.getX();
mouse_y = mouse_pos.getY(); mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
if ( (*iter)->isEnabled() if ( (*iter)->isEnabled()
&& ! (*iter)->isSelected() && ! (*iter)->isSelected()
&& ! (*iter)->isSeparator() ) && ! (*iter)->isSeparator() )
{ {
// Mouse pointer over item // Mouse pointer over item
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
@ -586,9 +586,9 @@ void FMenu::onMouseMove (FMouseEvent* ev)
else else
{ {
if ( mouse_over_menu if ( mouse_over_menu
&& (*iter)->isEnabled() && (*iter)->isEnabled()
&& (*iter)->isSelected() && (*iter)->isSelected()
&& ! mouse_over_submenu ) && ! mouse_over_submenu )
{ {
// Unselect selected item without mouse focus // Unselect selected item without mouse focus
(*iter)->unsetSelected(); (*iter)->unsetSelected();
@ -717,9 +717,9 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, void*)
while ( iter != end ) while ( iter != end )
{ {
if ( (*iter) != menuitem if ( (*iter) != menuitem
&& (*iter)->isChecked() && (*iter)->isChecked()
&& isRadioMenuItem(*iter) ) && isRadioMenuItem(*iter) )
{ {
(*iter)->unsetChecked(); (*iter)->unsetChecked();
} }
@ -1218,7 +1218,6 @@ void FMenu::draw()
{ {
// fill the background // fill the background
setColor (wc.menu_active_fg, wc.menu_active_bg); setColor (wc.menu_active_fg, wc.menu_active_bg);
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -1230,8 +1229,6 @@ void FMenu::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1381,9 +1378,9 @@ void FMenu::drawItems()
if ( ! std::iswprint(wint_t(item_text[z])) ) if ( ! std::iswprint(wint_t(item_text[z])) )
{ {
if ( ! isNewFont() if ( ! isNewFont()
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2 && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark ) || int(item_text[z]) > fc::NF_check_mark )
&& ! charEncodable(uInt(item_text[z])) ) && ! charEncodable(uInt(item_text[z])) )
{ {
item_text[z] = L' '; item_text[z] = L' ';
} }

View File

@ -532,10 +532,10 @@ bool FMenuBar::selectNextItem()
next_element = item_list.begin(); next_element = item_list.begin();
next = static_cast<FMenuItem*>(*next_element); next = static_cast<FMenuItem*>(*next_element);
} while ( ! next->isEnabled() } while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isSeparator() ); || next->isSeparator() );
if ( next == *iter ) if ( next == *iter )
return false; return false;
@ -599,10 +599,10 @@ bool FMenuBar::selectPrevItem()
--prev_element; --prev_element;
prev = static_cast<FMenuItem*>(*prev_element); prev = static_cast<FMenuItem*>(*prev_element);
} }
while ( ! prev->isEnabled() while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isSeparator() ); || prev->isSeparator() );
if ( prev == *iter ) if ( prev == *iter )
return false; return false;
@ -744,7 +744,6 @@ void FMenuBar::drawItems()
if ( item_list.empty() ) if ( item_list.empty() )
return; return;
updateVTerm(false);
setPrintPos (1,1); setPrintPos (1,1);
if ( isMonochron() ) if ( isMonochron() )
@ -826,8 +825,9 @@ void FMenuBar::drawItems()
if ( ! std::iswprint(wint_t(item_text[z])) ) if ( ! std::iswprint(wint_t(item_text[z])) )
{ {
if ( ! isNewFont() && ( int(item_text[z]) < fc::NF_rev_left_arrow2 if ( ! isNewFont()
|| int(item_text[z]) > fc::NF_check_mark ) ) && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark ) )
{ {
item_text[z] = L' '; item_text[z] = L' ';
} }
@ -885,8 +885,6 @@ void FMenuBar::drawItems()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -328,9 +328,9 @@ void FMenuItem::delAccelerator (FWidget* obj)
{ {
FWidget* root = getRootWidget(); FWidget* root = getRootWidget();
if ( root if ( root
&& root->accelerator_list && root->accelerator_list
&& ! root->accelerator_list->empty() ) && ! root->accelerator_list->empty() )
{ {
FWidget::Accelerators::iterator iter; FWidget::Accelerators::iterator iter;
iter = root->accelerator_list->begin(); iter = root->accelerator_list->begin();

View File

@ -421,7 +421,6 @@ void FMessageBox::draw()
int head_offset = 0; int head_offset = 0;
int center_x = 0; int center_x = 0;
int msg_x = int((getWidth() - int(max_line_width)) / 2); // center the whole block int msg_x = int((getWidth() - int(max_line_width)) / 2); // center the whole block
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -454,8 +453,6 @@ void FMessageBox::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -1179,9 +1179,9 @@ inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next)
{ {
if ( term && next ) if ( term && next )
{ {
return bool ( fake_reverse return bool ( fake_reverse
|| term->fg_color != next->fg_color || term->fg_color != next->fg_color
|| term->bg_color != next->bg_color ); || term->bg_color != next->bg_color );
} }
return false; return false;
@ -1315,8 +1315,8 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
{ {
if ( ansi_default_color ) if ( ansi_default_color )
{ {
if ( fg == Default && term->fg_color != Default if ( fg == Default && term->fg_color != Default
&& bg == Default && term->bg_color != Default ) && bg == Default && term->bg_color != Default )
{ {
setTermDefaultColor(term); setTermDefaultColor(term);
} }

View File

@ -55,6 +55,9 @@ class FOptiAttr
uChar transparent : 1; // transparent uChar transparent : 1; // transparent
uChar trans_shadow : 1; // transparent shadow uChar trans_shadow : 1; // transparent shadow
uChar inherit_bg : 1; // inherit background uChar inherit_bg : 1; // inherit background
uChar no_changes : 1; // no changes required
uChar restored : 1; // restored VTerm character
uChar : 6; // padding bits
} char_data; } char_data;
// Constructor // Constructor

View File

@ -404,9 +404,9 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
std::strncpy (move_ptr, move_xy, sizeof(move_buf) - 1); std::strncpy (move_ptr, move_xy, sizeof(move_buf) - 1);
move_time = F_cursor_address.duration; move_time = F_cursor_address.duration;
if ( xold < 0 if ( xold < 0
|| yold < 0 || yold < 0
|| isWideMove (xold, yold, xnew, ynew) ) || isWideMove (xold, yold, xnew, ynew) )
{ {
return ( move_time < LONG_DURATION ) ? move_buf : 0; return ( move_time < LONG_DURATION ) ? move_buf : 0;
} }
@ -429,8 +429,8 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
{ {
new_time = relativeMove (null_ptr, 0, yold, xnew, ynew); new_time = relativeMove (null_ptr, 0, yold, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_carriage_return.duration + new_time < move_time ) && F_carriage_return.duration + new_time < move_time )
{ {
method = 2; method = 2;
move_time = F_carriage_return.duration + new_time; move_time = F_carriage_return.duration + new_time;
@ -442,8 +442,8 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
{ {
new_time = relativeMove (null_ptr, 0, 0, xnew, ynew); new_time = relativeMove (null_ptr, 0, 0, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_cursor_home.duration + new_time < move_time ) && F_cursor_home.duration + new_time < move_time )
{ {
method = 3; method = 3;
move_time = F_cursor_home.duration + new_time; move_time = F_cursor_home.duration + new_time;
@ -455,8 +455,8 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
{ {
new_time = relativeMove (null_ptr, 0, screen_height-1, xnew, ynew); new_time = relativeMove (null_ptr, 0, screen_height-1, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_cursor_to_ll.duration + new_time < move_time ) && F_cursor_to_ll.duration + new_time < move_time )
{ {
method = 4; method = 4;
move_time = F_cursor_to_ll.duration + new_time; move_time = F_cursor_to_ll.duration + new_time;
@ -464,17 +464,17 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
} }
// Method 5: left margin for wrap to right-hand side // Method 5: left margin for wrap to right-hand side
if ( automatic_left_margin if ( automatic_left_margin
&& ! eat_nl_glitch && ! eat_nl_glitch
&& yold > 0 && yold > 0
&& F_cursor_left.cap ) && F_cursor_left.cap )
{ {
new_time = relativeMove (null_ptr, screen_width-1, yold-1, xnew, ynew); new_time = relativeMove (null_ptr, screen_width-1, yold-1, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_carriage_return.cap && F_carriage_return.cap
&& F_carriage_return.duration && F_carriage_return.duration
+ F_cursor_left.duration + new_time < move_time ) + F_cursor_left.duration + new_time < move_time )
{ {
method = 5; method = 5;
move_time = F_carriage_return.duration move_time = F_carriage_return.duration
@ -861,7 +861,7 @@ int FOptiMove::relativeMove ( char*& move
inline bool FOptiMove::isWideMove ( int xold, int yold inline bool FOptiMove::isWideMove ( int xold, int yold
, int xnew, int ynew ) , int xnew, int ynew )
{ {
return bool ( (xnew > MOVE_LIMIT) return bool ( (xnew > MOVE_LIMIT)
&& (xnew < screen_width - 1 - MOVE_LIMIT) && (xnew < screen_width - 1 - MOVE_LIMIT)
&& (std::abs(xnew-xold) + std::abs(ynew-yold) > MOVE_LIMIT) ); && (std::abs(xnew-xold) + std::abs(ynew-yold) > MOVE_LIMIT) );
} }

View File

@ -37,15 +37,12 @@ void FProgressbar::setPercentage (int percentage_value)
else else
percentage = percentage_value; percentage = percentage_value;
updateVTerm(false);
if ( isVisible() ) if ( isVisible() )
{ {
drawPercentage(); drawPercentage();
drawBar(); drawBar();
} }
updateVTerm(true);
updateTerminal(); updateTerminal();
} }
@ -72,9 +69,9 @@ bool FProgressbar::setEnable (bool on)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FProgressbar::setShadow (bool on) bool FProgressbar::setShadow (bool on)
{ {
if ( on if ( on
&& (Encoding != fc::VT100 || isTeraTerm() ) && (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII ) && Encoding != fc::ASCII )
flags |= fc::shadow; flags |= fc::shadow;
else else
flags &= ~fc::shadow; flags &= ~fc::shadow;
@ -128,7 +125,6 @@ void FProgressbar::hide()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::reset() void FProgressbar::reset()
{ {
updateVTerm(false);
percentage = -1; percentage = -1;
if ( isVisible() ) if ( isVisible() )
@ -137,7 +133,6 @@ void FProgressbar::reset()
drawBar(); drawBar();
} }
updateVTerm(true);
updateTerminal(); updateTerminal();
} }
@ -146,14 +141,12 @@ void FProgressbar::reset()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::draw() void FProgressbar::draw()
{ {
updateVTerm(false);
drawPercentage(); drawPercentage();
drawBar(); drawBar();
if ( (flags & fc::shadow) != 0 ) if ( (flags & fc::shadow) != 0 )
drawShadow (); drawShadow ();
updateVTerm(true);
flush_out(); flush_out();
} }
@ -202,9 +195,9 @@ void FProgressbar::drawBar()
if ( percentage > 0.0f && trunc(length) < bar_length ) if ( percentage > 0.0f && trunc(length) < bar_length )
{ {
if ( round(length) > trunc(length) if ( round(length) > trunc(length)
|| isCygwinTerminal() || isCygwinTerminal()
|| getMaxColor() < 16 ) || getMaxColor() < 16 )
{ {
if ( isMonochron() ) if ( isMonochron() )
{ {

View File

@ -41,10 +41,8 @@ void FRadioButton::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FRadioButton::draw() void FRadioButton::draw()
{ {
updateVTerm(false);
drawRadioButton(); drawRadioButton();
drawLabel(); drawLabel();
updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
} }

View File

@ -180,8 +180,8 @@ bool FRect::contains (const FRect& r) const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FRect::overlap (const FRect &r) const bool FRect::overlap (const FRect &r) const
{ {
return ( std::max(X1, r.X1) <= std::min(X2, r.X2) return ( std::max(X1, r.X1) <= std::min(X2, r.X2)
&& std::max(Y1, r.Y1) <= std::min(Y2, r.Y2) ); && std::max(Y1, r.Y1) <= std::min(Y2, r.Y2) );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -289,7 +289,6 @@ void FScrollbar::drawBar()
if ( slider_pos != current_slider_pos ) if ( slider_pos != current_slider_pos )
{ {
int z; int z;
updateVTerm(false);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
@ -392,8 +391,6 @@ void FScrollbar::drawBar()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
} }
@ -402,8 +399,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
{ {
int mouse_x, mouse_y; int mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
if ( min == max ) if ( min == max )
@ -443,8 +440,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
if ( slider_click_pos > 0 ) if ( slider_click_pos > 0 )
scroll_type = FScrollbar::scrollJump; scroll_type = FScrollbar::scrollJump;
if ( scroll_type == FScrollbar::scrollPageBackward if ( scroll_type == FScrollbar::scrollPageBackward
|| scroll_type == FScrollbar::scrollPageForward ) || scroll_type == FScrollbar::scrollPageForward )
{ {
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
slider_click_stop_pos = mouse_y - 2; slider_click_stop_pos = mouse_y - 2;
@ -457,8 +454,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
else else
slider_click_stop_pos = -1; slider_click_stop_pos = -1;
if ( scroll_type >= FScrollbar::scrollStepBackward if ( scroll_type >= FScrollbar::scrollStepBackward
&& scroll_type <= FScrollbar::scrollPageForward ) && scroll_type <= FScrollbar::scrollPageForward )
{ {
processScroll(); processScroll();
threshold_reached = false; threshold_reached = false;
@ -469,8 +466,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::onMouseUp (FMouseEvent* ev) void FScrollbar::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
slider_click_pos = -1; slider_click_pos = -1;
@ -487,8 +484,8 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
{ {
int mouse_x, mouse_y, new_scroll_type; int mouse_x, mouse_y, new_scroll_type;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
mouse_x = ev->getX(); mouse_x = ev->getX();
@ -531,8 +528,8 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
} }
} }
if ( mouse_x < 1 || mouse_x > getWidth() if ( mouse_x < 1 || mouse_x > getWidth()
|| mouse_y < 1 || mouse_y > getHeight() ) || mouse_y < 1 || mouse_y > getHeight() )
{ {
delOwnTimer(); delOwnTimer();
} }
@ -579,10 +576,10 @@ void FScrollbar::onTimer (FTimerEvent*)
addTimer(repeat_time); addTimer(repeat_time);
} }
if ( ( scroll_type == FScrollbar::scrollPageBackward if ( ( scroll_type == FScrollbar::scrollPageBackward
&& slider_pos < slider_click_stop_pos ) && slider_pos < slider_click_stop_pos )
|| ( scroll_type == FScrollbar::scrollPageForward || ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos+slider_length > slider_click_stop_pos ) ) && slider_pos+slider_length > slider_click_stop_pos ) )
{ {
delOwnTimer(); delOwnTimer();
return; return;
@ -604,11 +601,9 @@ void FScrollbar::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollbar::draw() void FScrollbar::draw()
{ {
updateVTerm(false);
drawButtons(); drawButtons();
current_slider_pos = -1; current_slider_pos = -1;
drawBar(); drawBar();
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -259,7 +259,6 @@ void FStatusBar::drawMessage()
if ( isLastActiveFocus ) if ( isLastActiveFocus )
space_offset = 0; space_offset = 0;
updateVTerm(false);
setColor (wc.statusbar_fg, wc.statusbar_bg); setColor (wc.statusbar_fg, wc.statusbar_bg);
setPrintPos (x, 1); setPrintPos (x, 1);
@ -301,8 +300,6 @@ void FStatusBar::drawMessage()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -416,10 +413,10 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x <= x2 && mouse_x <= x2
&& mouse_y == 1 && mouse_y == 1
&& ! (*iter)->hasMouseFocus() ) && ! (*iter)->hasMouseFocus() )
{ {
(*iter)->setMouseFocus(); (*iter)->setMouseFocus();
redraw(); redraw();
@ -508,9 +505,9 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
mouse_x = ev->getX(); mouse_x = ev->getX();
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x <= x2 && mouse_x <= x2
&& mouse_y == 1 ) && mouse_y == 1 )
{ {
if ( ! (*iter)->hasMouseFocus() ) if ( ! (*iter)->hasMouseFocus() )
{ {
@ -604,7 +601,6 @@ void FStatusBar::drawKeys()
return; return;
} }
updateVTerm(false);
setPrintPos (1, 1); setPrintPos (1, 1);
if ( isMonochron() ) if ( isMonochron() )
@ -678,10 +674,10 @@ void FStatusBar::drawKeys()
print (".."); print ("..");
} }
if ( iter+1 != key_list.end() if ( iter+1 != key_list.end()
&& ( (*(iter+1))->isActivated() || (*(iter+1))->hasMouseFocus() ) && ( (*(iter+1))->isActivated() || (*(iter+1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter+1))->getKey()).getLength()) + 3 && x + int(getKeyName((*(iter+1))->getKey()).getLength()) + 3
< screenWidth ) < screenWidth )
{ {
// next element is active // next element is active
if ( isMonochron() ) if ( isMonochron() )
@ -721,6 +717,5 @@ void FStatusBar::drawKeys()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
x_msg = x; x_msg = x;
} }

View File

@ -694,8 +694,8 @@ long FString::toLong() const
{ {
register uChar d = uChar((*p) - L'0'); register uChar d = uChar((*p) - L'0');
if ( num > tenth_limit if ( num > tenth_limit
|| (num == tenth_limit && d > tenth_limit_digit) ) || (num == tenth_limit && d > tenth_limit_digit) )
{ {
throw std::overflow_error ("overflow"); throw std::overflow_error ("overflow");
} }
@ -740,8 +740,8 @@ uLong FString::toULong() const
{ {
register uChar d = uChar((*p) - L'0'); register uChar d = uChar((*p) - L'0');
if ( num > tenth_limit if ( num > tenth_limit
|| (num == tenth_limit && d > tenth_limit_digit) ) || (num == tenth_limit && d > tenth_limit_digit) )
{ {
throw std::overflow_error ("overflow"); throw std::overflow_error ("overflow");
} }

View File

@ -97,10 +97,8 @@ void FSwitch::onMouseUp (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FSwitch::draw() void FSwitch::draw()
{ {
updateVTerm(false);
drawLabel(); drawLabel();
drawCheckButton(); drawCheckButton();
updateVTerm(true);
FToggleButton::draw(); FToggleButton::draw();
updateTerminal(); updateTerminal();
flush_out(); flush_out();

View File

@ -389,14 +389,14 @@ int FTerm::parseKeyString ( char buffer[]
return fc::Fkey_mouse; return fc::Fkey_mouse;
// SGR mouse tracking // SGR mouse tracking
if ( buffer[1] == '[' && buffer[2] == '<' && buf_len >= 9 if ( buffer[1] == '[' && buffer[2] == '<' && buf_len >= 9
&& (buffer[buf_len-1] == 'M' || buffer[buf_len-1] == 'm') ) && (buffer[buf_len-1] == 'M' || buffer[buf_len-1] == 'm') )
return fc::Fkey_extended_mouse; return fc::Fkey_extended_mouse;
// urxvt mouse tracking // urxvt mouse tracking
if ( buffer[1] == '[' && buffer[2] >= '1' && buffer[2] <= '9' if ( buffer[1] == '[' && buffer[2] >= '1' && buffer[2] <= '9'
&& buffer[3] >= '0' && buffer[3] <= '9' && buf_len >= 9 && buffer[3] >= '0' && buffer[3] <= '9' && buf_len >= 9
&& buffer[buf_len-1] == 'M' ) && buffer[buf_len-1] == 'M' )
return fc::Fkey_urxvt_mouse; return fc::Fkey_urxvt_mouse;
// look for termcap keys // look for termcap keys
@ -428,9 +428,9 @@ int FTerm::parseKeyString ( char buffer[]
if ( std::strncmp(kmeta, buffer, uInt(len)) == 0 ) // found if ( std::strncmp(kmeta, buffer, uInt(len)) == 0 ) // found
{ {
if ( len == 2 && ( buffer[1] == 'O' if ( len == 2 && ( buffer[1] == 'O'
|| buffer[1] == '[' || buffer[1] == '['
|| buffer[1] == ']') ) || buffer[1] == ']' ) )
{ {
if ( ! isKeyTimeout(time_keypressed, key_timeout) ) if ( ! isKeyTimeout(time_keypressed, key_timeout) )
return NEED_MORE_DATA; return NEED_MORE_DATA;
@ -504,11 +504,11 @@ bool FTerm::setVGAFont()
return VGAFont; return VGAFont;
if ( gnome_terminal if ( gnome_terminal
|| kde_konsole || kde_konsole
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| cygwin_terminal || cygwin_terminal
|| mintty_terminal ) || mintty_terminal )
return false; return false;
VGAFont = true; VGAFont = true;
@ -574,15 +574,15 @@ bool FTerm::setNewFont()
return true; return true;
if ( gnome_terminal if ( gnome_terminal
|| kde_konsole || kde_konsole
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| cygwin_terminal || cygwin_terminal
|| mintty_terminal ) || mintty_terminal )
return false; return false;
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
NewFont = true; NewFont = true;
// Set font in xterm to 8x16graph // Set font in xterm to 8x16graph
@ -649,7 +649,7 @@ bool FTerm::setOldFont()
VGAFont = false; VGAFont = false;
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
if ( xterm_font && xterm_font->getLength() > 2 ) if ( xterm_font && xterm_font->getLength() > 2 )
{ {
@ -932,7 +932,8 @@ const FString FTerm::getXTermColorName (int color)
void FTerm::setXTermCursorStyle (fc::xtermCursorStyle style) void FTerm::setXTermCursorStyle (fc::xtermCursorStyle style)
{ {
// Set the xterm cursor style // Set the xterm cursor style
if ( (xterm_terminal || mintty_terminal) && ! (gnome_terminal || kde_konsole) ) if ( (xterm_terminal || mintty_terminal)
&& ! (gnome_terminal || kde_konsole) )
{ {
putstringf (CSI "%d q", style); putstringf (CSI "%d q", style);
std::fflush(stdout); std::fflush(stdout);
@ -944,8 +945,8 @@ void FTerm::setXTermTitle (const FString& title)
{ {
// Set the xterm title // Set the xterm title
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || putty_terminal || mintty_terminal || putty_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "0;%s" BEL, title.c_str()); putstringf (OSC "0;%s" BEL, title.c_str());
@ -959,8 +960,8 @@ void FTerm::setXTermForeground (const FString& fg)
{ {
// Set the VT100 text foreground color // Set the VT100 text foreground color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || mlterm_terminal || mintty_terminal || mlterm_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "10;%s" BEL, fg.c_str()); putstringf (OSC "10;%s" BEL, fg.c_str());
@ -974,8 +975,8 @@ void FTerm::setXTermBackground (const FString& bg)
{ {
// Set the VT100 text background color // Set the VT100 text background color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || mlterm_terminal || mintty_terminal || mlterm_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "11;%s" BEL, bg.c_str()); putstringf (OSC "11;%s" BEL, bg.c_str());
@ -989,8 +990,8 @@ void FTerm::setXTermCursorColor (const FString& cc)
{ {
// Set the text cursor color // Set the text cursor color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || urxvt_terminal || mintty_terminal || urxvt_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "12;%s" BEL, cc.c_str()); putstringf (OSC "12;%s" BEL, cc.c_str());
@ -1004,7 +1005,7 @@ void FTerm::setXTermMouseForeground (const FString& mfg)
{ {
// Set the mouse foreground color // Set the mouse foreground color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "13;%s" BEL, mfg.c_str()); putstringf (OSC "13;%s" BEL, mfg.c_str());
@ -1031,7 +1032,7 @@ void FTerm::setXTermHighlightBackground (const FString& hbg)
{ {
// Set the highlight background color // Set the highlight background color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "17;%s" BEL, hbg.c_str()); putstringf (OSC "17;%s" BEL, hbg.c_str());
@ -1050,7 +1051,7 @@ void FTerm::setXTermDefaults()
setXTermCursorColor("rgb:ffff/ffff/ffff"); setXTermCursorColor("rgb:ffff/ffff/ffff");
if ( xterm_default_colors if ( xterm_default_colors
&& ! (mintty_terminal || rxvt_terminal || screen_terminal) ) && ! (mintty_terminal || rxvt_terminal || screen_terminal) )
{ {
// mintty and rxvt can't reset these settings // mintty and rxvt can't reset these settings
setXTermBackground("rgb:8080/a4a4/ecec"); setXTermBackground("rgb:8080/a4a4/ecec");
@ -1142,7 +1143,7 @@ void FTerm::resetXTermHighlightBackground()
{ {
// Reset the highlight background color // Reset the highlight background color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "117" BEL); putstringf (OSC "117" BEL);
@ -1305,10 +1306,10 @@ void FTerm::setEncoding (std::string enc)
Encoding = it->second; Encoding = it->second;
assert ( Encoding == fc::UTF8 assert ( Encoding == fc::UTF8
|| Encoding == fc::VT100 || Encoding == fc::VT100
|| Encoding == fc::PC || Encoding == fc::PC
|| Encoding == fc::ASCII ); || Encoding == fc::ASCII );
// set the new Fputchar function pointer // set the new Fputchar function pointer
switch ( int(Encoding) ) switch ( int(Encoding) )
@ -1564,9 +1565,9 @@ void FTerm::init_consoleCharMap()
c2 = fc::LowerHalfBlock; c2 = fc::LowerHalfBlock;
c3 = fc::FullBlock; c3 = fc::FullBlock;
if ( charEncode(c1, fc::PC) == charEncode(c1, fc::ASCII) if ( charEncode(c1, fc::PC) == charEncode(c1, fc::ASCII)
|| charEncode(c2, fc::PC) == charEncode(c2, fc::ASCII) || charEncode(c2, fc::PC) == charEncode(c2, fc::ASCII)
|| charEncode(c3, fc::PC) == charEncode(c3, fc::ASCII) ) || charEncode(c3, fc::PC) == charEncode(c3, fc::ASCII) )
{ {
no_shadow_character = true; no_shadow_character = true;
} }
@ -1574,8 +1575,8 @@ void FTerm::init_consoleCharMap()
c4 = fc::RightHalfBlock; c4 = fc::RightHalfBlock;
c5 = fc::LeftHalfBlock; c5 = fc::LeftHalfBlock;
if ( charEncode(c4, fc::PC) == charEncode(c4, fc::ASCII) if ( charEncode(c4, fc::PC) == charEncode(c4, fc::ASCII)
|| charEncode(c5, fc::PC) == charEncode(c5, fc::ASCII) ) || charEncode(c5, fc::PC) == charEncode(c5, fc::ASCII) )
{ {
no_half_block_character = true; no_half_block_character = true;
} }
@ -1694,9 +1695,9 @@ int FTerm::isConsole()
{ {
char arg = 0; char arg = 0;
// get keyboard type an compare // get keyboard type an compare
return ( isatty (fd_tty) return ( isatty (fd_tty)
&& ioctl(fd_tty, KDGKBTYPE, &arg) == 0 && ioctl(fd_tty, KDGKBTYPE, &arg) == 0
&& ((arg == KB_101) || (arg == KB_84)) ); && ((arg == KB_101) || (arg == KB_84)) );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1813,8 +1814,8 @@ int FTerm::getFramebuffer_bpp ()
if (fd >= 0) if (fd >= 0)
{ {
if ( ! ioctl(fd, FBIOGET_VSCREENINFO, &fb_var) if ( ! ioctl(fd, FBIOGET_VSCREENINFO, &fb_var)
&& ! ioctl(fd, FBIOGET_FSCREENINFO, &fb_fix) ) && ! ioctl(fd, FBIOGET_FSCREENINFO, &fb_fix) )
{ {
::close(fd); ::close(fd);
return int(fb_var.bits_per_pixel); return int(fb_var.bits_per_pixel);
@ -1884,8 +1885,8 @@ void FTerm::identifyTermType()
std::FILE *fp; std::FILE *fp;
if ( (fp = std::fopen("/etc/ttytype", "r")) != 0 if ( (fp = std::fopen("/etc/ttytype", "r")) != 0
|| (fp = std::fopen("/etc/ttys", "r")) != 0 ) || (fp = std::fopen("/etc/ttys", "r")) != 0 )
{ {
char* p; char* p;
char* type; char* type;
@ -2241,8 +2242,8 @@ char* FTerm::init_256colorTerminal()
} }
if ( std::strncmp(termtype, "rxvt", 4) != 0 if ( std::strncmp(termtype, "rxvt", 4) != 0
&& s1 && s1
&& std::strncmp(s1, "rxvt-xpm", 8) == 0 ) && std::strncmp(s1, "rxvt-xpm", 8) == 0 )
{ {
new_termtype = const_cast<char*>("rxvt-256color"); new_termtype = const_cast<char*>("rxvt-256color");
rxvt_terminal = true; rxvt_terminal = true;
@ -2411,8 +2412,8 @@ char* FTerm::parseSecDA (char*& current_termtype)
rxvt_terminal = true; rxvt_terminal = true;
force_vt100 = true; // this rxvt terminal support on utf-8 force_vt100 = true; // this rxvt terminal support on utf-8
if ( std::strncmp(termtype, "rxvt-", 5) != 0 if ( std::strncmp(termtype, "rxvt-", 5) != 0
|| std::strncmp(termtype, "rxvt-cygwin-native", 5) == 0 ) || std::strncmp(termtype, "rxvt-cygwin-native", 5) == 0 )
new_termtype = const_cast<char*>("rxvt-16color"); new_termtype = const_cast<char*>("rxvt-16color");
break; break;
@ -2712,6 +2713,8 @@ void FTerm::init_termcaps()
const_cast<char*>(CSI "48;5;%p1%dm"); const_cast<char*>(CSI "48;5;%p1%dm");
tcap[fc::t_exit_attribute_mode].string = \ tcap[fc::t_exit_attribute_mode].string = \
const_cast<char*>(CSI "0m" SI); const_cast<char*>(CSI "0m" SI);
tcap[fc::t_orig_pair].string = \
const_cast<char*>(CSI "39;49m");
} }
else if ( putty_terminal ) else if ( putty_terminal )
{ {
@ -2788,7 +2791,7 @@ void FTerm::init_termcaps()
// test for standard ECMA-48 (ANSI X3.64) terminal // test for standard ECMA-48 (ANSI X3.64) terminal
if ( tcap[fc::t_exit_underline_mode].string if ( tcap[fc::t_exit_underline_mode].string
&& std::strncmp(tcap[fc::t_exit_underline_mode].string, CSI "24m", 5) == 0 ) && std::strncmp(tcap[fc::t_exit_underline_mode].string, CSI "24m", 5) == 0 )
{ {
// seems to be a ECMA-48 (ANSI X3.64) compatible terminal // seems to be a ECMA-48 (ANSI X3.64) compatible terminal
tcap[fc::t_enter_dbl_underline_mode].string = \ tcap[fc::t_enter_dbl_underline_mode].string = \
@ -2856,9 +2859,9 @@ void FTerm::init_termcaps()
// ..110380-using-arrow-keys-shell-scripts.html // ..110380-using-arrow-keys-shell-scripts.html
key_up_string = tgetstr(const_cast<char*>("ku"), &buffer); key_up_string = tgetstr(const_cast<char*>("ku"), &buffer);
if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0)) if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0))
|| ( tcap[fc::t_cursor_up].string || ( tcap[fc::t_cursor_up].string
&& (std::strcmp(tcap[fc::t_cursor_up].string, CSI "A") == 0)) ) && (std::strcmp(tcap[fc::t_cursor_up].string, CSI "A") == 0) ) )
{ {
for (int i=0; Fkey[i].tname[0] != 0; i++) for (int i=0; Fkey[i].tname[0] != 0; i++)
{ {
@ -2975,7 +2978,8 @@ void FTerm::init_encoding()
{ {
// detect encoding and set the Fputchar function pointer // detect encoding and set the Fputchar function pointer
if ( isatty(stdout_no) && ! std::strcmp(nl_langinfo(CODESET), "UTF-8") ) if ( isatty(stdout_no)
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
{ {
utf8_console = true; utf8_console = true;
Encoding = fc::UTF8; Encoding = fc::UTF8;
@ -2984,9 +2988,9 @@ void FTerm::init_encoding()
utf8_input = true; utf8_input = true;
setUTF8(true); setUTF8(true);
} }
else if ( isatty(stdout_no) else if ( isatty(stdout_no)
&& (std::strlen(termtype) > 0) && (std::strlen(termtype) > 0)
&& (tcap[fc::t_exit_alt_charset_mode].string != 0) ) && (tcap[fc::t_exit_alt_charset_mode].string != 0) )
{ {
vt100_console = true; vt100_console = true;
Encoding = fc::VT100; Encoding = fc::VT100;
@ -3001,10 +3005,10 @@ void FTerm::init_encoding()
init_pc_charset(); init_pc_charset();
if ( linux_terminal if ( linux_terminal
|| cygwin_terminal || cygwin_terminal
|| NewFont || NewFont
|| (putty_terminal && ! utf8_state) ) || (putty_terminal && ! utf8_state) )
{ {
pc_charset_console = true; pc_charset_console = true;
Encoding = fc::PC; Encoding = fc::PC;
@ -3129,8 +3133,8 @@ void FTerm::init()
} }
// Test for Linux console // Test for Linux console
if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0 if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0
|| std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 ) || std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 )
linux_terminal = true; linux_terminal = true;
else else
linux_terminal = false; linux_terminal = false;
@ -3156,10 +3160,10 @@ void FTerm::init()
// Determine xterm maximum number of colors via OSC 4 // Determine xterm maximum number of colors via OSC 4
if ( ! color256 if ( ! color256
&& ! cygwin_terminal && ! cygwin_terminal
&& ! tera_terminal && ! tera_terminal
&& ! linux_terminal && ! linux_terminal
&& getXTermColorName(0) != "" ) && getXTermColorName(0) != "" )
{ {
if ( getXTermColorName(256) != "" ) if ( getXTermColorName(256) != "" )
{ {
@ -3175,10 +3179,10 @@ void FTerm::init()
} }
} }
if ( cygwin_terminal if ( cygwin_terminal
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| rxvt_terminal ) || rxvt_terminal )
{ {
FTermcap::max_color = 16; FTermcap::max_color = 16;
} }
@ -3205,8 +3209,8 @@ void FTerm::init()
} }
// Test if the terminal is a xterm // Test if the terminal is a xterm
if ( std::strncmp(termtype, const_cast<char*>("xterm"), 5) == 0 if ( std::strncmp(termtype, const_cast<char*>("xterm"), 5) == 0
|| std::strncmp(termtype, const_cast<char*>("Eterm"), 4) == 0 ) || std::strncmp(termtype, const_cast<char*>("Eterm"), 4) == 0 )
{ {
xterm_terminal = true; xterm_terminal = true;
@ -3326,9 +3330,9 @@ void FTerm::init()
setKDECursor(fc::UnderlineCursor); setKDECursor(fc::UnderlineCursor);
if ( FTermcap::max_color >= 16 if ( FTermcap::max_color >= 16
&& ! cygwin_terminal && ! cygwin_terminal
&& ! kde_konsole && ! kde_konsole
&& ! tera_terminal ) && ! tera_terminal )
{ {
resetColorMap(); resetColorMap();
saveColorMap(); saveColorMap();

View File

@ -408,10 +408,10 @@ void FTextView::onMouseDown (FMouseEvent* ev)
parent = getParentWidget(); parent = getParentWidget();
if ( parent if ( parent
&& parent->isDialogWidget() && parent->isDialogWidget()
&& (dialog = static_cast<FDialog*>(parent)) != 0 && (dialog = static_cast<FDialog*>(parent)) != 0
&& dialog->isResizeable() && dialog->isResizeable()
&& ! dialog->isZoomed() ) && ! dialog->isZoomed() )
{ {
int b = ev->getButton(); int b = ev->getButton();
const FPoint& tp = ev->getTermPos(); const FPoint& tp = ev->getTermPos();
@ -430,10 +430,10 @@ void FTextView::onMouseUp (FMouseEvent* ev)
FDialog* dialog; FDialog* dialog;
if ( parent if ( parent
&& parent->isDialogWidget() && parent->isDialogWidget()
&& (dialog = static_cast<FDialog*>(parent)) != 0 && (dialog = static_cast<FDialog*>(parent)) != 0
&& dialog->isResizeable() && dialog->isResizeable()
&& ! dialog->isZoomed() ) && ! dialog->isZoomed() )
{ {
int b = ev->getButton(); int b = ev->getButton();
const FPoint& tp = ev->getTermPos(); const FPoint& tp = ev->getTermPos();
@ -458,10 +458,10 @@ void FTextView::onMouseMove (FMouseEvent* ev)
FDialog* dialog; FDialog* dialog;
if ( parent if ( parent
&& parent->isDialogWidget() && parent->isDialogWidget()
&& (dialog = static_cast<FDialog*>(parent)) != 0 && (dialog = static_cast<FDialog*>(parent)) != 0
&& dialog->isResizeable() && dialog->isResizeable()
&& ! dialog->isZoomed() ) && ! dialog->isZoomed() )
{ {
int b = ev->getButton(); int b = ev->getButton();
const FPoint& tp = ev->getTermPos(); const FPoint& tp = ev->getTermPos();
@ -631,19 +631,18 @@ void FTextView::draw()
{ {
FWidget* parent = getParentWidget(); FWidget* parent = getParentWidget();
bool is_text_dialog; bool is_text_dialog;
updateVTerm(false);
setColor(); setColor();
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
if ( parent if ( parent
&& parent->isDialogWidget() && parent->isDialogWidget()
&& isPaddingIgnored() && isPaddingIgnored()
&& getGeometry() == FRect ( 1 && getGeometry() == FRect ( 1
, 2 , 2
, parent->getWidth() , parent->getWidth()
, parent->getHeight() - 1) ) , parent->getHeight() - 1) )
{ {
is_text_dialog = true; is_text_dialog = true;
} }
@ -662,7 +661,6 @@ void FTextView::draw()
if ( hbar->isVisible() ) if ( hbar->isVisible() )
hbar->redraw(); hbar->redraw();
updateVTerm(true);
drawText(); drawText();
if ( hasFocus() && getStatusBar() ) if ( hasFocus() && getStatusBar() )
@ -672,10 +670,8 @@ void FTextView::draw()
if ( curMsg != msg ) if ( curMsg != msg )
{ {
updateVTerm(false);
getStatusBar()->setMessage(msg); getStatusBar()->setMessage(msg);
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
updateVTerm(true);
} }
} }
@ -698,7 +694,6 @@ void FTextView::drawText()
if ( end > getRows() ) if ( end > getRows() )
end = getRows(); end = getRows();
updateVTerm(false);
setColor(); setColor();
if ( isMonochron() ) if ( isMonochron() )
@ -721,9 +716,9 @@ void FTextView::drawText()
bool utf8 = (Encoding == fc::UTF8) ? true : false; bool utf8 = (Encoding == fc::UTF8) ? true : false;
// only printable and 1 column per character // only printable and 1 column per character
if ( ( (utf8 && std::iswprint(wint_t(ch))) if ( ( (utf8 && std::iswprint(wint_t(ch)))
|| (!utf8 && ch < 256 && std::isprint(ch)) ) || (!utf8 && ch < 256 && std::isprint(ch)) )
&& wcwidth(ch) == 1 ) && wcwidth(ch) == 1 )
{ {
print (ch); print (ch);
} }
@ -737,8 +732,6 @@ void FTextView::drawText()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -822,8 +815,8 @@ void FTextView::cb_VBarChange (FWidget*, void*)
updateTerminal(); updateTerminal();
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward ) && scrollType <= FScrollbar::scrollPageForward )
{ {
vbar->setValue (yoffset); vbar->setValue (yoffset);
@ -919,8 +912,8 @@ void FTextView::cb_HBarChange (FWidget*, void*)
updateTerminal(); updateTerminal();
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown ) && scrollType <= FScrollbar::scrollWheelDown )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);

View File

@ -356,15 +356,15 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
redraw(); redraw();
} }
else if ( this == getGroup()->getLastButton() else if ( this == getGroup()->getLastButton()
&& out_ev->getFocusType() == fc::FocusNextWidget ) && out_ev->getFocusType() == fc::FocusNextWidget )
{ {
out_ev->ignore(); out_ev->ignore();
getGroup()->focusNextChild(); getGroup()->focusNextChild();
redraw(); redraw();
} }
else if ( this == getGroup()->getFirstButton() else if ( this == getGroup()->getFirstButton()
&& out_ev->getFocusType() == fc::FocusPreviousWidget ) && out_ev->getFocusType() == fc::FocusPreviousWidget )
{ {
out_ev->ignore(); out_ev->ignore();
getGroup()->focusPrevChild(); getGroup()->focusPrevChild();

View File

@ -79,7 +79,6 @@ void FToolTip::setText (const char* txt)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToolTip::draw() void FToolTip::draw()
{ {
updateVTerm(false);
setColor(); setColor();
if ( getMaxColor() < 16 ) if ( getMaxColor() < 16 )
@ -95,7 +94,6 @@ void FToolTip::draw()
} }
unsetBold(); unsetBold();
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -15,13 +15,11 @@ bool FVTerm::terminal_update_complete;
bool FVTerm::terminal_update_pending; bool FVTerm::terminal_update_pending;
bool FVTerm::force_terminal_update; bool FVTerm::force_terminal_update;
bool FVTerm::stop_terminal_updates; bool FVTerm::stop_terminal_updates;
bool FVTerm::vterm_updates;
int FVTerm::skipped_terminal_update = 0; int FVTerm::skipped_terminal_update = 0;
std::queue<int>* FVTerm::output_buffer = 0; std::queue<int>* FVTerm::output_buffer = 0;
FPoint* FVTerm::term_pos = 0; FPoint* FVTerm::term_pos = 0;
FVTerm::term_area* FVTerm::vterm = 0; FVTerm::term_area* FVTerm::vterm = 0;
FVTerm::term_area* FVTerm::vdesktop = 0; FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::last_area = 0;
FVTerm::term_area* FVTerm::active_area = 0; FVTerm::term_area* FVTerm::active_area = 0;
FVTerm::termcap_map* FVTerm::tcap = 0; FVTerm::termcap_map* FVTerm::tcap = 0;
FTermcap::tcap_map* FTermcap::tcap = 0; FTermcap::tcap_map* FTermcap::tcap = 0;
@ -41,7 +39,6 @@ FVTerm::FVTerm (FVTerm* parent)
, vwin(0) , vwin(0)
{ {
terminal_update_complete = false; terminal_update_complete = false;
vterm_updates = true;
if ( ! parent ) if ( ! parent )
{ {
@ -131,7 +128,7 @@ void FVTerm::clearTerm (int fillchar)
vdesktop->changes[i].trans_count = 0; vdesktop->changes[i].trans_count = 0;
} }
updateVTerm (vdesktop); vdesktop->has_changes = true;
setTermXY (0,0); setTermXY (0,0);
} }
else if ( cl ) else if ( cl )
@ -264,7 +261,7 @@ void FVTerm::updateTerminal()
// Updates pending changes to the terminal // Updates pending changes to the terminal
if ( stop_terminal_updates if ( stop_terminal_updates
|| static_cast<FApplication*>(init_object)->isQuit() ) || static_cast<FApplication*>(init_object)->isQuit() )
return; return;
if ( ! force_terminal_update ) if ( ! force_terminal_update )
@ -279,6 +276,9 @@ void FVTerm::updateTerminal()
} }
} }
// Update data on VTerm
updateVTerm();
for (register uInt y=0; y < uInt(vterm->height); y++) for (register uInt y=0; y < uInt(vterm->height); y++)
updateTerminalLine (y); updateTerminalLine (y);
@ -318,7 +318,9 @@ void FVTerm::updateTerminalLine (uInt y)
for (uInt x=xmin+1; x < uInt(vt->width); x++) for (uInt x=xmin+1; x < uInt(vt->width); x++)
{ {
if ( *min_char == vt->text[y * uInt(vt->width) + x] ) char_data* ch = &vt->text[y * uInt(vt->width) + x];
if ( *min_char == *ch )
beginning_whitespace++; beginning_whitespace++;
else else
break; break;
@ -340,7 +342,9 @@ void FVTerm::updateTerminalLine (uInt y)
for (uInt x=1; x < uInt(vt->width); x++) for (uInt x=1; x < uInt(vt->width); x++)
{ {
if ( *first_char == vt->text[y * uInt(vt->width) + x] ) char_data* ch = &vt->text[y * uInt(vt->width) + x];
if ( *first_char == *ch )
leading_whitespace++; leading_whitespace++;
else else
break; break;
@ -363,7 +367,9 @@ void FVTerm::updateTerminalLine (uInt y)
for (uInt x=uInt(vt->width)-1; x > 0 ; x--) for (uInt x=uInt(vt->width)-1; x > 0 ; x--)
{ {
if ( *last_char == vt->text[y * uInt(vt->width) + x] ) char_data* ch = &vt->text[y * uInt(vt->width) + x];
if ( *last_char == *ch )
tailing_whitespace++; tailing_whitespace++;
else else
break; break;
@ -399,6 +405,31 @@ void FVTerm::updateTerminalLine (uInt y)
char_data* print_char; char_data* print_char;
print_char = &vt->text[y * uInt(vt->width) + x]; print_char = &vt->text[y * uInt(vt->width) + x];
// skip character with no changes
if ( ! terminal_update_pending
&& print_char->no_changes
&& ! print_char->restored )
{
uInt count = 1;
for (uInt i=x+1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
if ( ch->no_changes && ! ch->restored )
count++;
else
break;
}
if ( count > uInt(cursor_addres_lengths) )
{
setTermXY (int(x + count), int(y));
x = x + count - 1;
continue;
}
}
// Erase a number of characters to draw simple whitespaces // Erase a number of characters to draw simple whitespaces
if ( ec && print_char->code == ' ' ) if ( ec && print_char->code == ' ' )
{ {
@ -407,7 +438,9 @@ void FVTerm::updateTerminalLine (uInt y)
for (uInt i=x+1; i <= xmax; i++) for (uInt i=x+1; i <= xmax; i++)
{ {
if ( *print_char == vt->text[y * uInt(vt->width) + i] ) char_data* ch = &vt->text[y * uInt(vt->width) + i];
if ( *print_char == *ch )
whitespace++; whitespace++;
else else
break; break;
@ -440,7 +473,9 @@ void FVTerm::updateTerminalLine (uInt y)
for (uInt i=x+1; i <= xmax; i++) for (uInt i=x+1; i <= xmax; i++)
{ {
if ( *print_char == vt->text[y * uInt(vt->width) + i] ) char_data* ch = &vt->text[y * uInt(vt->width) + i];
if ( *print_char == *ch )
repetitions++; repetitions++;
else else
break; break;
@ -704,6 +739,9 @@ int FVTerm::print (term_area* area, FString& s)
if ( p ) if ( p )
{ {
if ( *p )
area->has_changes = true;
while ( *p ) while ( *p )
{ {
int width, height, rsh, bsh; int width, height, rsh, bsh;
@ -762,12 +800,14 @@ int FVTerm::print (term_area* area, FString& s)
nc.transparent = next_attribute.transparent; nc.transparent = next_attribute.transparent;
nc.trans_shadow = next_attribute.trans_shadow; nc.trans_shadow = next_attribute.trans_shadow;
nc.inherit_bg = next_attribute.inherit_bg; nc.inherit_bg = next_attribute.inherit_bg;
nc.no_changes = false;
nc.restored = false;
if ( area if ( area
&& area->cursor_x > 0 && area->cursor_x > 0
&& area->cursor_y > 0 && area->cursor_y > 0
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character char_data* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
@ -775,16 +815,16 @@ int FVTerm::print (term_area* area, FString& s)
if ( *ac != nc ) // compare with an overloaded operator if ( *ac != nc ) // compare with an overloaded operator
{ {
if ( ( ! ac->transparent && nc.transparent ) if ( ( ! ac->transparent && nc.transparent )
|| ( ! ac->trans_shadow && nc.trans_shadow ) || ( ! ac->trans_shadow && nc.trans_shadow )
|| ( ! ac->inherit_bg && nc.inherit_bg ) ) || ( ! ac->inherit_bg && nc.inherit_bg ) )
{ {
// add one transparent character form line // add one transparent character form line
area->changes[ay].trans_count++; area->changes[ay].trans_count++;
} }
else if ( ( ac->transparent && ! nc.transparent ) else if ( ( ac->transparent && ! nc.transparent )
|| ( ac->trans_shadow && ! nc.trans_shadow ) || ( ac->trans_shadow && ! nc.trans_shadow )
|| ( ac->inherit_bg && ! nc.inherit_bg ) ) || ( ac->inherit_bg && ! nc.inherit_bg ) )
{ {
// remove one transparent character from line // remove one transparent character from line
area->changes[ay].trans_count--; area->changes[ay].trans_count--;
@ -820,8 +860,6 @@ int FVTerm::print (term_area* area, FString& s)
p++; p++;
len++; len++;
} // end of while } // end of while
updateVTerm (area);
} }
return len; return len;
@ -878,11 +916,13 @@ int FVTerm::print (term_area* area, register int c)
nc.transparent = next_attribute.transparent; nc.transparent = next_attribute.transparent;
nc.trans_shadow = next_attribute.trans_shadow; nc.trans_shadow = next_attribute.trans_shadow;
nc.inherit_bg = next_attribute.inherit_bg; nc.inherit_bg = next_attribute.inherit_bg;
nc.no_changes = false;
nc.restored = false;
if ( area->cursor_x > 0 if ( area->cursor_x > 0
&& area->cursor_y > 0 && area->cursor_y > 0
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character char_data* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
@ -890,17 +930,17 @@ int FVTerm::print (term_area* area, register int c)
if ( *ac != nc ) // compare with an overloaded operator if ( *ac != nc ) // compare with an overloaded operator
{ {
if ( ( ! ac->transparent && nc.transparent ) if ( ( ! ac->transparent && nc.transparent )
|| ( ! ac->trans_shadow && nc.trans_shadow ) || ( ! ac->trans_shadow && nc.trans_shadow )
|| ( ! ac->inherit_bg && nc.inherit_bg ) ) || ( ! ac->inherit_bg && nc.inherit_bg ) )
{ {
// add one transparent character form line // add one transparent character form line
area->changes[ay].trans_count++; area->changes[ay].trans_count++;
} }
if ( ( ac->transparent && ! nc.transparent ) if ( ( ac->transparent && ! nc.transparent )
|| ( ac->trans_shadow && ! nc.trans_shadow ) || ( ac->trans_shadow && ! nc.trans_shadow )
|| ( ac->inherit_bg && ! nc.inherit_bg ) ) || ( ac->inherit_bg && ! nc.inherit_bg ) )
{ {
// remove one transparent character from line // remove one transparent character from line
area->changes[ay].trans_count--; area->changes[ay].trans_count--;
@ -918,6 +958,7 @@ int FVTerm::print (term_area* area, register int c)
} }
area->cursor_x++; area->cursor_x++;
area->has_changes = true;
if ( area->cursor_x > width + rsh ) if ( area->cursor_x > width + rsh )
{ {
@ -928,11 +969,9 @@ int FVTerm::print (term_area* area, register int c)
if ( area->cursor_y > height + bsh ) if ( area->cursor_y > height + bsh )
{ {
area->cursor_y--; area->cursor_y--;
updateVTerm (area);
return -1; return -1;
} }
updateVTerm (area);
return 1; return 1;
} }
@ -1180,6 +1219,7 @@ void FVTerm::createArea ( int x_offset, int y_offset
area->input_cursor_x = -1; area->input_cursor_x = -1;
area->input_cursor_y = -1; area->input_cursor_y = -1;
area->input_cursor_visible = false; area->input_cursor_visible = false;
area->has_changes = false;
area->changes = 0; area->changes = 0;
area->text = 0; area->text = 0;
area->visible = false; area->visible = false;
@ -1244,6 +1284,7 @@ void FVTerm::resizeArea ( int x_offset, int y_offset
area->height = height; area->height = height;
area->right_shadow = rsw; area->right_shadow = rsw;
area->bottom_shadow = bsh; area->bottom_shadow = bsh;
area->has_changes = false;
default_char.code = ' '; default_char.code = ' ';
default_char.fg_color = fc::Default; default_char.fg_color = fc::Default;
@ -1264,6 +1305,7 @@ void FVTerm::resizeArea ( int x_offset, int y_offset
default_char.transparent = 0; default_char.transparent = 0;
default_char.trans_shadow = 0; default_char.trans_shadow = 0;
default_char.inherit_bg = 0; default_char.inherit_bg = 0;
default_char.no_changes = 0;
std::fill_n (area->text, area_size, default_char); std::fill_n (area->text, area_size, default_char);
@ -1389,12 +1431,12 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
s_ch.reverse = false; s_ch.reverse = false;
s_ch.standout = false; s_ch.standout = false;
if ( s_ch.code == fc::LowerHalfBlock if ( s_ch.code == fc::LowerHalfBlock
|| s_ch.code == fc::UpperHalfBlock || s_ch.code == fc::UpperHalfBlock
|| s_ch.code == fc::LeftHalfBlock || s_ch.code == fc::LeftHalfBlock
|| s_ch.code == fc::RightHalfBlock || s_ch.code == fc::RightHalfBlock
|| s_ch.code == fc::MediumShade || s_ch.code == fc::MediumShade
|| s_ch.code == fc::FullBlock ) || s_ch.code == fc::FullBlock )
s_ch.code = ' '; s_ch.code = ' ';
sc = &s_ch; sc = &s_ch;
@ -1413,6 +1455,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
} }
} }
sc->restored = true;
std::memcpy (tc, sc, sizeof(char_data)); std::memcpy (tc, sc, sizeof(char_data));
if ( short(vterm->changes[y+ty].xmin) > x ) if ( short(vterm->changes[y+ty].xmin) > x )
@ -1496,27 +1539,52 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::updateVTerm (bool on) void FVTerm::updateVTerm()
{ {
vterm_updates = on; // Update data on VTerm
if ( on ) if ( vdesktop && vdesktop->has_changes )
updateVTerm (last_area); {
updateVTerm(vdesktop);
vdesktop->has_changes = false;
}
FWidget* widget = static_cast<FWidget*>(vterm->widget);
if ( ! widget->window_list || widget->window_list->empty() )
return;
FWidget::widgetList::const_iterator iter, end;
iter = widget->window_list->begin();
end = widget->window_list->end();
for (; iter != end; ++iter)
{
term_area* win = (*iter)->getVWin();
if ( ! win )
continue;
if ( ! win->visible )
continue;
if ( win->has_changes )
{
updateVTerm(win);
win->has_changes = false;
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::updateVTerm (term_area* area) void FVTerm::updateVTerm (term_area* area)
{ {
// Update area data on VTerm
int ax, ay, aw, ah, rsh, bsh, y_end, ol; int ax, ay, aw, ah, rsh, bsh, y_end, ol;
char_data* tc; // terminal character char_data* tc; // terminal character
char_data* ac; // area character char_data* ac; // area character
if ( ! vterm_updates )
{
last_area = area;
return;
}
if ( ! area ) if ( ! area )
return; return;
@ -1542,7 +1610,7 @@ void FVTerm::updateVTerm (term_area* area)
else else
y_end = ah + bsh; y_end = ah + bsh;
for (register int y=0; y < y_end; y++) // line loop for (int y=0; y < y_end; y++) // line loop
{ {
int line_xmin = int(area->changes[y].xmin); int line_xmin = int(area->changes[y].xmin);
int line_xmax = int(area->changes[y].xmax); int line_xmax = int(area->changes[y].xmax);
@ -1561,7 +1629,7 @@ void FVTerm::updateVTerm (term_area* area)
if ( ax + line_xmin >= vterm->width ) if ( ax + line_xmin >= vterm->width )
continue; continue;
for (register int x=line_xmin; x <= line_xmax; x++) // column loop for (int x=line_xmin; x <= line_xmax; x++) // column loop
{ {
int gx, gy, line_len; int gx, gy, line_len;
covered_state is_covered; covered_state is_covered;
@ -1591,14 +1659,15 @@ void FVTerm::updateVTerm (term_area* area)
ch.reverse = false; ch.reverse = false;
ch.standout = false; ch.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
ch.no_changes = bool(! tc->restored && *tc == ch);
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
} }
else if ( ac->transparent ) // transparent else if ( ac->transparent ) // transparent
@ -1606,9 +1675,10 @@ void FVTerm::updateVTerm (term_area* area)
// restore one character on vterm // restore one character on vterm
char_data ch; char_data ch;
ch = getCoveredCharacter (gx+1 - ol, gy+1, area->widget); ch = getCoveredCharacter (gx+1 - ol, gy+1, area->widget);
ch.no_changes = bool(! tc->restored && *tc == ch);
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
} }
else // not transparent else // not transparent
{ {
if ( ac->trans_shadow ) // transparent shadow if ( ac->trans_shadow ) // transparent shadow
{ {
@ -1620,14 +1690,15 @@ void FVTerm::updateVTerm (term_area* area)
ch.reverse = false; ch.reverse = false;
ch.standout = false; ch.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
ch.no_changes = bool(! tc->restored && *tc == ch);
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
} }
else if ( ac->inherit_bg ) else if ( ac->inherit_bg )
@ -1637,16 +1708,30 @@ void FVTerm::updateVTerm (term_area* area)
std::memcpy (&ch, ac, sizeof(char_data)); std::memcpy (&ch, ac, sizeof(char_data));
cc = getCoveredCharacter (gx+1 - ol, gy+1, area->widget); cc = getCoveredCharacter (gx+1 - ol, gy+1, area->widget);
ch.bg_color = cc.bg_color; ch.bg_color = cc.bg_color;
ch.no_changes = bool(*tc == ch);
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
} }
else // default else // default
std::memcpy (tc, ac, sizeof(char_data)); {
if ( ! tc->restored && *tc == *ac )
{
std::memcpy (tc, ac, sizeof(char_data));
tc->no_changes = true;
}
else
{
std::memcpy (tc, ac, sizeof(char_data));
tc->no_changes = false;
}
}
} }
modified = true; modified = true;
} }
else if ( ! modified ) else if ( ! modified )
line_xmin++; // don't update covered character line_xmin++; // don't update covered character
tc->restored = false;
} }
_xmin = ax + line_xmin - ol; _xmin = ax + line_xmin - ol;
@ -1695,8 +1780,8 @@ bool FVTerm::updateVTermCursor (term_area* area)
y = ay + cy; y = ay + cy;
if ( isInsideArea(cx, cy, area) if ( isInsideArea(cx, cy, area)
&& isInsideTerminal(x, y) && isInsideTerminal(x, y)
&& isCovered(x, y, area) == non_covered ) && isCovered(x, y, area) == non_covered )
{ {
vterm->input_cursor_x = x; vterm->input_cursor_x = x;
vterm->input_cursor_y = y; vterm->input_cursor_y = y;
@ -1745,7 +1830,6 @@ void FVTerm::setAreaCursor ( int x, int y
area->input_cursor_x = x - 1; area->input_cursor_x = x - 1;
area->input_cursor_y = y - 1; area->input_cursor_y = y - 1;
area->input_cursor_visible = visible; area->input_cursor_visible = visible;
updateVTerm (area);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1940,12 +2024,12 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
ch.reverse = false; ch.reverse = false;
ch.standout = false; ch.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
@ -2014,6 +2098,24 @@ void FVTerm::scrollAreaForward (term_area* area)
std::fill_n (dc, area->width, nc); std::fill_n (dc, area->width, nc);
area->changes[y_max].xmin = 0; area->changes[y_max].xmin = 0;
area->changes[y_max].xmax = uInt(area->width - 1); area->changes[y_max].xmax = uInt(area->width - 1);
area->has_changes = true;
if ( area == vdesktop )
{
if ( tcap[fc::t_scroll_forward].string )
{
setTermXY (0, vdesktop->height);
scrollTermForward();
putArea (1, 1, vdesktop);
// avoid update lines from 0 to (y_max-1)
for (int y=0; y < y_max; y++)
{
area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0;
}
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2022,6 +2124,7 @@ void FVTerm::scrollAreaReverse (term_area* area)
// Scrolls the entire area one line down // Scrolls the entire area one line down
int total_width; int total_width;
int length; int length;
int y_max;
char_data nc; // next character char_data nc; // next character
char_data* lc; // last character char_data* lc; // last character
char_data* sc; // source character char_data* sc; // source character
@ -2035,8 +2138,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
length = area->width; length = area->width;
total_width = area->width + area->right_shadow; total_width = area->width + area->right_shadow;
y_max = area->height - 1;
for (int y=area->height-1; y > 0; y--) for (int y=y_max; y > 0; y--)
{ {
int pos1 = (y-1) * total_width; int pos1 = (y-1) * total_width;
int pos2 = y * total_width; int pos2 = y * total_width;
@ -2055,6 +2159,24 @@ void FVTerm::scrollAreaReverse (term_area* area)
std::fill_n (dc, area->width, nc); std::fill_n (dc, area->width, nc);
area->changes[0].xmin = 0; area->changes[0].xmin = 0;
area->changes[0].xmax = uInt(area->width - 1); area->changes[0].xmax = uInt(area->width - 1);
area->has_changes = true;
if ( area == vdesktop )
{
if ( tcap[fc::t_scroll_reverse].string )
{
setTermXY (0, 0);
scrollTermReverse();
putArea (1, 1, vdesktop);
// avoid update lines from 1 to y_max
for (int y=1; y <= y_max; y++)
{
area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0;
}
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2112,9 +2234,9 @@ void FVTerm::clearArea (term_area* area, int fillchar)
area->changes[i].xmin = 0; area->changes[i].xmin = 0;
area->changes[i].xmax = w - 1; area->changes[i].xmax = w - 1;
if ( nc.transparent if ( nc.transparent
|| nc.trans_shadow || nc.trans_shadow
|| nc.inherit_bg ) || nc.inherit_bg )
area->changes[i].trans_count = w; area->changes[i].trans_count = w;
else if ( area->right_shadow != 0 ) else if ( area->right_shadow != 0 )
area->changes[i].trans_count = uInt(area->right_shadow); area->changes[i].trans_count = uInt(area->right_shadow);
@ -2130,7 +2252,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
area->changes[y].trans_count = w; area->changes[y].trans_count = w;
} }
updateVTerm (area); area->has_changes = true;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2334,7 +2456,6 @@ void FVTerm::init()
init_object = this; init_object = this;
vterm = 0; vterm = 0;
vdesktop = 0; vdesktop = 0;
last_area = 0;
term_pos = new FPoint(-1,-1); term_pos = new FPoint(-1,-1);
output_buffer = new std::queue<int>; output_buffer = new std::queue<int>;
@ -2363,7 +2484,9 @@ void FVTerm::init()
term_attribute.pc_charset = \ term_attribute.pc_charset = \
term_attribute.transparent = \ term_attribute.transparent = \
term_attribute.trans_shadow = \ term_attribute.trans_shadow = \
term_attribute.inherit_bg = false; term_attribute.inherit_bg = \
term_attribute.no_changes = \
term_attribute.restored = false;
// next_attribute contains the state of the next printed character // next_attribute contains the state of the next printed character
std::memcpy (&next_attribute, &term_attribute, sizeof(char_data)); std::memcpy (&next_attribute, &term_attribute, sizeof(char_data));

View File

@ -68,6 +68,7 @@ class FVTerm : public FObject, public FTerm
FWidget* widget; FWidget* widget;
line_changes* changes; line_changes* changes;
char_data* text; char_data* text;
bool has_changes;
bool visible; bool visible;
} term_area; } term_area;
@ -263,7 +264,7 @@ class FVTerm : public FObject, public FTerm
static covered_state isCovered ( int, int static covered_state isCovered ( int, int
, term_area* ); , term_area* );
static void updateVTerm (bool); static void updateVTerm();
static void updateVTerm (term_area*); static void updateVTerm (term_area*);
static bool updateVTermCursor (term_area*); static bool updateVTermCursor (term_area*);
static bool isInsideArea (int, int, term_area*); static bool isInsideArea (int, int, term_area*);
@ -302,7 +303,6 @@ class FVTerm : public FObject, public FTerm
// Data Members // Data Members
static term_area* vterm; // virtual terminal static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop static term_area* vdesktop; // virtual desktop
static term_area* last_area; // last used area
static term_area* active_area; // active area static term_area* active_area; // active area
term_area* print_area; // print area for this object term_area* print_area; // print area for this object
term_area* vwin; // virtual window term_area* vwin; // virtual window
@ -342,7 +342,6 @@ class FVTerm : public FObject, public FTerm
static bool terminal_update_pending; static bool terminal_update_pending;
static bool force_terminal_update; static bool force_terminal_update;
static bool stop_terminal_updates; static bool stop_terminal_updates;
static bool vterm_updates;
static int skipped_terminal_update; static int skipped_terminal_update;
}; };
@ -404,7 +403,8 @@ inline void FVTerm::setNormal()
next_attribute.pc_charset = \ next_attribute.pc_charset = \
next_attribute.transparent = \ next_attribute.transparent = \
next_attribute.trans_shadow = \ next_attribute.trans_shadow = \
next_attribute.inherit_bg = false; next_attribute.inherit_bg = \
next_attribute.no_changes = false;
next_attribute.fg_color = fc::Default; next_attribute.fg_color = fc::Default;
next_attribute.bg_color = fc::Default; next_attribute.bg_color = fc::Default;

View File

@ -64,7 +64,7 @@ FWidget::FWidget (FWidget* parent)
if ( ! parent ) if ( ! parent )
{ {
assert ( ! rootObject assert ( ! rootObject
&& "FTerm: There should be only one root object" ); && "FTerm: There should be only one root object" );
rootObject = this; rootObject = this;
show_root_widget = 0; show_root_widget = 0;
@ -200,10 +200,10 @@ FPoint FWidget::getPrintPos()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side) std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
{ {
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
switch ( side ) switch ( side )
{ {
@ -280,7 +280,7 @@ bool FWidget::setFocus (bool on)
FWidget::getFocusWidget()->unsetFocus(); FWidget::getFocusWidget()->unsetFocus();
if ( (!isDialogWidget() && focusable_children == 0) if ( (!isDialogWidget() && focusable_children == 0)
|| (isDialogWidget() && focusable_children == 1) ) || (isDialogWidget() && focusable_children == 1) )
{ {
FWidget::setFocusWidget(this); FWidget::setFocusWidget(this);
} }
@ -347,8 +347,8 @@ void FWidget::setY (int y, bool adjust)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::setPos (int x, int y, bool adjust) void FWidget::setPos (int x, int y, bool adjust)
{ {
if ( getX() == x && wsize.getX() == x if ( getX() == x && wsize.getX() == x
&& getY() == y && wsize.getY() == y ) && getY() == y && wsize.getY() == y )
{ {
return; return;
} }
@ -422,7 +422,7 @@ void FWidget::setSize (int width, int height, bool adjust)
height = std::max (height, size_hints.min_height); height = std::max (height, size_hints.min_height);
if ( getWidth() == width && wsize.getWidth() == width if ( getWidth() == width && wsize.getWidth() == width
&& getHeight() == height && wsize.getHeight() == height ) && getHeight() == height && wsize.getHeight() == height )
return; return;
if ( width < 1 ) if ( width < 1 )
@ -653,10 +653,10 @@ void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
{ {
uLong length; uLong length;
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
switch ( side ) switch ( side )
{ {
@ -687,10 +687,10 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
{ {
uLong length, index; uLong length, index;
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
assert ( pos >= 1 ); assert ( pos >= 1 );
@ -748,10 +748,10 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
{ {
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->isVisible() && widget->isVisible()
&& ! widget->isWindowWidget() && ! widget->isWindowWidget()
&& widget->getTermGeometry().contains(x,y) ) && widget->getTermGeometry().contains(x,y) )
{ {
FWidget* child = childWidgetAt(widget, x, y); FWidget* child = childWidgetAt(widget, x, y);
return (child != 0) ? child : widget; return (child != 0) ? child : widget;
@ -948,9 +948,9 @@ void FWidget::delAccelerator (FWidget* obj)
if ( ! widget || widget == statusbar || widget == menubar ) if ( ! widget || widget == statusbar || widget == menubar )
widget = getRootWidget(); widget = getRootWidget();
if ( widget if ( widget
&& widget->accelerator_list && widget->accelerator_list
&& ! widget->accelerator_list->empty() ) && ! widget->accelerator_list->empty() )
{ {
FWidget::Accelerators::iterator iter; FWidget::Accelerators::iterator iter;
iter = widget->accelerator_list->begin(); iter = widget->accelerator_list->begin();
@ -1159,8 +1159,8 @@ void FWidget::hide()
shown = false; shown = false;
if ( ! isDialogWidget() if ( ! isDialogWidget()
&& FWidget::getFocusWidget() == this && FWidget::getFocusWidget() == this
&& ! focusPrevChild() ) && ! focusPrevChild() )
{ {
if ( FWidget::getFocusWidget() ) if ( FWidget::getFocusWidget() )
FWidget::getFocusWidget()->unsetFocus(); FWidget::getFocusWidget()->unsetFocus();
@ -1190,9 +1190,9 @@ bool FWidget::focusFirstChild()
{ {
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->acceptFocus() && widget->acceptFocus()
&& ! widget->isMenuWidget() ) && ! widget->isMenuWidget() )
{ {
widget->setFocus(); widget->setFocus();
@ -1233,9 +1233,9 @@ bool FWidget::focusLastChild()
--iter; --iter;
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->acceptFocus() && widget->acceptFocus()
&& ! widget->isMenuWidget() ) && ! widget->isMenuWidget() )
{ {
widget->setFocus(); widget->setFocus();
@ -1285,8 +1285,8 @@ void FWidget::drawShadow()
if ( isMonochron() && ! trans_shadow ) if ( isMonochron() && ! trans_shadow )
return; return;
if ( (Encoding == fc::VT100 && ! (trans_shadow || isTeraTerm()) ) if ( (Encoding == fc::VT100 && ! (trans_shadow || isTeraTerm()) )
|| (Encoding == fc::ASCII && ! trans_shadow) ) || (Encoding == fc::ASCII && ! trans_shadow) )
{ {
clearShadow(); clearShadow();
return; return;
@ -1828,10 +1828,10 @@ bool FWidget::focusNextChild()
next_element = children.begin(); next_element = children.begin();
next = static_cast<FWidget*>(*next_element); next = static_cast<FWidget*>(*next_element);
} while ( ! next->isEnabled() } while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isWindowWidget() ); || next->isWindowWidget() );
FFocusEvent out (fc::FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(fc::FocusNextWidget); out.setFocusType(fc::FocusNextWidget);
@ -1901,10 +1901,10 @@ bool FWidget::focusPrevChild()
--prev_element; --prev_element;
prev = static_cast<FWidget*>(*prev_element); prev = static_cast<FWidget*>(*prev_element);
} while ( ! prev->isEnabled() } while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isWindowWidget() ); || prev->isWindowWidget() );
FFocusEvent out (fc::FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(fc::FocusPreviousWidget); out.setFocusType(fc::FocusPreviousWidget);
@ -1965,11 +1965,11 @@ bool FWidget::event (FEvent* ev)
if ( ! kev->isAccepted() ) if ( ! kev->isAccepted() )
{ {
if ( kev->key() == fc::Fkey_right if ( kev->key() == fc::Fkey_right
|| kev->key() == fc::Fkey_down ) || kev->key() == fc::Fkey_down )
accpt_focus = focusNextChild(); accpt_focus = focusNextChild();
else if ( kev->key() == fc::Fkey_left else if ( kev->key() == fc::Fkey_left
|| kev->key() == fc::Fkey_up ) || kev->key() == fc::Fkey_up )
accpt_focus = focusPrevChild(); accpt_focus = focusPrevChild();
if ( accpt_focus ) if ( accpt_focus )

View File

@ -442,7 +442,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
FWindow* w = static_cast<FWindow*>(*iter); FWindow* w = static_cast<FWindow*>(*iter);
if ( ! w->isWindowHidden() if ( ! w->isWindowHidden()
&& w->getTermGeometry().contains(x,y) ) && w->getTermGeometry().contains(x,y) )
return w; return w;
} }
} }
@ -594,7 +594,7 @@ bool FWindow::raiseWindow (FWidget* obj)
return false; return false;
if ( (window_list->back()->getFlags() & fc::modal) != 0 if ( (window_list->back()->getFlags() & fc::modal) != 0
&& ! obj->isMenuWidget() ) && ! obj->isMenuWidget() )
return false; return false;
iter = window_list->begin(); iter = window_list->begin();
@ -704,10 +704,10 @@ void FWindow::switchToPrevWindow()
FWindow* w = static_cast<FWindow*>(*iter); FWindow* w = static_cast<FWindow*>(*iter);
if ( w if ( w
&& w != active_window && w != active_window
&& ! (w->isWindowHidden() || w->isWindowActive()) && ! (w->isWindowHidden() || w->isWindowActive())
&& w != static_cast<FWindow*>(getStatusBar()) && w != static_cast<FWindow*>(getStatusBar())
&& w != static_cast<FWindow*>(getMenuBar()) ) && w != static_cast<FWindow*>(getMenuBar()) )
{ {
setActiveWindow(w); setActiveWindow(w);
break; break;

View File

@ -302,7 +302,6 @@ Calc::~Calc()
void Calc::drawDispay() void Calc::drawDispay()
{ {
FString display = input; FString display = input;
updateVTerm(false);
if ( display.isNull() || display.isEmpty() ) if ( display.isNull() || display.isEmpty() )
display = L'0'; display = L'0';
@ -364,8 +363,6 @@ void Calc::drawDispay()
setPrintPos (1,4); setPrintPos (1,4);
print(separator); print(separator);
} }
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -684,7 +681,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
else else
// Test if (x/180) != 0 and x/90 == 0 // Test if (x/180) != 0 and x/90 == 0
if ( std::fabs(std::fmod(*x,180.0L)) > LDBL_EPSILON if ( std::fabs(std::fmod(*x,180.0L)) > LDBL_EPSILON
&& std::fabs(std::fmod(*x,90.0L)) < LDBL_EPSILON ) && std::fabs(std::fmod(*x,90.0L)) < LDBL_EPSILON )
error = true; error = true;
else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 == 0 else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 == 0
*x = 0.0L; *x = 0.0L;
@ -984,8 +981,8 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
{ {
// remove trailing zeros // remove trailing zeros
while ( ! input.includes(L'e') while ( ! input.includes(L'e')
&& input.includes(L'.') && input.includes(L'.')
&& input.back() == L'0' ) && input.back() == L'0' )
input = input.left(input.getLength()-1); input = input.left(input.getLength()-1);
} }
} }

View File

@ -41,15 +41,9 @@ void keyboard::onKeyPress (FKeyEvent* ev)
printf ("Key %s (id %d)\n", getKeyName(key_id).c_str(), key_id); printf ("Key %s (id %d)\n", getKeyName(key_id).c_str(), key_id);
if ( is_last_line ) if ( is_last_line )
{
scrollAreaForward (vdesktop); scrollAreaForward (vdesktop);
if ( ! scrollTermForward() )
putArea (getTermPos(), vdesktop);
}
setAreaCursor (1, getPrintPos().getY(), true, vdesktop); setAreaCursor (1, getPrintPos().getY(), true, vdesktop);
} }

View File

@ -94,8 +94,6 @@ void Mandelbrot::draw()
print(' '); print(' ');
} }
} }
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -210,12 +210,12 @@ void Menu::defaultCallback (FMenuList* mb)
{ {
FMenuItem* item = mb->getItem(int(i)); FMenuItem* item = mb->getItem(int(i));
if ( item if ( item
&& item->isEnabled() && item->isEnabled()
&& item->acceptFocus() && item->acceptFocus()
&& item->isVisible() && item->isVisible()
&& ! item->isSeparator() && ! item->isSeparator()
&& item->getText() != "&Quit" ) && item->getText() != "&Quit" )
{ {
// Add the callback function // Add the callback function
item->addCallback item->addCallback
@ -278,8 +278,8 @@ void Menu::cb_exitApp (FWidget*, void*)
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0 if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|| std::strcmp(argv[1], "-h") == 0 ) ) || std::strcmp(argv[1], "-h") == 0 ) )
{ {
std::cout << "Generic options:" << std::endl std::cout << "Generic options:" << std::endl
<< " -h, --help " << " -h, --help "

View File

@ -261,8 +261,6 @@ void AttribDemo::printAltCharset()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void AttribDemo::draw() void AttribDemo::draw()
{ {
updateVTerm(false);
// test alternate character set // test alternate character set
printAltCharset(); printAltCharset();
@ -383,7 +381,6 @@ void AttribDemo::draw()
setPrintPos (16, 17); setPrintPos (16, 17);
print ("Change background color ->"); print ("Change background color ->");
updateVTerm(true);
} }

View File

@ -60,13 +60,8 @@ void timer::onTimer (FTimerEvent* ev)
printf ("timer event, id %d\n", timer_id ); printf ("timer event, id %d\n", timer_id );
if ( is_last_line ) if ( is_last_line )
{
scrollAreaForward (vdesktop); scrollAreaForward (vdesktop);
if ( ! scrollTermForward() )
putArea (getTermPos(), vdesktop);
}
setAreaCursor (1, getPrintPos().getY(), true, vdesktop); setAreaCursor (1, getPrintPos().getY(), true, vdesktop);
} }

View File

@ -67,7 +67,6 @@ Transparent::~Transparent()
void Transparent::draw() void Transparent::draw()
{ {
FDialog::draw(); FDialog::draw();
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -106,8 +105,6 @@ void Transparent::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -188,19 +185,16 @@ MainWindow::MainWindow (FWidget* parent)
transpwin->setText("transparent"); transpwin->setText("transparent");
transpwin->setGeometry (6, 3, 29, 12); transpwin->setGeometry (6, 3, 29, 12);
transpwin->unsetTransparentShadow(); transpwin->unsetTransparentShadow();
transpwin->show();
Transparent* shadowwin = new Transparent(this, Transparent::shadow); Transparent* shadowwin = new Transparent(this, Transparent::shadow);
shadowwin->setText("shadow"); shadowwin->setText("shadow");
shadowwin->setGeometry (46, 11, 29, 12); shadowwin->setGeometry (46, 11, 29, 12);
shadowwin->unsetTransparentShadow(); shadowwin->unsetTransparentShadow();
shadowwin->show();
Transparent* ibg = new Transparent(this, Transparent::inherit_background); Transparent* ibg = new Transparent(this, Transparent::inherit_background);
ibg->setText("inherit background"); ibg->setText("inherit background");
ibg->setGeometry (42, 3, 29, 7); ibg->setGeometry (42, 3, 29, 7);
ibg->unsetTransparentShadow(); ibg->unsetTransparentShadow();
ibg->show();
// Statusbar at the bottom // Statusbar at the bottom
FStatusBar* statusbar = new FStatusBar (this); FStatusBar* statusbar = new FStatusBar (this);
@ -219,7 +213,6 @@ MainWindow::~MainWindow()
void MainWindow::draw() void MainWindow::draw()
{ {
FDialog::draw(); FDialog::draw();
updateVTerm(false);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -233,7 +226,7 @@ void MainWindow::draw()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
updateVTerm(true); updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -275,8 +268,8 @@ void MainWindow::onTimer (FTimerEvent*)
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0 if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|| std::strcmp(argv[1], "-h") == 0 ) ) || std::strcmp(argv[1], "-h") == 0 ) )
{ {
std::cout << "Generic options:" << std::endl std::cout << "Generic options:" << std::endl
<< " -h, --help " << " -h, --help "

View File

@ -895,8 +895,8 @@ int main (int argc, char* argv[])
FString ver = F_VERSION; // library version FString ver = F_VERSION; // library version
FString title = "The FINAL CUT " + ver + " (C) 2016 by Markus Gans"; FString title = "The FINAL CUT " + ver + " (C) 2016 by Markus Gans";
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0 if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|| std::strcmp(argv[1], "-h") == 0 ) ) || std::strcmp(argv[1], "-h") == 0 ) )
{ {
std::cout << "Generic options:" << std::endl std::cout << "Generic options:" << std::endl
<< " -h, --help " << " -h, --help "

View File

@ -502,10 +502,10 @@ void Window::cb_next (FWidget*, void*)
next_element = dialog_list->begin(); next_element = dialog_list->begin();
next = static_cast<FDialog*>(*next_element); next = static_cast<FDialog*>(*next_element);
} while ( ! next->isEnabled() } while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| ! next->isWindowWidget() ); || ! next->isWindowWidget() );
activateWindow(next); activateWindow(next);
break; break;
@ -529,7 +529,7 @@ void Window::cb_previous (FWidget*, void*)
--iter; --iter;
if ( (*iter)->isDialogWidget() if ( (*iter)->isDialogWidget()
&& static_cast<FWindow*>(*iter)->isWindowActive() ) && static_cast<FWindow*>(*iter)->isWindowActive() )
{ {
FDialog* prev; FDialog* prev;
widgetList::const_iterator prev_element; widgetList::const_iterator prev_element;
@ -542,10 +542,10 @@ void Window::cb_previous (FWidget*, void*)
--prev_element; --prev_element;
prev = static_cast<FDialog*>(*prev_element); prev = static_cast<FDialog*>(*prev_element);
} while ( ! prev->isEnabled() } while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| ! prev->isWindowWidget() ); || ! prev->isWindowWidget() );
activateWindow(prev); activateWindow(prev);
break; break;
@ -576,8 +576,8 @@ void Window::cb_destroyWindow (FWidget*, void* data_ptr)
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0 if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|| std::strcmp(argv[1], "-h") == 0 ) ) || std::strcmp(argv[1], "-h") == 0 ) )
{ {
std::cout << "Generic options:" << std::endl std::cout << "Generic options:" << std::endl
<< " -h, --help " << " -h, --help "