180 |
181 |
181 One particular device instance is bound to the global variable Display: |
182 One particular device instance is bound to the global variable Display: |
182 this is the default graphics display, on which new views are created |
183 this is the default graphics display, on which new views are created |
183 (however, provisions exist for multi-display operation) |
184 (however, provisions exist for multi-display operation) |
184 |
185 |
185 Currently, there is are only two concrete display classes (released to the public): |
186 Currently, there is are twoconcrete display classes (released to the public): |
186 |
187 |
187 XWorkstation - a plain X window interface |
188 XWorkstation - a plain X window interface |
188 |
189 |
189 GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
190 GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
190 extension; either simulated (VGL) or a real GL |
191 extension; either simulated (VGL) or a real GL |
191 (real GL is only available on SGI machines) |
192 (real GL is only available on SGI machines) |
192 |
193 |
193 the following are coming soon: |
194 the following are coming soon: |
194 |
195 |
195 OpenGLWorkstation |
196 OpenGLWorkstation |
196 - an X window interface with a openGL(tm) (3D graphic library) |
197 - an X window interface with a openGL(tm) (3D graphic library) |
197 extension; either simulated (MESA) or a real openGL |
198 extension; either simulated (MESA) or a real openGL |
198 (real openGL is only available on SGI/NT machines) |
199 (real openGL is only available on SGI/NT machines) |
199 |
200 |
200 WinWorkstation - what will that be ? |
201 WinWorkstation - what will that be ? |
201 |
202 |
202 An experimental version for a NeXTStep interface exists, but is currently |
203 An experimental version for a NeXTStep interface exists, but is currently |
203 no longer maintained and not released. |
204 no longer maintained and not released. |
204 Also, interfaces for other graphic systems (i.e. OS/2) are |
|
205 planned for and will be available (hopefully) in late 96. |
|
206 |
205 |
207 DeviceWorkstation itself is an abstract class; the methods as defined |
206 DeviceWorkstation itself is an abstract class; the methods as defined |
208 here perform things which are common to all graphic devices or block |
207 here perform things which are common to all graphic devices or block |
209 methods and raise a subclassResponsibilty error condition. |
208 methods and raise a subclassResponsibilty error condition. |
210 To create a new graphic interface, at least the subclassResponsibilty-methods |
209 To create a new graphic interface, at least the subclassResponsibility-methods |
211 have to be reimplemented in a concrete subclass. |
210 have to be reimplemented in a concrete subclass. |
212 |
211 |
213 ST/X is designed to allow the use of multiple workstation devices in parallel, if |
212 ST/X is designed to allow the use of multiple workstation devices in parallel, |
214 the underlying window system supports this. |
213 if the underlying window system supports this. |
215 For example, in X, it is possible to create another instance of XWorkstation, |
214 For example, in X, it is possible to create another instance of XWorkstation, |
216 start a dispatch process for it, and to create and open views on this display. |
215 start a dispatch process for it, and to create and open views on this display. |
217 This does not work with other devices (i.e. Windows). |
216 Multiple display operation does not work with other devices (i.e. Windows). |
218 |
217 |
219 If you want to experiment with multi-display applications, |
218 If you want to experiment with multi-display applications, |
220 you have to: |
219 you have to: |
221 |
220 |
222 - create a new instance of XWorkstation: |
221 - create a new instance of XWorkstation: |
223 |
222 |
224 Smalltalk at:#Display2 put:(XWorkstation new). |
223 Smalltalk at:#Display2 put:(XWorkstation new). |
225 or: |
224 or: |
226 Smalltalk at:#Display2 put:(GLXWorkstation new). |
225 Smalltalk at:#Display2 put:(GLXWorkstation new). |
227 |
226 |
228 |
227 |
229 - have it connect to the display (i.e. the xServer): |
228 - have it connect to the display (i.e. the xServer): |
230 (replace 'localhost' below with the name of your display) |
229 (replace 'localhost' below with the name of your display) |
231 |
230 |
232 Display2 := Display2 initializeFor:'localhost:0.0' |
231 Display2 := Display2 initializeFor:'localhost:0.0' |
233 |
232 |
234 returns nil, if connection is refused |
233 returns nil, if connection is refused |
235 - leaving you with Display2==nil in this case. |
234 - leaving you with Display2==nil in this case. |
236 |
235 |
237 |
236 |
238 - start an event dispatcher process for it: |
237 - start an event dispatcher process for it: |
239 (this is now no longer needed - the first opened view will do it for you) |
238 (this is now no longer needed - the first opened view will do it for you) |
240 |
239 |
241 Display2 startDispatch |
240 Display2 startDispatch |
242 |
241 |
243 |
242 |
244 - optionally set its keyboard map |
243 - optionally set its keyboard map |
245 (since this is usually done for Display in the startup-file, |
244 (since this is usually done for Display in the startup-file, |
246 the new display does not have all your added key bindings) |
245 the new display does not have all your added key bindings) |
247 |
246 |
248 Display2 keyboardMap:(Display keyboardMap) |
247 Display2 keyboardMap:(Display keyboardMap) |
249 |
248 |
250 |
249 |
251 - create a view for it: |
250 - create a view for it: |
252 |
251 |
253 (FileBrowser onDevice:Display2) open |
252 (FileBrowser onDevice:Display2) open |
254 |
253 |
255 (Workspace onDevice:Display2) open |
254 (Workspace onDevice:Display2) open |
256 |
255 |
257 (Launcher onDevice:Display2) open |
256 (Launcher onDevice:Display2) open |
258 does not work with Launcher, since its an ApplicationModel (not a view) |
257 does not work with Launcher, since its an ApplicationModel (not a view) |
259 use: |
258 use: |
260 Launcher openOnDevice:Display2 |
259 Launcher openOnDevice:Display2 |
261 instead. |
260 instead. |
262 |
261 |
263 However, as mentioned above, there may be a few places, where the default |
262 However, as mentioned above, there may be a few places, where the default |
264 display 'Display' is still hard-coded - especially, in contributed and |
263 display 'Display' is still hard-coded - especially, in contributed and |
265 Public domain code, you may find those. |
264 Public domain code, you may find those. |
266 |
265 |
267 Beside this (little bug ;-), remote display operation works pretty well. |
266 Beside this (little bug ;-), remote display operation works pretty well. |
268 If you write your application to work around those, multi-display applications are |
267 If you write your application to work around those, multi-display applications are |
269 possible in the current release. |
268 possible in the current release (and actually being used in a concrete application, |
|
269 where up to 6 x-terminals are connected to a single linux PC). |
270 |
270 |
271 To make your application ready for multi-display operation, replace all |
271 To make your application ready for multi-display operation, replace all |
272 references to 'Display' by: 'Screen current', which evaluates to the currently |
272 references to 'Display' by: 'Screen current', which evaluates to the currently |
273 active display. I.e. each view gets its actual display via this expression. |
273 active display. I.e. each view gets its actual display via this expression. |
274 Since ST/X views already use this, new views opened by remote views should |
274 Since ST/X views already use this, new views opened by remote views should |
276 |
276 |
277 There is no easy solution for things like Notifiers, WarnBoxes or |
277 There is no easy solution for things like Notifiers, WarnBoxes or |
278 Debuggers when opened from some background or non-view process. |
278 Debuggers when opened from some background or non-view process. |
279 These will come up one the default Display, as returned by 'Screen default'. |
279 These will come up one the default Display, as returned by 'Screen default'. |
280 |
280 |
|
281 Finally, your application should care for I/O errors (i.e. lost connection when |
|
282 a remote display is switched off). |
|
283 The framework provides per-display signals, which are raised in the corresponding |
|
284 event dispatchers context. |
|
285 For a save environment, you should add static exception handler blocks on those |
|
286 signals; i.e. the setup for remote displays should look somewhat like: |
|
287 |newDpy| |
|
288 |
|
289 newDpy := GLXWorkstation new. |
|
290 newDpy := newDpy initializeFor:'localhost:0.0'. |
|
291 newDpy isNil ifTrue:[ |
|
292 self warn:'cannot connect ...'. |
|
293 ] ifFalse:[ |
|
294 newDpy deviceIOErrorSignal handlerBlock:[:ex | |
|
295 Transcript beep. |
|
296 Transcript showCR:'Display (' , newDpy displayName , '): connection broken.'. |
|
297 AbortSignal raise. |
|
298 ]. |
|
299 newDpy startDispatch. |
|
300 Launcher openOnDevice:newDpy. |
|
301 ]. |
|
302 |
281 There may still some problems to be expected, |
303 There may still some problems to be expected, |
282 if the screens have different display capabilities (b&w vs. greyscale vs. |
304 if the screens have different display capabilities (b&w vs. greyscale vs. |
283 color display). The current styleSheet approach keeps default values |
305 color display). The current styleSheet approach keeps default values |
284 only once (it should do so per display ...) For now, expect ugly looking |
306 only once (it should do so per display ...) |
285 views in this case - or set your styleSheet for the smallest common |
307 For now, expect ugly looking views in this case - or set your styleSheet |
286 capabilities (i.e. for b&w). |
308 for the smallest common capabilities (i.e. for b&w). |
|
309 This may be fixed in a future version ... |
|
310 |
287 " |
311 " |
288 ! ! |
312 ! ! |
289 |
313 |
290 !DeviceWorkstation class methodsFor:'initialization'! |
314 !DeviceWorkstation class methodsFor:'initialization'! |
291 |
315 |