char *icon, buf[56];
int ret;
- if (!emix_config_notify_get())
- return;
+ if (!emix_config_notify_get()) return;
memset(&n, 0, sizeof(E_Notification_Notify));
- if (val > EMIX_VOLUME_MAX || val < 0)
- return;
+ if (val < 0) return;
ret = snprintf(buf, (sizeof(buf) - 1), "%s: %d%%", _("New volume"), val);
if ((ret < 0) || ((unsigned int)ret > sizeof(buf)))
char buf[PATH_MAX];
_popup_del(inst);
- if (mixer_context->emixer)
- return;
+ if (mixer_context->emixer) return;
snprintf(buf, sizeof(buf), "%s/%s/emixer %s",
e_module_dir_get(mixer_context->module),
_slider_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
{
- int val;
+ int val, pval;
Emix_Volume v;
unsigned int i;
Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default;
+ pval = s->volume.volumes[0];
val = (int)elm_slider_value_get(obj);
+ if ((pval > 80) && (pval <= 100) && (val > 100) && (val < 120)) val = 100;
v.volumes = calloc(s->volume.channel_count, sizeof(int));
v.channel_count = s->volume.channel_count;
- for (i = 0; i < s->volume.channel_count; i++)
- v.volumes[i] = val;
-
+ for (i = 0; i < s->volume.channel_count; i++) v.volumes[i] = val;
emix_sink_volume_set(s, v);
+ elm_slider_value_set(obj, val);
+}
+
+static void
+_slider_drag_stop_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event EINA_UNUSED)
+{
+ Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default;
+ int val = s->volume.volumes[0];
+ elm_slider_value_set(obj, val);
}
static void
evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0);
evas_object_show(slider);
- elm_slider_min_max_set(slider, 0.0, EMIX_VOLUME_MAX);
+ elm_slider_min_max_set(slider, 0.0, EMIX_VOLUME_MAX + 50);
evas_object_smart_callback_add(slider, "changed", _slider_changed_cb, NULL);
+ evas_object_smart_callback_add(slider, "slider,drag,stop", _slider_drag_stop_cb, NULL);
elm_slider_value_set(slider, volume);
elm_box_pack_end(bx, slider);
evas_object_show(slider);
#define VOLSET(vol, srcvol, target, func) \
do { \
Emix_Volume _v; \
+ int _pvol = srcvol.volumes[0]; \
+ if ((_pvol > 80) && (_pvol <= 100) && \
+ (vol > 100) && (vol < 120)) vol = 100; \
_v.channel_count = srcvol.channel_count; \
_v.volumes = calloc(srcvol.channel_count, sizeof(int)); \
if (_v.volumes) { \
Emix_Sink *sink = evas_object_data_get(bxv, "sink");
double vol = elm_slider_value_get(obj);
VOLSET(vol, sink->volume, sink, emix_sink_volume_set);
+ elm_slider_value_set(obj, vol);
+}
+
+static void
+_cb_sink_volume_drag_stop(void *data,
+ Evas_Object *obj,
+ void *event EINA_UNUSED)
+{
+ Evas_Object *bxv = data;
+ Emix_Sink *sink = evas_object_data_get(bxv, "sink");
+ int vol = sink->volume.volumes[0];
+ elm_slider_value_set(obj, vol);
}
static void
sl = elm_slider_add(win);
evas_object_data_set(bxv, "volume", sl);
- elm_slider_min_max_set(sl, 0.0, 100.0);
- elm_slider_span_size_set(sl, 100 * elm_config_scale_get());
+ elm_slider_min_max_set(sl, 0.0, EMIX_VOLUME_MAX + 50);
+ elm_slider_span_size_set(sl, (EMIX_VOLUME_MAX + 50) * elm_config_scale_get());
elm_slider_unit_format_set(sl, "%1.0f");
elm_slider_indicator_format_set(sl, "%1.0f");
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.5);
elm_box_pack_end(bx, sl);
evas_object_show(sl);
evas_object_smart_callback_add(sl, "changed", _cb_sink_volume_change, bxv);
+ evas_object_smart_callback_add(sl, "slider,drag,stop",
+ _cb_sink_volume_drag_stop, bxv);
ck = elm_check_add(win);
evas_object_data_set(bxv, "mute", ck);
Emix_Sink_Input *input = evas_object_data_get(bxv, "input");
double vol = elm_slider_value_get(obj);
VOLSET(vol, input->volume, input, emix_sink_input_volume_set);
+ elm_slider_value_set(obj, vol);
+}
+
+static void
+_cb_sink_input_volume_drag_stop(void *data,
+ Evas_Object *obj,
+ void *event EINA_UNUSED)
+{
+ Evas_Object *bxv = data;
+ Emix_Sink_Input *input = evas_object_data_get(bxv, "input");
+ int vol = input->volume.volumes[0];
+ elm_slider_value_set(obj, vol);
}
static void
sl = elm_slider_add(win);
evas_object_data_set(bxv, "volume", sl);
- elm_slider_min_max_set(sl, 0.0, 100.0);
- elm_slider_span_size_set(sl, 100 * elm_config_scale_get());
+ elm_slider_min_max_set(sl, 0.0, EMIX_VOLUME_MAX + 50);
+ elm_slider_span_size_set(sl, (EMIX_VOLUME_MAX + 50) * elm_config_scale_get());
elm_slider_unit_format_set(sl, "%1.0f");
elm_slider_indicator_format_set(sl, "%1.0f");
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.5);
evas_object_show(sl);
evas_object_smart_callback_add(sl, "changed",
_cb_sink_input_volume_change, bxv);
+ evas_object_smart_callback_add(sl, "slider,drag,stop",
+ _cb_sink_input_volume_drag_stop, bxv);
ck = elm_check_add(win);
evas_object_data_set(bxv, "mute", ck);
Emix_Source *source = evas_object_data_get(bxv, "source");
double vol = elm_slider_value_get(obj);
VOLSET(vol, source->volume, source, emix_source_volume_set);
+ elm_slider_value_set(obj, vol);
+}
+
+static void
+_cb_source_volume_drag_stop(void *data,
+ Evas_Object *obj,
+ void *event EINA_UNUSED)
+{
+ Evas_Object *bxv = data;
+ Emix_Source *source = evas_object_data_get(bxv, "source");
+ int vol = source->volume.volumes[0];
+ elm_slider_value_set(obj, vol);
}
static void
sl = elm_slider_add(win);
evas_object_data_set(bxv, "volume", sl);
- elm_slider_min_max_set(sl, 0.0, 100.0);
- elm_slider_span_size_set(sl, 100 * elm_config_scale_get());
+ elm_slider_min_max_set(sl, 0.0, EMIX_VOLUME_MAX + 50);
+ elm_slider_span_size_set(sl, (EMIX_VOLUME_MAX + 50) * elm_config_scale_get());
elm_slider_unit_format_set(sl, "%1.0f");
elm_slider_indicator_format_set(sl, "%1.0f");
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.5);
evas_object_show(sl);
evas_object_smart_callback_add(sl, "changed",
_cb_source_volume_change, bxv);
+ evas_object_smart_callback_add(sl, "slider,drag,stop",
+ _cb_source_volume_drag_stop, bxv);
ck = elm_check_add(win);
evas_object_data_set(bxv, "mute", ck);