From 06762ab54d64e84328d427403bb6074dfd0f630c Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 25 Jan 2010 16:51:08 -0800 Subject: [PATCH] Convert the tap and drop live wallpaper commands coordinates to screen space. --- src/com/android/launcher2/CellLayout.java | 5 ++++- src/com/android/launcher2/Workspace.java | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index df8ca8958a..8b141a41c3 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -565,8 +565,11 @@ public class CellLayout extends ViewGroup { if (lp.dropped) { lp.dropped = false; + final int[] cellXY = mCellXY; + getLocationOnScreen(cellXY); mWallpaperManager.sendWallpaperCommand(getWindowToken(), "android.home.drop", - childLeft + lp.width / 2, childTop + lp.height / 2, 0, null); + cellXY[0] + childLeft + lp.width / 2, + cellXY[1] + childTop + lp.height / 2, 0, null); } } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 9abf562d95..8732929d80 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -637,12 +637,14 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag case MotionEvent.ACTION_UP: if (mTouchState != TOUCH_STATE_SCROLLING) { - final CellLayout currentScreen = (CellLayout)getChildAt(mCurrentScreen); if (!currentScreen.lastDownOnOccupiedCell()) { + getLocationOnScreen(mTempCell); // Send a tap to the wallpaper if the last down was on empty space mWallpaperManager.sendWallpaperCommand(getWindowToken(), - "android.wallpaper.tap", (int) ev.getX(), (int) ev.getY(), 0, null); + "android.wallpaper.tap", + mTempCell[0] + (int) ev.getX(), + mTempCell[1] + (int) ev.getY(), 0, null); } }