From 57f0d69080cef7811a1eb3d4020b22e548be5dbf Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 10 Feb 2004 01:40:56 +0000 Subject: [PATCH] fixed cursors (bug 379) darcs-hash:20040210014056-5007d-88eff74532f65faf0d2e4cadb720cfc9d38b53e3.gz --- src/org/ibex/Box.java | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/org/ibex/Box.java b/src/org/ibex/Box.java index 9d7ed49..1b10383 100644 --- a/src/org/ibex/Box.java +++ b/src/org/ibex/Box.java @@ -629,10 +629,11 @@ public final class Box extends JSScope implements Scheduler.Task { set(CURSOR); boxToCursor.put(this, value); Surface surface = getSurface(); - String tempcursor = surface.cursor; - // FIXME - //Move(surface.mousex, surface.mousey, surface.mousex, surface.mousey); - if (surface.cursor != tempcursor) surface.syncCursor(); + if (surface != null) { + String tempcursor = surface.cursor; + propagateDownward(null, null, false); + if (surface.cursor != tempcursor) surface.syncCursor(); + } } private void setFill(Object value) throws JSExn { @@ -666,8 +667,15 @@ public final class Box extends JSScope implements Scheduler.Task { int y = globalToLocalY(getSurface()._mousey); boolean wasinside = test(MOUSEINSIDE); boolean isinside = test(VISIBLE) && inside(x, y) && !obscured; - if (!wasinside && isinside) { set(MOUSEINSIDE); putAndTriggerTrapsAndCatchExceptions("Enter", T); } - if (wasinside && !isinside) { clear(MOUSEINSIDE); putAndTriggerTrapsAndCatchExceptions("Leave", T); } + if (!wasinside && isinside) { + set(MOUSEINSIDE); + putAndTriggerTrapsAndCatchExceptions("Enter", T); + } + if (isinside && test(CURSOR)) getSurface().cursor = (String)boxToCursor.get(this); + if (wasinside && !isinside) { + clear(MOUSEINSIDE); + putAndTriggerTrapsAndCatchExceptions("Leave", T); + } boolean found = false; if (wasinside || isinside) @@ -678,17 +686,20 @@ public final class Box extends JSScope implements Scheduler.Task { } else try { found = true; child.clear(STOP_UPWARD_PROPAGATION); - child.putAndTriggerTrapsAndCatchExceptions(name, value); + if (name != null) child.putAndTriggerTrapsAndCatchExceptions(name, value); + else child.propagateDownward(name, value, obscured); } finally { if (save_stop) child.set(STOP_UPWARD_PROPAGATION); else child.clear(STOP_UPWARD_PROPAGATION); } if (child.inside(x - child.x, y - child.y)) - if (name.equals("_Move")) obscured = true; + if (name != null && name.equals("_Move")) obscured = true; else break; } if (!obscured && !found) - if (!name.equals("_Move") || wasinside) putAndTriggerTrapsAndCatchExceptions(name.substring(1), value); + if ("_Move".equals(name) || wasinside) + if (name != null) + putAndTriggerTrapsAndCatchExceptions(name.substring(1), value); } private static int stringToColor(String s) { -- 1.7.10.4