summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRene Wagner <rw@handhelds.org>2006-08-12 18:44:38 +0200
committerRene Wagner <rw@handhelds.org>2006-08-12 18:44:38 +0200
commit0df30a7c5465366d03a38d38d17d117012c892e0 (patch)
tree16bf84b3afd267e3980dd77cc307dd3cc7084d55
parent08dbe81541eac12755dafedfd01ccef78bd6afa1 (diff)
minimix: disable polling and repaint icon when idle.
Signed-off-by: Rene Wagner <rw@handhelds.org>
-rw-r--r--org.handhelds.familiar/packages/minimix/files/disable-polling.patch95
-rw-r--r--org.handhelds.familiar/packages/minimix/minimix_0.8.bb3
2 files changed, 98 insertions, 0 deletions
diff --git a/org.handhelds.familiar/packages/minimix/files/disable-polling.patch b/org.handhelds.familiar/packages/minimix/files/disable-polling.patch
new file mode 100644
index 0000000..973e020
--- /dev/null
+++ b/org.handhelds.familiar/packages/minimix/files/disable-polling.patch
@@ -0,0 +1,95 @@
+Index: minimix/minimix.c
+===================================================================
+RCS file: /cvs/gpe/base/minimix/minimix.c,v
+retrieving revision 1.10
+diff -u -r1.10 minimix.c
+--- minimix/minimix.c 19 Sep 2005 15:36:02 -0000 1.10
++++ minimix/minimix.c 2 Aug 2006 17:06:51 -0000
+@@ -2,7 +2,7 @@
+ * minimix -- volume control
+ *
+ * Copyright (c) 2002, 2003, 2004 Phil Blundell
+- * 2005 Rene Wagner
++ * 2005, 2006 Rene Wagner
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -39,7 +39,13 @@
+ GtkWidget *icon;
+ gint icon_size;
+ gboolean configure_done = FALSE;
++
++#ifdef ENABLE_POLLING
+ guint timeout;
++#endif /* ENABLE_POLLING */
++
++guint render_idle_source;
++gboolean render_idle_scheduled = FALSE;
+
+ int mixerfd;
+
+@@ -87,9 +93,11 @@
+ current_vol_icon = vol_icons[level < SLIDER_MAX ? level / (SLIDER_MAX / (NUM_VOL_ICONS - 1)) + 1 : VOL_ICON_MAX];
+ }
+
++#ifdef ENABLE_POLLING
+ /* avoid loops... */
+ if (level != gtk_adjustment_get_value (adj))
+ gtk_adjustment_set_value (adj, level);
++#endif /* ENABLE_POLLING */
+ }
+
+ void
+@@ -106,6 +114,7 @@
+ gtk_image_set_from_pixbuf(GTK_IMAGE(icon), dbuf);
+ }
+
++#ifdef ENABLE_POLLING
+ gboolean
+ timeout_cb (gpointer data)
+ {
+@@ -118,6 +127,16 @@
+
+ return TRUE;
+ }
++#endif /* ENABLE_POLLING */
++
++gboolean
++render_when_idle (gpointer data)
++{
++ render_icon();
++ render_idle_scheduled = FALSE;
++
++ return FALSE;
++}
+
+ void
+ value_changed (GtkAdjustment *adj)
+@@ -129,7 +148,13 @@
+ refresh (value);
+
+ if (configure_done && current_vol_icon != old_icon)
+- render_icon ();
++ {
++ if (G_UNLIKELY (render_idle_scheduled))
++ g_source_remove (render_idle_source);
++ else
++ render_idle_scheduled = TRUE;
++ render_idle_source = g_idle_add(render_when_idle, NULL);
++ }
+
+ value |= (value << 8);
+ ioctl (mixerfd, SOUND_MIXER_WRITE_VOLUME, &value);
+@@ -282,9 +307,12 @@
+ gtk_widget_add_events (slider_window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
+
+ refresh (read_volume_level ());
++
++#ifdef ENABLE_POLLING
+ timeout = g_timeout_add (200,
+ (GSourceFunc) timeout_cb,
+ NULL);
++#endif /* ENABLE_POLLING */
+
+ gtk_widget_show_all (box);
+
diff --git a/org.handhelds.familiar/packages/minimix/minimix_0.8.bb b/org.handhelds.familiar/packages/minimix/minimix_0.8.bb
index 484393c..11443f6 100644
--- a/org.handhelds.familiar/packages/minimix/minimix_0.8.bb
+++ b/org.handhelds.familiar/packages/minimix/minimix_0.8.bb
@@ -2,8 +2,11 @@ DESCRIPTION = "Volume Control Applet for GPE"
LICENSE = "GPL"
MAINTAINER = "Rene Wagner <rw@handhelds.org>"
SECTION = "gpe"
+PR = "r1"
DEPENDS = "libgpewidget"
GPE_TARBALL_SUFFIX = "bz2"
inherit gpe autotools
+
+SRC_URI += "file://disable-polling.patch;patch=1"