Add the possibility to switch off the cursor optimization

This commit is contained in:
Markus Gans 2015-12-21 18:37:20 +01:00
parent a1b7e34d7d
commit 7590d2101d
4 changed files with 57 additions and 31 deletions

View File

@ -114,6 +114,7 @@ void FApplication::cmd_options ()
static struct option long_options[] = static struct option long_options[] =
{ {
{"encoding", required_argument, 0, 0 }, {"encoding", required_argument, 0, 0 },
{"no-optimized-cursor", no_argument, 0, 0 },
{"vgafont", no_argument, 0, 0 }, {"vgafont", no_argument, 0, 0 },
{"newfont", no_argument, 0, 0 }, {"newfont", no_argument, 0, 0 },
{0, 0, 0, 0 } {0, 0, 0, 0 }
@ -141,8 +142,13 @@ void FApplication::cmd_options ()
setEncoding(encoding.c_str()); setEncoding(encoding.c_str());
} }
} }
if ( strcmp(long_options[idx].name, "no-optimize-cursor") == 0 )
setCursorOptimisation (false);
if ( strcmp(long_options[idx].name, "vgafont") == 0 ) if ( strcmp(long_options[idx].name, "vgafont") == 0 )
setVGAFont(); setVGAFont();
if ( strcmp(long_options[idx].name, "newfont") == 0 ) if ( strcmp(long_options[idx].name, "newfont") == 0 )
setNewFont(); setNewFont();
} }
@ -1264,6 +1270,7 @@ void FApplication::print_cmd_Options ()
::printf("\nFinalCut Options:\n" ::printf("\nFinalCut Options:\n"
" --encoding <name> Sets the character encoding mode\n" " --encoding <name> Sets the character encoding mode\n"
" {UTF8, VT100, PC, ASCII}\n" " {UTF8, VT100, PC, ASCII}\n"
" --no-optimized-cursor No cursor optimisation\n"
" --vgafont Set the standard vga 8x16 font\n" " --vgafont Set the standard vga 8x16 font\n"
" --newfont Enables the graphical font\n"); " --newfont Enables the graphical font\n");
} }

View File

@ -8,7 +8,7 @@
// ▕ FOptiMove ▏ // ▕ FOptiMove ▏
// ▕▁▁▁▁▁▁▁▁▁▁▁▏ // ▕▁▁▁▁▁▁▁▁▁▁▁▏
// The cursor optimisation based on ncurses lib_mvcur.c // The cursor optimization based on ncurses lib_mvcur.c
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef _FOPTIMOVE_H #ifndef _FOPTIMOVE_H

View File

@ -87,6 +87,7 @@ bool FTerm::vt100_console;
bool FTerm::ascii_console; bool FTerm::ascii_console;
bool FTerm::NewFont; bool FTerm::NewFont;
bool FTerm::VGAFont; bool FTerm::VGAFont;
bool FTerm::cursor_optimisation;
uChar FTerm::x11_button_state; uChar FTerm::x11_button_state;
termios FTerm::term_init; termios FTerm::term_init;
char FTerm::termtype[30] = ""; char FTerm::termtype[30] = "";
@ -591,6 +592,9 @@ int FTerm::parseKeyString ( char* buffer
buffer[n] = '\0'; buffer[n] = '\0';
input_data_pending = bool(buffer[0] != '\0'); input_data_pending = bool(buffer[0] != '\0');
if ( key == 0 ) // Ctrl+Space or Ctrl+@
key = fc::Fckey_space;
return int(key == 127 ? fc::Fkey_backspace : key); return int(key == 127 ? fc::Fkey_backspace : key);
} }
@ -1328,6 +1332,9 @@ void FTerm::init()
tmux_terminal = \ tmux_terminal = \
background_color_erase = false; background_color_erase = false;
// Preset to true
cursor_optimisation = true;
// assertion: programm start in cooked mode // assertion: programm start in cooked mode
raw_mode = \ raw_mode = \
input_data_pending = \ input_data_pending = \
@ -2685,7 +2692,7 @@ void FTerm::updateTerminal()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setKDECursor(fc::kde_konsole_CursorShape style) void FTerm::setKDECursor (fc::kde_konsole_CursorShape style)
{ {
// Set cursor style in KDE konsole // Set cursor style in KDE konsole
if ( kde_konsole ) if ( kde_konsole )
@ -3186,7 +3193,10 @@ void FTerm::setTermXY (register int x, register int y)
if ( y >= term_height ) if ( y >= term_height )
y = term_height - 1; y = term_height - 1;
if ( cursor_optimisation )
move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y); move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y);
else
move_str = tgoto(tcap[t_cursor_address].string, x, y);
if ( move_str ) if ( move_str )
appendOutputBuffer(move_str); appendOutputBuffer(move_str);
flush_out(); flush_out();
@ -3195,7 +3205,7 @@ void FTerm::setTermXY (register int x, register int y)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setBeep(int Hz, int ms) void FTerm::setBeep (int Hz, int ms)
{ {
if ( ! linux_terminal ) if ( ! linux_terminal )
return; return;
@ -3374,7 +3384,7 @@ bool FTerm::setTermUnderline (bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::hideCursor(bool on) bool FTerm::hideCursor (bool on)
{ {
char *vi, *vs, *ve; char *vi, *vs, *ve;
@ -3424,7 +3434,7 @@ bool FTerm::isCursorInside()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setEncoding(std::string enc) void FTerm::setEncoding (std::string enc)
{ {
std::map<std::string,fc::encoding>::const_iterator it; std::map<std::string,fc::encoding>::const_iterator it;
@ -3472,7 +3482,7 @@ std::string FTerm::getEncoding()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::setPCcharset(bool on) bool FTerm::setPCcharset (bool on)
{ {
// display all CP437/VGA characters [00...ff] // display all CP437/VGA characters [00...ff]
if ( on == pc_charset_state ) if ( on == pc_charset_state )
@ -3503,7 +3513,7 @@ bool FTerm::setPCcharset(bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::setNonBlockingInput(bool on) bool FTerm::setNonBlockingInput (bool on)
{ {
if ( on == non_blocking_stdin ) if ( on == non_blocking_stdin )
return non_blocking_stdin; return non_blocking_stdin;
@ -3524,7 +3534,7 @@ bool FTerm::setNonBlockingInput(bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::setVT100altChar(bool on) bool FTerm::setVT100altChar (bool on)
{ {
if ( on == vt100_state ) if ( on == vt100_state )
return vt100_state; return vt100_state;
@ -3546,7 +3556,7 @@ bool FTerm::setVT100altChar(bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::setUTF8(bool on) // UTF-8 (Unicode) bool FTerm::setUTF8 (bool on) // UTF-8 (Unicode)
{ {
if ( on == utf8_state ) if ( on == utf8_state )
return utf8_state; return utf8_state;
@ -3568,7 +3578,7 @@ bool FTerm::setUTF8(bool on) // UTF-8 (Unicode)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::setRawMode(bool on) bool FTerm::setRawMode (bool on)
{ {
if ( on == raw_mode ) if ( on == raw_mode )
return raw_mode; return raw_mode;

View File

@ -186,6 +186,7 @@ class FTerm
static bool underline; static bool underline;
static bool NewFont; static bool NewFont;
static bool VGAFont; static bool VGAFont;
static bool cursor_optimisation;
static uInt tabstop; static uInt tabstop;
static fc::encoding Encoding; static fc::encoding Encoding;
@ -244,8 +245,8 @@ class FTerm
static uInt getBaudRate (const struct termios*); static uInt getBaudRate (const struct termios*);
static void init_consoleCharMap(); static void init_consoleCharMap();
static char* init_256colorTerminal(); static char* init_256colorTerminal();
static char* parseAnswerbackMsg(char*&); static char* parseAnswerbackMsg (char*&);
static char* parseSecDA(char*&); static char* parseSecDA (char*&);
static void init_termcaps(); static void init_termcaps();
static void init_vt100altChar(); static void init_vt100altChar();
static void init_encoding(); static void init_encoding();
@ -285,7 +286,7 @@ class FTerm
static int parseKeyString (char*, int, timeval*); static int parseKeyString (char*, int, timeval*);
int getLineNumber(); int getLineNumber();
int getColumnNumber(); int getColumnNumber();
static FString getKeyName(int); static FString getKeyName (int);
static char* getTermType(); static char* getTermType();
static char* getTermName(); static char* getTermName();
@ -301,14 +302,15 @@ class FTerm
static bool setNewFont(); static bool setNewFont();
static bool isNewFont(); static bool isNewFont();
static bool setOldFont(); static bool setOldFont();
static void setConsoleCursor(fc::console_cursor_style); static bool setCursorOptimisation (bool);
static void setConsoleCursor (fc::console_cursor_style);
static void getTermSize(); static void getTermSize();
static void setTermSize (int, int); static void setTermSize (int, int);
void createVTerm(); void createVTerm();
static void resizeVTerm(); static void resizeVTerm();
static void putVTerm(); static void putVTerm();
static void updateTerminal(); static void updateTerminal();
static void setKDECursor(fc::kde_konsole_CursorShape); static void setKDECursor (fc::kde_konsole_CursorShape);
static FString getXTermFont(); static FString getXTermFont();
static FString getXTermTitle(); static FString getXTermTitle();
static void setXTermCursorStyle (fc::xterm_cursor_style); static void setXTermCursorStyle (fc::xterm_cursor_style);
@ -344,44 +346,44 @@ class FTerm
#endif // F_HAVE_LIBGPM #endif // F_HAVE_LIBGPM
static void setTermXY (register int, register int); static void setTermXY (register int, register int);
static void setBeep(int, int); static void setBeep (int, int);
static void resetBeep(); static void resetBeep();
static void beep(); static void beep();
static bool setTermBold(bool); static bool setTermBold (bool);
static bool setTermReverse(bool); static bool setTermReverse (bool);
static bool setTermUnderline(bool); static bool setTermUnderline (bool);
static bool hideCursor(bool); static bool hideCursor (bool);
static bool hideCursor(); static bool hideCursor();
static bool showCursor(); static bool showCursor();
static bool isHiddenCursor(); static bool isHiddenCursor();
bool isCursorInside(); bool isCursorInside();
static void setEncoding(std::string); static void setEncoding (std::string);
static std::string getEncoding(); static std::string getEncoding();
static bool setPCcharset(bool); static bool setPCcharset (bool);
static bool setPCcharset(); static bool setPCcharset();
static bool unsetPCcharset(); static bool unsetPCcharset();
static bool isPCcharset(); static bool isPCcharset();
static bool setNonBlockingInput(bool); static bool setNonBlockingInput (bool);
static bool setNonBlockingInput(); static bool setNonBlockingInput();
static bool unsetNonBlockingInput(); static bool unsetNonBlockingInput();
static bool setVT100altChar(bool); static bool setVT100altChar (bool);
static bool setVT100altChar(); static bool setVT100altChar();
static bool unsetVT100altChar(); static bool unsetVT100altChar();
static bool isVT100altChar(); static bool isVT100altChar();
static bool setUTF8(bool); static bool setUTF8 (bool);
static bool setUTF8(); static bool setUTF8();
static bool unsetUTF8(); static bool unsetUTF8();
static bool isUTF8(); static bool isUTF8();
static bool isUTF8_linux_terminal(); static bool isUTF8_linux_terminal();
static bool setRawMode(bool); static bool setRawMode (bool);
static bool setRawMode(); static bool setRawMode();
static bool unsetRawMode(); static bool unsetRawMode();
static bool setCookedMode(); static bool setCookedMode();
@ -529,6 +531,13 @@ inline bool FTerm::isTeraTerm()
inline bool FTerm::isUrxvtTerminal() inline bool FTerm::isUrxvtTerminal()
{ return urxvt_terminal; } { return urxvt_terminal; }
//----------------------------------------------------------------------
inline bool FTerm::setCursorOptimisation (bool on)
{
cursor_optimisation = on;
return cursor_optimisation;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::isRaw() inline bool FTerm::isRaw()
{ return raw_mode; } { return raw_mode; }