]> pilppa.com Git - familiar-h63xx-build.git/commitdiff
minimix: disable polling and repaint icon when idle.
authorRene Wagner <rw@handhelds.org>
Sat, 12 Aug 2006 16:44:38 +0000 (18:44 +0200)
committerRene Wagner <rw@handhelds.org>
Sat, 12 Aug 2006 16:44:38 +0000 (18:44 +0200)
Signed-off-by: Rene Wagner <rw@handhelds.org>
org.handhelds.familiar/packages/minimix/files/disable-polling.patch [new file with mode: 0644]
org.handhelds.familiar/packages/minimix/minimix_0.8.bb

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 (file)
index 0000000..973e020
--- /dev/null
@@ -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);
index 484393c322ed011504a3ec602abc6ae5be259178..11443f6c59a3510cfc5ace988cdb67508dfe1f8a 100644 (file)
@@ -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"