Ejemplo n.º 1
0
static
void xvd_raise_handler (const char *keystring, void *Inst)
{
  XvdInstance *xvd_inst = (XvdInstance *) Inst;
  
  g_debug ("The RaiseVolume key was pressed.");
  
  if (xvd_mixer_change_volume (xvd_inst, xvd_inst->vol_step)) {
		#ifdef HAVE_LIBNOTIFY
			if (xvd_inst->current_vol == 100)
				xvd_notify_overshoot_notification (xvd_inst);
			else
				xvd_notify_volume_notification (xvd_inst);
		#endif
  }
}
Ejemplo n.º 2
0
/**
 * Decides the type of notification to show on a change.
 */
static void
xvd_notify_volume_callback (pa_context *c,
                            int         success,
                            void       *userdata)
{
  XvdInstance  *i = (XvdInstance *) userdata;
  guint32       r_oldv, r_curv;

  if (!c || !userdata)
    {
      g_warning ("xvd_notify_volume_update: invalid argument");
      return;
    }

  if (!success)
    {
      g_warning ("xvd_notify_volume_update: operation failed, %s",
                 pa_strerror (pa_context_errno (c)));
      return;
    }

  /* the sink was (un)muted */
  if (old_mute != i->mute)
    {
      xvd_notify_volume_notification (i);
      return;
    }

  r_oldv = xvd_get_readable_volume (&old_volume);
  r_curv = xvd_get_readable_volume (&i->volume);

  /* trying to go above 100 */
  if (r_oldv == 100 && r_curv >= r_oldv)
    xvd_notify_overshoot_notification (i);
  /* trying to go below 0 */
  else if (r_oldv == 0 && r_curv <= r_oldv)
   xvd_notify_undershoot_notification (i);
  /* normal */
  else
   xvd_notify_volume_notification (i);
}