2018-05-27 19:43:18 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* ftermfreebsd.h - Contains the FreeBSD terminal functions *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2019-01-04 02:18:54 +01:00
|
|
|
* Copyright 2018-2019 Markus Gans *
|
2018-05-27 19:43:18 +02:00
|
|
|
* *
|
|
|
|
* 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
|
|
|
|
* ════════════════
|
|
|
|
*
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FTermFreeBSD ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FTERMFREEBSD_H
|
|
|
|
#define FTERMFREEBSD_H
|
|
|
|
|
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "final/fc.h"
|
|
|
|
#include "final/ftypes.h"
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
#undef mouse_info // consio.h
|
|
|
|
#undef buttons // consio.h
|
|
|
|
|
|
|
|
#include <sys/consio.h>
|
|
|
|
#include <sys/kbio.h>
|
|
|
|
#endif
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
|
|
|
|
2018-05-27 19:43:18 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FTermFreeBSD
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
2019-01-04 02:18:54 +01:00
|
|
|
class FTermFreeBSD final
|
2018-05-27 19:43:18 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Typedef
|
|
|
|
typedef fc::freebsdConsoleCursorStyle CursorStyle;
|
|
|
|
|
|
|
|
// Constructors
|
2018-12-03 03:22:36 +01:00
|
|
|
FTermFreeBSD() = default;
|
2018-12-24 18:11:16 +01:00
|
|
|
|
2018-12-09 22:04:55 +01:00
|
|
|
// Disable copy constructor
|
|
|
|
FTermFreeBSD (const FTermFreeBSD&) = delete;
|
2018-12-24 18:11:16 +01:00
|
|
|
|
2018-05-27 19:43:18 +02:00
|
|
|
// Destructor
|
2018-12-03 03:22:36 +01:00
|
|
|
virtual ~FTermFreeBSD() = default;
|
2018-05-27 19:43:18 +02:00
|
|
|
|
2018-12-09 22:04:55 +01:00
|
|
|
// Disable assignment operator (=)
|
|
|
|
FTermFreeBSD& operator = (const FTermFreeBSD&) = delete;
|
|
|
|
|
2018-05-27 19:43:18 +02:00
|
|
|
// Accessors
|
2018-08-09 00:04:00 +02:00
|
|
|
const char* getClassName() const;
|
2018-05-27 19:43:18 +02:00
|
|
|
static CursorStyle getCursorStyle();
|
|
|
|
|
|
|
|
// Inquiry
|
|
|
|
static bool isFreeBSDConsole();
|
|
|
|
|
|
|
|
// Mutators
|
|
|
|
static void setCursorStyle (CursorStyle, bool);
|
2018-06-17 23:25:32 +02:00
|
|
|
static void enableChangeCursorStyle();
|
|
|
|
static void disableChangeCursorStyle();
|
|
|
|
static void enableMetaSendsEscape();
|
|
|
|
static void disableMetaSendsEscape();
|
2018-06-12 16:37:48 +02:00
|
|
|
|
2018-05-27 19:43:18 +02:00
|
|
|
// Methods
|
|
|
|
static void init();
|
2018-06-12 16:37:48 +02:00
|
|
|
static void initCharMap (uInt[][fc::NUM_OF_ENCODINGS]);
|
2018-05-27 19:43:18 +02:00
|
|
|
static void finish();
|
|
|
|
static void restoreCursorStyle();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Methods
|
|
|
|
static bool saveFreeBSDAltKey();
|
|
|
|
static bool setFreeBSDAltKey (uInt);
|
|
|
|
static bool setFreeBSDAlt2Meta();
|
|
|
|
static bool resetFreeBSDAlt2Meta();
|
|
|
|
|
|
|
|
// Data Members
|
|
|
|
static uInt bsd_alt_keymap;
|
|
|
|
static CursorStyle cursor_style;
|
2018-06-17 23:25:32 +02:00
|
|
|
static bool change_cursorstyle;
|
|
|
|
static bool meta_sends_escape;
|
2018-05-27 19:43:18 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2018-06-17 23:25:32 +02:00
|
|
|
// FTermFreeBSD inline functions
|
2018-08-09 00:04:00 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FTermFreeBSD::getClassName() const
|
|
|
|
{ return "FTermFreeBSD"; }
|
|
|
|
|
2018-06-17 23:25:32 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
inline void FTermFreeBSD::enableChangeCursorStyle()
|
|
|
|
{ change_cursorstyle = true; }
|
2018-05-27 19:43:18 +02:00
|
|
|
|
2018-06-17 23:25:32 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FTermFreeBSD::disableChangeCursorStyle()
|
|
|
|
{ change_cursorstyle = false; }
|
2018-05-27 19:43:18 +02:00
|
|
|
|
2018-06-17 23:25:32 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FTermFreeBSD::enableMetaSendsEscape()
|
|
|
|
{ meta_sends_escape = true; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FTermFreeBSD::disableMetaSendsEscape()
|
|
|
|
{ meta_sends_escape = false; }
|
|
|
|
#endif // defined(__FreeBSD__) || defined(__DragonFly__)
|
2018-05-27 19:43:18 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
|
|
|
|
2018-06-17 23:25:32 +02:00
|
|
|
#endif // FTERMFREEBSD_H
|