diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index e4bd3c3..d1188cc 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -56,6 +56,8 @@ import android.graphics.Matrix;
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.graphics.Region;
+import android.graphics.Canvas;
+import android.graphics.Path;
 import android.os.BatteryStats;
 import android.os.Binder;
 import android.os.Debug;
@@ -298,6 +300,12 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
     IInputMethodManager mInputMethodManager;
     
     SurfaceSession mFxSession;
+    Surface mCursorSurface;
+    int mCursorX;
+    int mCursorY;
+    int mCursorW;
+    int mCursorH;
+
     Surface mDimSurface;
     boolean mDimShown;
     float mDimCurrentAlpha;
@@ -3866,6 +3874,42 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
         if (DEBUG_INPUT) Log.v(
                 TAG, "dispatchTrackball [" + ev.getAction() +"] <" + ev.getX() + ", " + ev.getY() + ">");
         
+	if (mCursorSurface != null) {
+	       	if (ev.getAction() == MotionEvent.ACTION_MOVE) {
+			Surface.openTransaction();
+			try {
+				try {
+					int cx, cy;
+
+					cx = mCursorX + (int) (ev.getX() * ev.getXPrecision() + 0.5);
+					cy = mCursorY + (int) (ev.getY() * ev.getYPrecision() + 0.5);
+					if (cx < 0)
+						cx = 0;
+					else if (cx >= mDisplay.getWidth())
+						cx = mDisplay.getWidth() - 1;
+					if (cy < 0)
+						cy = 0;
+					else if (cy >= mDisplay.getHeight())
+						cy = mDisplay.getHeight() - 1;
+
+					if (mCursorX != cx || mCursorY != cy) {
+						mCursorSurface.setPosition(cx, cy);
+
+						mCursorX = cx;
+						mCursorY = cy;
+					}
+				} catch (RuntimeException e) {
+					Log.w(TAG, "Error moving Cursor surface because of ", e);
+				}
+			} finally {
+				Surface.closeTransaction();
+			}
+		}
+
+		ev.setLocation((float) mCursorX, (float) mCursorY);
+		return dispatchPointer(qev, ev, pid, uid);
+	}
+
         Object focusObj = mKeyWaiter.waitForNextEventTarget(null, qev,
                 ev, false, false);
         if (focusObj == null) {
@@ -4456,8 +4500,9 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
             final float yf = nextMotion.getY();
             final long eventTime = nextMotion.getEventTime();
             
-            final boolean screenWasOff = qev != null
-                    && (qev.flags&WindowManagerPolicy.FLAG_BRIGHT_HERE) != 0;
+            //final boolean screenWasOff = qev != null
+            //        && (qev.flags&WindowManagerPolicy.FLAG_BRIGHT_HERE) != 0;
+	    final boolean screenWasOff = false;
             
             WindowState target = null;
             
@@ -4907,7 +4952,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
                         if (!mPolicy.isWakeRelMovementTq(event.deviceId,
                                 device.classes, event)) {
                             //Log.i(TAG, "dropping because screenIsOff and !isWakeKey");
-                            return false;
+                            //return false;
                         }
                         event.flags |= WindowManagerPolicy.FLAG_WOKE_HERE;
                     }
@@ -7514,6 +7559,57 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
         
         if (mFxSession == null) {
             mFxSession = new SurfaceSession();
+	    int cx, cy, cw, ch;
+
+	    cw = 16;
+	    ch = 16;
+	    cx = (mDisplay.getWidth() - cw) / 2;
+	    cy = (mDisplay.getHeight() - ch) / 2;
+
+	    Surface surface = null;
+            Canvas canvas;
+            try {
+                surface = new Surface(mFxSession, 0, -1, cw, ch, PixelFormat.TRANSPARENT, 0);
+
+                canvas = surface.lockCanvas(null);
+                canvas.drawColor(0x0);
+
+		Path path = new Path();
+		path.moveTo(0.0f, 0.0f);
+		path.lineTo(8.0f, 0.0f);
+		path.lineTo(5.0f, 3.0f);
+		path.lineTo(16.0f, 14.0f);
+		path.lineTo(14.0f, 16.0f);
+		path.lineTo(3.0f, 5.0f);
+		path.lineTo(0.0f, 8.0f);
+		path.close();
+		canvas.clipPath(path);
+                canvas.drawColor(0xffff0000);
+
+                surface.unlockCanvasAndPost(canvas);
+            } catch (Exception e) {
+                    Log.e(TAG, "Exception creating Cursor surface", e);
+            }
+
+	    if (surface != null) {
+		    Surface.openTransaction();
+		    try {
+			    surface.setPosition(cx, cy);
+			    surface.setSize(cw, ch);
+			    surface.setLayer(99999);
+			    surface.show();
+		    } catch (Exception e) {
+			    Log.e(TAG, "Exception Cursor transaction", e);
+		    }
+		    Surface.closeTransaction();
+	    }
+
+	    mCursorSurface = surface;
+	    mCursorX = cx;
+	    mCursorY = cy;
+	    mCursorW = cw;
+	    mCursorH = ch;
+
         }
         
         if (SHOW_TRANSACTIONS) Log.i(TAG, ">>> OPEN TRANSACTION");

