diff --git a/include/final/fmouse.h b/include/final/fmouse.h index cdd0f272..7a51c605 100644 --- a/include/final/fmouse.h +++ b/include/final/fmouse.h @@ -112,6 +112,7 @@ class FMouse // Mutators void setMaxWidth (short); void setMaxHeight (short); + void setDblclickInterval (const long); // Inquiries virtual bool hasData() = 0; @@ -464,6 +465,7 @@ class FMouseControl void setStdinNo (int); void setMaxWidth (short); void setMaxHeight (short); + void setDblclickInterval (const long); void useGpmMouse (bool = true); void useXtermMouse (bool = true); @@ -499,9 +501,9 @@ class FMouseControl private: // Accessor - FMouse* getMouseWithData(); - FMouse* getMouseWithEvent(); - void putstring (const char[], int = 1); + FMouse* getMouseWithData(); + FMouse* getMouseWithEvent(); + void putstring (const char[], int = 1); // Data Member std::map mouse_protocol; diff --git a/include/final/fterm.h b/include/final/fterm.h index aea2fa25..ed1a1dcc 100644 --- a/include/final/fterm.h +++ b/include/final/fterm.h @@ -580,7 +580,6 @@ class FTerm static int fd_tty; static uInt baudrate; static long key_timeout; - static long dblclick_interval; static bool resize_term; static struct termios term_init; @@ -798,10 +797,6 @@ inline void FTerm::setXTermDefaultColors (bool on) inline void FTerm::setKeypressTimeout (const long timeout) { key_timeout = timeout; } -//---------------------------------------------------------------------- -inline void FTerm::setDblclickInterval (const long timeout) -{ dblclick_interval = timeout; } - //---------------------------------------------------------------------- inline bool FTerm::setRawMode() { return setRawMode(true); } diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 86af3c1d..9f058166 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -74,8 +74,11 @@ FApplication::FApplication ( const int& _argc // Set the keyboard keypress timeout setKeypressTimeout (key_timeout); - // Set the double click interval - setDblclickInterval (dblclick_interval); + // Set the default double click interval + FMouseControl* mouse = getMouseControl(); + + if ( mouse ) + mouse->setDblclickInterval (dblclick_interval); if ( ! (_argc && _argv) ) { diff --git a/src/fmouse.cpp b/src/fmouse.cpp index 79d42698..5722adfb 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -87,6 +87,12 @@ inline void FMouse::setMaxHeight (short y_max) max_height = y_max; } +//---------------------------------------------------------------------- +inline void FMouse::setDblclickInterval (const long timeout) +{ + dblclick_interval = timeout; +} + //---------------------------------------------------------------------- inline bool FMouse::hasEvent() { @@ -1253,6 +1259,20 @@ void FMouseControl::setMaxHeight (short y_max) mouse_protocol[FMouse::urxvt]->setMaxHeight(y_max); } +//---------------------------------------------------------------------- +void FMouseControl::setDblclickInterval (const long timeout) +{ + iter = mouse_protocol.begin(); + + while ( iter != mouse_protocol.end() ) + { + if ( iter->second ) + return iter->second->setDblclickInterval(timeout); + + ++iter; + } +} + //---------------------------------------------------------------------- void FMouseControl::useGpmMouse (bool on) { diff --git a/src/fterm.cpp b/src/fterm.cpp index ec329adb..248b209e 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -58,7 +58,6 @@ int FTerm::clr_eol_length; int FTerm::cursor_addres_lengths; uInt FTerm::baudrate; long FTerm::key_timeout; -long FTerm::dblclick_interval; bool FTerm::resize_term; bool FTerm::decscusr_support; bool FTerm::terminal_detection; @@ -324,6 +323,12 @@ void FTerm::setFreeBSDConsoleCursorStyle ( fc::freebsdConsoleCursorStyle style } #endif +//---------------------------------------------------------------------- +void FTerm::setDblclickInterval (const long timeout) +{ + mouse->setDblclickInterval(timeout); +} + //---------------------------------------------------------------------- void FTerm::setTTY (const termios& t) { @@ -2523,9 +2528,6 @@ void FTerm::init_global_values() // Set default timeout for keypress key_timeout = 100000; // 100 ms - // Set the default double click interval - dblclick_interval = 500000; // 500 ms - // Preset to false utf8_console = \ utf8_input = \ @@ -3588,38 +3590,15 @@ void FTerm::init_termcaps_cygwin_quirks() // Set background color erase for cygwin terminal FTermcap::background_color_erase = true; - // Set ansi foreground and background color - if ( FTermcap::max_color > 8 ) - { - TCAP(fc::t_set_a_foreground) = \ - C_STR(CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m"); - TCAP(fc::t_set_a_background) = \ - C_STR(CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m"); - } - else - { - TCAP(fc::t_set_a_foreground) = \ - C_STR(CSI "3%p1%dm"); - TCAP(fc::t_set_a_background) = \ - C_STR(CSI "4%p1%dm"); - } - - TCAP(fc::t_orig_pair) = \ - C_STR(CSI "39;49;25m"); - - // Avoid dim + underline - TCAP(fc::t_enter_dim_mode) = 0; - TCAP(fc::t_exit_dim_mode) = 0; - TCAP(fc::t_enter_underline_mode) = 0; - TCAP(fc::t_exit_underline_mode) = 0; - FTermcap::attr_without_color = 18; + init_termcaps_linux_quirks(); } //---------------------------------------------------------------------- void FTerm::init_termcaps_linux_quirks() { - // Set ansi foreground and background color + /* Same settings are used by cygwin */ + // Set ansi foreground and background color if ( FTermcap::max_color > 8 ) { TCAP(fc::t_set_a_foreground) = \ @@ -4305,6 +4284,7 @@ void FTerm::enableMouse() bool gpm_mouse = false; bool xterm_mouse = false; +#if defined(__linux__) if ( linux_terminal && openConsole() == 0 ) { if ( isLinuxConsole() ) @@ -4312,6 +4292,7 @@ void FTerm::enableMouse() closeConsole(); } +#endif if ( TCAP(fc::t_key_mouse) && ! linux_terminal ) xterm_mouse = true;