⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gkrellm.h

📁 系统任务管理器
💻 H
📖 第 1 页 / 共 2 页
字号:
/* GKrellM|  Copyright (C) 1999-2006 Bill Wilson||  Author:  Bill Wilson    billw@gkrellm.net|  Latest versions might be found at:  http://gkrellm.net||  This program is free software which I release under the GNU General Public|  License. You may redistribute and/or modify this program under the terms|  of that license as published by the Free Software Foundation; either|  version 2 of the License, or (at your option) any later version.||  This program 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 General Public License for more details.  Version 2 is in the|  COPYRIGHT file in the top level directory of this distribution.| |  To get a copy of the GNU General Puplic License, write to the Free Software|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#if defined(HAVE_CONFIG_H)#include "config.h"#endif  #if !defined(WIN32)#include <sys/param.h>#endif#include <gtk/gtk.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <fcntl.h>#include <time.h>#if !defined(WIN32)#include <unistd.h>#else#include "win32.h"#endif#include <sys/stat.h>#include <locale.h>#if defined(__sun) && defined(__SVR4)#define __solaris__#endif#if !defined(__FreeBSD__) && !defined(__linux__) && !defined(__NetBSD__) \	&& !defined(__OpenBSD__) && !defined(__solaris__) && !defined(WIN32) \	&& !defined(__APPLE__)#define  USE_LIBGTOP#endif#if !defined(PACKAGE)#define PACKAGE	"gkrellm"#endif/* Internationalization support.*/#if defined (ENABLE_NLS)#include <libintl.h>#	undef _#	define _(String) dgettext(PACKAGE,String)#	if defined(gettext_noop)#		define N_(String) gettext_noop(String)#	else#		define N_(String) (String)#	endif	/* gettext_noop */#else#	define _(String) (String)#	define N_(String) (String)#	define textdomain(String) (String)#	define gettext(String) (String)#	define dgettext(Domain,String) (String)#	define dcgettext(Domain,String,Type) (String)#	define bindtextdomain(Domain,Directory) (Domain) #endif	/* ENABLE_NLS *//* -------------------------------------------------------------------*/#define	GKRELLM_VERSION_MAJOR	2#define	GKRELLM_VERSION_MINOR	2#define	GKRELLM_VERSION_REV		9#define	GKRELLM_EXTRAVERSION	""#define GKRELLM_CHECK_VERSION(major,minor,rev)    \	(GKRELLM_VERSION_MAJOR > (major) || \	(GKRELLM_VERSION_MAJOR == (major) && GKRELLM_VERSION_MINOR > (minor)) || \	(GKRELLM_VERSION_MAJOR == (major) && GKRELLM_VERSION_MINOR == (minor) && \	GKRELLM_VERSION_REV >= (rev)))#define	GKRELLM_DIR				".gkrellm2"#define	GKRELLM_USER_CONFIG		".gkrellm2/user-config"#define	GKRELLM_2_1_14_CONFIG	".gkrellm2/user_config"#define	GKRELLM_THEME_CONFIG	".gkrellm2/theme_config"#define GKRELLM_THEMES_DIR		".gkrellm2/themes"#define	GKRELLM_DATA_DIR		".gkrellm2/data"#define	GKRELLM_PLUGINS_DIR		".gkrellm2/plugins"#define	GKRELLM_LOCK_FILE		".gkrellm2/lock"#define GKRELLMRC				"gkrellmrc"#define	PLUGIN_ENABLE_FILE		".gkrellm2/plugin_enable"#define	PLUGIN_PLACEMENT_FILE	".gkrellm2/plugin_placement"#if !defined(WIN32)#define	LOCAL_THEMES_DIR		"/usr/local/share/gkrellm2/themes"#if !defined(SYSTEM_THEMES_DIR)#define	SYSTEM_THEMES_DIR		"/usr/share/gkrellm2/themes"#endif#define	LOCAL_PLUGINS_DIR		"/usr/local/lib/gkrellm2/plugins"#if !defined(SYSTEM_PLUGINS_DIR)#define	SYSTEM_PLUGINS_DIR		"/usr/lib/gkrellm2/plugins"#endif#else#define     LOCAL_THEMES_DIR		"./themes"#if !defined(SYSTEM_THEMES_DIR)#define     SYSTEM_THEMES_DIR		"./themes"#endif#define     LOCAL_PLUGINS_DIR		"./plugins"#if !defined(SYSTEM_PLUGINS_DIR)#define     SYSTEM_PLUGINS_DIR		"./plugins"#endif#endif#define	ON				1#define	OFF				0#define	CFG_BUFSIZE		384  /* Features  */#define	GKRELLM_HAVE_THEME_SCALE			1#define	GKRELLM_HAVE_DECAL_TEXT_INSERT		1#define	GKRELLM_HAVE_CLIENT_MODE_PLUGINS 	1#define	GKRELLM_USING_PANGO					1#define	GKRELLM_HAVE_DECAL_SCROLL_TEXT		1  /* Label midpoints are positioned as a percent of chart_width.  */#define	GKRELLM_LABEL_NONE		-1#define	GKRELLM_LABEL_CENTER	50#define GKRELLM_LABEL_MAX		100#define	GRID_MODE_NORMAL		0#define	GRID_MODE_RESTRAINED	1  /* GkrellmDecals in the decal_misc_piximage.  */#define	D_MISC_BLANK			0#define	D_MISC_AC				1#define	D_MISC_BATTERY			2#define	D_MISC_BATTERY_WARN		3#define	D_MISC_LED0				4#define	D_MISC_LED1				5#define	D_MISC_FS_UMOUNTED		6#define	D_MISC_FS_MOUNTED		7#define D_MISC_FS_PRESSED		8#define D_MISC_BUTTON_OUT		9#define D_MISC_BUTTON_ON		10#define D_MISC_BUTTON_IN		11#define	N_MISC_DECALS			12  /* For formatting sizes in decimal or binary abbreviated notation.  */#define	KB_SIZE(s)	((s) * 1e3)#define	KiB_SIZE(s)	((s) * 1024.0)#define	MB_SIZE(s)	((s) * 1e6)#define	MiB_SIZE(s)	((s) * 1024.0 * 1024.0)#define	GB_SIZE(s)	((s) * 1e9)#define	GiB_SIZE(s)	((s) * 1024.0 * 1024.0 * 1024.0)#define	TB_SIZE(s)	((s) * 1e12)#define	TiB_SIZE(s)	((s) * 1024.0 * 1024.0 * 1024.0 * 1024.0)typedef struct	{	gfloat	limit,			divisor;	gchar	*format;	}	GkrellmSizeAbbrev;  /* Sensor types so CPU and Proc monitors  can get info from the Sensors  |  module.  The sensor module readings for temperature and fan are  |  reported on CPU and Proc panels.  */#define SENSOR_TEMPERATURE  0#define SENSOR_FAN          1#define SENSOR_VOLTAGE      2#define	SENSOR_GROUP_MAINBOARD	0#define	SENSOR_GROUP_DISK		1#define	FULL_SCALE_GRIDS		5typedef struct	{	PangoFontDescription *font;	PangoFontDescription **font_seed;	gpointer	privat;	gint		effect;	gint		internal;	gint		flags;	GdkColor	color;	GdkColor	shadow_color;	}	GkrellmTextstyle;typedef struct	{	gchar				*text;	gint				x_off,						y_off;	gint				x_off_prev;		/* Kludge to check if d->x_off was */										/* modified directly.		*/	gpointer			privat;	GkrellmTextstyle	text_style;	}	GkrellmText;  /* Values for GkrellmDecal flags  */#define DF_TOP_LAYER			0x1#define	DF_MOVED				0x2#define DF_LOCAL_PIXMAPS		0x4#define	DF_OVERLAY_PIXMAPS		0x8#define	DF_TEXT_OVERLAPS		0x10#define	DF_SCROLL_TEXT_DIVERTED	0x20#define	DF_SCROLL_TEXT_CENTER	0x40#define	DF_SCROLL_TEXT_H_LOOP	0x80#define	DF_SCROLL_TEXT_V_LOOP	0x100#define	DF_TEXT_USE_MARKUP		0x200  /* Values for GkrellmDecal state  */#define	DS_INVISIBLE	0#define	DS_VISIBLE		1  /* A decal is a pixmap or a part of a pixmap drawn on a panel.  The  |  pixmap can be a graphic, a vertical stack of graphics, or a drawn  |  text string  */typedef struct	{	GdkPixmap	*pixmap;	GdkBitmap	*mask;	GdkBitmap	*stencil;	gint		y_src;		/* Offset into pixmap if a vertical stack	*/	gint		w, h;		/* Size of the decal						*/	gint		x, y;		/* Position of decal in a drawable			*/		gshort		flags,				state;	gint		value;		/* Index into stack, text value, etc	*/	gboolean	modified;	gint		x_off,				y_ink;			/* Pixels from top of Pango glyph to 1st ink*/	gint		x_old, y_old;	/* Used if decal was moved */	GkrellmTextstyle text_style;	/* Used if decal is a drawn text string	*/	gpointer	panel;	GList		*text_list;	gchar		*scroll_text;	gint		scroll_width,				scroll_height,				y_off;	guint		chart_sequence_id;	/* For drawing text decal on a chart */	GdkRectangle ink;	}	GkrellmDecal;  /* Get the first decal in a panel decal list.  Use if only one decal in list.  */#define	DECAL(p)	((GkrellmDecal *)(((p)->decal_list)->data))typedef struct	{	gchar		*string;	gpointer	privat;	gint		old1,		/* olds are leftovers from GdkFont->Pango */				old2,				width,				height,				old3;	gint		position;		/* 0 - 100 %	*/	gint		x_panel,		/* x position of label start in panel */				y_panel,				h_panel;	}	GkrellmLabel;typedef struct	{	gint		x_src;	gint		y_src;	gint		x_dst;	gint		y_dst;	gint		w;	gint		h;	}	GkrellmDrawrec;typedef struct	{	gint		left,				right,				top,				bottom;	}	GkrellmMargin;typedef struct	{	gint		left,				right,				top,				bottom;	}	GkrellmBorder;typedef struct	{	GdkPixbuf	*pixbuf;	GkrellmBorder border;	}	GkrellmPiximage;  /* Bit flags for setting styles in config.c.  Also used as override flags.  */#define	GKRELLMSTYLE_KRELL_YOFF			0x1#define	GKRELLMSTYLE_KRELL_LEFT_MARGIN	0x2#define	GKRELLMSTYLE_KRELL_RIGHT_MARGIN	0x4#define	GKRELLMSTYLE_KRELL_EXPAND		0x8#define	GKRELLMSTYLE_KRELL_X_HOT		0x10#define	GKRELLMSTYLE_KRELL_DEPTH		0x20#define	GKRELLMSTYLE_KRELL_EMA_PERIOD	0x40#define	GKRELLMSTYLE_LABEL_POSITION		0x80#define	GKRELLMSTYLE_LEFT_MARGIN		0x100#define	GKRELLMSTYLE_RIGHT_MARGIN		0x200#define	GKRELLMSTYLE_TOP_MARGIN			0x400#define	GKRELLMSTYLE_BOTTOM_MARGIN		0x800#define	GKRELLMSTYLE_TEXTCOLOR_A		0x1000#define	GKRELLMSTYLE_TEXTCOLOR_B		0x2000#define	GKRELLMSTYLE_TEXTFONT_A			0x4000#define	GKRELLMSTYLE_TEXTFONT_B			0x8000#define	GKRELLMSTYLE_BORDER				0x10000#define	GKRELLMSTYLE_TRANSPARENCY		0x20000#define	GKRELLMSTYLE_KRELL_YOFF_NOT_SCALABLE 0x40000#define	GKRELLMSTYLE_SCROLL_TEXT_CACHE_OFF	 0x80000#define	GKRELLMSTYLE_LABEL_YOFF			0x100000  /* Some of these style entries do not apply to all monitors.  */typedef struct	{	gint		override;		/* Flag which entries have override status */	gint		ref_count;	gint		krell_yoff,				krell_expand,				krell_x_hot,				krell_ema_period,				krell_depth;	gint		krell_left_margin,				krell_right_margin;	gboolean	krell_yoff_not_scalable;	gint		label_yoff;	gint		label_position;	gboolean	scroll_text_cache_off;	gint		spare0;	gboolean	transparency;	gint		themed;			/* Non zero if theme has custom assignments */	GkrellmBorder border;			/* Border for background panel image */	GkrellmMargin margin;	GkrellmTextstyle label_tsA;	GkrellmTextstyle label_tsB;	}	GkrellmStyle;  /* The GkrellmPanel of each GkrellmChart or Meter can have a moving indicator  |  representing a current sampled data value as a fraction of some full  |  scale value.  Since there can be quite a few of them dancing around on  |  a maxed out GKrellM display, I call them Krells - inspired by the  |  wall full of power monitoring meters the Krell had in Forbidden Planet.  */  /* Krell.expand values */#define	KRELL_EXPAND_NONE				0#define	KRELL_EXPAND_LEFT				1#define	KRELL_EXPAND_RIGHT				2#define	KRELL_EXPAND_BAR_MODE			3#define KRELL_EXPAND_LEFT_SCALED		4#define KRELL_EXPAND_RIGHT_SCALED		5#define	KRELL_EXPAND_BAR_MODE_SCALED	6  /* Krell flags */#define	KRELL_FLAG_BOTTOM_MARGIN	1typedef struct	{	GdkPixmap	*pixmap;	GdkBitmap	*mask;	gint		w, h;	/* Of the full Krell - all the frames included */	gint		depth;	/* How many vertical frames in the krell image */	gint		flags;	GdkBitmap	*stencil;	gint		spare0;	gint		reading;	gint		last_reading;	gint		full_scale;	gulong		previous;	gulong		value;	gint		modified;	/* True if krell has moved.			*/	gint		x_hot;		/* Offset in Krell pixmap to hot spot */	gint		x_position;	/* Current position of x_hot in Panel */	gint		x0,		/* Offset in Panel to start of Krell scale range */				y0;	gint		w_scale;	/* Width of active range, function of margins */	gint		h_frame;	/* Height of one frame */	gint		ema;		/* exponential moving average */	gint		period;		/* of ema */	gint		full_scale_expand;	gboolean	monotonic;	gint		bar_mode;	gpointer	panel;	GkrellmDrawrec	old_draw;	/* Last draw for restoring background.	*/	GkrellmDrawrec	draw;		/* Parameters to currently drawn krell	*/	}	GkrellmKrell;  /* Get the first krell in a panel krell list.  Use if only one krell in list.  */#define	KRELL(p)	((GkrellmKrell *)(((p)->krell_list)->data))typedef struct	{	GtkWidget	*hbox;			/* Container box this area is packed into */	GdkPixmap	*bg_text_layer_pixmap;  /* A bg_pixmap with text decals */	GtkWidget	*drawing_area;	GdkPixmap	*pixmap;		/* Expose pixmap */	GdkBitmap	*bg_mask;	GdkPixmap	*bg_pixmap;		/* Bg of panel, may be dirtied with label */	GdkPixmap	*bg_clean_pixmap;	/* A no label bg_pixmap				*/	GkrellmPiximage *bg_piximage;	GkrellmLabel *label;	GkrellmTextstyle *textstyle;	GkrellmStyle *style;	gpointer	monitor;	gpointer	privat;	GList		*decal_list;	GList		*krell_list;	GList		*button_list;	gint		x, y, w, h;	gint		h_configure;	PangoLayout	*layout;	gint		transparency;	gboolean	modified;		/* True if decal/krell modified.	*/	gboolean	keep_lists;	gboolean	shown;	gboolean	need_decal_overlap_check;	gboolean	label_on_top_of_decals;	gboolean	scroll_text_cache_off;	gboolean	bg_piximage_override;	gboolean	button_signals_connected;	gint		id_press,		/* Signals if buttons in this panel	*/				id_release,				id_enter,				id_leave;	gint		y_mapped;	}	GkrellmPanel;typedef struct	{	void		(*func)();	gpointer	data;	}	GkrellmCallback;#define CHART_WIDTH_MAX	1000#define CHART_WIDTH_MIN	25  /* Each chart must have a GkrellmChartconfig struct associated with it.  */#define	GKRELLM_CHARTCONFIG_KEYWORD	"chart_config"  /* Values for GkrellmChartconfig flags */#define	NO_CONFIG_AUTO_GRID_RESOLUTION	1#define	NO_CONFIG_FIXED_GRIDS			2typedef struct	{	gint		flags;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -