[Pkg-wmaker-commits] [wmix] 35/44: Improve the osd update code

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Sep 29 10:40:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmix.

commit 8e5e2fd6b4ba2c1cf751ee49337435732967d0a7
Author: Johannes Holmberg <johannes at update.uu.se>
Date:   Wed Sep 16 21:19:42 2015 -0400

    Improve the osd update code
    
    - More logical relationship between volume level and bar length
    - No unnecessary drawing
    - Volume bar shrinks properly even when volume is lowered very quickly
---
 ui_x.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/ui_x.c b/ui_x.c
index 2ab337e..ef034c5 100644
--- a/ui_x.c
+++ b/ui_x.c
@@ -417,16 +417,20 @@ void update_osd(float volume, bool up)
     static int bar;
 
     if (config.osd) {
-	foo =
-	    (((dockapp.osd_width / 100) * (volume * 100)) / 20) + 1;
-
-	if ((foo != bar) || up) {
-	    XClearArea(display, dockapp.osd, ((bar - 1) * 20), 30,
-		       (foo * 20), 25, 1);
-	    for (i = 1; i < foo; i++)
-		XFillRectangle(display, dockapp.osd, dockapp.osd_gc,
-			       i * 20, 30, 5, 25);
-	}
+	foo = (dockapp.osd_width - 20) * volume / 20.0;
+
+        if (up) {
+            for (i = 1; i <= foo; i++)
+                XFillRectangle(display, dockapp.osd, dockapp.osd_gc,
+                               i * 20, 30, 5, 25);
+        } else if (foo < bar) {
+            XClearArea(display, dockapp.osd, ((foo+1) * 20), 30,
+                       ((bar-foo) * 20), 25, 1);
+        } else if (foo > bar) {
+            for (i = (bar > 0 ? bar : 1); i <= foo; i++)
+                XFillRectangle(display, dockapp.osd, dockapp.osd_gc,
+                               i * 20, 30, 5, 25);
+        }
 	bar = foo;
     }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmix.git



More information about the Pkg-wmaker-commits mailing list