34 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 35 #error "Only <final/final.h> can be included directly." 38 #if defined(__linux__) 41 #if defined(__arm__) && defined(__GLIBC__) && defined(__GLIBC_PREREQ) 43 #if !__GLIBC_PREREQ(2,30) 44 #define ARM_ISA_SYSCTL 48 #if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL) 49 #define ISA_SYSCTL_SUPPORT 51 #endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL) 56 struct console_font_op;
58 #endif // defined(__linux__) 60 #include <sys/ioctl.h> 66 #include <unordered_map> 70 #include "final/output/tty/ftermcap.h" 71 #include "final/output/tty/ftermdata.h" 72 #include "final/util/fstring.h" 85 using CursorStyle = LinuxConsoleCursorStyle;
106 auto getClassName()
const ->
FString;
108 auto getCursorStyle()
const -> CursorStyle;
110 auto getFramebufferBpp()
const noexcept -> int;
113 auto setCursorStyle (CursorStyle) -> bool;
114 auto setPalette (FColor,
int,
int,
int) -> bool;
115 void setUTF8 (
bool =
true)
const;
118 static auto isLinuxConsole() -> bool;
119 auto isVGAFontUsed()
const noexcept -> bool;
120 auto isNewFontUsed()
const noexcept -> bool;
124 void initCharMap()
const;
126 auto loadVGAFont() -> bool;
127 auto loadNewFont() -> bool;
128 auto loadOldFont() -> bool;
129 auto saveColorMap() -> bool;
130 auto resetColorMap() -> bool;
131 void setBeep (
int,
int)
const;
132 void resetBeep()
const;
133 auto modifierKeyCorrection (
const FKey&) -> FKey;
145 struct ModifierKeyHash
147 auto operator () (
const ModifierKey& m_key)
const noexcept -> std::size_t
150 std::memcpy(&m, &m_key,
sizeof(uChar));
151 return std::hash<uChar>{}(m);
164 std::array<RGB, 16> color;
169 ModifierKey modifier;
175 auto operator () (
const Pair& pair)
const noexcept -> std::size_t
178 const auto hash1 = ModifierKeyHash{}(pair.modifier);
180 seed ^= hash1 + 0x9e3779b9 + (seed << 6u) + (seed >> 2u);
181 seed ^= hash2 + 0x9e3779b9 + (seed << 6u) + (seed >> 2u);
188 auto operator () (
const Pair& lhs,
const Pair& rhs)
const noexcept ->
bool 190 return std::memcmp(&lhs.modifier, &rhs.modifier,
sizeof(ModifierKey)) == 0
191 && lhs.key == rhs.key;
196 using KeyMap = std::unordered_map<Pair, FKey, PairHash, PairEqual>;
197 using FontData = std::vector<uChar>;
198 using UnicodeEntries = std::vector<struct unipair>;
201 auto getFramebuffer_bpp()
const -> int;
202 auto getScreenFont() -> bool;
203 auto getUnicodeMap () -> bool;
204 auto getModifierKey() & -> ModifierKey&;
207 auto isLinuxTerm()
const -> bool;
210 auto setScreenFont (
const uChar[], uInt, uInt, uInt
211 ,
bool =
false ) -> int;
212 auto setUnicodeMap (
struct unimapdesc*)
const -> int;
213 void setLinuxCursorStyle (LinuxConsoleCursorStyle)
const;
216 #if defined(ISA_SYSCTL_SUPPORT) 217 auto getInputStatusRegisterOne()
const -> uInt16;
218 auto readAttributeController (uChar)
const -> uChar;
219 void writeAttributeController (uChar, uChar)
const;
220 auto getAttributeMode()
const -> uChar;
221 void setAttributeMode (uChar)
const;
222 auto setBlinkAsIntensity (
bool =
true)
const -> int;
223 auto has9BitCharacters()
const -> bool;
224 void getVGAPalette();
225 void setVGADefaultPalette();
226 auto setVGAPalette (FColor,
int,
int,
int) -> bool;
227 auto saveVGAPalette() -> bool;
228 auto resetVGAPalette() -> bool;
229 #endif // defined(ISA_SYSCTL_SUPPORT) 231 void keyCorrection();
232 void shiftKeyCorrection();
233 void ctrlKeyCorrection();
234 void altKeyCorrection();
235 void shiftCtrlKeyCorrection();
236 void shiftAltKeyCorrection();
237 void ctrlAltKeyCorrection();
238 void shiftCtrlAltKeyCorrection();
239 void initSpecialCharacter()
const;
240 auto getFontPos (
wchar_t ucs)
const -> sInt16;
241 void deleteFontData (console_font_op&);
242 void deleteUnicodeMapEntries (unimapdesc&);
243 void characterFallback (
wchar_t,
const std::vector<wchar_t>&)
const;
246 #if defined(__linux__) 249 bool has_saved_palette{};
250 int framebuffer_bpp{-1};
251 CursorStyle linux_console_cursor_style{};
252 console_font_op screen_font{};
253 unimapdesc screen_unicode_map{};
254 FontData font_data{};
255 FontData screen_font_data{};
256 UnicodeEntries unicode_entries{};
257 ColorMap saved_color_map{};
260 ModifierKey mod_key{};
261 #endif // defined(__linux__) 267 inline auto FTermLinux::getClassName()
const ->
FString 268 {
return "FTermLinux"; }
271 #if defined(__linux__) 272 inline auto FTermLinux::getFramebufferBpp()
const noexcept ->
int 273 {
return framebuffer_bpp; }
276 inline auto FTermLinux::isVGAFontUsed()
const noexcept ->
bool 280 inline auto FTermLinux::isNewFontUsed()
const noexcept ->
bool 282 #endif // defined(__linux__) 286 #endif // FTERMLINUX_H Definition: ftermcap.h:72
Definition: ftermlinux.h:81
Definition: class_template.cpp:25