Technical discussions | Discussions techniques
Subscription date : 10 May 2010
Messages : 22
|
I see Scooby-do's code, in file applet-icon-finder.c there is:
if (1||myData.pCurrentDock != pDock)
{
cairo_dock_emit_motion_signal (pDock,
x,
y);
}
else
{
myData.iPrevMouseX = myData.iMouseX;
myData.iPrevMouseY = myData.iMouseY;
myData.iMotionCount = 10;
}
I try remove "1||" and found out focus icon move quiet well, but then I found out it didn't work well when in sub-dock.
So I try my own code:
typedef struct
{
guint iCount;
gfloat fX;
gfloat fY;
gfloat fDx;
gfloat fDy;
CairoDock *pDock;
Icon* pIcon;
} movement_s;
static gboolean __movement(gpointer data)
{
movement_s* m = (movement_s*)(data);
m->fX += m->fDx;
m->fY += m->fDy;
cairo_dock_emit_motion_signal (m->pDock,
(gint)(m->fX),
(gint)(m->fY));
m->iCount--;
if (m->iCount == 0 )
{
g_free(m);
return FALSE;
}else return TRUE;
}
if (myData.pCurrentDock != pDock)
{
cairo_dock_emit_motion_signal (pDock,
x,
y);
}
else
{
movement_s* pMove = g_new0(movement_s,1);
pMove->fX = (gfloat)(myData.iMouseX);
pMove->fY = (gfloat)(myData.iMouseY);
pMove->pDock = pDock;
pMove->pIcon = pIcon;
pMove->iCount = 10;
pMove->fDx = (x-(gfloat)(myData.iMouseX))/(gfloat)(pMove->iCount);
pMove->fDy = (y-(gfloat)(myData.iMouseY))/(gfloat)(pMove->iCount);
g_timeout_add(20,__movement,pMove);
}
Then movement work well both in dock and sub-dock now, although movement between dock and sub-dock still shaking.
Another problem is icon animation stop after show once.
If I put launch animation code in timeout callback, animation will block later movement.  |
Subscription date : 30 November 2007
Messages : 17118
|
icon animation stop after show once
this is because the applet simulate the mouse's movement on the dock.
and you have set up the animation on mouse hover to not repeat itself.  |
Subscription date : 10 May 2010
Messages : 22
|
Ok, I get it. |
Technical discussions | Discussions techniques
|