summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-08-10 01:06:22 +0200
committerBenBE <BenBE@geshi.org>2021-08-16 08:05:46 +0200
commitedafa26f9e6298bcd935a2eaf9dfcec8868eff8d (patch)
treea132dc7790407375454e84594cff8899f2ffc4dc
parent68460b25e39c583d04edaac3ea1ce3e5bdee6b89 (diff)
Simplify Action_pickFromVector() width parameter usage
Pass one less instead of subtracting one inside the function.
-rw-r--r--Action.c9
-rw-r--r--linux/Platform.c2
2 files changed, 5 insertions, 6 deletions
diff --git a/Action.c b/Action.c
index 8a1a47dc..5d774587 100644
--- a/Action.c
+++ b/Action.c
@@ -48,7 +48,7 @@ Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess)
int y = ((Panel*)mainPanel)->y;
ScreenManager* scr = ScreenManager_new(header, st->settings, st, false);
scr->allowFocusChange = false;
- ScreenManager_add(scr, list, x - 1);
+ ScreenManager_add(scr, list, x);
ScreenManager_add(scr, (Panel*)mainPanel, -1);
Panel* panelFocus;
int ch;
@@ -185,7 +185,7 @@ static Htop_Reaction actionSetSortColumn(State* st) {
free(name);
}
- const ListItem* field = (const ListItem*) Action_pickFromVector(st, sortPanel, 15, false);
+ const ListItem* field = (const ListItem*) Action_pickFromVector(st, sortPanel, 14, false);
if (field) {
reaction |= Action_setSortKey(st->settings, field->key);
}
@@ -325,7 +325,6 @@ static Htop_Reaction actionSetAffinity(State* st) {
int width;
Panel* affinityPanel = AffinityPanel_new(st->pl, affinity1, &width);
- width += 1; /* we add a gap between the panels */
Affinity_delete(affinity1);
const void* set = Action_pickFromVector(st, affinityPanel, width, true);
@@ -349,7 +348,7 @@ static Htop_Reaction actionKill(State* st) {
return HTOP_OK;
Panel* signalsPanel = SignalsPanel_new();
- const ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 15, true);
+ const ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 14, true);
if (sgn && sgn->key != 0) {
Panel_setHeader((Panel*)st->mainPanel, "Sending...");
Panel_draw((Panel*)st->mainPanel, false, true, true, State_hideFunctionBar(st));
@@ -368,7 +367,7 @@ static Htop_Reaction actionFilterByUser(State* st) {
Vector_insertionSort(usersPanel->items);
ListItem* allUsers = ListItem_new("All users", -1);
Panel_insert(usersPanel, 0, (Object*) allUsers);
- const ListItem* picked = (ListItem*) Action_pickFromVector(st, usersPanel, 20, false);
+ const ListItem* picked = (ListItem*) Action_pickFromVector(st, usersPanel, 19, false);
if (picked) {
if (picked == allUsers) {
st->pl->userId = (uid_t)-1;
diff --git a/linux/Platform.c b/linux/Platform.c
index f31137fe..66fcb5f3 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -138,7 +138,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
IOPriority ioprio1 = p->ioPriority;
Panel* ioprioPanel = IOPriorityPanel_new(ioprio1);
- const void* set = Action_pickFromVector(st, ioprioPanel, 21, true);
+ const void* set = Action_pickFromVector(st, ioprioPanel, 20, true);
if (set) {
IOPriority ioprio2 = IOPriorityPanel_getIOPriority(ioprioPanel);
bool ok = MainPanel_foreachProcess(st->mainPanel, LinuxProcess_setIOPriority, (Arg) { .i = ioprio2 }, NULL);

© 2014-2024 Faster IT GmbH | imprint | privacy policy