1303 dispatchEvent(e);
1304 }
1305
1306 comp.createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
1307 comp, this,
1308 HierarchyEvent.PARENT_CHANGED,
1309 Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_EVENT_MASK));
1310 }
1311 if (peer != null && layoutMgr == null && isVisible()) {
1312 updateCursorImmediately();
1313 }
1314 invalidateIfValid();
1315 }
1316 }
1317
1318 // Should only be called while holding tree lock
1319 int numListening(long mask) {
1320 int superListening = super.numListening(mask);
1321
1322 if (mask == AWTEvent.HIERARCHY_EVENT_MASK) {
1323 if (eventLog.isLoggable(PlatformLogger.FINE)) {
1324 // Verify listeningChildren is correct
1325 int sum = 0;
1326 for (Component comp : component) {
1327 sum += comp.numListening(mask);
1328 }
1329 if (listeningChildren != sum) {
1330 eventLog.fine("Assertion (listeningChildren == sum) failed");
1331 }
1332 }
1333 return listeningChildren + superListening;
1334 } else if (mask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) {
1335 if (eventLog.isLoggable(PlatformLogger.FINE)) {
1336 // Verify listeningBoundsChildren is correct
1337 int sum = 0;
1338 for (Component comp : component) {
1339 sum += comp.numListening(mask);
1340 }
1341 if (listeningBoundsChildren != sum) {
1342 eventLog.fine("Assertion (listeningBoundsChildren == sum) failed");
1343 }
1344 }
1345 return listeningBoundsChildren + superListening;
1346 } else {
1347 // assert false;
1348 if (eventLog.isLoggable(PlatformLogger.FINE)) {
1349 eventLog.fine("This code must never be reached");
1350 }
1351 return superListening;
1352 }
1353 }
1354
1355 // Should only be called while holding tree lock
1356 void adjustListeningChildren(long mask, int num) {
1357 if (eventLog.isLoggable(PlatformLogger.FINE)) {
1358 boolean toAssert = (mask == AWTEvent.HIERARCHY_EVENT_MASK ||
1359 mask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK ||
1360 mask == (AWTEvent.HIERARCHY_EVENT_MASK |
1361 AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK));
1362 if (!toAssert) {
1363 eventLog.fine("Assertion failed");
1364 }
1365 }
1366
1367 if (num == 0)
1368 return;
1369
1370 if ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0) {
1371 listeningChildren += num;
1372 }
1373 if ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0) {
1374 listeningBoundsChildren += num;
1375 }
1376
1377 adjustListeningChildrenOnParent(mask, num);
1378 }
1379
1380 // Should only be called while holding tree lock
1381 void adjustDescendants(int num) {
1382 if (num == 0)
1383 return;
1384
1385 descendantsCount += num;
1386 adjustDecendantsOnParent(num);
1387 }
1388
1389 // Should only be called while holding tree lock
1390 void adjustDecendantsOnParent(int num) {
1391 if (parent != null) {
1392 parent.adjustDescendants(num);
1393 }
1394 }
1395
1396 // Should only be called while holding tree lock
1397 int countHierarchyMembers() {
1398 if (log.isLoggable(PlatformLogger.FINE)) {
1399 // Verify descendantsCount is correct
1400 int sum = 0;
1401 for (Component comp : component) {
1402 sum += comp.countHierarchyMembers();
1403 }
1404 if (descendantsCount != sum) {
1405 log.fine("Assertion (descendantsCount == sum) failed");
1406 }
1407 }
1408 return descendantsCount + 1;
1409 }
1410
1411 private int getListenersCount(int id, boolean enabledOnToolkit) {
1412 checkTreeLock();
1413 if (enabledOnToolkit) {
1414 return descendantsCount;
1415 }
1416 switch (id) {
1417 case HierarchyEvent.HIERARCHY_CHANGED:
1418 return listeningChildren;
4093 Component c = getComponent(index);
4094 if (c.isLightweight() && c.isShowing()) {
4095 s = s.getUnion(c.getOpaqueShape());
4096 }
4097 }
4098 return s.getIntersection(getNormalShape());
4099 }
4100 return super.getOpaqueShape();
4101 }
4102
4103 final void recursiveSubtractAndApplyShape(Region shape) {
4104 recursiveSubtractAndApplyShape(shape, getTopmostComponentIndex(), getBottommostComponentIndex());
4105 }
4106
4107 final void recursiveSubtractAndApplyShape(Region shape, int fromZorder) {
4108 recursiveSubtractAndApplyShape(shape, fromZorder, getBottommostComponentIndex());
4109 }
4110
4111 final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
4112 checkTreeLock();
4113 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4114 mixingLog.fine("this = " + this +
4115 "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
4116 }
4117 if (fromZorder == -1) {
4118 return;
4119 }
4120 if (shape.isEmpty()) {
4121 return;
4122 }
4123 // An invalid container with not-null layout should be ignored
4124 // by the mixing code, the container will be validated later
4125 // and the mixing code will be executed later.
4126 if (getLayout() != null && !isValid()) {
4127 return;
4128 }
4129 for (int index = fromZorder; index <= toZorder; index++) {
4130 Component comp = getComponent(index);
4131 if (!comp.isLightweight()) {
4132 comp.subtractAndApplyShape(shape);
4133 } else if (comp instanceof Container &&
4134 ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
4135 ((Container)comp).recursiveSubtractAndApplyShape(shape);
4136 }
4137 }
4138 }
4139
4140 final void recursiveApplyCurrentShape() {
4141 recursiveApplyCurrentShape(getTopmostComponentIndex(), getBottommostComponentIndex());
4142 }
4143
4144 final void recursiveApplyCurrentShape(int fromZorder) {
4145 recursiveApplyCurrentShape(fromZorder, getBottommostComponentIndex());
4146 }
4147
4148 final void recursiveApplyCurrentShape(int fromZorder, int toZorder) {
4149 checkTreeLock();
4150 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4151 mixingLog.fine("this = " + this +
4152 "; fromZ=" + fromZorder + "; toZ=" + toZorder);
4153 }
4154 if (fromZorder == -1) {
4155 return;
4156 }
4157 // An invalid container with not-null layout should be ignored
4158 // by the mixing code, the container will be validated later
4159 // and the mixing code will be executed later.
4160 if (getLayout() != null && !isValid()) {
4161 return;
4162 }
4163 for (int index = fromZorder; index <= toZorder; index++) {
4164 Component comp = getComponent(index);
4165 if (!comp.isLightweight()) {
4166 comp.applyCurrentShape();
4167 }
4168 if (comp instanceof Container &&
4169 ((Container)comp).hasHeavyweightDescendants()) {
4170 ((Container)comp).recursiveApplyCurrentShape();
4247 */
4248 final boolean isRecursivelyVisibleUpToHeavyweightContainer() {
4249 if (!isLightweight()) {
4250 return true;
4251 }
4252
4253 for (Container cont = this;
4254 cont != null && cont.isLightweight();
4255 cont = cont.getContainer())
4256 {
4257 if (!cont.isVisible()) {
4258 return false;
4259 }
4260 }
4261 return true;
4262 }
4263
4264 @Override
4265 void mixOnShowing() {
4266 synchronized (getTreeLock()) {
4267 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4268 mixingLog.fine("this = " + this);
4269 }
4270
4271 boolean isLightweight = isLightweight();
4272
4273 if (isLightweight && isRecursivelyVisibleUpToHeavyweightContainer()) {
4274 recursiveShowHeavyweightChildren();
4275 }
4276
4277 if (!isMixingNeeded()) {
4278 return;
4279 }
4280
4281 if (!isLightweight || (isLightweight && hasHeavyweightDescendants())) {
4282 recursiveApplyCurrentShape();
4283 }
4284
4285 super.mixOnShowing();
4286 }
4287 }
4288
4289 @Override
4290 void mixOnHiding(boolean isLightweight) {
4291 synchronized (getTreeLock()) {
4292 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4293 mixingLog.fine("this = " + this +
4294 "; isLightweight=" + isLightweight);
4295 }
4296 if (isLightweight) {
4297 recursiveHideHeavyweightChildren();
4298 }
4299 super.mixOnHiding(isLightweight);
4300 }
4301 }
4302
4303 @Override
4304 void mixOnReshaping() {
4305 synchronized (getTreeLock()) {
4306 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4307 mixingLog.fine("this = " + this);
4308 }
4309
4310 boolean isMixingNeeded = isMixingNeeded();
4311
4312 if (isLightweight() && hasHeavyweightDescendants()) {
4313 final Point origin = new Point(getX(), getY());
4314 for (Container cont = getContainer();
4315 cont != null && cont.isLightweight();
4316 cont = cont.getContainer())
4317 {
4318 origin.translate(cont.getX(), cont.getY());
4319 }
4320
4321 recursiveRelocateHeavyweightChildren(origin);
4322
4323 if (!isMixingNeeded) {
4324 return;
4325 }
4326
4327 recursiveApplyCurrentShape();
4328 }
4329
4330 if (!isMixingNeeded) {
4331 return;
4332 }
4333
4334 super.mixOnReshaping();
4335 }
4336 }
4337
4338 @Override
4339 void mixOnZOrderChanging(int oldZorder, int newZorder) {
4340 synchronized (getTreeLock()) {
4341 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4342 mixingLog.fine("this = " + this +
4343 "; oldZ=" + oldZorder + "; newZ=" + newZorder);
4344 }
4345
4346 if (!isMixingNeeded()) {
4347 return;
4348 }
4349
4350 boolean becameHigher = newZorder < oldZorder;
4351
4352 if (becameHigher && isLightweight() && hasHeavyweightDescendants()) {
4353 recursiveApplyCurrentShape();
4354 }
4355 super.mixOnZOrderChanging(oldZorder, newZorder);
4356 }
4357 }
4358
4359 @Override
4360 void mixOnValidating() {
4361 synchronized (getTreeLock()) {
4362 if (mixingLog.isLoggable(PlatformLogger.FINE)) {
4363 mixingLog.fine("this = " + this);
4364 }
4365
4366 if (!isMixingNeeded()) {
4367 return;
4368 }
4369
4370 if (hasHeavyweightDescendants()) {
4371 recursiveApplyCurrentShape();
4372 }
4373
4374 if (isLightweight() && isNonOpaqueForMixing()) {
4375 subtractAndApplyShapeBelowMe();
4376 }
4377
4378 super.mixOnValidating();
4379 }
4380 }
4381
4382 // ****************** END OF MIXING CODE ********************************
4532 // other than that which received the MOUSE_PRESSED event. If the
4533 // mouse is now over a different Component, don't dispatch the event.
4534 // The previous fix for a similar problem was associated with bug
4535 // 4155217.
4536 if (mouseOver == mouseEventTarget) {
4537 retargetMouseEvent(mouseOver, id, e);
4538 }
4539 break;
4540 case MouseEvent.MOUSE_MOVED:
4541 retargetMouseEvent(mouseEventTarget, id, e);
4542 break;
4543 case MouseEvent.MOUSE_DRAGGED:
4544 if (isMouseGrab(e)) {
4545 retargetMouseEvent(mouseEventTarget, id, e);
4546 }
4547 break;
4548 case MouseEvent.MOUSE_WHEEL:
4549 // This may send it somewhere that doesn't have MouseWheelEvents
4550 // enabled. In this case, Component.dispatchEventImpl() will
4551 // retarget the event to a parent that DOES have the events enabled.
4552 if (eventLog.isLoggable(PlatformLogger.FINEST) && (mouseOver != null)) {
4553 eventLog.finest("retargeting mouse wheel to " +
4554 mouseOver.getName() + ", " +
4555 mouseOver.getClass());
4556 }
4557 retargetMouseEvent(mouseOver, id, e);
4558 break;
4559 }
4560 //Consuming of wheel events is implemented in "retargetMouseEvent".
4561 if (id != MouseEvent.MOUSE_WHEEL) {
4562 e.consume();
4563 }
4564 } else if (isCleaned && id != MouseEvent.MOUSE_WHEEL) {
4565 //After mouseEventTarget was removed and cleaned should consume all events
4566 //until new mouseEventTarget is found
4567 e.consume();
4568 }
4569 return e.isConsumed();
4570 }
4571
4572 private boolean processDropTargetEvent(SunDropTargetEvent e) {
|
1303 dispatchEvent(e);
1304 }
1305
1306 comp.createHierarchyEvents(HierarchyEvent.HIERARCHY_CHANGED,
1307 comp, this,
1308 HierarchyEvent.PARENT_CHANGED,
1309 Toolkit.enabledOnToolkit(AWTEvent.HIERARCHY_EVENT_MASK));
1310 }
1311 if (peer != null && layoutMgr == null && isVisible()) {
1312 updateCursorImmediately();
1313 }
1314 invalidateIfValid();
1315 }
1316 }
1317
1318 // Should only be called while holding tree lock
1319 int numListening(long mask) {
1320 int superListening = super.numListening(mask);
1321
1322 if (mask == AWTEvent.HIERARCHY_EVENT_MASK) {
1323 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1324 // Verify listeningChildren is correct
1325 int sum = 0;
1326 for (Component comp : component) {
1327 sum += comp.numListening(mask);
1328 }
1329 if (listeningChildren != sum) {
1330 eventLog.fine("Assertion (listeningChildren == sum) failed");
1331 }
1332 }
1333 return listeningChildren + superListening;
1334 } else if (mask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) {
1335 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1336 // Verify listeningBoundsChildren is correct
1337 int sum = 0;
1338 for (Component comp : component) {
1339 sum += comp.numListening(mask);
1340 }
1341 if (listeningBoundsChildren != sum) {
1342 eventLog.fine("Assertion (listeningBoundsChildren == sum) failed");
1343 }
1344 }
1345 return listeningBoundsChildren + superListening;
1346 } else {
1347 // assert false;
1348 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1349 eventLog.fine("This code must never be reached");
1350 }
1351 return superListening;
1352 }
1353 }
1354
1355 // Should only be called while holding tree lock
1356 void adjustListeningChildren(long mask, int num) {
1357 if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
1358 boolean toAssert = (mask == AWTEvent.HIERARCHY_EVENT_MASK ||
1359 mask == AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK ||
1360 mask == (AWTEvent.HIERARCHY_EVENT_MASK |
1361 AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK));
1362 if (!toAssert) {
1363 eventLog.fine("Assertion failed");
1364 }
1365 }
1366
1367 if (num == 0)
1368 return;
1369
1370 if ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0) {
1371 listeningChildren += num;
1372 }
1373 if ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0) {
1374 listeningBoundsChildren += num;
1375 }
1376
1377 adjustListeningChildrenOnParent(mask, num);
1378 }
1379
1380 // Should only be called while holding tree lock
1381 void adjustDescendants(int num) {
1382 if (num == 0)
1383 return;
1384
1385 descendantsCount += num;
1386 adjustDecendantsOnParent(num);
1387 }
1388
1389 // Should only be called while holding tree lock
1390 void adjustDecendantsOnParent(int num) {
1391 if (parent != null) {
1392 parent.adjustDescendants(num);
1393 }
1394 }
1395
1396 // Should only be called while holding tree lock
1397 int countHierarchyMembers() {
1398 if (log.isLoggable(PlatformLogger.Level.FINE)) {
1399 // Verify descendantsCount is correct
1400 int sum = 0;
1401 for (Component comp : component) {
1402 sum += comp.countHierarchyMembers();
1403 }
1404 if (descendantsCount != sum) {
1405 log.fine("Assertion (descendantsCount == sum) failed");
1406 }
1407 }
1408 return descendantsCount + 1;
1409 }
1410
1411 private int getListenersCount(int id, boolean enabledOnToolkit) {
1412 checkTreeLock();
1413 if (enabledOnToolkit) {
1414 return descendantsCount;
1415 }
1416 switch (id) {
1417 case HierarchyEvent.HIERARCHY_CHANGED:
1418 return listeningChildren;
4093 Component c = getComponent(index);
4094 if (c.isLightweight() && c.isShowing()) {
4095 s = s.getUnion(c.getOpaqueShape());
4096 }
4097 }
4098 return s.getIntersection(getNormalShape());
4099 }
4100 return super.getOpaqueShape();
4101 }
4102
4103 final void recursiveSubtractAndApplyShape(Region shape) {
4104 recursiveSubtractAndApplyShape(shape, getTopmostComponentIndex(), getBottommostComponentIndex());
4105 }
4106
4107 final void recursiveSubtractAndApplyShape(Region shape, int fromZorder) {
4108 recursiveSubtractAndApplyShape(shape, fromZorder, getBottommostComponentIndex());
4109 }
4110
4111 final void recursiveSubtractAndApplyShape(Region shape, int fromZorder, int toZorder) {
4112 checkTreeLock();
4113 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4114 mixingLog.fine("this = " + this +
4115 "; shape=" + shape + "; fromZ=" + fromZorder + "; toZ=" + toZorder);
4116 }
4117 if (fromZorder == -1) {
4118 return;
4119 }
4120 if (shape.isEmpty()) {
4121 return;
4122 }
4123 // An invalid container with not-null layout should be ignored
4124 // by the mixing code, the container will be validated later
4125 // and the mixing code will be executed later.
4126 if (getLayout() != null && !isValid()) {
4127 return;
4128 }
4129 for (int index = fromZorder; index <= toZorder; index++) {
4130 Component comp = getComponent(index);
4131 if (!comp.isLightweight()) {
4132 comp.subtractAndApplyShape(shape);
4133 } else if (comp instanceof Container &&
4134 ((Container)comp).hasHeavyweightDescendants() && comp.isShowing()) {
4135 ((Container)comp).recursiveSubtractAndApplyShape(shape);
4136 }
4137 }
4138 }
4139
4140 final void recursiveApplyCurrentShape() {
4141 recursiveApplyCurrentShape(getTopmostComponentIndex(), getBottommostComponentIndex());
4142 }
4143
4144 final void recursiveApplyCurrentShape(int fromZorder) {
4145 recursiveApplyCurrentShape(fromZorder, getBottommostComponentIndex());
4146 }
4147
4148 final void recursiveApplyCurrentShape(int fromZorder, int toZorder) {
4149 checkTreeLock();
4150 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4151 mixingLog.fine("this = " + this +
4152 "; fromZ=" + fromZorder + "; toZ=" + toZorder);
4153 }
4154 if (fromZorder == -1) {
4155 return;
4156 }
4157 // An invalid container with not-null layout should be ignored
4158 // by the mixing code, the container will be validated later
4159 // and the mixing code will be executed later.
4160 if (getLayout() != null && !isValid()) {
4161 return;
4162 }
4163 for (int index = fromZorder; index <= toZorder; index++) {
4164 Component comp = getComponent(index);
4165 if (!comp.isLightweight()) {
4166 comp.applyCurrentShape();
4167 }
4168 if (comp instanceof Container &&
4169 ((Container)comp).hasHeavyweightDescendants()) {
4170 ((Container)comp).recursiveApplyCurrentShape();
4247 */
4248 final boolean isRecursivelyVisibleUpToHeavyweightContainer() {
4249 if (!isLightweight()) {
4250 return true;
4251 }
4252
4253 for (Container cont = this;
4254 cont != null && cont.isLightweight();
4255 cont = cont.getContainer())
4256 {
4257 if (!cont.isVisible()) {
4258 return false;
4259 }
4260 }
4261 return true;
4262 }
4263
4264 @Override
4265 void mixOnShowing() {
4266 synchronized (getTreeLock()) {
4267 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4268 mixingLog.fine("this = " + this);
4269 }
4270
4271 boolean isLightweight = isLightweight();
4272
4273 if (isLightweight && isRecursivelyVisibleUpToHeavyweightContainer()) {
4274 recursiveShowHeavyweightChildren();
4275 }
4276
4277 if (!isMixingNeeded()) {
4278 return;
4279 }
4280
4281 if (!isLightweight || (isLightweight && hasHeavyweightDescendants())) {
4282 recursiveApplyCurrentShape();
4283 }
4284
4285 super.mixOnShowing();
4286 }
4287 }
4288
4289 @Override
4290 void mixOnHiding(boolean isLightweight) {
4291 synchronized (getTreeLock()) {
4292 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4293 mixingLog.fine("this = " + this +
4294 "; isLightweight=" + isLightweight);
4295 }
4296 if (isLightweight) {
4297 recursiveHideHeavyweightChildren();
4298 }
4299 super.mixOnHiding(isLightweight);
4300 }
4301 }
4302
4303 @Override
4304 void mixOnReshaping() {
4305 synchronized (getTreeLock()) {
4306 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4307 mixingLog.fine("this = " + this);
4308 }
4309
4310 boolean isMixingNeeded = isMixingNeeded();
4311
4312 if (isLightweight() && hasHeavyweightDescendants()) {
4313 final Point origin = new Point(getX(), getY());
4314 for (Container cont = getContainer();
4315 cont != null && cont.isLightweight();
4316 cont = cont.getContainer())
4317 {
4318 origin.translate(cont.getX(), cont.getY());
4319 }
4320
4321 recursiveRelocateHeavyweightChildren(origin);
4322
4323 if (!isMixingNeeded) {
4324 return;
4325 }
4326
4327 recursiveApplyCurrentShape();
4328 }
4329
4330 if (!isMixingNeeded) {
4331 return;
4332 }
4333
4334 super.mixOnReshaping();
4335 }
4336 }
4337
4338 @Override
4339 void mixOnZOrderChanging(int oldZorder, int newZorder) {
4340 synchronized (getTreeLock()) {
4341 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4342 mixingLog.fine("this = " + this +
4343 "; oldZ=" + oldZorder + "; newZ=" + newZorder);
4344 }
4345
4346 if (!isMixingNeeded()) {
4347 return;
4348 }
4349
4350 boolean becameHigher = newZorder < oldZorder;
4351
4352 if (becameHigher && isLightweight() && hasHeavyweightDescendants()) {
4353 recursiveApplyCurrentShape();
4354 }
4355 super.mixOnZOrderChanging(oldZorder, newZorder);
4356 }
4357 }
4358
4359 @Override
4360 void mixOnValidating() {
4361 synchronized (getTreeLock()) {
4362 if (mixingLog.isLoggable(PlatformLogger.Level.FINE)) {
4363 mixingLog.fine("this = " + this);
4364 }
4365
4366 if (!isMixingNeeded()) {
4367 return;
4368 }
4369
4370 if (hasHeavyweightDescendants()) {
4371 recursiveApplyCurrentShape();
4372 }
4373
4374 if (isLightweight() && isNonOpaqueForMixing()) {
4375 subtractAndApplyShapeBelowMe();
4376 }
4377
4378 super.mixOnValidating();
4379 }
4380 }
4381
4382 // ****************** END OF MIXING CODE ********************************
4532 // other than that which received the MOUSE_PRESSED event. If the
4533 // mouse is now over a different Component, don't dispatch the event.
4534 // The previous fix for a similar problem was associated with bug
4535 // 4155217.
4536 if (mouseOver == mouseEventTarget) {
4537 retargetMouseEvent(mouseOver, id, e);
4538 }
4539 break;
4540 case MouseEvent.MOUSE_MOVED:
4541 retargetMouseEvent(mouseEventTarget, id, e);
4542 break;
4543 case MouseEvent.MOUSE_DRAGGED:
4544 if (isMouseGrab(e)) {
4545 retargetMouseEvent(mouseEventTarget, id, e);
4546 }
4547 break;
4548 case MouseEvent.MOUSE_WHEEL:
4549 // This may send it somewhere that doesn't have MouseWheelEvents
4550 // enabled. In this case, Component.dispatchEventImpl() will
4551 // retarget the event to a parent that DOES have the events enabled.
4552 if (eventLog.isLoggable(PlatformLogger.Level.FINEST) && (mouseOver != null)) {
4553 eventLog.finest("retargeting mouse wheel to " +
4554 mouseOver.getName() + ", " +
4555 mouseOver.getClass());
4556 }
4557 retargetMouseEvent(mouseOver, id, e);
4558 break;
4559 }
4560 //Consuming of wheel events is implemented in "retargetMouseEvent".
4561 if (id != MouseEvent.MOUSE_WHEEL) {
4562 e.consume();
4563 }
4564 } else if (isCleaned && id != MouseEvent.MOUSE_WHEEL) {
4565 //After mouseEventTarget was removed and cleaned should consume all events
4566 //until new mouseEventTarget is found
4567 e.consume();
4568 }
4569 return e.isConsumed();
4570 }
4571
4572 private boolean processDropTargetEvent(SunDropTargetEvent e) {
|