2006-06-06 20:28:42 +00:00
|
|
|
/* Do not edit this file. It was automatically generated. */
|
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
|
2006-03-04 18:16:49 +00:00
|
|
|
Released under the GNU GPL, see the COPYING file
|
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2017-07-26 18:40:55 +00:00
|
|
|
#if HAVE_SETUID_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2017-05-23 17:02:34 +00:00
|
|
|
#define ColorIndex(i,j) ((7-i)*8+j)
|
|
|
|
|
|
|
|
#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j))
|
2006-06-06 20:28:42 +00:00
|
|
|
|
|
|
|
#define Black COLOR_BLACK
|
|
|
|
#define Red COLOR_RED
|
|
|
|
#define Green COLOR_GREEN
|
|
|
|
#define Yellow COLOR_YELLOW
|
|
|
|
#define Blue COLOR_BLUE
|
|
|
|
#define Magenta COLOR_MAGENTA
|
|
|
|
#define Cyan COLOR_CYAN
|
|
|
|
#define White COLOR_WHITE
|
|
|
|
|
2017-05-23 17:02:34 +00:00
|
|
|
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
|
2018-02-05 06:01:12 +00:00
|
|
|
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
|
2017-05-23 17:02:34 +00:00
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
#define KEY_WHEELUP KEY_F(20)
|
|
|
|
#define KEY_WHEELDOWN KEY_F(21)
|
2015-08-19 22:09:54 +00:00
|
|
|
#define KEY_RECLICK KEY_F(22)
|
2015-08-19 21:55:24 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
//#link curses
|
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include <stdbool.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
typedef enum TreeStr_ {
|
|
|
|
TREE_STR_HORZ,
|
|
|
|
TREE_STR_VERT,
|
|
|
|
TREE_STR_RTEE,
|
|
|
|
TREE_STR_BEND,
|
|
|
|
TREE_STR_TEND,
|
|
|
|
TREE_STR_OPEN,
|
|
|
|
TREE_STR_SHUT,
|
|
|
|
TREE_STR_COUNT
|
|
|
|
} TreeStr;
|
|
|
|
|
2015-02-03 21:30:05 +00:00
|
|
|
typedef enum ColorSchemes_ {
|
|
|
|
COLORSCHEME_DEFAULT = 0,
|
|
|
|
COLORSCHEME_MONOCHROME = 1,
|
|
|
|
COLORSCHEME_BLACKONWHITE = 2,
|
|
|
|
COLORSCHEME_LIGHTTERMINAL = 3,
|
|
|
|
COLORSCHEME_MIDNIGHT = 4,
|
|
|
|
COLORSCHEME_BLACKNIGHT = 5,
|
2015-04-09 18:17:20 +00:00
|
|
|
COLORSCHEME_BROKENGRAY = 6,
|
|
|
|
LAST_COLORSCHEME = 7,
|
2015-02-03 21:30:05 +00:00
|
|
|
} ColorSchemes;
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
typedef enum ColorElements_ {
|
|
|
|
RESET_COLOR,
|
|
|
|
DEFAULT_COLOR,
|
|
|
|
FUNCTION_BAR,
|
|
|
|
FUNCTION_KEY,
|
|
|
|
FAILED_SEARCH,
|
|
|
|
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,
|
|
|
|
METER_TEXT,
|
|
|
|
METER_VALUE,
|
|
|
|
LED_COLOR,
|
|
|
|
UPTIME,
|
2008-09-23 06:21:28 +00:00
|
|
|
BATTERY,
|
2006-03-04 18:16:49 +00:00
|
|
|
TASKS_RUNNING,
|
|
|
|
SWAP,
|
|
|
|
PROCESS,
|
|
|
|
PROCESS_SHADOW,
|
|
|
|
PROCESS_TAG,
|
|
|
|
PROCESS_MEGABYTES,
|
|
|
|
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,
|
2008-03-08 23:39:48 +00:00
|
|
|
PROCESS_THREAD,
|
|
|
|
PROCESS_THREAD_BASENAME,
|
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,
|
|
|
|
LOAD,
|
|
|
|
LOAD_AVERAGE_FIFTEEN,
|
|
|
|
LOAD_AVERAGE_FIVE,
|
|
|
|
LOAD_AVERAGE_ONE,
|
|
|
|
CHECK_BOX,
|
|
|
|
CHECK_MARK,
|
|
|
|
CHECK_TEXT,
|
|
|
|
CLOCK,
|
2010-08-24 23:20:38 +00:00
|
|
|
HELP_BOLD,
|
|
|
|
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,
|
2006-03-04 18:16:49 +00:00
|
|
|
LAST_COLORELEMENT
|
|
|
|
} ColorElements;
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
2014-04-24 15:20:03 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_handleSIGSEGV(int sgn);
|
2014-11-24 20:55:03 +00:00
|
|
|
|
2016-03-09 02:16:34 +00:00
|
|
|
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
2016-02-19 15:38:02 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
extern const char *CRT_treeStrAscii[TREE_STR_COUNT];
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-07-17 12:33:34 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
extern const char *CRT_treeStrUtf8[TREE_STR_COUNT];
|
|
|
|
|
2015-07-17 12:33:34 +00:00
|
|
|
extern bool CRT_utf8;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
extern const char **CRT_treeStr;
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2015-02-04 13:41:18 +00:00
|
|
|
extern int CRT_delay;
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern int* CRT_colors;
|
2015-02-03 21:30:05 +00:00
|
|
|
|
|
|
|
extern int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT];
|
2006-06-06 20:28:42 +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-07-10 00:35:32 +00:00
|
|
|
extern char* CRT_termType;
|
2006-07-23 22:45:24 +00:00
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
// TODO move color scheme to Settings, perhaps?
|
|
|
|
|
|
|
|
extern int CRT_colorScheme;
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void *backtraceArray[128];
|
2010-08-24 23:20:38 +00:00
|
|
|
|
2017-07-26 18:40:55 +00:00
|
|
|
#if HAVE_SETUID_ENABLED
|
|
|
|
|
|
|
|
#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0)
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_dropPrivileges();
|
2017-07-26 18:40:55 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_restorePrivileges();
|
2017-07-26 18:40:55 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Turn setuid operations into NOPs */
|
|
|
|
|
|
|
|
#ifndef CRT_dropPrivileges
|
|
|
|
#define CRT_dropPrivileges()
|
|
|
|
#define CRT_restorePrivileges()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-06-06 20:28:42 +00:00
|
|
|
// TODO: pass an instance of Settings instead.
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_init(int delay, int colorScheme);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_done();
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_fatalError(const char* note);
|
2012-10-19 18:59:48 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern int CRT_readKey();
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_disableDelay();
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_enableDelay();
|
2006-06-06 20:28:42 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_setColors(int colorScheme);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#endif
|