Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
1a604a05
Commit
1a604a05
authored
Feb 02, 2012
by
Hisham Muhammad
Browse files
BUGFIX: behavior of 'F' (follow) key was broken, also affecting the
persistence of mouse selections. Closes #3165065.
parent
58676d70
Changes
4
Show whitespace changes
Inline
Side-by-side
ChangeLog
View file @
1a604a05
...
@@ -7,6 +7,8 @@ What's new in version 1.0.1
...
@@ -7,6 +7,8 @@ What's new in version 1.0.1
* Safer behavior on the kill screen, to make it harder to kill the wrong process.
* Safer behavior on the kill screen, to make it harder to kill the wrong process.
* Fix for building in FreeBSD 8.2
* Fix for building in FreeBSD 8.2
(thanks to Trond Endrestol)
(thanks to Trond Endrestol)
* BUGFIX: behavior of 'F' (follow) key was broken, also affecting the
persistence of mouse selections.
* BUGFIX: keep main panel up-to-date when running the screen manager,
* BUGFIX: keep main panel up-to-date when running the screen manager,
to fix crash when processes die while on the F9/Kill screen.
to fix crash when processes die while on the F9/Kill screen.
...
...
ProcessList.c
View file @
1a604a05
...
@@ -109,7 +109,7 @@ typedef struct ProcessList_ {
...
@@ -109,7 +109,7 @@ typedef struct ProcessList_ {
UsersTable* usersTable;
UsersTable* usersTable;
Panel* panel;
Panel* panel;
bool
follow;
int
follow
ing
;
bool userOnly;
bool userOnly;
uid_t userId;
uid_t userId;
bool filtering;
bool filtering;
...
@@ -899,15 +899,15 @@ void ProcessList_expandTree(ProcessList* this) {
...
@@ -899,15 +899,15 @@ void ProcessList_expandTree(ProcessList* this) {
}
}
}
}
void
ProcessList_rebuildPanel
(
ProcessList
*
this
,
bool
flags
,
bool
follow
,
bool
userOnly
,
uid_t
userId
,
bool
filtering
,
const
char
*
incFilter
)
{
void
ProcessList_rebuildPanel
(
ProcessList
*
this
,
bool
flags
,
int
follow
ing
,
bool
userOnly
,
uid_t
userId
,
bool
filtering
,
const
char
*
incFilter
)
{
if
(
!
flags
)
{
if
(
!
flags
)
{
follow
=
this
->
follow
;
follow
ing
=
this
->
follow
ing
;
userOnly
=
this
->
userOnly
;
userOnly
=
this
->
userOnly
;
userId
=
this
->
userId
;
userId
=
this
->
userId
;
filtering
=
this
->
filtering
;
filtering
=
this
->
filtering
;
incFilter
=
this
->
incFilter
;
incFilter
=
this
->
incFilter
;
}
else
{
}
else
{
this
->
follow
=
follow
;
this
->
follow
ing
=
follow
ing
;
this
->
userOnly
=
userOnly
;
this
->
userOnly
=
userOnly
;
this
->
userId
=
userId
;
this
->
userId
=
userId
;
this
->
filtering
=
filtering
;
this
->
filtering
=
filtering
;
...
@@ -915,10 +915,8 @@ void ProcessList_rebuildPanel(ProcessList* this, bool flags, bool follow, bool u
...
@@ -915,10 +915,8 @@ void ProcessList_rebuildPanel(ProcessList* this, bool flags, bool follow, bool u
}
}
int
currPos
=
Panel_getSelectedIndex
(
this
->
panel
);
int
currPos
=
Panel_getSelectedIndex
(
this
->
panel
);
pid_t
currPid
=
0
;
pid_t
currPid
=
following
?
following
:
0
;
int
currScrollV
=
this
->
panel
->
scrollV
;
int
currScrollV
=
this
->
panel
->
scrollV
;
if
(
follow
)
currPid
=
ProcessList_get
(
this
,
currPos
)
->
pid
;
Panel_prune
(
this
->
panel
);
Panel_prune
(
this
->
panel
);
int
size
=
ProcessList_size
(
this
);
int
size
=
ProcessList_size
(
this
);
...
@@ -934,7 +932,7 @@ void ProcessList_rebuildPanel(ProcessList* this, bool flags, bool follow, bool u
...
@@ -934,7 +932,7 @@ void ProcessList_rebuildPanel(ProcessList* this, bool flags, bool follow, bool u
if
(
!
hidden
)
{
if
(
!
hidden
)
{
Panel_set
(
this
->
panel
,
idx
,
(
Object
*
)
p
);
Panel_set
(
this
->
panel
,
idx
,
(
Object
*
)
p
);
if
((
!
follow
&&
idx
==
currPos
)
||
(
follow
&&
p
->
pid
==
currPid
))
{
if
((
follow
ing
==
-
1
&&
idx
==
currPos
)
||
(
follow
ing
!=
-
1
&&
p
->
pid
==
currPid
))
{
Panel_setSelected
(
this
->
panel
,
idx
);
Panel_setSelected
(
this
->
panel
,
idx
);
this
->
panel
->
scrollV
=
currScrollV
;
this
->
panel
->
scrollV
=
currScrollV
;
}
}
...
...
ProcessList.h
View file @
1a604a05
...
@@ -92,7 +92,7 @@ typedef struct ProcessList_ {
...
@@ -92,7 +92,7 @@ typedef struct ProcessList_ {
UsersTable
*
usersTable
;
UsersTable
*
usersTable
;
Panel
*
panel
;
Panel
*
panel
;
bool
follow
;
int
follow
ing
;
bool
userOnly
;
bool
userOnly
;
uid_t
userId
;
uid_t
userId
;
bool
filtering
;
bool
filtering
;
...
@@ -183,6 +183,6 @@ ProcessField ProcessList_keyAt(ProcessList* this, int at);
...
@@ -183,6 +183,6 @@ ProcessField ProcessList_keyAt(ProcessList* this, int at);
void
ProcessList_expandTree
(
ProcessList
*
this
);
void
ProcessList_expandTree
(
ProcessList
*
this
);
void
ProcessList_rebuildPanel
(
ProcessList
*
this
,
bool
flags
,
bool
follow
,
bool
userOnly
,
uid_t
userId
,
bool
filtering
,
const
char
*
incFilter
);
void
ProcessList_rebuildPanel
(
ProcessList
*
this
,
bool
flags
,
int
follow
ing
,
bool
userOnly
,
uid_t
userId
,
bool
filtering
,
const
char
*
incFilter
);
#endif
#endif
htop.c
View file @
1a604a05
...
@@ -440,6 +440,7 @@ int main(int argc, char** argv) {
...
@@ -440,6 +440,7 @@ int main(int argc, char** argv) {
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
tv
,
NULL
);
newTime
=
((
double
)
tv
.
tv_sec
*
10
)
+
((
double
)
tv
.
tv_usec
/
100000
);
newTime
=
((
double
)
tv
.
tv_sec
*
10
)
+
((
double
)
tv
.
tv_usec
/
100000
);
recalculate
=
(
newTime
-
oldTime
>
CRT_delay
);
recalculate
=
(
newTime
-
oldTime
>
CRT_delay
);
int
following
=
follow
?
((
Process
*
)
Panel_getSelected
(
panel
))
->
pid
:
-
1
;
if
(
recalculate
)
if
(
recalculate
)
oldTime
=
newTime
;
oldTime
=
newTime
;
if
(
doRefresh
)
{
if
(
doRefresh
)
{
...
@@ -451,7 +452,7 @@ int main(int argc, char** argv) {
...
@@ -451,7 +452,7 @@ int main(int argc, char** argv) {
ProcessList_sort
(
pl
);
ProcessList_sort
(
pl
);
refreshTimeout
=
1
;
refreshTimeout
=
1
;
}
}
ProcessList_rebuildPanel
(
pl
,
true
,
follow
,
userOnly
,
userId
,
filtering
,
incFilter
.
buffer
);
ProcessList_rebuildPanel
(
pl
,
true
,
follow
ing
,
userOnly
,
userId
,
filtering
,
incFilter
.
buffer
);
}
}
doRefresh
=
true
;
doRefresh
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment