Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/htop/files/, sys-process/htop/
Date: Sun, 27 Dec 2020 23:45:24
Message-Id: 1609112717.2750c23c9e168f7e2d53f75405d5f8d0f1f7a7bc.polynomial-c@gentoo
1 commit: 2750c23c9e168f7e2d53f75405d5f8d0f1f7a7bc
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 27 23:44:42 2020 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 27 23:45:17 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2750c23c
7
8 sys-process/htop: Revbump to fix column header sort highlight
9
10 Package-Manager: Portage-3.0.12, Repoman-3.0.2
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 .../htop-3.0.4-sort_column_header_highlight.patch | 153 +++++++++++++++++++++
14 .../{htop-3.0.4.ebuild => htop-3.0.4-r1.ebuild} | 4 +
15 2 files changed, 157 insertions(+)
16
17 diff --git a/sys-process/htop/files/htop-3.0.4-sort_column_header_highlight.patch b/sys-process/htop/files/htop-3.0.4-sort_column_header_highlight.patch
18 new file mode 100644
19 index 00000000000..a2b6a0d4259
20 --- /dev/null
21 +++ b/sys-process/htop/files/htop-3.0.4-sort_column_header_highlight.patch
22 @@ -0,0 +1,153 @@
23 +From 86d293125565a15bbd94683080dbc755c5d7edee Mon Sep 17 00:00:00 2001
24 +From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@××××××××××.com>
25 +Date: Tue, 22 Dec 2020 17:12:38 +0100
26 +Subject: [PATCH] Restore highlighted header of current sorted process column
27 +
28 +---
29 + MainPanel.c | 10 ++++++++--
30 + Panel.c | 22 ++++++++++------------
31 + Panel.h | 6 ++++--
32 + ScreenManager.c | 2 +-
33 + htop.c | 2 --
34 + 5 files changed, 23 insertions(+), 19 deletions(-)
35 +
36 +diff --git a/MainPanel.c b/MainPanel.c
37 +index 949138dc..c8a4c059 100644
38 +--- a/MainPanel.c
39 ++++ b/MainPanel.c
40 +@@ -102,7 +102,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
41 + MainPanel_updateTreeFunctions(this, this->state->settings->treeView);
42 + }
43 + if (reaction & HTOP_UPDATE_PANELHDR) {
44 +- ProcessList_printHeader(this->state->pl, Panel_getHeader(super));
45 ++ result |= REDRAW;
46 + }
47 + if (reaction & HTOP_REFRESH) {
48 + result |= REFRESH;
49 +@@ -168,13 +168,19 @@ static void MainPanel_drawFunctionBar(Panel* super) {
50 + }
51 + }
52 +
53 ++static void MainPanel_printHeader(Panel* super) {
54 ++ MainPanel* this = (MainPanel*) super;
55 ++ ProcessList_printHeader(this->state->pl, &super->header);
56 ++}
57 ++
58 + const PanelClass MainPanel_class = {
59 + .super = {
60 + .extends = Class(Panel),
61 + .delete = MainPanel_delete
62 + },
63 + .eventHandler = MainPanel_eventHandler,
64 +- .drawFunctionBar = MainPanel_drawFunctionBar
65 ++ .drawFunctionBar = MainPanel_drawFunctionBar,
66 ++ .printHeader = MainPanel_printHeader
67 + };
68 +
69 + MainPanel* MainPanel_new() {
70 +diff --git a/Panel.c b/Panel.c
71 +index b36f1efc..26a0c0ec 100644
72 +--- a/Panel.c
73 ++++ b/Panel.c
74 +@@ -76,13 +76,6 @@ void Panel_setSelectionColor(Panel* this, ColorElements colorId) {
75 + this->selectionColorId = colorId;
76 + }
77 +
78 +-RichString* Panel_getHeader(Panel* this) {
79 +- assert (this != NULL);
80 +-
81 +- this->needsRedraw = true;
82 +- return &(this->header);
83 +-}
84 +-
85 + inline void Panel_setHeader(Panel* this, const char* header) {
86 + RichString_writeWide(&(this->header), CRT_colors[PANEL_HEADER_FOCUS], header);
87 + this->needsRedraw = true;
88 +@@ -228,15 +221,20 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect
89 + int x = this->x;
90 + int h = this->h;
91 +
92 ++ const int header_attr = focus
93 ++ ? CRT_colors[PANEL_HEADER_FOCUS]
94 ++ : CRT_colors[PANEL_HEADER_UNFOCUS];
95 ++ if (force_redraw) {
96 ++ if (Panel_printHeaderFn(this))
97 ++ Panel_printHeader(this);
98 ++ else
99 ++ RichString_setAttr(&this->header, header_attr);
100 ++ }
101 + int headerLen = RichString_sizeVal(this->header);
102 + if (headerLen > 0) {
103 +- int attr = focus
104 +- ? CRT_colors[PANEL_HEADER_FOCUS]
105 +- : CRT_colors[PANEL_HEADER_UNFOCUS];
106 +- attrset(attr);
107 ++ attrset(header_attr);
108 + mvhline(y, x, ' ', this->w);
109 + if (scrollH < headerLen) {
110 +- RichString_setAttr(&this->header, attr);
111 + RichString_printoffnVal(this->header, y, x, scrollH,
112 + MINIMUM(headerLen - scrollH, this->w));
113 + }
114 +diff --git a/Panel.h b/Panel.h
115 +index 959c0b78..63659e3c 100644
116 +--- a/Panel.h
117 ++++ b/Panel.h
118 +@@ -37,11 +37,13 @@ typedef enum HandlerResult_ {
119 +
120 + typedef HandlerResult (*Panel_EventHandler)(Panel*, int);
121 + typedef void (*Panel_DrawFunctionBar)(Panel*);
122 ++typedef void (*Panel_PrintHeader)(Panel*);
123 +
124 + typedef struct PanelClass_ {
125 + const ObjectClass super;
126 + const Panel_EventHandler eventHandler;
127 + const Panel_DrawFunctionBar drawFunctionBar;
128 ++ const Panel_PrintHeader printHeader;
129 + } PanelClass;
130 +
131 + #define As_Panel(this_) ((const PanelClass*)((this_)->super.klass))
132 +@@ -49,6 +51,8 @@ typedef struct PanelClass_ {
133 + #define Panel_eventHandler(this_, ev_) (assert(As_Panel(this_)->eventHandler), As_Panel(this_)->eventHandler((Panel*)(this_), ev_))
134 + #define Panel_drawFunctionBarFn(this_) As_Panel(this_)->drawFunctionBar
135 + #define Panel_drawFunctionBar(this_) (assert(As_Panel(this_)->drawFunctionBar), As_Panel(this_)->drawFunctionBar((Panel*)(this_)))
136 ++#define Panel_printHeaderFn(this_) As_Panel(this_)->printHeader
137 ++#define Panel_printHeader(this_) (assert(As_Panel(this_)->printHeader), As_Panel(this_)->printHeader((Panel*)(this_)))
138 +
139 + struct Panel_ {
140 + Object super;
141 +@@ -84,8 +88,6 @@ void Panel_done(Panel* this);
142 +
143 + void Panel_setSelectionColor(Panel* this, ColorElements colorId);
144 +
145 +-RichString* Panel_getHeader(Panel* this);
146 +-
147 + void Panel_setHeader(Panel* this, const char* header);
148 +
149 + void Panel_move(Panel* this, int x, int y);
150 +diff --git a/ScreenManager.c b/ScreenManager.c
151 +index 57cb564d..4c74e477 100644
152 +--- a/ScreenManager.c
153 ++++ b/ScreenManager.c
154 +@@ -141,7 +141,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
155 +
156 + bool timedOut = true;
157 + bool redraw = true;
158 +- bool force_redraw = false;
159 ++ bool force_redraw = true;
160 + bool rescan = false;
161 + int sortTimeout = 0;
162 + int resetSortTimeout = 5;
163 +diff --git a/htop.c b/htop.c
164 +index 4b43ed2a..aa6d9147 100644
165 +--- a/htop.c
166 ++++ b/htop.c
167 +@@ -313,8 +313,6 @@ int main(int argc, char** argv) {
168 +
169 + MainPanel_updateTreeFunctions(panel, settings->treeView);
170 +
171 +- ProcessList_printHeader(pl, Panel_getHeader((Panel*)panel));
172 +-
173 + State state = {
174 + .settings = settings,
175 + .ut = ut,
176
177 diff --git a/sys-process/htop/htop-3.0.4.ebuild b/sys-process/htop/htop-3.0.4-r1.ebuild
178 similarity index 95%
179 rename from sys-process/htop/htop-3.0.4.ebuild
180 rename to sys-process/htop/htop-3.0.4-r1.ebuild
181 index 1e6c67cacd0..8b37c2d31a5 100644
182 --- a/sys-process/htop/htop-3.0.4.ebuild
183 +++ b/sys-process/htop/htop-3.0.4-r1.ebuild
184 @@ -29,6 +29,10 @@ CONFIG_CHECK="~TASKSTATS ~TASK_XACCT ~TASK_IO_ACCOUNTING ~CGROUPS"
185
186 S="${WORKDIR}/${P/_}"
187
188 +PATCHES=(
189 + "${FILESDIR}/${P}-sort_column_header_highlight.patch"
190 +)
191 +
192 pkg_setup() {
193 if ! has_version sys-process/lsof; then
194 ewarn "To use lsof features in htop (what processes are accessing"