Debugging
authorEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 17:59:29 +0000 (18:59 +0100)
committerEnrico Zini <enrico@enricozini.org>
Sun, 16 Aug 2009 17:59:29 +0000 (18:59 +0100)
src/app_power.vala

index 10c8fb98165fc1c8319a59dc789ffef20c8fcd4d..e6d99103e5dfe059128e6090eecec2182d6b1664 100644 (file)
@@ -107,17 +107,24 @@ public class Power : zavai.Resource, Object
                bool short_press = false;
                bool long_press = false;
 
+stderr.printf("EVENT %d\n", (int)pressed);
+
                if (pressed)
                {
                        if (last_down.tv_sec == 0)
+                       {
+stderr.printf("  FIRST PRESSED\n");
                                last_down = *t;
+                       }
                        else
                        {
                                long diff = timediff(t, &last_down);
+stderr.printf("  PRESSED FOR %ld\n", diff);
                                long_press = diff >= 1500000;
                        }
                } else {
                        long diff = timediff(t, &last_down);
+stderr.printf("  RELEASED AFTER %ld\n", diff);
                        if (diff >= 1500000)
                                long_press = true;
                        else
@@ -127,6 +134,8 @@ public class Power : zavai.Resource, Object
                        last_down.tv_usec = 0;
                }
 
+stderr.printf("  LP %d SP %d\n", (int)long_press, (int)short_press);
+
                if (short_press) {
                        if (screen_locked)
                                // Short press: turn on backlight for a bit