From fc5981a361167e285e0a17307612abb57f2f9810 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Tue, 17 Jan 2017 19:29:39 +0100
Subject: Cleanup
---
nncmpp.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/nncmpp.c b/nncmpp.c
index 6d73e9f..06ccd98 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -873,8 +873,6 @@ app_init_attributes (void)
static void
app_init_context (void)
{
- memset (&g_ctx, 0, sizeof g_ctx);
-
poller_init (&g_ctx.poller);
mpd_client_init (&g_ctx.client, &g_ctx.poller);
config_init (&g_ctx.config);
@@ -1432,12 +1430,13 @@ app_draw_scrollbar (void)
// TODO: clamp the values, make sure they follow the right order
// We subtract half a character from both the top and the bottom, hence -1
- int length = (float) visible_items / (int) tab->item_count
+ // XXX: I'm not completely sure why we need that 0.5 constant in both
+ int length = (double) visible_items / tab->item_count
* (visible_items - 1) * 8 + 0.5;
- int start = (float) tab->item_top / (int) tab->item_count
+ int start = (double) tab->item_top / tab->item_count
* (visible_items - 1) * 8 + 0.5;
- // Then we make sure the bar is high at least one character, hence +8
+ // Then we make sure the bar is at least one character high, hence +8
int end = start + length + 8;
int start_part = start % 8; start /= 8;
@@ -1804,7 +1803,6 @@ app_process_action (enum action action)
case ACTION_NONE:
break;
default:
- beep ();
return false;
}
return true;
--
cgit v1.2.3-70-g09d2