mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2025-01-14 08:01:09 +01:00
use log10 in numlen
This commit is contained in:
parent
fe35ea633a
commit
2707be7199
2 changed files with 7 additions and 7 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
int wrap(int i, int max) {
|
int wrap(int i, int max) {
|
||||||
|
@ -5,13 +7,10 @@ int wrap(int i, int max) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int numlen(int n) {
|
int numlen(int n) {
|
||||||
if (n >= 1000000) return 7;
|
if (n == 0) {
|
||||||
if (n >= 100000) return 6;
|
return n;
|
||||||
if (n >= 10000) return 5;
|
}
|
||||||
if (n >= 1000) return 4;
|
return log10(n) + 1;
|
||||||
if (n >= 100) return 3;
|
|
||||||
if (n >= 10) return 2;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct modifier_key {
|
static struct modifier_key {
|
||||||
|
|
|
@ -10,6 +10,7 @@ target_link_libraries(swaygrab
|
||||||
sway-common
|
sway-common
|
||||||
${JSONC_LIBRARIES}
|
${JSONC_LIBRARIES}
|
||||||
rt
|
rt
|
||||||
|
m
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
|
Loading…
Reference in a new issue