macOS build fix

This commit is contained in:
Markus Gans 2018-01-16 16:16:29 +01:00
parent 460dff3291
commit 2d9103c102
5 changed files with 41 additions and 40 deletions

View File

@ -112,6 +112,7 @@ class FMouse
// Mutators // Mutators
void setMaxWidth (short); void setMaxWidth (short);
void setMaxHeight (short); void setMaxHeight (short);
void setDblclickInterval (const long);
// Inquiries // Inquiries
virtual bool hasData() = 0; virtual bool hasData() = 0;
@ -464,6 +465,7 @@ class FMouseControl
void setStdinNo (int); void setStdinNo (int);
void setMaxWidth (short); void setMaxWidth (short);
void setMaxHeight (short); void setMaxHeight (short);
void setDblclickInterval (const long);
void useGpmMouse (bool = true); void useGpmMouse (bool = true);
void useXtermMouse (bool = true); void useXtermMouse (bool = true);
@ -499,9 +501,9 @@ class FMouseControl
private: private:
// Accessor // Accessor
FMouse* getMouseWithData(); FMouse* getMouseWithData();
FMouse* getMouseWithEvent(); FMouse* getMouseWithEvent();
void putstring (const char[], int = 1); void putstring (const char[], int = 1);
// Data Member // Data Member
std::map<FMouse::mouse_type, FMouse*> mouse_protocol; std::map<FMouse::mouse_type, FMouse*> mouse_protocol;

View File

@ -580,7 +580,6 @@ class FTerm
static int fd_tty; static int fd_tty;
static uInt baudrate; static uInt baudrate;
static long key_timeout; static long key_timeout;
static long dblclick_interval;
static bool resize_term; static bool resize_term;
static struct termios term_init; static struct termios term_init;
@ -798,10 +797,6 @@ inline void FTerm::setXTermDefaultColors (bool on)
inline void FTerm::setKeypressTimeout (const long timeout) inline void FTerm::setKeypressTimeout (const long timeout)
{ key_timeout = timeout; } { key_timeout = timeout; }
//----------------------------------------------------------------------
inline void FTerm::setDblclickInterval (const long timeout)
{ dblclick_interval = timeout; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::setRawMode() inline bool FTerm::setRawMode()
{ return setRawMode(true); } { return setRawMode(true); }

View File

@ -74,8 +74,11 @@ FApplication::FApplication ( const int& _argc
// Set the keyboard keypress timeout // Set the keyboard keypress timeout
setKeypressTimeout (key_timeout); setKeypressTimeout (key_timeout);
// Set the double click interval // Set the default double click interval
setDblclickInterval (dblclick_interval); FMouseControl* mouse = getMouseControl();
if ( mouse )
mouse->setDblclickInterval (dblclick_interval);
if ( ! (_argc && _argv) ) if ( ! (_argc && _argv) )
{ {

View File

@ -87,6 +87,12 @@ inline void FMouse::setMaxHeight (short y_max)
max_height = y_max; max_height = y_max;
} }
//----------------------------------------------------------------------
inline void FMouse::setDblclickInterval (const long timeout)
{
dblclick_interval = timeout;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMouse::hasEvent() inline bool FMouse::hasEvent()
{ {
@ -1253,6 +1259,20 @@ void FMouseControl::setMaxHeight (short y_max)
mouse_protocol[FMouse::urxvt]->setMaxHeight(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) void FMouseControl::useGpmMouse (bool on)
{ {

View File

@ -58,7 +58,6 @@ int FTerm::clr_eol_length;
int FTerm::cursor_addres_lengths; int FTerm::cursor_addres_lengths;
uInt FTerm::baudrate; uInt FTerm::baudrate;
long FTerm::key_timeout; long FTerm::key_timeout;
long FTerm::dblclick_interval;
bool FTerm::resize_term; bool FTerm::resize_term;
bool FTerm::decscusr_support; bool FTerm::decscusr_support;
bool FTerm::terminal_detection; bool FTerm::terminal_detection;
@ -324,6 +323,12 @@ void FTerm::setFreeBSDConsoleCursorStyle ( fc::freebsdConsoleCursorStyle style
} }
#endif #endif
//----------------------------------------------------------------------
void FTerm::setDblclickInterval (const long timeout)
{
mouse->setDblclickInterval(timeout);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setTTY (const termios& t) void FTerm::setTTY (const termios& t)
{ {
@ -2523,9 +2528,6 @@ void FTerm::init_global_values()
// Set default timeout for keypress // Set default timeout for keypress
key_timeout = 100000; // 100 ms key_timeout = 100000; // 100 ms
// Set the default double click interval
dblclick_interval = 500000; // 500 ms
// Preset to false // Preset to false
utf8_console = \ utf8_console = \
utf8_input = \ utf8_input = \
@ -3588,38 +3590,15 @@ void FTerm::init_termcaps_cygwin_quirks()
// Set background color erase for cygwin terminal // Set background color erase for cygwin terminal
FTermcap::background_color_erase = true; FTermcap::background_color_erase = true;
// Set ansi foreground and background color init_termcaps_linux_quirks();
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;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::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 ) if ( FTermcap::max_color > 8 )
{ {
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = \
@ -4305,6 +4284,7 @@ void FTerm::enableMouse()
bool gpm_mouse = false; bool gpm_mouse = false;
bool xterm_mouse = false; bool xterm_mouse = false;
#if defined(__linux__)
if ( linux_terminal && openConsole() == 0 ) if ( linux_terminal && openConsole() == 0 )
{ {
if ( isLinuxConsole() ) if ( isLinuxConsole() )
@ -4312,6 +4292,7 @@ void FTerm::enableMouse()
closeConsole(); closeConsole();
} }
#endif
if ( TCAP(fc::t_key_mouse) && ! linux_terminal ) if ( TCAP(fc::t_key_mouse) && ! linux_terminal )
xterm_mouse = true; xterm_mouse = true;