[Xfce4-commits] r29170 - in xfce4-mixer/branches/xfce_4_4: include lib src

Danny Milosavljevic dannym at xfce.org
Sun Jan 11 20:33:42 CET 2009


Author: dannym
Date: 2009-01-11 19:33:42 +0000 (Sun, 11 Jan 2009)
New Revision: 29170

Modified:
   xfce4-mixer/branches/xfce_4_4/include/vc.h
   xfce4-mixer/branches/xfce_4_4/lib/vc_alsa.c
   xfce4-mixer/branches/xfce_4_4/src/main.c
Log:
try to add support for detecting the unloading of an ALSA module (bug# 3374 etc).

Modified: xfce4-mixer/branches/xfce_4_4/include/vc.h
===================================================================
--- xfce4-mixer/branches/xfce_4_4/include/vc.h	2009-01-11 17:59:09 UTC (rev 29169)
+++ xfce4-mixer/branches/xfce_4_4/include/vc.h	2009-01-11 19:33:42 UTC (rev 29170)
@@ -31,8 +31,13 @@
 
 /* this is the volume changer stuff */
 
-typedef void (*volchanger_callback_t)(char const *which, void *privdata);
+typedef enum {
+	VE_VALUE_CHANGED,
+	VE_REMOVED,
+} volchanger_callback_event_t;
 
+typedef void (*volchanger_callback_t)(char const *which, volchanger_callback_event_t kind, void *privdata);
+
 typedef enum {
 	CT_SLIDER = 0,
 	CT_ONOFF = 1,
@@ -56,6 +61,10 @@
 	void (*vc_set_switch)(char const *which, gboolean b);
 	char const *(*vc_get_device)(void);
 	void (*vc_handle_events)(void);
+	void (*__dummy_1)(void);
+	void (*__dummy_2)(void);
+	void (*__dummy_3)(void);
+	void (*__dummy_4)(void);
 } volchanger_t;
 
 typedef struct {
@@ -66,11 +75,15 @@
 	
 	/* only for type == CT_SELECT: */
 	GList		*choices; /* list item = volchoice_t */
+	void* __dummy_1;
+	void* __dummy_2;
 } volcontrol_t;
 
 typedef struct {
-  gchar* name;
-  gchar* displayname;
+	gchar* name;
+	gchar* displayname;
+	void*  __dummy_1;
+	int    __dummy_2;
 } volchoice_t; /* choices entry for select */
 
 void register_vc(volchanger_t *vc);
@@ -122,7 +135,11 @@
         vc_get_switch: vc_get_switch, \
         vc_set_switch: vc_set_switch, \
         vc_get_device: vc_get_device, \
-        vc_handle_events: vc_handle_events \
+        vc_handle_events: vc_handle_events, \
+        __dummy_1: 0, \
+        __dummy_2: 0, \
+        __dummy_3: 0, \
+        __dummy_4: 0 \
 }; \
 \
 int register_##a(void) \

Modified: xfce4-mixer/branches/xfce_4_4/lib/vc_alsa.c
===================================================================
--- xfce4-mixer/branches/xfce_4_4/lib/vc_alsa.c	2009-01-11 17:59:09 UTC (rev 29169)
+++ xfce4-mixer/branches/xfce_4_4/lib/vc_alsa.c	2009-01-11 19:33:42 UTC (rev 29170)
@@ -499,15 +499,27 @@
 static int alsa_cb(snd_mixer_t *ctl, unsigned int mask, snd_mixer_elem_t *elem)
 {
 	const char *which;
+	volchanger_callback_event_t event;
+
 	g_warning ("alsa_cb\n");
+
+	
 	if (elem && snd_mixer_elem_get_type (elem) == SND_MIXER_ELEM_SIMPLE) {
 		which = snd_mixer_selem_get_name (elem);
 	} else {
 		which = NULL;
 	}
-	
+
+	if (mask == SND_CTL_EVENT_MASK_REMOVE) {
+		event = VE_REMOVED;
+	} else if (mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)) {
+		event = VE_VALUE_CHANGED;
+	} else {
+		return 0;
+	}
+
 	if (mycb) 
-		(*mycb) (which, mydata);
+		(*mycb) (which, event, mydata);
 		
 	return 0;
 }
@@ -526,6 +538,7 @@
 
 	snd_mixer_set_callback_private (handle, data);
 	snd_mixer_set_callback (handle, alsa_cb);
+	/* snd_mixer_elem_set_callback(elem, melem_event); */
 }
 
 static void vc_close_device()

Modified: xfce4-mixer/branches/xfce_4_4/src/main.c
===================================================================
--- xfce4-mixer/branches/xfce_4_4/src/main.c	2009-01-11 17:59:09 UTC (rev 29169)
+++ xfce4-mixer/branches/xfce_4_4/src/main.c	2009-01-11 19:33:42 UTC (rev 29170)
@@ -27,7 +27,7 @@
 static guint src;
 
 
-static void vol_changed_cb (char const *vcname, void *privdata)
+static void vol_changed_cb (char const *vcname, volchanger_callback_event_t kind, void *privdata)
 {
 	if (mixer_window) {
 		xfce_mixer_window_refresh_value (XFCE_MIXER_WINDOW (mixer_window), vcname);




More information about the Xfce4-commits mailing list