Action.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef HEADER_Action
  2. #define HEADER_Action
  3. /*
  4. htop - Action.h
  5. (C) 2015 Hisham H. Muhammad
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <stdbool.h>
  10. #include <sys/types.h>
  11. #include "Header.h"
  12. #include "Machine.h"
  13. #include "Object.h"
  14. #include "Panel.h"
  15. #include "Process.h"
  16. #include "Settings.h"
  17. typedef enum {
  18. HTOP_OK = 0x00,
  19. HTOP_REFRESH = 0x01,
  20. HTOP_RECALCULATE = 0x02 | HTOP_REFRESH,
  21. HTOP_SAVE_SETTINGS = 0x04,
  22. HTOP_KEEP_FOLLOWING = 0x08,
  23. HTOP_QUIT = 0x10,
  24. HTOP_REDRAW_BAR = 0x20,
  25. HTOP_UPDATE_PANELHDR = 0x40 | HTOP_REFRESH,
  26. HTOP_RESIZE = 0x80 | HTOP_REFRESH | HTOP_REDRAW_BAR | HTOP_UPDATE_PANELHDR,
  27. } Htop_Reaction;
  28. struct MainPanel_; // IWYU pragma: keep
  29. typedef struct State_ {
  30. Machine* host;
  31. struct MainPanel_* mainPanel;
  32. Header* header;
  33. bool pauseUpdate;
  34. bool hideSelection;
  35. bool hideMeters;
  36. } State;
  37. static inline bool State_hideFunctionBar(const State* st) {
  38. const Settings* settings = st->host->settings;
  39. return settings->hideFunctionBar == 2 || (settings->hideFunctionBar == 1 && st->hideSelection);
  40. }
  41. typedef Htop_Reaction (*Htop_Action)(State* st);
  42. Object* Action_pickFromVector(State* st, Panel* list, int x, bool follow);
  43. bool Action_setUserOnly(const char* userName, uid_t* userId);
  44. Htop_Reaction Action_setSortKey(Settings* settings, ProcessField sortKey);
  45. Htop_Reaction Action_setScreenTab(State* st, int x);
  46. Htop_Reaction Action_follow(State* st);
  47. void Action_setBindings(Htop_Action* keys);
  48. #endif