Commit Graph

2369 Commits

Author SHA1 Message Date
Nathan Scott 0672be7db1 Update version number for git repo builds 2020-12-22 17:41:14 +11:00
Nathan Scott 0b989ee38c Bump version number for 3.0.4 release 2020-12-22 17:39:42 +11:00
Christian Göttsche 3fb0024fd3 Merge branch 'misc' of https://github.com/cgzones/htop into cgzones-misc 2020-12-22 17:30:29 +11:00
Nathan Scott dfb9b82607 Resolve clang-analyzer signed/unsigned comparison CI failure 2020-12-22 16:58:17 +11:00
Nathan Scott fc7aead36b Merge branch 'harden_makecommandstr' of https://github.com/BenBE/htop into BenBE-harden_makecommandstr 2020-12-22 16:55:11 +11:00
Nathan Scott 737cd6167a Merge branch 'resize_bar' of https://github.com/cgzones/htop into cgzones-resize_bar 2020-12-22 15:25:08 +11:00
Benny Baumann 6502b02666 DiD: Ensure string offsets are inside string boundaries 2020-12-21 22:35:38 +01:00
Christian Göttsche cdfd407e2e Panel_init: initialize selectedLen member 2020-12-21 22:34:50 +01:00
Christian Göttsche 64c05a1ed5 EnvScreen: mark local class functions static 2020-12-21 22:34:50 +01:00
Christian Göttsche a7612b0b7d TraceScreen: mark local class functions static 2020-12-21 22:34:50 +01:00
Christian Göttsche 3ec8f67ab2 InfoScreen: drop unused member 2020-12-21 22:34:50 +01:00
Benny Baumann 10c6810bff Avoid NULL dereference on zombie processes
Fixes #361
2020-12-21 22:29:18 +01:00
Benny Baumann 068561351f Document dynamic bindings and assumed external configuration 2020-12-21 22:15:28 +01:00
Daniel Lange 9b8b380c32 De-lazy @cgzones :) 2020-12-21 20:40:00 +01:00
Christian Göttsche a09ad6b8b4 Action: sort key binding assignments
Avoid accidental duplicate usage.
2020-12-21 15:53:42 +01:00
Christian Göttsche 9a86577cf2 DragonFlyBSD update
- move some functions to file scope
- drop unused global variable
2020-12-20 18:32:04 +01:00
Christian Göttsche 8db8b9edac DragonFlyBSD update
- drop unused kinfo includes and link argument
- detect kvm library necessity at configure step
- fix variable typo
2020-12-20 18:22:41 +01:00
Benny Baumann 4a73e80338 Make remaining number literals use uppercase 2020-12-20 17:17:51 +01:00
Benny Baumann 5fa1c7040d Minor typo and comment clarification 2020-12-20 17:15:51 +01:00
Christian Göttsche 3f9c63d5c0 MetersPanel: drop color interruption in FunctionBar 2020-12-20 17:02:20 +01:00
Christian Göttsche 358d20687f Use variable-length-array instead of small dynamic allocation 2020-12-20 17:01:50 +01:00
Christian Göttsche e3862aa67e Rework drawing of FunctionBar
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-20 17:01:50 +01:00
Christian Göttsche 7e7a53c415 Mark event arrays const 2020-12-20 16:58:37 +01:00
Christian Göttsche 6b100b0cf4 Use upper case numeric literals
See https://rules.sonarsource.com/c/RSPEC-818
2020-12-20 16:58:17 +01:00
Christian Göttsche 6e46fd6f1f BarMeter: rework text padding
In case the text is too long for the bar, try to fit by truncating at a
space character.

E.g.
    [|24.1% 2000Mhz 40°C]
    [24.1% 2000Mhz 40°C]
    [||||24.1% 2000Mhz]
    [|||24.1% 2000Mhz]
    [||24.1% 2000Mhz]
    [|24.1% 2000Mhz]
    [24.1% 2000Mhz]
    [||||   24.1%]
    [||||  24.1%]
    [|||| 24.1%]
    [||||24.1%]
    [|||24.1%]
    [||24.1%]
    [|24.1%]
    [24.1%]
    [24.1]
    [24.]
    [24]
    [2]
2020-12-20 16:55:17 +01:00
Christian Göttsche 22da57d621 CPUMeter: drop minimum width of CPU usage in bar mode
The usage percentage is the first text, no need to set a minimum width.
The BarMeter does already add padding.
2020-12-20 16:55:17 +01:00
Christian Göttsche c5e31ba4aa Meter: fix artifacts with very tiny width
- The Bar Meter might override the right border
- The TextMeter might wrap-around into the next line
2020-12-20 16:55:17 +01:00
Christian Göttsche f878f302ca Remove duplicate newline in CRT_fatalError calls 2020-12-19 21:30:39 +01:00
Alexander Momchilov 67ccd6b909 Unhardcode tick-to-ms conversion
Division by 100000.0 worked because `sysconf(_SC_CLK_TCK)` happened to be 100.

By unhardcoding:

1) It becomes more clear what this 100000.0 figure comes from.
2) It protects against bugs in the case `sysconf(_SC_CLK_TCK)` ever changes.
2020-12-19 21:30:39 +01:00
Christian Göttsche f614b8a19f Mark Platform_defaultFields const 2020-12-19 21:13:32 +01:00
Christian Göttsche c150e4bde9 Enable -Wformat=2
Now that the global format variable Process_pidFormat is gone, enable
the compiler warning -Wformat=2.
2020-12-19 21:13:32 +01:00
Christian Göttsche 9f68c8d341 Merge Process_pidColumns into Process_fields and rework auto-fit for PID-like columns 2020-12-19 21:13:32 +01:00
Christian Göttsche 89473cc9ae Rework enum ProcessField
Use only one enum instead of a global and a platform specific one.
Drop Platform_numberOfFields global variable.
Set known size of Process_fields array
2020-12-19 21:13:32 +01:00
Christian Göttsche d872e36308 LinuxProcess: drop dead Process columns 2020-12-19 21:13:32 +01:00
Benny Baumann 77db240b48 Split boilerplate and platform-independent field comparison
This acheives two things:
- Allows for simple tie-breaking if values compare equal (needed to make sorting the tree-view stable)
- Allows for platform-dependent overriding of the sort-order for specific fields

Also fixes a small oversight on DragonFlyBSD when default-sorting.
2020-12-19 16:02:34 +01:00
Hisham Muhammad 2327260ee8 Separate tree and list sort orders
Implements the suggestion from https://github.com/htop-dev/htop/issues/399#issuecomment-747861013

Thanks to the refactors from 0bd5c8fb5da and 6393baa74e5, this was really easy
and clean to do.

It maintains the "Tree view always by PID" option in the Settings, which
results in some specific behaviors such as "clicking on the column header to
exit tree view" and "picking a new sort order to exit tree view", for the sake
of the muscle memory of long time htop users. :)
2020-12-19 16:02:34 +01:00
Hisham Muhammad e8c6994f40 Add "Tree view is always sorted by PID" option to mimic htop 2 behavior 2020-12-19 16:02:34 +01:00
Hisham Muhammad 3d1703f16f Invert Process_compare resolution so that superclass matches run first
* This removes duplicated code that adjusts the sort direction from every
  OS-specific folder.
* Most fields in a regular htop screen are OS-independent, so trying
  Process_compare first and only falling back to the OS-specific
  compareByKey function if it's an OS-specific field makes sense.
* This will allow us to override the sortKey in a global way without having
  to edit each OS-specific file.
2020-12-19 16:02:34 +01:00
Christian Göttsche 52fa4e7ee4 Fix typo 2020-12-18 23:35:28 +01:00
Christian Göttsche 27b8d81ed2 ProcessList: save scan time in millisecond
The delay is saved in deciseconds, use a bigger resolution to avoid
timing irregularities.
2020-12-18 22:43:21 +01:00
Christian Göttsche 26993d2d2b Support clock_gettime() on OSX El Capitan and earlier 2020-12-18 22:43:21 +01:00
Benny Baumann 0401df8cbd Update key mapping documentation for sorting 2020-12-18 07:37:23 +01:00
Christian Göttsche 0cb257586a Move macro definitions close to usage 2020-12-16 19:13:56 +01:00
Christian Göttsche 1193c6e349 Use common naming for bare enum types 2020-12-16 19:13:56 +01:00
Christian Göttsche edd6130be7 MainPanel: use actual KEY_RESIZE instead of KEY_SHUFFLE
KEY_RESIZE (0632) is equal to KEY_SHUFFLE (0x19a)
2020-12-16 19:12:50 +01:00
Christian Göttsche 107e3c8aa5 MainPanel: do not reset hideProcessSelection on KEY_SHUFFLE
KEY_SHUFFLE might get send from time to time, e.g. in a tmux session.
2020-12-15 14:23:09 +01:00
Christian Göttsche 4eeeb63647 LibSensors: fix unversioned libsensors library name 2020-12-15 13:54:32 +01:00
Christian Göttsche eb36385a6b LibSensors: restore temperature for Raspberry Pi
sensors output:
  cpu_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +58.0 C  (crit = +90.0 C)
2020-12-15 13:46:46 +01:00
Christian Göttsche 79970f05f3 Meter: restore non-wide-character build
Use mbstowcs() only with wide ncurses support.

Closes: #401
2020-12-15 12:05:39 +01:00
Christian Göttsche 61b8e31b41 Misc CRT cleanup 2020-12-14 21:11:20 +01:00