meta-efl: enjoy: fix scrolling

* [SHR bug #2058] http://www.shr-project.org/trac/ticket/2058
* [EFL bug #1477] http://trac.enlightenment.org/e/ticket/1477

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Denis 'GNUtoo' Carikli
2012-09-09 15:59:12 +02:00
committed by Martin Jansa
parent 469c1599ce
commit fac9e9c8b5
2 changed files with 139 additions and 1 deletions
@@ -0,0 +1,133 @@
From ac4c8a57e8a042acd4b8ff803d3d3574b0e7a7fb Mon Sep 17 00:00:00 2001
From: Alban Browaeys <prahal@yahoo.com>
Date: Wed, 5 Sep 2012 02:58:26 +0000
Subject: [PATCH] always use position as percent and define a 1 seconds
tolerance.
Fix "reverb" effect: ie loop between setting the slider to match
the position and handling slider to position (seek).
---
data/themes/default.edc | 8 +++-----
src/bin/win.c | 28 ++++++++++++++++++++++------
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/data/themes/default.edc b/data/themes/default.edc
index 65efddf..27bb9e4 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -186,7 +186,6 @@ collections {
group {
name: "nowplaying";
script {
- public cur_length;
public mute;
public get_time_str(Float:time, time_str[6])
@@ -201,16 +200,15 @@ collections {
new Float:position = getfarg(2);
new Float:length = getfarg(3);
if (length > 0)
- external_param_set_float(PART:"progress.slider", "value", position / length * 100);
+ external_param_set_float(PART:"progress.slider", "value", position * 100);
else
external_param_set_float(PART:"progress.slider", "value", 0);
new time_str[6];
- get_time_str(position, time_str);
+ get_time_str(position * length, time_str);
set_text(PART:"ejy.text.current_time", time_str);
get_time_str(length, time_str);
set_text(PART:"ejy.text.total_time", time_str);
- set_float(cur_length, length);
} else if (type == MSG_INT && id == MSG_SHUFFLE) {
external_param_set_bool(PART:"buttons.shuffle", "state", getarg(2));
} else if (type == MSG_INT && id == MSG_LOOP) {
@@ -687,7 +685,7 @@ collections {
source: "progress.slider";
signal: "changed";
script {
- send_message(MSG_FLOAT, MSG_POSITION, (external_param_get_float(PART:"progress.slider", "value") * get_float(cur_length) / 100));
+ send_message(MSG_FLOAT, MSG_POSITION, (external_param_get_float(PART:"progress.slider", "value") / 100));
}
}
program {
diff --git a/src/bin/win.c b/src/bin/win.c
index 63951db..ad93ab5 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -194,8 +194,8 @@ _win_play_eval(Win *w)
{
Edje_Message_Float_Set *mf;
- w->play.position = emotion_object_position_get(w->emotion);
w->play.length = emotion_object_play_length_get(w->emotion);
+ w->play.position = emotion_object_position_get(w->emotion) / w->play.length;
if ((w->song) && (w->song->length != (int)w->play.length))
db_song_length_set(w->db, w->song, w->play.length);
@@ -542,8 +542,14 @@ _win_edje_msg(void *data, Evas_Object *o __UNUSED__, Edje_Message_Type type, int
else
{
Edje_Message_Float *m = msg;
+
+ if ((((m->val - w->play.position) * w->play.length) < 1.0)
+ && (((w->play.position - m->val) * w->play.length) < 1.0))
+ return;
+
w->play.position = m->val;
- emotion_object_position_set(w->emotion, w->play.position);
+ emotion_object_position_set(w->emotion, w->play.position
+ * w->play.length);
ecore_event_add(ENJOY_EVENT_POSITION_CHANGE, NULL, NULL, NULL);
}
break;
@@ -617,16 +623,21 @@ enjoy_control_seek(uint64_t position)
{
Win *w = &_win;
double seek_to;
+ double new_pos = w->play.length / ((double)position / 1e6);
if (!w->db) return;
- seek_to = w->play.position + w->play.length / ((double)position / 1e6);
+
+ if ((((new_pos - w->play.position) * w->play.length) < 1.0)
+ && (((w->play.position - new_pos) * w->play.length) < 1.0)) return;
+
+ seek_to = w->play.position + new_pos;
if (seek_to <= 0.0)
seek_to = 0.0;
else if (seek_to >= 1.0)
seek_to = 1.0;
w->play.position = seek_to;
- emotion_object_position_set(w->emotion, w->play.position);
+ emotion_object_position_set(w->emotion, w->play.position * w->play.length);
ecore_event_add(ENJOY_EVENT_POSITION_CHANGE, NULL, NULL, NULL);
}
@@ -692,15 +703,20 @@ EAPI void
enjoy_position_set(int32_t position)
{
Win *w = &_win;
+ double new_pos = w->play.length / ((double)position / 1e6);
if (!w->db) return;
- w->play.position = w->play.length / ((double)position / 1e6);
+
+ if ((((new_pos - w->play.position) * w->play.length) < 1.0)
+ && (((w->play.position - new_pos) * w->play.length) < 1.0)) return;
+
+ w->play.position = new_pos;
if (w->play.position < 0.0)
w->play.position = 0.0;
else if (w->play.position > 1.0)
w->play.position = 1.0;
- emotion_object_position_set(w->emotion, w->play.position);
+ emotion_object_position_set(w->emotion, w->play.position * w->play.length);
ecore_event_add(ENJOY_EVENT_POSITION_CHANGE, NULL, NULL, NULL);
}
--
1.7.7
+6 -1
View File
@@ -21,9 +21,14 @@ RDEPENDS += "\
" "
inherit e gettext inherit e gettext
SRC_URI = "${E_SVN}/trunk;module=${SRCNAME};protocol=http;scmdata=keep" SRC_URI = " \
${E_SVN}/trunk;module=${SRCNAME};protocol=http;scmdata=keep \
file://0001-always-use-position-as-percent-and-define-a-1-second.patch \
"
S = "${WORKDIR}/${SRCNAME}" S = "${WORKDIR}/${SRCNAME}"
PR = "r1"
FILES_${PN} += "${datadir}/icons/" FILES_${PN} += "${datadir}/icons/"
EXTRA_OECONF = "\ EXTRA_OECONF = "\