2006-03-04 18:16:49 +00:00
|
|
|
#ifndef HEADER_CRT
|
|
|
|
#define HEADER_CRT
|
|
|
|
/*
|
|
|
|
htop - CRT.h
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2020-10-05 07:51:32 +00:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2006-03-04 18:16:49 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "config.h"
|
2020-09-09 19:35:15 +00:00
|
|
|
|
2020-09-12 21:25:25 +00:00
|
|
|
#include <stdbool.h>
|
2017-05-23 17:02:34 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "Macros.h"
|
|
|
|
#include "ProvideCurses.h"
|
2021-01-27 16:14:15 +00:00
|
|
|
#include "Settings.h"
|
2020-09-19 11:55:23 +00:00
|
|
|
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
typedef enum TreeStr_ {
|
|
|
|
TREE_STR_VERT,
|
|
|
|
TREE_STR_RTEE,
|
|
|
|
TREE_STR_BEND,
|
|
|
|
TREE_STR_TEND,
|
|
|
|
TREE_STR_OPEN,
|
|
|
|
TREE_STR_SHUT,
|
2020-12-28 19:41:33 +00:00
|
|
|
TREE_STR_ASC,
|
|
|
|
TREE_STR_DESC,
|
2020-12-14 14:45:48 +00:00
|
|
|
LAST_TREE_STR
|
2015-01-22 01:27:31 +00:00
|
|
|
} TreeStr;
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
typedef enum ColorScheme_ {
|
|
|
|
COLORSCHEME_DEFAULT,
|
2020-10-05 15:24:59 +00:00
|
|
|
COLORSCHEME_MONOCHROME,
|
|
|
|
COLORSCHEME_BLACKONWHITE,
|
|
|
|
COLORSCHEME_LIGHTTERMINAL,
|
|
|
|
COLORSCHEME_MIDNIGHT,
|
|
|
|
COLORSCHEME_BLACKNIGHT,
|
|
|
|
COLORSCHEME_BROKENGRAY,
|
2020-12-14 14:45:48 +00:00
|
|
|
LAST_COLORSCHEME
|
|
|
|
} ColorScheme;
|
2015-02-03 21:30:05 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
typedef enum ColorElements_ {
|
|
|
|
RESET_COLOR,
|
|
|
|
DEFAULT_COLOR,
|
|
|
|
FUNCTION_BAR,
|
|
|
|
FUNCTION_KEY,
|
|
|
|
FAILED_SEARCH,
|
2020-10-17 10:54:45 +00:00
|
|
|
FAILED_READ,
|
2020-10-05 13:14:54 +00:00
|
|
|
PAUSED,
|
2006-03-04 18:16:49 +00:00
|
|
|
PANEL_HEADER_FOCUS,
|
|
|
|
PANEL_HEADER_UNFOCUS,
|
2015-04-09 18:17:20 +00:00
|
|
|
PANEL_SELECTION_FOCUS,
|
|
|
|
PANEL_SELECTION_FOLLOW,
|
|
|
|
PANEL_SELECTION_UNFOCUS,
|
2006-03-04 18:16:49 +00:00
|
|
|
LARGE_NUMBER,
|
2021-03-28 16:18:56 +00:00
|
|
|
METER_SHADOW,
|
2006-03-04 18:16:49 +00:00
|
|
|
METER_TEXT,
|
|
|
|
METER_VALUE,
|
2020-10-20 19:40:51 +00:00
|
|
|
METER_VALUE_ERROR,
|
2020-10-16 17:44:53 +00:00
|
|
|
METER_VALUE_IOREAD,
|
|
|
|
METER_VALUE_IOWRITE,
|
2020-10-07 13:42:13 +00:00
|
|
|
METER_VALUE_NOTICE,
|
|
|
|
METER_VALUE_OK,
|
2020-12-23 19:54:03 +00:00
|
|
|
METER_VALUE_WARN,
|
2006-03-04 18:16:49 +00:00
|
|
|
LED_COLOR,
|
|
|
|
UPTIME,
|
2008-09-23 06:21:28 +00:00
|
|
|
BATTERY,
|
2006-03-04 18:16:49 +00:00
|
|
|
TASKS_RUNNING,
|
|
|
|
SWAP,
|
2021-01-07 13:38:18 +00:00
|
|
|
SWAP_CACHE,
|
2006-03-04 18:16:49 +00:00
|
|
|
PROCESS,
|
|
|
|
PROCESS_SHADOW,
|
|
|
|
PROCESS_TAG,
|
|
|
|
PROCESS_MEGABYTES,
|
2020-09-13 21:50:24 +00:00
|
|
|
PROCESS_GIGABYTES,
|
2006-03-04 18:16:49 +00:00
|
|
|
PROCESS_TREE,
|
|
|
|
PROCESS_R_STATE,
|
2014-10-14 01:30:17 +00:00
|
|
|
PROCESS_D_STATE,
|
2006-03-04 18:16:49 +00:00
|
|
|
PROCESS_BASENAME,
|
|
|
|
PROCESS_HIGH_PRIORITY,
|
|
|
|
PROCESS_LOW_PRIORITY,
|
2020-10-31 01:56:16 +00:00
|
|
|
PROCESS_NEW,
|
|
|
|
PROCESS_TOMB,
|
2008-03-08 23:39:48 +00:00
|
|
|
PROCESS_THREAD,
|
|
|
|
PROCESS_THREAD_BASENAME,
|
2020-10-17 10:54:45 +00:00
|
|
|
PROCESS_COMM,
|
|
|
|
PROCESS_THREAD_COMM,
|
2006-03-04 18:16:49 +00:00
|
|
|
BAR_BORDER,
|
|
|
|
BAR_SHADOW,
|
|
|
|
GRAPH_1,
|
|
|
|
GRAPH_2,
|
|
|
|
MEMORY_USED,
|
|
|
|
MEMORY_BUFFERS,
|
2014-04-24 16:15:52 +00:00
|
|
|
MEMORY_BUFFERS_TEXT,
|
2006-03-04 18:16:49 +00:00
|
|
|
MEMORY_CACHE,
|
2021-03-03 18:48:30 +00:00
|
|
|
MEMORY_SHARED,
|
2021-01-14 14:46:37 +00:00
|
|
|
HUGEPAGE_1,
|
|
|
|
HUGEPAGE_2,
|
|
|
|
HUGEPAGE_3,
|
|
|
|
HUGEPAGE_4,
|
2006-03-04 18:16:49 +00:00
|
|
|
LOAD,
|
|
|
|
LOAD_AVERAGE_FIFTEEN,
|
|
|
|
LOAD_AVERAGE_FIVE,
|
|
|
|
LOAD_AVERAGE_ONE,
|
2020-08-31 20:08:35 +00:00
|
|
|
CHECK_BOX,
|
2006-03-04 18:16:49 +00:00
|
|
|
CHECK_MARK,
|
|
|
|
CHECK_TEXT,
|
|
|
|
CLOCK,
|
2020-10-05 11:52:58 +00:00
|
|
|
DATE,
|
|
|
|
DATETIME,
|
2010-08-24 23:20:38 +00:00
|
|
|
HELP_BOLD,
|
2021-01-21 19:27:37 +00:00
|
|
|
HELP_SHADOW,
|
2010-08-24 23:20:38 +00:00
|
|
|
HOSTNAME,
|
2006-03-04 18:16:49 +00:00
|
|
|
CPU_NICE,
|
2014-04-24 16:15:52 +00:00
|
|
|
CPU_NICE_TEXT,
|
2006-03-04 18:16:49 +00:00
|
|
|
CPU_NORMAL,
|
2020-08-20 04:09:27 +00:00
|
|
|
CPU_SYSTEM,
|
2006-10-04 14:21:27 +00:00
|
|
|
CPU_IOWAIT,
|
|
|
|
CPU_IRQ,
|
|
|
|
CPU_SOFTIRQ,
|
2010-08-24 23:20:38 +00:00
|
|
|
CPU_STEAL,
|
|
|
|
CPU_GUEST,
|
2020-08-20 03:59:41 +00:00
|
|
|
PRESSURE_STALL_TEN,
|
|
|
|
PRESSURE_STALL_SIXTY,
|
|
|
|
PRESSURE_STALL_THREEHUNDRED,
|
2019-07-06 04:27:49 +00:00
|
|
|
ZFS_MFU,
|
|
|
|
ZFS_MRU,
|
|
|
|
ZFS_ANON,
|
|
|
|
ZFS_HEADER,
|
|
|
|
ZFS_OTHER,
|
2019-09-03 18:26:02 +00:00
|
|
|
ZFS_COMPRESSED,
|
|
|
|
ZFS_RATIO,
|
2020-09-22 11:54:15 +00:00
|
|
|
ZRAM,
|
2021-06-23 07:44:56 +00:00
|
|
|
DYNAMIC_GRAY,
|
|
|
|
DYNAMIC_DARKGRAY,
|
|
|
|
DYNAMIC_RED,
|
|
|
|
DYNAMIC_GREEN,
|
|
|
|
DYNAMIC_BLUE,
|
|
|
|
DYNAMIC_CYAN,
|
|
|
|
DYNAMIC_MAGENTA,
|
|
|
|
DYNAMIC_YELLOW,
|
|
|
|
DYNAMIC_WHITE,
|
2006-03-04 18:16:49 +00:00
|
|
|
LAST_COLORELEMENT
|
|
|
|
} ColorElements;
|
|
|
|
|
2020-09-09 19:35:15 +00:00
|
|
|
void CRT_fatalError(const char* note) ATTR_NORETURN;
|
2014-04-24 15:20:03 +00:00
|
|
|
|
2020-10-03 15:53:15 +00:00
|
|
|
void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
|
2014-11-24 20:55:03 +00:00
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
#define KEY_WHEELUP KEY_F(20)
|
|
|
|
#define KEY_WHEELDOWN KEY_F(21)
|
|
|
|
#define KEY_RECLICK KEY_F(22)
|
|
|
|
#define KEY_ALT(x) (KEY_F(64 - 26) + ((x) - 'A'))
|
2016-02-19 15:38:02 +00:00
|
|
|
|
2020-09-10 17:56:33 +00:00
|
|
|
extern const char* CRT_degreeSign;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-07-17 12:33:34 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
|
2020-08-31 20:08:35 +00:00
|
|
|
extern bool CRT_utf8;
|
2015-07-17 12:33:34 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-10-31 22:28:02 +00:00
|
|
|
extern const char* const* CRT_treeStr;
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2020-10-05 15:24:59 +00:00
|
|
|
extern const int* CRT_colors;
|
2015-02-03 21:30:05 +00:00
|
|
|
|
2011-09-08 01:10:58 +00:00
|
|
|
extern int CRT_cursorX;
|
|
|
|
|
2014-02-27 19:35:22 +00:00
|
|
|
extern int CRT_scrollHAmount;
|
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
extern int CRT_scrollWheelVAmount;
|
|
|
|
|
2020-12-14 14:45:48 +00:00
|
|
|
extern ColorScheme CRT_colorScheme;
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2021-01-27 16:14:15 +00:00
|
|
|
void CRT_init(const Settings* settings, bool allowUnicode);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-08 12:28:34 +00:00
|
|
|
void CRT_done(void);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-08 12:28:34 +00:00
|
|
|
int CRT_readKey(void);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-08 12:28:34 +00:00
|
|
|
void CRT_disableDelay(void);
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2020-09-08 12:28:34 +00:00
|
|
|
void CRT_enableDelay(void);
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void CRT_setColors(int colorScheme);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#endif
|