Linux functions from FTerm moved into the FTermLinux class

This commit is contained in:
Markus Gans 2018-06-12 16:37:48 +02:00
parent 4b82af367f
commit 231c30f740
20 changed files with 1719 additions and 1277 deletions

View File

@ -1,3 +1,6 @@
2017-06-12 Markus Gans <guru.mail@muenster.de>
* Linux functions from FTerm moved into the FTermLinux class
2017-05-27 Markus Gans <guru.mail@muenster.de>
* Move FreeBSD, NetBSD and OpenBSD functions to separate classes

View File

@ -151,18 +151,6 @@ class FApplication : public FWidget
bool sendKeyUpEvent (FWidget*);
void sendKeyboardAccelerator();
void processKeyboardEvent();
#if defined(__linux__)
static int linuxShiftKeyCorrection (const int&);
static int linuxCtrlKeyCorrection (const int&);
static int linuxAltKeyCorrection (const int&);
static int linuxShiftCtrlKeyCorrection (const int&);
static int linuxShiftAltKeyCorrection (const int&);
static int linuxCtrlAltKeyCorrection (const int&);
static int linuxShiftCtrlAltKeyCorrection (const int&);
static int linuxModifierKeyCorrection (const int&);
#endif
bool processDialogSwitchAccelerator();
bool processAccelerator (const FWidget*&);
bool getMouseEvent();

View File

@ -43,6 +43,18 @@
* :- - - - FTermXTerminal
* :
* :
* : 1
* :- - - - FTermLinux
* :
* :
* : 1
* :- - - - FTermFreeBSD
* :
* :
* : 1
* :- - - - FTermOpenBSD
* :
* :
* : 1
* :- - - - FColorPalette
* :
@ -77,16 +89,6 @@
#include "final/fconfig.h"
#if defined(__linux__)
#include <linux/fb.h> // Linux framebuffer console
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#include <sys/io.h> // <asm/io.h> is deprecated
#endif
#include <sys/kd.h>
#endif
#include <sys/ioctl.h>
#include <sys/stat.h>
@ -137,6 +139,10 @@
#include "final/ftermcapquirks.h"
#include "final/ftermdetection.h"
#if defined(__linux__)
#include "final/ftermlinux.h"
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include "final/ftermfreebsd.h"
#endif
@ -162,17 +168,6 @@ class FTerm
// Typedefs
typedef FOptiAttr::char_data char_data;
#if defined(__linux__)
static struct modifier_key // bit field
{
uChar shift : 1; // 0..1
uChar alt_gr : 1; // 0..1
uChar ctrl : 1; // 0..1
uChar alt : 1; // 0..1
uChar : 4; // padding bits
} mod_key;
#endif
// Constructor
explicit FTerm (bool = false);
@ -182,24 +177,17 @@ class FTerm
// Accessors
virtual const char* getClassName() const;
static termios getTTY();
static int getTTYFileDescriptor();
static int getLineNumber();
static int getColumnNumber();
static const FString getKeyName (int);
static FMouseControl* getMouseControl();
#if defined(__linux__)
static modifier_key& getLinuxModifierKey();
#endif
static char* getTermType();
static char* getTermFileName();
static int getTabstop();
static int getMaxColor();
#if defined(__linux__)
static fc::linuxConsoleCursorStyle getLinuxConsoleCursorStyle();
#endif
#if DEBUG
static const FString& getAnswerbackString();
static const FString& getSecDAString();
@ -249,12 +237,6 @@ class FTerm
static void unsetInsertCursor();
static bool setCursorOptimisation (bool);
static void redefineDefaultColors (bool);
#if defined(__linux__)
static char* setLinuxConsoleCursorStyle \
(fc::linuxConsoleCursorStyle, bool);
#endif
static void setKeypressTimeout (const long);
static void setDblclickInterval (const long);
static void disableAltScreen();
@ -267,10 +249,13 @@ class FTerm
// Methods
static int parseKeyString (char[], int, timeval*);
static int keyCorrection (const int&);
static bool& unprocessedInput();
static bool setVGAFont();
static bool setNewFont();
static bool setOldFont();
static int openConsole();
static int closeConsole();
static char* moveCursor (int, int, int, int);
static char* cursorsVisibility (bool);
static void printMoveDurations();
@ -290,6 +275,9 @@ class FTerm
static void setEncoding (fc::encoding);
static fc::encoding getEncoding();
static std::string getEncodingString();
static bool charEncodable (uInt);
static uInt charEncode (uInt);
static uInt charEncode (uInt, fc::encoding);
static bool scrollTermForward();
static bool scrollTermReverse();
@ -334,9 +322,6 @@ class FTerm
// Methods
static void initScreenSettings();
static bool charEncodable (uInt);
static uInt charEncode (uInt);
static uInt charEncode (uInt, fc::encoding);
static char* changeAttribute ( char_data*&
, char_data*& );
static void changeTermSizeFinished();
@ -372,13 +357,6 @@ class FTerm
// Typedefs
typedef FTermcap::tcap_map termcap_map;
typedef struct
{
uChar red;
uChar green;
uChar blue;
} dacreg;
// Constants
static const int NEED_MORE_DATA = -1; // parseKeyString return value
@ -387,36 +365,7 @@ class FTerm
// Disable assignment operator (=)
FTerm& operator = (const FTerm&);
#if defined(__linux__)
static int isLinuxConsole();
#endif
// Methods
#if defined(__linux__)
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
static uInt16 getInputStatusRegisterOne();
static uChar readAttributeController (uChar);
static void writeAttributeController (uChar, uChar);
static uChar getAttributeMode();
static void setAttributeMode (uChar);
static int setBlinkAsIntensity (bool);
#endif
static int getFramebuffer_bpp();
#endif
static int openConsole();
static int closeConsole();
#if defined(__linux__)
static int getScreenFont();
static int setScreenFont ( uChar[], uInt, uInt, uInt
, bool = false );
static int setUnicodeMap (struct unimapdesc*);
static int getUnicodeMap ();
static void initLinuxConsole();
static void initLinuxConsoleCharMap();
#endif
static void init_global_values();
static void oscPrefix();
static void oscPostfix();
@ -519,6 +468,11 @@ class FTerm
static FTermDetection* term_detection;
static FTermXTerminal* xterm;
#if defined(__linux__)
#undef linux
static FTermLinux* linux;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
static FTermFreeBSD* freebsd;
#endif
@ -530,45 +484,6 @@ class FTerm
static FMouseControl* mouse;
static const FString* save_xterm_font;
static const FString* save_xterm_title;
static struct colorEnv
{
void setDefault()
{
string1 = 0;
string2 = 0;
string3 = 0;
string4 = 0;
string5 = 0;
string6 = 0;
}
char* string1;
char* string2;
char* string3;
char* string4;
char* string5;
char* string6;
} color_env;
static struct secondaryDA
{
void setDefault()
{
terminal_id_type = -1;
terminal_id_version = -1;
terminal_id_hardware = -1;
}
int terminal_id_type;
int terminal_id_version;
int terminal_id_hardware;
} secondary_da;
struct
{
dacreg d[16];
} color_map;
};
#pragma pack(pop)
@ -578,6 +493,10 @@ class FTerm
inline const char* FTerm::getClassName() const
{ return "FTerm"; }
//----------------------------------------------------------------------
inline int FTerm::getTTYFileDescriptor()
{ return fd_tty; }
//----------------------------------------------------------------------
inline char* FTerm::getTermType()
{ return termtype; }

View File

@ -65,8 +65,6 @@ class FTermFreeBSD
// Destructor
~FTermFreeBSD();
// Overloaded operators
// Accessors
static CursorStyle getCursorStyle();
@ -75,9 +73,10 @@ class FTermFreeBSD
// Mutators
static void setCursorStyle (CursorStyle, bool);
// Methods
static void init();
static void initCharMap();
static void initCharMap (uInt[][fc::NUM_OF_ENCODINGS]);
static void finish();
static void restoreCursorStyle();

View File

@ -64,22 +64,22 @@ class FTermios
static int getStdOut();
// Inquiries
static bool isRaw();
static bool isRaw();
// Methods
static void init();
static void setTTY (const termios&);
static void storeTTYsettings();
static void restoreTTYsettings();
static void setHardwareEcho();
static void unsetHardwareEcho();
static void setCaptureSendCharacters();
static void unsetCaptureSendCharacters();
static bool setRawMode (bool);
static bool setRawMode();
static bool unsetRawMode();
static bool setCookedMode();
static uInt getBaudRate();
static void init();
static void setTTY (const termios&);
static void storeTTYsettings();
static void restoreTTYsettings();
static void setHardwareEcho();
static void unsetHardwareEcho();
static void setCaptureSendCharacters();
static void unsetCaptureSendCharacters();
static bool setRawMode (bool);
static bool setRawMode();
static bool unsetRawMode();
static bool setCookedMode();
static uInt getBaudRate();
private:
// Data Members

213
include/final/ftermlinux.h Normal file
View File

@ -0,0 +1,213 @@
/***********************************************************************
* ftermlinux.h - Contains the Linux terminal functions *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
/* Standalone class
*
*
*
* FTermLinux
*
*/
#ifndef FTERMLINUX_H
#define FTERMLINUX_H
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
#error "Only <final/final.h> can be included directly."
#endif
#if defined(__linux__)
#include <linux/fb.h> // Linux framebuffer console
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#include <sys/io.h> // <asm/io.h> is deprecated
#endif
#include <sys/kd.h>
#endif
#include <sys/ioctl.h>
#include <unistd.h>
#include <cstdio> // need for sprintf
#include <cstring>
#include "final/fc.h"
#include "final/fcharmap.h"
#include "final/ftermdetection.h"
#include "final/ftypes.h"
//----------------------------------------------------------------------
// class FTermLinux
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FTermLinux
{
public:
// Constructors
FTermLinux();
// Destructor
~FTermLinux();
// Accessors
static fc::linuxConsoleCursorStyle getCursorStyle();
static int getFramebufferBpp();
// Mutators
static void setFTermDetection (FTermDetection*);
static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool);
static bool setPalette (short, int, int, int);
static void setUTF8 (bool);
// Inquiries
static bool isLinuxConsole();
static bool hasShadowCharacter();
static bool hasHalfBlockCharacter();
static bool isVGAFontUsed();
static bool isNewFontUsed();
// Methods
static void init();
static void initCharMap (uInt[][fc::NUM_OF_ENCODINGS]);
static void finish();
static bool loadVGAFont();
static bool loadNewFont();
static bool loadOldFont (uInt[][fc::NUM_OF_ENCODINGS]);
static bool saveColorMap();
static bool resetColorMap();
static void setBeep (int, int);
static void resetBeep();
static char* restoreCursorStyle();
static int modifierKeyCorrection (const int&);
private:
// Typedef
static struct modifier_key // bit field
{
uChar shift : 1; // 0..1
uChar alt_gr : 1; // 0..1
uChar ctrl : 1; // 0..1
uChar alt : 1; // 0..1
uChar : 4; // padding bits
} mod_key;
typedef struct
{
uChar red;
uChar green;
uChar blue;
} rgb;
typedef struct
{
rgb color[16];
} ColorMap;
// Disable copy constructor
FTermLinux (const FTermLinux&);
// Disable assignment operator (=)
FTermLinux& operator = (const FTermLinux&);
// Accessors
static int getFramebuffer_bpp();
static bool getScreenFont();
static bool getUnicodeMap ();
static modifier_key& getModifierKey();
// Mutators
static int setScreenFont ( uChar[], uInt, uInt, uInt
, bool = false );
static int setUnicodeMap (struct unimapdesc*);
// Methods
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
static uInt16 getInputStatusRegisterOne();
static uChar readAttributeController (uChar);
static void writeAttributeController (uChar, uChar);
static uChar getAttributeMode();
static void setAttributeMode (uChar);
static int setBlinkAsIntensity (bool);
static bool setVGAPalette (short, int, int, int);
static bool saveVGAPalette();
static bool resetVGAPalette();
#endif
static int shiftKeyCorrection (const int&);
static int ctrlKeyCorrection (const int&);
static int altKeyCorrection (const int&);
static int shiftCtrlKeyCorrection (const int&);
static int shiftAltKeyCorrection (const int&);
static int ctrlAltKeyCorrection (const int&);
static int shiftCtrlAltKeyCorrection (const int&);
// Data Members
#if defined(__linux__)
static bool VGAFont;
static bool NewFont;
static bool shadow_character;
static bool half_block_character;
static bool has_saved_palette;
static FTermDetection* term_detection;
static fc::linuxConsoleCursorStyle
linux_console_cursor_style;
static console_font_op screen_font;
static unimapdesc screen_unicode_map;
static ColorMap saved_color_map;
static ColorMap cmap;
#if DEBUG
static int framebuffer_bpp;
#endif
#endif // defined(__linux__)
};
#pragma pack(pop)
// FTermLinux inline functions
//----------------------------------------------------------------------
inline int FTermLinux::getFramebufferBpp()
{ return framebuffer_bpp; }
//----------------------------------------------------------------------
inline void FTermLinux::setFTermDetection (FTermDetection* td)
{ term_detection = td; }
//----------------------------------------------------------------------
inline bool FTermLinux::hasShadowCharacter()
{ return shadow_character; }
//----------------------------------------------------------------------
inline bool FTermLinux::hasHalfBlockCharacter()
{ return half_block_character; }
//----------------------------------------------------------------------
inline bool FTermLinux::isVGAFontUsed()
{ return VGAFont; }
//----------------------------------------------------------------------
inline bool FTermLinux::isNewFontUsed()
{ return NewFont; }
#endif // FTERMLINUX_H

View File

@ -58,12 +58,6 @@ class FTermOpenBSD
// Destructor
~FTermOpenBSD();
// Overloaded operators
// Accessors
// Mutators
// Inquiries
static bool isWSConsConsole();
@ -91,10 +85,4 @@ class FTermOpenBSD
};
#pragma pack(pop)
// FTermOpenBSD inline functions
//----------------------------------------------------------------------
#endif // FTERMOPENBSD_H

View File

@ -44,6 +44,7 @@ libfinal_la_SOURCES = \
ftermxterminal.cpp \
ftermfreebsd.cpp \
ftermopenbsd.cpp \
ftermlinux.cpp \
ftermdetection.cpp \
ftermios.cpp \
fterm.cpp \
@ -110,6 +111,7 @@ finalcutinclude_HEADERS = \
../include/final/ftermxterminal.h \
../include/final/ftermfreebsd.h \
../include/final/ftermopenbsd.h \
../include/final/ftermlinux.h \
../include/final/ftermdetection.h \
../include/final/ftermios.h \
../include/final/fterm.h \

View File

@ -50,6 +50,7 @@ INCLUDE_HEADERS = \
ftermxterminal.h \
ftermfreebsd.h \
ftermopenbsd.h \
ftermlinux.h \
fvterm.h \
ftextview.h \
ftogglebutton.h \
@ -107,6 +108,7 @@ OBJS = \
ftermxterminal.o \
ftermfreebsd.o \
ftermopenbsd.o \
ftermlinux.o \
fvterm.o \
fevent.o \
foptiattr.o \

View File

@ -50,6 +50,7 @@ INCLUDE_HEADERS = \
ftermxterminal.h \
ftermfreebsd.h \
ftermopenbsd.h \
ftermlinux.h \
fvterm.h \
ftextview.h \
ftogglebutton.h \
@ -107,6 +108,7 @@ OBJS = \
ftermxterminal.o \
ftermfreebsd.o \
ftermopenbsd.o \
ftermlinux.o \
fvterm.o \
fevent.o \
foptiattr.o \

View File

@ -137,10 +137,10 @@ am_libfinal_la_OBJECTS = fstring.lo fpoint.lo frect.lo fscrollbar.lo \
fcheckmenuitem.lo fmenulist.lo fdialog.lo fscrollview.lo \
fwindow.lo fmessagebox.lo ftooltip.lo ffiledialog.lo \
ftextview.lo fstatusbar.lo ftermcapquirks.lo ftermxterminal.lo \
ftermfreebsd.lo ftermopenbsd.lo ftermdetection.lo ftermios.lo \
fterm.lo fvterm.lo fevent.lo foptiattr.lo foptimove.lo \
ftermbuffer.lo fapplication.lo fcolorpalette.lo \
fwidgetcolors.lo fwidget.lo fobject.lo
ftermfreebsd.lo ftermopenbsd.lo ftermlinux.lo \
ftermdetection.lo ftermios.lo fterm.lo fvterm.lo fevent.lo \
foptiattr.lo foptimove.lo ftermbuffer.lo fapplication.lo \
fcolorpalette.lo fwidgetcolors.lo fwidget.lo fobject.lo
libfinal_la_OBJECTS = $(am_libfinal_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -418,6 +418,7 @@ libfinal_la_SOURCES = \
ftermxterminal.cpp \
ftermfreebsd.cpp \
ftermopenbsd.cpp \
ftermlinux.cpp \
ftermdetection.cpp \
ftermios.cpp \
fterm.cpp \
@ -482,6 +483,7 @@ finalcutinclude_HEADERS = \
../include/final/ftermxterminal.h \
../include/final/ftermfreebsd.h \
../include/final/ftermopenbsd.h \
../include/final/ftermlinux.h \
../include/final/ftermdetection.h \
../include/final/ftermios.h \
../include/final/fterm.h \
@ -611,6 +613,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermdetection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermfreebsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermios.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermlinux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermopenbsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftermxterminal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftextview.Plo@am__quote@

View File

@ -562,6 +562,7 @@ inline void FApplication::parseKeyPuffer (FWidget* widget)
&& key != NEED_MORE_DATA )
{
key = FTerm::parseKeyString(fifo_buf, fifo_buf_size, &time_keypressed);
key = keyCorrection(key);
if ( key != NEED_MORE_DATA )
performKeyboardAction (widget);
@ -580,10 +581,6 @@ inline void FApplication::parseKeyPuffer (FWidget* widget)
//----------------------------------------------------------------------
inline void FApplication::performKeyboardAction (FWidget* widget)
{
#if defined(__linux__)
key = linuxModifierKeyCorrection (key);
#endif
switch ( key )
{
case fc::Fckey_l: // Ctrl-L (redraw the screen)
@ -716,331 +713,6 @@ void FApplication::processKeyboardEvent()
sendEscapeKeyPressEvent (widget);
}
#if defined(__linux__)
//----------------------------------------------------------------------
int FApplication::linuxShiftKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fkey_sr; // Shift+Up
case fc::Fkey_down:
return fc::Fkey_sf; // Shift+Down
case fc::Fkey_left:
return fc::Fkey_sleft; // Shift+Left
case fc::Fkey_right:
return fc::Fkey_sright; // Shift+Right
case fc::Fkey_ic:
return fc::Fkey_sic; // Shift+Ins
case fc::Fkey_dc:
return fc::Fkey_sdc; // Shift+Del
case fc::Fkey_home:
return fc::Fkey_shome; // Shift+Home
case fc::Fkey_end:
return fc::Fkey_send; // Shift+End
case fc::Fkey_ppage:
return fc::Fkey_sprevious; // Shift+PgUp
case fc::Fkey_npage:
return fc::Fkey_snext; // Shift+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxCtrlKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fckey_up; // Ctrl+Up
case fc::Fkey_down:
return fc::Fckey_down; // Ctrl+Down
case fc::Fkey_left:
return fc::Fckey_left; // Ctrl+Left
case fc::Fkey_right:
return fc::Fckey_right; // Ctrl+Right
case fc::Fkey_ic:
return fc::Fckey_ic; // Ctrl+Ins
case fc::Fkey_dc:
return fc::Fckey_dc; // Ctrl+Del
case fc::Fkey_home:
return fc::Fckey_home; // Ctrl+Home
case fc::Fkey_end:
return fc::Fckey_end; // Ctrl+End
case fc::Fkey_ppage:
return fc::Fckey_ppage; // Ctrl+PgUp
case fc::Fkey_npage:
return fc::Fckey_npage; // Ctrl+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxAltKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fmkey_up; // Meta+Up
case fc::Fkey_down:
return fc::Fmkey_down; // Meta+Down
case fc::Fkey_left:
return fc::Fmkey_left; // Meta+Left
case fc::Fkey_right:
return fc::Fmkey_right; // Meta+Right
case fc::Fkey_ic:
return fc::Fmkey_ic; // Meta+Ins
case fc::Fkey_dc:
return fc::Fmkey_dc; // Meta+Del
case fc::Fkey_home:
return fc::Fmkey_home; // Meta+Home
case fc::Fkey_end:
return fc::Fmkey_end; // Meta+End
case fc::Fkey_ppage:
return fc::Fmkey_ppage; // Meta+PgUp
case fc::Fkey_npage:
return fc::Fmkey_npage; // Meta+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxShiftCtrlKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fckey_sup; // Shift+Ctrl+Up
case fc::Fkey_down:
return fc::Fckey_sdown; // Shift+Ctrl+Down
case fc::Fkey_left:
return fc::Fckey_sleft; // Shift+Ctrl+Left
case fc::Fkey_right:
return fc::Fckey_sright; // Shift+Ctrl+Right
case fc::Fkey_ic:
return fc::Fckey_sic; // Shift+Ctrl+Ins
case fc::Fkey_dc:
return fc::Fckey_sdc; // Shift+Ctrl+Del
case fc::Fkey_home:
return fc::Fckey_shome; // Shift+Ctrl+Home
case fc::Fkey_end:
return fc::Fckey_send; // Shift+Ctrl+End
case fc::Fkey_ppage:
return fc::Fckey_sppage; // Shift+Ctrl+PgUp
case fc::Fkey_npage:
return fc::Fckey_snpage; // Shift+Ctrl+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxShiftAltKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fmkey_sup; // Shift+Meta+Up
case fc::Fkey_down:
return fc::Fmkey_sdown; // Shift+Meta+Down
case fc::Fkey_left:
return fc::Fmkey_sright; // Shift+Meta+Left
case fc::Fkey_right:
return fc::Fmkey_sleft; // Shift+Meta+Right
case fc::Fkey_ic:
return fc::Fmkey_sic; // Shift+Meta+Ins
case fc::Fkey_dc:
return fc::Fmkey_sdc; // Shift+Meta+Del
case fc::Fkey_home:
return fc::Fmkey_shome; // Shift+Meta+Home
case fc::Fkey_end:
return fc::Fmkey_send; // Shift+Meta+End
case fc::Fkey_ppage:
return fc::Fmkey_sppage; // Shift+Meta+PgUp
case fc::Fkey_npage:
return fc::Fmkey_snpage; // Shift+Meta+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxCtrlAltKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fcmkey_up; // Ctrl+Meta+Up
case fc::Fkey_down:
return fc::Fcmkey_down; // Ctrl+Meta+Down
case fc::Fkey_left:
return fc::Fcmkey_left; // Ctrl+Meta+Left
case fc::Fkey_right:
return fc::Fcmkey_right; // Ctrl+Meta+Right
case fc::Fkey_ic:
return fc::Fcmkey_ic; // Ctrl+Meta+Ins
case fc::Fkey_dc:
return fc::Fcmkey_dc; // Ctrl+Meta+Del
case fc::Fkey_home:
return fc::Fcmkey_home; // Ctrl+Meta+Home
case fc::Fkey_end:
return fc::Fcmkey_end; // Ctrl+Meta+End
case fc::Fkey_ppage:
return fc::Fcmkey_ppage; // Ctrl+Meta+PgUp
case fc::Fkey_npage:
return fc::Fcmkey_npage; // Ctrl+Meta+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxShiftCtrlAltKeyCorrection (const int& key_id)
{
switch ( key_id )
{
case fc::Fkey_up:
return fc::Fcmkey_sup; // Shift+Ctrl+Meta+Up
case fc::Fkey_down:
return fc::Fcmkey_sdown; // Shift+Ctrl+Meta+Down
case fc::Fkey_left:
return fc::Fcmkey_sleft; // Shift+Ctrl+Meta+Left
case fc::Fkey_right:
return fc::Fcmkey_sright; // Shift+Ctrl+Meta+Right
case fc::Fkey_ic:
return fc::Fcmkey_sic; // Shift+Ctrl+Meta+Ins
case fc::Fkey_dc:
return fc::Fcmkey_sdc; // Shift+Ctrl+Meta+Del
case fc::Fkey_home:
return fc::Fcmkey_shome; // Shift+Ctrl+Meta+Home
case fc::Fkey_end:
return fc::Fcmkey_send; // Shift+Ctrl+Meta+End
case fc::Fkey_ppage:
return fc::Fcmkey_sppage; // Shift+Ctrl+Meta+PgUp
case fc::Fkey_npage:
return fc::Fcmkey_snpage; // Shift+Ctrl+Meta+PgDn
default:
return key_id;
}
}
//----------------------------------------------------------------------
int FApplication::linuxModifierKeyCorrection (const int& key_id)
{
// Get the current modifier key state
FTerm::modifier_key& m = getLinuxModifierKey();
if ( ! (m.shift || m.ctrl || m.alt) )
{
return key_id;
}
else if ( m.shift && ! m.ctrl && ! m.alt )
{
return linuxShiftKeyCorrection(key_id);
}
else if ( ! m.shift && m.ctrl && ! m.alt )
{
return linuxCtrlKeyCorrection(key_id);
}
else if ( ! m.shift && ! m.ctrl && m.alt )
{
return linuxAltKeyCorrection(key_id);
}
else if ( m.shift && m.ctrl && ! m.alt )
{
return linuxShiftCtrlKeyCorrection(key_id);
}
else if ( m.shift && ! m.ctrl && m.alt )
{
return linuxShiftAltKeyCorrection(key_id);
}
else if ( ! m.shift && m.ctrl && m.alt )
{
return linuxCtrlAltKeyCorrection(key_id);
}
else if ( m.shift && m.ctrl && m.alt )
{
return linuxShiftCtrlAltKeyCorrection(key_id);
}
return key_id;
}
#endif
//----------------------------------------------------------------------
bool FApplication::processDialogSwitchAccelerator()
{

View File

@ -39,6 +39,15 @@ void FColorPalette::set8ColorPalette (funcp setPalette)
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
// The same colors again...
setPalette (fc::DarkGray, 0x00, 0x00, 0x00);
setPalette (fc::LightBlue, 0x22, 0x22, 0xb2);
setPalette (fc::LightGreen, 0x18, 0x78, 0x18);
setPalette (fc::LightCyan, 0x66, 0x66, 0xff);
setPalette (fc::LightRed, 0xb2, 0x18, 0x18);
setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Yellow, 0xe8, 0x87, 0x1f);
setPalette (fc::White, 0xe0, 0xe0, 0xe0);
}
//----------------------------------------------------------------------
@ -65,15 +74,41 @@ void FColorPalette::set16ColorPalette (funcp setPalette)
//----------------------------------------------------------------------
void FColorPalette::reset8ColorPalette (funcp setPalette)
{
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x00, 0x00, 0xaa);
setPalette (fc::Green, 0x00, 0xaa, 0x00);
setPalette (fc::Cyan, 0x00, 0x55, 0xaa);
setPalette (fc::Red, 0xaa, 0x00, 0x00);
setPalette (fc::Magenta, 0xaa, 0x00, 0xaa);
setPalette (fc::Brown, 0xaa, 0xaa, 0x00);
setPalette (fc::LightGray, 0xaa, 0xaa, 0xaa);
setPalette (fc::DarkGray, 0x55, 0x55, 0x55);
setPalette (fc::LightBlue, 0x55, 0x55, 0xff);
setPalette (fc::LightGreen, 0x55, 0xff, 0x55);
setPalette (fc::LightCyan, 0x55, 0xff, 0xff);
setPalette (fc::LightRed, 0xff, 0x55, 0x55);
setPalette (fc::LightMagenta, 0xff, 0x55, 0xff);
setPalette (fc::Yellow, 0xff, 0xff, 0x55);
setPalette (fc::White, 0xff, 0xff, 0xff);
}
//----------------------------------------------------------------------
void FColorPalette::reset16ColorPalette (funcp setPalette)
{
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
setPalette (fc::LightGray, 0xb2, 0xb2, 0xb2);
setPalette (fc::DarkGray, 0x68, 0x68, 0x68);
setPalette (fc::LightBlue, 0x54, 0x54, 0xff);
setPalette (fc::LightGreen, 0x54, 0xff, 0x54);
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x00, 0x00, 0xaa);
setPalette (fc::Green, 0x00, 0xaa, 0x00);
setPalette (fc::Cyan, 0x00, 0x55, 0xaa);
setPalette (fc::Red, 0xaa, 0x00, 0x00);
setPalette (fc::Magenta, 0xaa, 0x00, 0xaa);
setPalette (fc::Brown, 0xaa, 0xaa, 0x00);
setPalette (fc::LightGray, 0xaa, 0xaa, 0xaa);
setPalette (fc::DarkGray, 0x55, 0x55, 0x55);
setPalette (fc::LightBlue, 0x55, 0x55, 0xff);
setPalette (fc::LightGreen, 0x55, 0xff, 0x55);
setPalette (fc::LightCyan, 0x55, 0xff, 0xff);
setPalette (fc::LightRed, 0xff, 0x55, 0x55);
setPalette (fc::LightMagenta, 0xff, 0x55, 0xff);
setPalette (fc::Yellow, 0xff, 0xff, 0x55);
setPalette (fc::White, 0xff, 0xff, 0xff);
}

View File

@ -260,7 +260,12 @@ void FScrollbar::drawVerticalBar()
setPrintPos (1, 1 + z);
if ( isNewFont() )
print (fc::NF_border_line_left); // ⎸
{
if ( isMonochron() || max_color < 16 )
print (fc::MediumShade); // ▒
else
print (fc::NF_border_line_left); // ⎸
}
if ( isMonochron() || max_color < 16 )
print (fc::MediumShade); // ▒
@ -293,7 +298,12 @@ void FScrollbar::drawVerticalBar()
setPrintPos (1, 1 + z);
if ( isNewFont() )
print (fc::NF_border_line_left); // ⎸
{
if ( isMonochron() || max_color < 16 )
print (fc::MediumShade); // ▒
else
print (fc::NF_border_line_left); // ⎸
}
if ( isMonochron() || max_color < 16 )
print (fc::MediumShade);
@ -318,7 +328,7 @@ void FScrollbar::drawHorizontalBar()
for (z = 0; z < slider_pos; z++)
{
if ( isNewFont() )
if ( isNewFont() && max_color > 8 )
print (fc::NF_border_line_upper); // ¯
else if ( isMonochron() || max_color < 16 )
print (fc::MediumShade); // ▒
@ -342,7 +352,7 @@ void FScrollbar::drawHorizontalBar()
for (; z <= bar_length; z++)
{
if ( isNewFont() )
if ( isNewFont() && max_color > 8 )
print (fc::NF_border_line_upper); // ¯
else if ( isMonochron() || max_color < 16 )
print (fc::MediumShade); // ▒

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,10 @@ FTermDetection::FTermDetection()
// Example: vte version 0.40.0 = 0 * 100 + 40 * 100 + 0 = 4000
// a.b.c = a * 100 + b * 100 + c
gnome_terminal_id = 0;
// Initialize the structs
color_env.setDefault();
secondary_da.setDefault();
}
//----------------------------------------------------------------------

View File

@ -99,7 +99,7 @@ void FTermFreeBSD::init()
}
//----------------------------------------------------------------------
void FTermFreeBSD::initCharMap()
void FTermFreeBSD::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
{
// A FreeBSD console can't show ASCII codes from 0x00 to 0x1b
@ -107,8 +107,8 @@ void FTermFreeBSD::initCharMap()
return;
for (int i = 0; i <= fc::lastCharItem; i++)
if ( fc::character[i][fc::PC] < 0x1c )
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
if ( char_map[i][fc::PC] < 0x1c )
char_map[i][fc::PC] = char_map[i][fc::ASCII];
}
//----------------------------------------------------------------------

1196
src/ftermlinux.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@
kbd_t FTermOpenBSD::wscons_keyboard_encoding = 0;
#endif
//----------------------------------------------------------------------
// class FTermOpenBSD
//----------------------------------------------------------------------

View File

@ -868,7 +868,7 @@ const FString* FTermXTerminal::captureXTermTitle()
//----------------------------------------------------------------------
void FTermXTerminal::enableXTermMouse()
{
// activate the xterm mouse support
// Activate the xterm mouse support
if ( mouse_support )
return;
@ -885,7 +885,7 @@ void FTermXTerminal::enableXTermMouse()
//----------------------------------------------------------------------
void FTermXTerminal::disableXTermMouse()
{
// deactivate the xterm mouse support
// Deactivate the xterm mouse support
if ( ! mouse_support )
return;
@ -902,7 +902,7 @@ void FTermXTerminal::disableXTermMouse()
//----------------------------------------------------------------------
void FTermXTerminal::enableXTermMetaSendsESC()
{
// activate the xterm meta key sends escape prefix
// Activate the xterm meta key sends escape prefix
if ( meta_sends_esc )
return;
@ -916,7 +916,7 @@ void FTermXTerminal::enableXTermMetaSendsESC()
//----------------------------------------------------------------------
void FTermXTerminal::disableXTermMetaSendsESC()
{
// deactivate the xterm meta key sends escape prefix
// Deactivate the xterm meta key sends escape prefix
if ( ! meta_sends_esc )
return;