mirror of https://github.com/xzeldon/htop.git
Merge branch 'hishamhm-pull-923'
This commit is contained in:
commit
011125dab2
|
@ -97,5 +97,6 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
|
||||||
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Count CPUs from 0 instead of 1"), &(settings->countCPUsFromZero)));
|
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Count CPUs from 0 instead of 1"), &(settings->countCPUsFromZero)));
|
||||||
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Update process names on every refresh"), &(settings->updateProcessNames)));
|
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Update process names on every refresh"), &(settings->updateProcessNames)));
|
||||||
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Add guest time in CPU meter percentage"), &(settings->accountGuestInCPUMeter)));
|
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Add guest time in CPU meter percentage"), &(settings->accountGuestInCPUMeter)));
|
||||||
|
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Enable the mouse"), &(settings->enableMouse)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||||
ch = getch();
|
ch = getch();
|
||||||
|
|
||||||
HandlerResult result = IGNORED;
|
HandlerResult result = IGNORED;
|
||||||
if (ch == KEY_MOUSE) {
|
if (ch == KEY_MOUSE && this->settings->enableMouse) {
|
||||||
ch = ERR;
|
ch = ERR;
|
||||||
MEVENT mevent;
|
MEVENT mevent;
|
||||||
int ok = getmouse(&mevent);
|
int ok = getmouse(&mevent);
|
||||||
|
|
|
@ -58,6 +58,7 @@ typedef struct Settings_ {
|
||||||
bool updateProcessNames;
|
bool updateProcessNames;
|
||||||
bool accountGuestInCPUMeter;
|
bool accountGuestInCPUMeter;
|
||||||
bool headerMargin;
|
bool headerMargin;
|
||||||
|
bool enableMouse;
|
||||||
|
|
||||||
bool changed;
|
bool changed;
|
||||||
} Settings;
|
} Settings;
|
||||||
|
@ -232,6 +233,8 @@ static bool Settings_read(Settings* this, const char* fileName) {
|
||||||
} else if (String_eq(option[0], "color_scheme")) {
|
} else if (String_eq(option[0], "color_scheme")) {
|
||||||
this->colorScheme = atoi(option[1]);
|
this->colorScheme = atoi(option[1]);
|
||||||
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0;
|
if (this->colorScheme < 0 || this->colorScheme >= LAST_COLORSCHEME) this->colorScheme = 0;
|
||||||
|
} else if (String_eq(option[0], "enable_mouse")) {
|
||||||
|
this->enableMouse = atoi(option[1]);
|
||||||
} else if (String_eq(option[0], "left_meters")) {
|
} else if (String_eq(option[0], "left_meters")) {
|
||||||
Settings_readMeters(this, option[1], 0);
|
Settings_readMeters(this, option[1], 0);
|
||||||
didReadMeters = true;
|
didReadMeters = true;
|
||||||
|
@ -315,6 +318,7 @@ bool Settings_write(Settings* this) {
|
||||||
fprintf(fd, "update_process_names=%d\n", (int) this->updateProcessNames);
|
fprintf(fd, "update_process_names=%d\n", (int) this->updateProcessNames);
|
||||||
fprintf(fd, "account_guest_in_cpu_meter=%d\n", (int) this->accountGuestInCPUMeter);
|
fprintf(fd, "account_guest_in_cpu_meter=%d\n", (int) this->accountGuestInCPUMeter);
|
||||||
fprintf(fd, "color_scheme=%d\n", (int) this->colorScheme);
|
fprintf(fd, "color_scheme=%d\n", (int) this->colorScheme);
|
||||||
|
fprintf(fd, "enable_mouse=%d\n", (int) this->enableMouse);
|
||||||
fprintf(fd, "delay=%d\n", (int) this->delay);
|
fprintf(fd, "delay=%d\n", (int) this->delay);
|
||||||
fprintf(fd, "left_meters="); writeMeters(this, fd, 0);
|
fprintf(fd, "left_meters="); writeMeters(this, fd, 0);
|
||||||
fprintf(fd, "left_meter_modes="); writeMeterModes(this, fd, 0);
|
fprintf(fd, "left_meter_modes="); writeMeterModes(this, fd, 0);
|
||||||
|
@ -390,6 +394,7 @@ Settings* Settings_new(int cpuCount) {
|
||||||
CRT_restorePrivileges();
|
CRT_restorePrivileges();
|
||||||
}
|
}
|
||||||
this->colorScheme = 0;
|
this->colorScheme = 0;
|
||||||
|
this->enableMouse = true;
|
||||||
this->changed = false;
|
this->changed = false;
|
||||||
this->delay = DEFAULT_DELAY;
|
this->delay = DEFAULT_DELAY;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
|
@ -49,6 +49,7 @@ typedef struct Settings_ {
|
||||||
bool updateProcessNames;
|
bool updateProcessNames;
|
||||||
bool accountGuestInCPUMeter;
|
bool accountGuestInCPUMeter;
|
||||||
bool headerMargin;
|
bool headerMargin;
|
||||||
|
bool enableMouse;
|
||||||
|
|
||||||
bool changed;
|
bool changed;
|
||||||
} Settings;
|
} Settings;
|
||||||
|
|
11
htop.c
11
htop.c
|
@ -39,6 +39,7 @@ static void printHelpFlag() {
|
||||||
fputs("htop " VERSION " - " COPYRIGHT "\n"
|
fputs("htop " VERSION " - " COPYRIGHT "\n"
|
||||||
"Released under the GNU GPL.\n\n"
|
"Released under the GNU GPL.\n\n"
|
||||||
"-C --no-color Use a monochrome color scheme\n"
|
"-C --no-color Use a monochrome color scheme\n"
|
||||||
|
"-m --no-mouse Disable the mouse\n"
|
||||||
"-d --delay=DELAY Set the delay between updates, in tenths of seconds\n"
|
"-d --delay=DELAY Set the delay between updates, in tenths of seconds\n"
|
||||||
"-h --help Print this help screen\n"
|
"-h --help Print this help screen\n"
|
||||||
"-s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)\n"
|
"-s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)\n"
|
||||||
|
@ -62,6 +63,7 @@ typedef struct CommandLineSettings_ {
|
||||||
int sortKey;
|
int sortKey;
|
||||||
int delay;
|
int delay;
|
||||||
bool useColors;
|
bool useColors;
|
||||||
|
bool enableMouse;
|
||||||
bool treeView;
|
bool treeView;
|
||||||
} CommandLineSettings;
|
} CommandLineSettings;
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
.sortKey = 0,
|
.sortKey = 0,
|
||||||
.delay = -1,
|
.delay = -1,
|
||||||
.useColors = true,
|
.useColors = true,
|
||||||
|
.enableMouse = true,
|
||||||
.treeView = false,
|
.treeView = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,6 +88,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
{"user", optional_argument, 0, 'u'},
|
{"user", optional_argument, 0, 'u'},
|
||||||
{"no-color", no_argument, 0, 'C'},
|
{"no-color", no_argument, 0, 'C'},
|
||||||
{"no-colour",no_argument, 0, 'C'},
|
{"no-colour",no_argument, 0, 'C'},
|
||||||
|
{"no-mouse", no_argument, 0, 'm'},
|
||||||
{"tree", no_argument, 0, 't'},
|
{"tree", no_argument, 0, 't'},
|
||||||
{"pid", required_argument, 0, 'p'},
|
{"pid", required_argument, 0, 'p'},
|
||||||
{0,0,0,0}
|
{0,0,0,0}
|
||||||
|
@ -92,7 +96,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
|
|
||||||
int opt, opti=0;
|
int opt, opti=0;
|
||||||
/* Parse arguments */
|
/* Parse arguments */
|
||||||
while ((opt = getopt_long(argc, argv, "hvCs:td:u::p:", long_opts, &opti))) {
|
while ((opt = getopt_long(argc, argv, "hvmCs:td:u::p:", long_opts, &opti))) {
|
||||||
if (opt == EOF) break;
|
if (opt == EOF) break;
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -140,6 +144,9 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
case 'C':
|
case 'C':
|
||||||
flags.useColors = false;
|
flags.useColors = false;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
flags.enableMouse = false;
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
flags.treeView = true;
|
flags.treeView = true;
|
||||||
break;
|
break;
|
||||||
|
@ -213,6 +220,8 @@ int main(int argc, char** argv) {
|
||||||
settings->delay = flags.delay;
|
settings->delay = flags.delay;
|
||||||
if (!flags.useColors)
|
if (!flags.useColors)
|
||||||
settings->colorScheme = COLORSCHEME_MONOCHROME;
|
settings->colorScheme = COLORSCHEME_MONOCHROME;
|
||||||
|
if (!flags.enableMouse)
|
||||||
|
settings->enableMouse = false;
|
||||||
if (flags.treeView)
|
if (flags.treeView)
|
||||||
settings->treeView = true;
|
settings->treeView = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue