mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Use MainPanel type in State struct
The State struct holds a pointer to the main process panel. Use the distinct MainPanel type, to improve maintainability regrading its usage. This avoids usages of down-casts from Panel to MainPanel, only up-casts from MainPanel to Panel are now required.
This commit is contained in:
@ -130,9 +130,7 @@ void Platform_done(void) {
|
||||
}
|
||||
|
||||
static Htop_Reaction Platform_actionSetIOPriority(State* st) {
|
||||
Panel* panel = st->panel;
|
||||
|
||||
const LinuxProcess* p = (const LinuxProcess*) Panel_getSelected(panel);
|
||||
const LinuxProcess* p = (const LinuxProcess*) Panel_getSelected((Panel*)st->mainPanel);
|
||||
if (!p)
|
||||
return HTOP_OK;
|
||||
|
||||
@ -141,7 +139,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
|
||||
const void* set = Action_pickFromVector(st, ioprioPanel, 21, true);
|
||||
if (set) {
|
||||
IOPriority ioprio2 = IOPriorityPanel_getIOPriority(ioprioPanel);
|
||||
bool ok = MainPanel_foreachProcess((MainPanel*)panel, LinuxProcess_setIOPriority, (Arg) { .i = ioprio2 }, NULL);
|
||||
bool ok = MainPanel_foreachProcess(st->mainPanel, LinuxProcess_setIOPriority, (Arg) { .i = ioprio2 }, NULL);
|
||||
if (!ok) {
|
||||
beep();
|
||||
}
|
||||
|
Reference in New Issue
Block a user