DisplaySurface.st
changeset 4435 3704585b9706
parent 4413 139a64d7cb9a
child 4436 05eadeb4b603
equal deleted inserted replaced
4434:cbbb56b8d851 4435:3704585b9706
  2144 !
  2144 !
  2145 
  2145 
  2146 destroyView
  2146 destroyView
  2147     "physically destroy the view."
  2147     "physically destroy the view."
  2148      
  2148      
  2149     drawableId notNil ifTrue:[
  2149     |id|
  2150 	device destroyView:self withId:drawableId.
  2150 
       
  2151     (id := drawableId) notNil ifTrue:[
  2151 	drawableId := nil.
  2152 	drawableId := nil.
       
  2153 	device destroyView:self withId:id.
  2152 	realized := false.
  2154 	realized := false.
  2153     ].
  2155     ].
  2154 !
  2156 !
  2155 
  2157 
  2156 destroyed
  2158 destroyed
  2157     "view has been destroyed by someone else"
  2159     "view has been destroyed by someone else"
  2158 
  2160 
  2159     drawableId notNil ifTrue:[
  2161     |id|
  2160 	device removeKnownView:self withId:drawableId.
  2162 
       
  2163     (id := drawableId) notNil ifTrue:[
  2161 	drawableId := nil.
  2164 	drawableId := nil.
       
  2165 	device removeKnownView:self withId:id.
  2162 	realized := false. 
  2166 	realized := false. 
  2163     ].
  2167     ].
  2164     self destroy
  2168     self destroy
  2165 
  2169 
  2166     "Modified: 22.3.1997 / 14:56:34 / cg"
  2170     "Modified: 22.3.1997 / 14:56:34 / cg"
  2438      - release system resources"
  2442      - release system resources"
  2439 
  2443 
  2440     |id|
  2444     |id|
  2441 
  2445 
  2442     drawableId notNil ifTrue:[
  2446     drawableId notNil ifTrue:[
  2443         [
  2447 	[
  2444             (device viewIdKnown:drawableId) ifTrue:[
  2448 	    (device viewIdKnown:drawableId) ifTrue:[
  2445 "/ 'Display [info]: recycled view (' infoPrint. v infoPrint. ') not destroyed: ' infoPrint.
  2449 "/ 'Display [info]: recycled view (' infoPrint. v infoPrint. ') not destroyed: ' infoPrint.
  2446 "/ drawableId displayString infoPrintCR.
  2450 "/ drawableId displayString infoPrintCR.
  2447                 drawableId := nil.
  2451 		drawableId := nil.
  2448             ] ifFalse:[
  2452 	    ] ifFalse:[
  2449                 (id := gcId) notNil ifTrue:[
  2453 		(id := gcId) notNil ifTrue:[
  2450                     gcId := nil.
  2454 		    gcId := nil.
  2451                     device deviceIOErrorSignal handle:[:ex |
  2455 		    device deviceIOErrorSignal handle:[:ex |
  2452                     ] do:[
  2456 		    ] do:[
  2453                         device destroyGC:id.
  2457 			device destroyGC:id.
  2454                     ]
  2458 		    ]
  2455                 ].
  2459 		].
  2456 
  2460 
  2457                 "/ care for lost-view trouble:
  2461 		"/ care for lost-view trouble:
  2458                 "/ if the windowID is still registered,
  2462 		"/ if the windowID is still registered,
  2459                 "/ this may be due to a not-yet-reclaimed
  2463 		"/ this may be due to a not-yet-reclaimed
  2460                 "/ subview of a view which has already been destroyed
  2464 		"/ subview of a view which has already been destroyed
  2461                 "/ (X recycles window handles.)
  2465 		"/ (X recycles window handles.)
  2462                 "/ In this case, we arrive here with a nil-view argument,
  2466 		"/ In this case, we arrive here with a nil-view argument,
  2463                 "/ and a windowId, which is already reused for some other view.
  2467 		"/ and a windowId, which is already reused for some other view.
  2464                 "/ The situation is detected by finding a non-nil (and non-zero)
  2468 		"/ The situation is detected by finding a non-nil (and non-zero)
  2465                 "/ view in the devices id<->view table for the given windowId.
  2469 		"/ view in the devices id<->view table for the given windowId.
  2466 
  2470 
  2467 "/ 'GC destroy: ' print. drawableId displayString printCR.
  2471 "/ 'GC destroy: ' print. drawableId displayString printCR.
  2468 "/ device checkKnownViewId:drawableId.
  2472 "/ device checkKnownViewId:drawableId.
  2469                 id := drawableId.
  2473 		id := drawableId.
  2470                 drawableId := nil.
  2474 		drawableId := nil.
  2471                 device deviceIOErrorSignal handle:[:ex |
  2475 		device deviceIOErrorSignal handle:[:ex |
  2472                 ] do:[
  2476 		] do:[
  2473                     device destroyView:nil withId:id.
  2477 		    device destroyView:nil withId:id.
  2474                 ]
  2478 		].
  2475             ]
  2479 		DeviceGraphicsContext cleanupLobbyForChildrenOfViewWithId:id.
  2476         ] valueUninterruptably.
  2480 	    ]
       
  2481 	] valueUninterruptably.
  2477     ].
  2482     ].
  2478 
  2483 
  2479     "Created: / 25.9.1997 / 10:01:46 / stefan"
  2484     "Created: / 25.9.1997 / 10:01:46 / stefan"
  2480     "Modified: / 15.11.2001 / 14:17:12 / cg"
  2485     "Modified: / 15.11.2001 / 14:17:12 / cg"
  2481 ! !
  2486 ! !
  2482 
  2487 
  2483 !DisplaySurface class methodsFor:'documentation'!
  2488 !DisplaySurface class methodsFor:'documentation'!
  2484 
  2489 
  2485 version
  2490 version
  2486     ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.125 2005-07-26 08:51:26 cg Exp $'
  2491     ^ '$Header: /cvs/stx/stx/libview/DisplaySurface.st,v 1.126 2005-12-12 10:10:33 cg Exp $'
  2487 ! !
  2492 ! !
  2488 
  2493 
  2489 DisplaySurface initialize!
  2494 DisplaySurface initialize!