1389 viewIdFromPoint:aPoint |
1389 viewIdFromPoint:aPoint |
1390 "given a point on the screen, return the id of the ST/X view in which that |
1390 "given a point on the screen, return the id of the ST/X view in which that |
1391 point is (this may be a subview). Return nil, if its not an ST/X view |
1391 point is (this may be a subview). Return nil, if its not an ST/X view |
1392 or if the point is on the background" |
1392 or if the point is on the background" |
1393 |
1393 |
1394 |searchId foundId| |
1394 |searchId foundId n| |
1395 |
1395 |
1396 searchId := self realRootWindowId. |
1396 searchId := self realRootWindowId. |
1397 |
1397 |
1398 "/ this is required, since X raises a bad error, when we come |
1398 "/ this is required, since X raises a bad error, when we come |
1399 "/ along with an illegal id (which happens, if a view from another |
1399 "/ along with an illegal id (which happens, if a view from another |
1400 "/ screen-device is picked ...) |
1400 "/ screen-device is picked ...) |
1401 self class deviceErrorSignal handle:[:ex | |
1401 self class deviceErrorSignal handle:[:ex | |
1402 ^ nil |
1402 ^ nil |
1403 ] do:[ |
1403 ] do:[ |
1404 [searchId notNil] whileTrue:[ |
1404 n := 0. |
1405 foundId := searchId. |
1405 [searchId notNil] whileTrue:[ |
1406 searchId := self viewIdFromPoint:aPoint in:searchId. |
1406 n := n + 1. |
1407 ] |
1407 n > 1000 ifTrue:[ |
|
1408 self halt:'oops - endless view hierarchy'. |
|
1409 ^ nil |
|
1410 ]. |
|
1411 foundId := searchId. |
|
1412 searchId := self viewIdFromPoint:aPoint in:searchId. |
|
1413 ] |
1408 ]. |
1414 ]. |
1409 ^ foundId |
1415 ^ foundId |
1410 ! |
1416 ! |
1411 |
1417 |
1412 viewIdFromPoint:aPoint in:windowId |
1418 viewIdFromPoint:aPoint in:windowId |