summaryrefslogtreecommitdiffstats
path: root/ScreenManager.c
AgeCommit message (Collapse)Author
2024-03-14Ignore FOCUS_IN and FOCUS_OUT events if these have been activated within xtermDaniel Lange
Closes: #1410
2023-12-26Update includes based on IWYUBenny Baumann
2023-12-26Fix code styleBenny Baumann
2023-08-31Rename ProcessList to ProcessTable throughoutNathan Scott
Following up with some discusson from a few months back, where it was proposed that ProcessTable is a better name. This data structure is definitely not a list ... if it was one-dimensional it'd be a set, but in practice it has much more in common with a two-dimensional table. The Process table is a familiar operating system concept for many people too so it resonates a little in that way as well.
2023-08-30Support dynamic screens with 'top-most' entities beyond processesSohaib Mohamed
This implements our concept of 'dynamic screens' in htop, with a first use-case of pcp-htop displaying things like top-filesystem and top-cgroups under new screen tabs. However the idea is more general than use in pcp-htop and we've paved the way here for us to collectively build mroe general tabular screens in core htop, as well. From the pcp-htop side of things, dynamic screens are configured using text-based configuration files that define the mapping for PCP metrics to columns (and metric instances to rows). Metrics are defined either directly (via metric names) or indirectly via PCP derived metric specifications. Value scaling and the units displayed is automatic based on PCP metric units and data types. This commit represents a collaborative effort of several months, primarily between myself, Nathan and BenBE. Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com> Signed-off-by: Nathan Scott <nathans@redhat.com>
2023-08-30Introduce Row and Table classes for screens beyond top-processesNathan Scott
This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.
2023-05-22Implement logic for '--max-iterations'Sahil Siddiq
* Add '--max-iterations' option to longopts and shortopts * Implement termination logic * Add iterationsRemaining to 'struct Machine' Co-authored-by: BenBE <BenBE@geshi.org>
2023-05-08Adapt platform code for the new Machine base classNathan Scott
Move host-centric data to new derived <Platform>Machine classes, separate from process-list-centric data.
2023-05-08Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott
First stage in sanitizing the process list structure so that htop can support other types of lists too (cgroups, filesystems, ...), in the not-too-distant future. This introduces struct Machine for system-wide information while keeping process-list information in ProcessList (now much less). Next step is to propogate this separation into each platform, to match these core changes.
2023-05-08Drop references to 'Process' in generic screen codeNathan Scott
Prepare the way for making screen tabs more generalised, able to cater to entities other than processes. 'actionTogglePauseProcessUpdate' -> 'actionTogglePauseUpdate' 'pauseProcessUpdate' -> 'pauseUpdate' 'hideProcessSelection' -> 'hideSelection' 'hideProcessSelection' -> 'hideSelection' Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2023-02-18Misc cleanupChristian Göttsche
* declare read-only pointer parameter const * drop duplicate include of <errno.h> * use String_startsWith
2022-10-24Reformat code baseBenny Baumann
This includes: - Wrap function implementations - Pointer alignment for function signatures - Pointer alignment for variable declarations - Whitespace after keywords - Whitespace after comma - Whitespace around initializers - Whitespace around operators - Code indentation - Line break for single line statements - Misleading alignment
2022-10-22Toggle the header meters with pound keyChristian Göttsche
Show/hide the header meters with the pound ('#') key. Useful in cases where the header is too large and occupies essential parts of the screen, especially in settings (see #1108). It is only stored as a runtime state, not a persistent setting; to remove the header permanently one can delete all active meters.
2022-02-13ProcessList_buildTree: produce sorted treeDenis Lisov
ProcessList_buildTree does not need any particular sort order for children of the same process or roots. Switching these to the sort order configured by the user produces sorted tree automatically, making repeat sort unnecessary.
2022-02-13ProcessList: sort before panel rebuild if neededDenis Lisov
2021-12-07Fix misc styleguide issues and add missing header filesSohaib Mohamed
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-12-07Introduce screen tabsHisham Muhammad
This is a forward port (by nathans) of Hisham's original code.
2021-10-27Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra
While most Unix-like systems use 16-bit user IDs, Linux supports 32-bit UIDs since version 2.6. UIDs above 65535 are used for UID namespacing of containers, where a container has its own set of 16-bit user IDs. Processes in such containers will have (much) larger UIDs than 65535. Because the current format strings for `ST_UID` and `USER` are `%5d` and `%9d` respectively, processes with such UIDs lead to misaligned columns. Dynamically scale the `ST_UID` column and increase the size of `USER` to 10 characters (length of UINT32_MAX) to ensure that the user ID always fits. Additionally: clean up how the titlebuffer size calculation and ensure the PID column has a minimum size of 5.
2021-09-22Update license headers to explicitly say GPLv2+Daniel Lange
2021-08-22Abstract resize handling by adding a new Htop reactionChristian Göttsche
2021-08-22ScreenManager: reduce ScreenManager_resizeChristian Göttsche
The main change is the header hight being not included in y1. This is important if a sub-manager gets resized, e.g. a resize while editing the Settings or in a pickFromVector selection, and afterwards, then the sub-manager is closed, the super-ScreenManager gets resized, it uses the correct header hight. The header hight might have been changed since the last resize of the super-manager in the Settings by adding/removing some meters. This fixes new meters being hidden after added at runtime after a resize in the main window.
2021-08-10ScreenManager: drop unused memberChristian Göttsche
2021-07-15netbsd: Support curses libraries without ncurses mouse supportnia
This adds a configure check for the ncurses getmouse() function and disables mouse-related code paths when mouse support is not present in the curses library. This is necessary for stable versions of NetBSD's libcurses, the development version has stub mouse functions for compatibility with ncurses. Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-07-04Check for set_escdelay in ncursesBenny Baumann
2021-04-05Request the realtime and monotonic clock times once per sampleNathan Scott
Refactor the sample time code to make one call to gettimeofday (aka the realtime clock in clock_gettime, when available) and one to the monotonic clock. Stores each in more appropriately named ProcessList fields for ready access when needed. Every platform gets the opportunity to provide their own clock code, and the existing Mac OS X specific code is moved below darwin instead of in Compat. A couple of leftover time(2) calls are converted to use these ProcessList fields as well, instead of yet again sampling the system clock. Related to https://github.com/htop-dev/htop/pull/574
2021-03-31Reorder the header update and process scanningNathan Scott
BenBE points out that some header meters use values calculated during process scanning - make sure we scan processes first in order that current values are displayed. Related to https://github.com/htop-dev/htop/pull/574
2021-03-04Separate data-update and drawing of headerChristian Göttsche
2021-02-05Use MainPanel type in State structChristian Göttsche
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.
2021-02-01Check for sortTimeout to not run towards -infDaniel Lange
Seems to happen on Mac OS "Big Sur" (~forced application sleep) Partial fix for #510
2021-01-11Mark several non-modified pointer variables constChristian Göttsche
2021-01-11Fix clearing the last line in setup on function bar change (thanks cgzones)Daniel Lange
2021-01-04Add option to hide the Function BarChristian Göttsche
Support three settings: - Always show Function Bar - Always hide the Function Bar, except in Infoscreens (Env/Locks...) and when editing the search and filter mode - Hide the Function Bar on ESC until the next user input Closes: #439
2021-01-04Panel: rework hight logicChristian Göttsche
The hight of a Panel dpends on whether the Panel has a header or not. Also the header migth not be set on Panel creation, like in the MainPanel. This currently causes the cursor to get hidden behind the FunctionBar on down-scrolling.
2020-12-23Restore highlighted header of current sorted process columnChristian Göttsche
2020-12-20Rework drawing of FunctionBarChristian Göttsche
Draw the FunctionBar within Panel_draw instead of manually throughout the code. Add an optional PanelClass function drawFunctionBar, to allow specific panels to override the default FunctionBar_draw call. Rework the code on color change, to really change all colors (selection markers and panel headers). Closes: #402
2020-12-09Fix pause mode ("Z") in tree viewDaniel Lange
2020-12-03Common order for ESC/q/F10Benny Baumann
2020-11-28Hide process selection on ESCChristian Göttsche
Do not highlight the current process line after pressing ESC in the main screen. Restore after pressing any key.
2020-11-26Drop unneeded parameters to the ScreenManager constructorNathan Scott
All calls to ScreenManager_new always pass the same first five values, the orientation is always HORIZONTAL and the y1 parameter is always the height of the passed-in header struct pointer. I think its safe to assert at this point that no VERTICAL orientation will arrive (if it does, its no harm in re-adding this then) - so we can remove unused conditionals (and TODOs) based on orientation too.
2020-11-16Merge branch 'hili-new-old' of adsr/htop into highlight-new-old-processesDaniel Lange
2020-11-02Embracing branchesBenny Baumann
2020-11-02Spacing around operatorsBenny Baumann
2020-10-30Highlight new and old processes (#74)Adam Saponara
2020-10-19Continue to update generic data in paused modeChristian Göttsche
Generic data, as CPU and memory usage, are used by Meters. In paused mode they would stop receiving updates and especially Graph Meters would stop showing continuous data. Improves: #214 Closes: #253
2020-10-18Make all required includes explicitBenny Baumann
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-12Add key to pause process list updatesChristian Göttsche
2020-10-05Update License consistently to GPLv2 as per COPYING fileDaniel Lange
2020-09-24Do not drop qualifier in castChristian Göttsche
ListItem.c:73:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual] ListItem* obj1 = (ListItem*) cast1; ^ ListItem.c:74:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual] ListItem* obj2 = (ListItem*) cast2; ^ Process.c:434:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Process* p1 = (Process*)v1; ^ Process.c:435:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Process* p2 = (Process*)v2; ^ Process.c:441:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Settings *settings = ((Process*)v1)->settings; ^ Process.c:443:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p1 = (Process*)v1; ^ Process.c:444:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p2 = (Process*)v2; ^ Process.c:446:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p2 = (Process*)v1; ^ Process.c:447:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] p1 = (Process*)v2; ^ AffinityPanel.c:37:16: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual] free((void*)this->text); ^ AffinityPanel.c:39:19: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual] free((void*)this->indent); ^ linux/LinuxProcess.c:294:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual] Settings *settings = ((Process*)v1)->settings; ^ linux/LinuxProcess.c:296:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p1 = (LinuxProcess*)v1; ^ linux/LinuxProcess.c:297:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p2 = (LinuxProcess*)v2; ^ linux/LinuxProcess.c:299:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p2 = (LinuxProcess*)v1; ^ linux/LinuxProcess.c:300:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual] p1 = (LinuxProcess*)v2; ^ linux/LinuxProcessList.c:62:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual] TtyDriver* a = (TtyDriver*) va; ^ linux/LinuxProcessList.c:63:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual] TtyDriver* b = (TtyDriver*) vb; ^ linux/Battery.c:130:21: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] free((char *) isOnline); ^ linux/Battery.c:197:26: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName); ^ linux/Battery.c:209:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName); ^ linux/Battery.c:262:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual] xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName); ^
2020-09-15Revert the vim_mode setting for now, needs a rethinkNathan Scott
There have been too many bugs reported in vim_mode, and the proposed fixes are increasingly fragile - hence we have decided to back it out for now. For reference: https://github.com/htop-dev/htop/issues/69 https://github.com/htop-dev/htop/pull/37 https://github.com/htop-dev/htop/pull/106 The whitespace changes also arrived in commit 12805f61d not sure what that was about, but backed out as well.
2020-09-03Axe automated header generation.Zev Weiss
Reasoning: - implementation was unsound -- broke down when I added a fairly basic macro definition expanding to a struct initializer in a *.c file. - made it way too easy (e.g. via otherwise totally innocuous git commands) to end up with timestamps such that it always ran MakeHeader.py but never used its output, leading to overbuild noise when running what should be a null 'make'. - but mostly: it's just an awkward way of dealing with C code.