diff options
-rw-r--r-- | src/sbmanager.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/sbmanager.c b/src/sbmanager.c index c3bbb95..3976f88 100644 --- a/src/sbmanager.c +++ b/src/sbmanager.c @@ -81,6 +81,8 @@ SBItem *selected_item = NULL; gfloat start_x = 0.0; gfloat start_y = 0.0; +gboolean move_left = TRUE; + GList *dockitems = NULL; GList *sbpages = NULL; @@ -652,13 +654,22 @@ static GList *insert_into_icon_list(GList *iconlist, SBItem *newitem, gfloat ite gfloat xpos = clutter_actor_get_x(icon); gfloat ypos = clutter_actor_get_y(icon); - if ((item_y > ypos + 70) || (item_y < ypos - 10)) { - /* this is not the row we are in */ - continue; - } - if (item_x < xpos + 30) { - newpos = i; - break; + gint nrow = (ypos - 16) / 88; + gint irow = (item_y - 16) / 88; + + xpos += nrow*STAGE_WIDTH; + gfloat ixpos = item_x + irow*STAGE_WIDTH; + + if (move_left) { + if (ixpos < xpos + 40) { + newpos = i; + break; + } + } else { + if (ixpos < xpos - 10) { + newpos = i; + break; + } } } @@ -676,6 +687,12 @@ static gboolean stage_motion(ClutterActor *actor, ClutterMotionEvent *event, gpo clutter_actor_move_by(icon, (event->x - start_x), (event->y - start_y)); + if (event->x-start_x > 0) { + move_left = FALSE; + } else { + move_left = TRUE; + } + start_x = event->x; start_y = event->y; |