htop/CRT.h

190 lines
3.3 KiB
C
Raw Normal View History

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
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.
*/
#include "config.h"
#include <stdbool.h>
#include "Macros.h"
#include "ProvideCurses.h"
2021-01-27 16:14:15 +00:00
#include "Settings.h"
typedef enum TreeStr_ {
TREE_STR_VERT,
TREE_STR_RTEE,
TREE_STR_BEND,
TREE_STR_TEND,
TREE_STR_OPEN,
TREE_STR_SHUT,
TREE_STR_ASC,
TREE_STR_DESC,
2020-12-14 14:45:48 +00:00
LAST_TREE_STR
} 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;
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,
PANEL_SELECTION_FOCUS,
PANEL_SELECTION_FOLLOW,
PANEL_SELECTION_UNFOCUS,
2006-03-04 18:16:49 +00:00
LARGE_NUMBER,
METER_TEXT,
METER_VALUE,
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,
METER_VALUE_WARN,
2006-03-04 18:16:49 +00:00
LED_COLOR,
UPTIME,
BATTERY,
2006-03-04 18:16:49 +00:00
TASKS_RUNNING,
SWAP,
SWAP_CACHE,
2006-03-04 18:16:49 +00:00
PROCESS,
PROCESS_SHADOW,
PROCESS_TAG,
PROCESS_MEGABYTES,
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,
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,
MEMORY_BUFFERS_TEXT,
2006-03-04 18:16:49 +00:00
MEMORY_CACHE,
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,
CHECK_BOX,
2006-03-04 18:16:49 +00:00
CHECK_MARK,
CHECK_TEXT,
CLOCK,
DATE,
DATETIME,
HELP_BOLD,
HOSTNAME,
2006-03-04 18:16:49 +00:00
CPU_NICE,
CPU_NICE_TEXT,
2006-03-04 18:16:49 +00:00
CPU_NORMAL,
2020-08-20 04:09:27 +00:00
CPU_SYSTEM,
CPU_IOWAIT,
CPU_IRQ,
CPU_SOFTIRQ,
CPU_STEAL,
CPU_GUEST,
2020-08-20 03:59:41 +00:00
PRESSURE_STALL_TEN,
PRESSURE_STALL_SIXTY,
PRESSURE_STALL_THREEHUNDRED,
ZFS_MFU,
ZFS_MRU,
ZFS_ANON,
ZFS_HEADER,
ZFS_OTHER,
ZFS_COMPRESSED,
ZFS_RATIO,
2020-09-22 11:54:15 +00:00
ZRAM,
2006-03-04 18:16:49 +00:00
LAST_COLORELEMENT
} ColorElements;
void CRT_fatalError(const char* note) ATTR_NORETURN;
2014-04-24 15:20:03 +00:00
void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
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'))
extern const char* CRT_degreeSign;
2006-03-04 18:16:49 +00:00
#ifdef HAVE_LIBNCURSESW
extern bool CRT_utf8;
#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;
extern int CRT_cursorX;
2014-02-27 19:35:22 +00:00
extern int CRT_scrollHAmount;
extern int CRT_scrollWheelVAmount;
2020-12-14 14:45:48 +00:00
extern ColorScheme CRT_colorScheme;
#ifdef HAVE_SETUID_ENABLED
void CRT_dropPrivileges(void);
void CRT_restorePrivileges(void);
#else /* HAVE_SETUID_ENABLED */
/* Turn setuid operations into NOPs */
2020-10-05 15:24:59 +00:00
static inline void CRT_dropPrivileges(void) { }
static inline void CRT_restorePrivileges(void) { }
#endif /* HAVE_SETUID_ENABLED */
2021-01-27 16:14:15 +00:00
void CRT_init(const Settings* settings, bool allowUnicode);
2006-03-04 18:16:49 +00:00
void CRT_done(void);
2006-03-04 18:16:49 +00:00
int CRT_readKey(void);
2006-03-04 18:16:49 +00:00
void CRT_disableDelay(void);
2006-06-06 20:28:42 +00:00
void CRT_enableDelay(void);
2006-06-06 20:28:42 +00:00
void CRT_setColors(int colorScheme);
2006-03-04 18:16:49 +00:00
#endif