[Pommed-commits] r259 - in trunk: . dbus-client gpomme pommed pommed/mactel pommed/pmac wmpomme

Julien Blache jblache at alioth.debian.org
Thu Feb 22 01:13:15 CET 2007


Author: jblache
Date: 2007-02-22 01:13:15 +0100 (Thu, 22 Feb 2007)
New Revision: 259

Modified:
   trunk/ChangeLog
   trunk/dbus-client/dbus-client.c
   trunk/dbus-client/dbus-client.h
   trunk/gpomme/gpomme.c
   trunk/pommed/dbus.c
   trunk/pommed/dbus.h
   trunk/pommed/kbd_backlight.h
   trunk/pommed/mactel/kbd_backlight.c
   trunk/pommed/pmac/kbd_backlight.c
   trunk/wmpomme/wmpomme.c
Log:
Tell DBus clients who is adjusting the keyboard backlight, so they can skip notifications if it's not the user itself.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/ChangeLog	2007-02-22 00:13:15 UTC (rev 259)
@@ -5,6 +5,11 @@
 	- pommed: PowerBook5,5 has an ADB keyboard, not a USB keyboard.
 	- Added October 2003 iBook G4 support (PowerBook6,3), patch by
 	Arthur PETITPIERRE.
+	- pommed: tell DBus clients who is adjusting the keyboard
+	backlight, so they can decide to skip the notification if it's not
+	the user itself.
+	- gpomme: adapt to the new DBus notification.
+	- wmpomme: adapt to the new DBus notification.
 
 version 1.1:
 	- gpomme: added theme selection; use -t theme_name to select the

Modified: trunk/dbus-client/dbus-client.c
===================================================================
--- trunk/dbus-client/dbus-client.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/dbus-client/dbus-client.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -3,7 +3,7 @@
  *
  * $Id$
  *
- * Copyright (C) 2006 Julien BLACHE <jb at jblache.org>
+ * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

Modified: trunk/dbus-client/dbus-client.h
===================================================================
--- trunk/dbus-client/dbus-client.h	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/dbus-client/dbus-client.h	2007-02-22 00:13:15 UTC (rev 259)
@@ -14,6 +14,10 @@
 #define MBP_DBUS_SIG_LIGHT  (1 << 5)
 
 
+#define KBD_USER      0
+#define KBD_AUTO      1
+
+
 /* Method calls */
 int
 mbp_call_lcd_getlevel(DBusPendingCallNotifyFunction cb, void *userdata);

Modified: trunk/gpomme/gpomme.c
===================================================================
--- trunk/gpomme/gpomme.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/gpomme/gpomme.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -4,7 +4,7 @@
  * $Id$
  *
  * Copyright (C) 2006 Soeren SONNENBURG <debian at nn7.de>
- * Copyright (C) 2006 Julien BLACHE <jb at jblache.org>
+ * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
  *
  * Portions of the GTK code below were shamelessly
  * stolen from pbbuttonsd. Thanks ! ;-)
@@ -315,6 +315,7 @@
   int scratch;
   int cur;
   int max;
+  int who;
   double ratio;
 
   /* Disconnected, try to reconnect */
@@ -353,11 +354,15 @@
 				DBUS_TYPE_UINT32, &cur,
 				DBUS_TYPE_UINT32, &scratch, /* previous */
 				DBUS_TYPE_UINT32, &max,
+				DBUS_TYPE_UINT32, &who,
 				DBUS_TYPE_INVALID);
 
-	  ratio = (double)cur / (double)max;
+	  if (who == KBD_USER)
+	    {
+	      ratio = (double)cur / (double)max;
 
-	  show_window(IMG_KBD_BCK, _("Keyboard backlight level"), ratio);
+	      show_window(IMG_KBD_BCK, _("Keyboard backlight level"), ratio);
+	    }
 	}
       else if (dbus_message_is_signal(msg, "org.pommed.signal.audioVolume", "audioVolume"))
 	{

Modified: trunk/pommed/dbus.c
===================================================================
--- trunk/pommed/dbus.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/pommed/dbus.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -3,7 +3,7 @@
  *
  * $Id$
  *
- * Copyright (C) 2006 Julien BLACHE <jb at jblache.org>
+ * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -89,7 +89,7 @@
 }
 
 void
-mbpdbus_send_kbd_backlight(int cur, int prev)
+mbpdbus_send_kbd_backlight(int cur, int prev, int who)
 {
   DBusMessage *msg;
 
@@ -114,6 +114,7 @@
 				 DBUS_TYPE_UINT32, &cur,
 				 DBUS_TYPE_UINT32, &prev,
 				 DBUS_TYPE_UINT32, &kbd_bck_info.max,
+				 DBUS_TYPE_UINT32, &who,
 				 DBUS_TYPE_INVALID);
   if (ret == FALSE)
     {

Modified: trunk/pommed/dbus.h
===================================================================
--- trunk/pommed/dbus.h	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/pommed/dbus.h	2007-02-22 00:13:15 UTC (rev 259)
@@ -10,7 +10,7 @@
 mbpdbus_send_lcd_backlight(int cur, int prev);
 
 void
-mbpdbus_send_kbd_backlight(int cur, int prev);
+mbpdbus_send_kbd_backlight(int cur, int prev, int who);
 
 void
 mbpdbus_send_ambient_light(int l, int l_prev, int r, int r_prev);

Modified: trunk/pommed/kbd_backlight.h
===================================================================
--- trunk/pommed/kbd_backlight.h	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/pommed/kbd_backlight.h	2007-02-22 00:13:15 UTC (rev 259)
@@ -19,10 +19,15 @@
 #define KBD_BACKLIGHT           "/sys/class/leds/smc:kbd_backlight/brightness"
 #endif /* __powerpc__ */
 
+
 #define KBD_BACKLIGHT_OFF       0
 #define KBD_BACKLIGHT_MAX       255
 
 
+#define KBD_USER     0
+#define KBD_AUTO     1
+
+
 struct _kbd_bck_info
 {
   int level;

Modified: trunk/pommed/mactel/kbd_backlight.c
===================================================================
--- trunk/pommed/mactel/kbd_backlight.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/pommed/mactel/kbd_backlight.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -83,7 +83,7 @@
 }
 
 static void
-kbd_backlight_set(int val)
+kbd_backlight_set(int val, int who)
 {
   int curval;
 
@@ -130,7 +130,7 @@
 
   logdebug("KBD backlight value set to %d\n", val);
 
-  mbpdbus_send_kbd_backlight(val, curval);
+  mbpdbus_send_kbd_backlight(val, curval, who);
 
   kbd_bck_info.level = val;
 }
@@ -138,7 +138,7 @@
 void
 kbd_backlight_off(void)
 {
-  kbd_backlight_set(KBD_BACKLIGHT_OFF);
+  kbd_backlight_set(KBD_BACKLIGHT_OFF, KBD_USER);
 }
 
 void
@@ -173,7 +173,7 @@
   else
     return;
 
-  kbd_backlight_set(newval);
+  kbd_backlight_set(newval, KBD_USER);
 }
 
 void
@@ -231,7 +231,7 @@
       kbd_bck_info.auto_on = 1;
       kbd_bck_info.off = 0;
 
-      kbd_backlight_set(kbd_cfg.auto_lvl);
+      kbd_backlight_set(kbd_cfg.auto_lvl, KBD_AUTO);
     }
   else if (kbd_bck_info.auto_on)
     {
@@ -242,7 +242,7 @@
 	  kbd_bck_info.auto_on = 0;
 	  kbd_bck_info.off = 0;
 
-	  kbd_backlight_set(KBD_BACKLIGHT_OFF);
+	  kbd_backlight_set(KBD_BACKLIGHT_OFF, KBD_AUTO);
 	}
     }
 

Modified: trunk/pommed/pmac/kbd_backlight.c
===================================================================
--- trunk/pommed/pmac/kbd_backlight.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/pommed/pmac/kbd_backlight.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -3,7 +3,7 @@
  *
  * $Id$
  *
- * Copyright (C) 2006 Julien BLACHE <jb at jblache.org>
+ * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
  * Copyright (C) 2006 Yves-Alexis Perez <corsac at corsac.net>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -72,7 +72,7 @@
 }
 
 static void
-kbd_backlight_set(int val)
+kbd_backlight_set(int val, int who)
 {
   int fd, curval, ret;
   unsigned char buf[8];
@@ -143,7 +143,7 @@
 
   close(fd);
 
-  mbpdbus_send_kbd_backlight(val, kbd_bck_info.level);
+  mbpdbus_send_kbd_backlight(val, kbd_bck_info.level, who);
 
   kbd_bck_info.level = val;
 }
@@ -151,7 +151,7 @@
 void
 kbd_backlight_off(void)
 {
-  kbd_backlight_set(KBD_BACKLIGHT_OFF);
+  kbd_backlight_set(KBD_BACKLIGHT_OFF, KBD_USER);
 }
 
 void
@@ -189,7 +189,7 @@
   else
     return;
 
-  kbd_backlight_set(newval);
+  kbd_backlight_set(newval, KBD_USER);
 }
 
 void
@@ -258,7 +258,7 @@
       kbd_bck_info.auto_on = 1;
       kbd_bck_info.off = 0;
 
-      kbd_backlight_set(kbd_cfg.auto_lvl);
+      kbd_backlight_set(kbd_cfg.auto_lvl, KBD_AUTO);
     }
   else if (kbd_bck_info.auto_on)
     {
@@ -269,7 +269,7 @@
 	  kbd_bck_info.auto_on = 0;
 	  kbd_bck_info.off = 0;
 
-	  kbd_backlight_set(KBD_BACKLIGHT_OFF);
+	  kbd_backlight_set(KBD_BACKLIGHT_OFF, KBD_AUTO);
 	}
     }
 

Modified: trunk/wmpomme/wmpomme.c
===================================================================
--- trunk/wmpomme/wmpomme.c	2007-02-21 23:55:49 UTC (rev 258)
+++ trunk/wmpomme/wmpomme.c	2007-02-22 00:13:15 UTC (rev 259)
@@ -158,6 +158,7 @@
 				DBUS_TYPE_UINT32, &mbp.kbd_lvl,
 				DBUS_TYPE_UINT32, &scratch, /* previous */
 				DBUS_TYPE_UINT32, &mbp.kbd_max,
+				DBUS_TYPE_UINT32, &scratch, /* who */
 				DBUS_TYPE_INVALID);
 	}
       else if (dbus_message_is_signal(msg, "org.pommed.signal.audioVolume", "audioVolume"))




More information about the Pommed-commits mailing list