[Pkg-wmaker-commits] [wmbubble] 184/207: Make duck blink when system() returns an error.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:32 UTC 2015


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

dtorrance-guest pushed a commit to branch master
in repository wmbubble.

commit cd54a40844546ccecc75bf72123d066fa135c88d
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Mon Dec 1 08:03:06 2014 -0600

    Make duck blink when system() returns an error.
    
    This is achieved by adding a new global int, duck_blink, which decrements on
    every redraw when positive and inverts the color of the duck's body when it
    is a multiple of 10.
    
    It is set to 60 when system() returns an error, achieving an effect of 3
    blinks.
---
 bubblemon.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bubblemon.c b/bubblemon.c
index d3ea532..8e3ad78 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -174,6 +174,8 @@ int datefont_widths[256];
 char datefont_transparent;
 unsigned int datefont_offset;
 
+int duck_blink = 0;
+
 const struct XrmUnified {
 	char * const option;
 	char * const specifier;
@@ -436,10 +438,8 @@ int main(int argc, char **argv) {
 				if (event.xbutton.button <= argc) {
 					snprintf(execute, 250, "%s &",
 					         argv[event.xbutton.button - 1]);
-					if (system(execute) == -1) {
-						fprintf(stderr, "execute failed\n");
-						exit(-1);
-					}
+					if (system(execute) == -1)
+						duck_blink += 60;
 				}
 				break;
 			case EnterNotify:
@@ -1346,6 +1346,11 @@ void draw_duck(int x, int y, int frame_no, int flipx, int flipy) {
 	duck_left = 0;
 	if (x < 0)
 		duck_left = -(x);
+	if (duck_blink > 0) {
+		if (duck_blink % 10 == 0)
+			duck_colors[1] = 0xFFFFFF - duck_colors[1];
+		duck_blink--;
+	}
 	for (yy = duck_top; yy < duck_bottom; yy++) {
 		/* calculate this only once */
 		int ypos = (yy + y) * BOX_SIZE;

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



More information about the Pkg-wmaker-commits mailing list