Skip to content

Commit

Permalink
Fixed XTOP responsivity
Browse files Browse the repository at this point in the history
  • Loading branch information
kala13x committed Nov 26, 2024
1 parent 8bb5cce commit 0286574
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/sys/xtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ int XTop_GetNetworkStats(xtop_stats_t *pStats, xarray_t *pIfaces)
if (pDstIface == NULL) continue;

memcpy(pDstIface, pSrcIface, sizeof(xnet_iface_t));
if (strnlen(pDstIface->sName, sizeof(pDstIface->sName) - 1) > 12)
{
pDstIface->sName[9] = '.';
pDstIface->sName[10] = '.';
pDstIface->sName[11] = '.';
pDstIface->sName[12] = XSTR_NUL;
}

if (XArray_AddData(pIfaces, pDstIface, 0) < 0) free(pDstIface);
}

Expand Down
2 changes: 1 addition & 1 deletion src/xver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#define XUTILS_VERSION_MAX 2
#define XUTILS_VERSION_MIN 6
#define XUTILS_BUILD_NUMBER 11
#define XUTILS_BUILD_NUMBER 12

#ifdef __cplusplus
extern "C" {
Expand Down
16 changes: 8 additions & 8 deletions tools/xtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,19 +683,19 @@ XSTATUS XTOPApp_AddCPUExtra(xcli_win_t *pWin, xtop_args_t *pArgs, xcli_bar_t *pB

static uint8_t XTOPApp_GetAddrSpacePadding(xcli_win_t *pWin)
{
uint8_t nSpacePadding = (pWin->frame.nColumns < 106) ? 7 : 8;
nSpacePadding = (pWin->frame.nColumns < 104) ? 6 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 102) ? 5 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 100) ? 4 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 98) ? 5 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 91) ? 4 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 89) ? 3 : nSpacePadding;
uint8_t nSpacePadding = (pWin->frame.nColumns < 112) ? 7 : 8;
nSpacePadding = (pWin->frame.nColumns < 110) ? 6 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 108) ? 5 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 106) ? 4 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 104) ? 5 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 97) ? 4 : nSpacePadding;
nSpacePadding = (pWin->frame.nColumns < 95) ? 3 : nSpacePadding;
return nSpacePadding;
}

static xbool_t XTOPApp_IsNarrowInterface(xcli_win_t *pWin)
{
return (pWin->frame.nColumns < 98) ? XTRUE : XFALSE;
return (pWin->frame.nColumns < 104) ? XTRUE : XFALSE;
}

static uint8_t XTOPApp_GetIfaceSpacePadding(xcli_win_t *pWin, xbool_t bIsHeader)
Expand Down

0 comments on commit 0286574

Please sign in to comment.