资源简介
htop安装源码
代码片段和文件信息
/*
htop - Action.c
(C) 2015 Hisham H. Muhammad
Released under the GNU GPL see the COPYING file
in the source distribution for its full text.
*/
#include “config.h“
#include “Action.h“
#include “Affinity.h“
#include “AffinityPanel.h“
#include “CategoriesPanel.h“
#include “CRT.h“
#include “EnvScreen.h“
#include “MainPanel.h“
#include “OpenFilesScreen.h“
#include “Process.h“
#include “ScreenManager.h“
#include “SignalsPanel.h“
#include “StringUtils.h“
#include “TraceScreen.h“
#include “Platform.h“
#include
#include
#include
#include
#include
#include
#include
/*{
#include “IncSet.h“
#include “Settings.h“
#include “Header.h“
#include “UsersTable.h“
#include “ProcessList.h“
#include “Panel.h“
typedef enum {
HTOP_OK = 0x00
HTOP_REFRESH = 0x01
HTOP_RECALCULATE = 0x03 // implies HTOP_REFRESH
HTOP_SAVE_SETTINGS = 0x04
HTOP_KEEP_FOLLOWING = 0x08
HTOP_QUIT = 0x10
HTOP_REDRAW_BAR = 0x20
HTOP_UPDATE_PANELHDR = 0x41 // implies HTOP_REFRESH
} Htop_Reaction;
typedef Htop_Reaction (*Htop_Action)();
typedef struct State_ {
Settings* settings;
UsersTable* ut;
ProcessList* pl;
Panel* panel;
Header* header;
} State;
}*/
object* Action_pickFromVector(State* st Panel* list int x) {
Panel* panel = st->panel;
Header* header = st->header;
Settings* settings = st->settings;
int y = panel->y;
ScreenManager* scr = ScreenManager_new(0 header->height 0 -1 HORIZONTAL header settings false);
scr->allowFocusChange = false;
ScreenManager_add(scr list x - 1);
ScreenManager_add(scr panel -1);
Panel* panelFocus;
int ch;
bool unfollow = false;
int pid = MainPanel_selectedPid((MainPanel*)panel);
if (header->pl->following == -1) {
header->pl->following = pid;
unfollow = true;
}
ScreenManager_run(scr &panelFocus &ch);
if (unfollow) {
header->pl->following = -1;
}
ScreenManager_delete(scr);
Panel_move(panel 0 y);
Panel_resize(panel COLS LINES-y-1);
if (panelFocus == list && ch == 13) {
Process* selected = (Process*)Panel_getSelected(panel);
if (selected && selected->pid == pid)
return Panel_getSelected(list);
else
beep();
}
return NULL;
}
// ----------------------------------------
static void Action_runSetup(Settings* settings const Header* header ProcessList* pl) {
ScreenManager* scr = ScreenManager_new(0 header->height 0 -1 HORIZONTAL header settings true);
CategoriesPanel* panelCategories = CategoriesPanel_new(scr settings (Header*) header pl);
ScreenManager_add(scr (Panel*) panelCategories 16);
CategoriesPanel_makeMetersPage(panelCategories);
Panel* panelFocus;
int ch;
ScreenManager_run(scr &panelFocus &ch);
ScreenManager_delete(scr);
if (settings->changed) {
Header_writeBackToSettings(header);
}
}
static bool changePriority(MainPanel* panel int delta)
评论
共有 条评论