44 " |
45 " |
45 this abstract class defines common protocol to all Display types. |
46 this abstract class defines common protocol to all Display types. |
46 |
47 |
47 instance variables: |
48 instance variables: |
48 |
49 |
|
50 displayId <Number> the device id of the display |
49 visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
51 visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
50 monitorType <Symbol> one of #monochrome, #color, #unknown |
52 monitorType <Symbol> one of #monochrome, #color, #unknown |
51 height <Integer> number of vertical pixels |
53 |
52 width <Integer> number of horizontal pixels |
|
53 heightMM <Number> screen height in millimeter |
|
54 widthMM <Number> screen width in millimeter |
|
55 depth <Integer> bits per color |
54 depth <Integer> bits per color |
56 ncells <Integer> number of colors (i.e. colormap size; not always == 2^depth) |
55 ncells <Integer> number of colors (i.e. colormap size; not always == 2^depth) |
57 bitsPerRGB <Integer> number of valid bits per rgb component |
56 bitsPerRGB <Integer> number of valid bits per rgb component |
58 (actual number taken in A/D converter) |
57 (actual number taken in A/D converter; not all devices report the true value) |
|
58 hasColors <Boolean> true, if display supports colors |
|
59 hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display) |
|
60 width <Integer> number of horizontal pixels |
|
61 height <Integer> number of vertical pixels |
|
62 heightMM <Number> screen height in millimeter |
|
63 widthMM <Number> screen width in millimeter |
59 resolutionHor <Number> pixels per horizontal millimeter |
64 resolutionHor <Number> pixels per horizontal millimeter |
60 resolutionVer <Number> pixels per vertical millimeter |
65 resolutionVer <Number> pixels per vertical millimeter |
61 |
66 |
62 ... |
67 knownViews <Collection> all views known |
|
68 knownIds <Collection> corresponding device-view ids |
|
69 knownBitmaps <Collection> all known device bitmaps |
|
70 knownBitmapIds <Collection> corresponding device-bitmap ids |
|
71 |
|
72 dispatching <Boolean> true, if currently in dispatch loop |
|
73 |
|
74 idleBlocks <Collection> blocks to evaluate, when no events are pending |
63 |
75 |
64 controlDown <Boolean> control key currently pressed |
76 controlDown <Boolean> control key currently pressed |
65 shiftDown <Boolean> shift key currently pressed |
77 shiftDown <Boolean> shift key currently pressed |
66 hasColor <Boolean> true if display can display colors |
78 metaDown <Boolean> |
67 hasGreyscales <Boolean> true, if display can display grey (i.e. is not b/w display) |
79 altDown <Boolean> |
|
80 |
|
81 ignoreBackingStore |
|
82 motionEventCompression |
|
83 |
|
84 timeOutBlocks <Collection> |
|
85 timeOutTimes <Collection> |
|
86 |
|
87 lastId <Number> |
|
88 lastView <View> |
|
89 |
68 keyboardMap <KeyBdMap> mapping for keys |
90 keyboardMap <KeyBdMap> mapping for keys |
69 |
91 |
70 " |
92 " |
71 ! ! |
93 ! ! |
72 |
94 |
73 !DeviceWorkstation class methodsFor:'initialization'! |
95 !DeviceWorkstation class methodsFor:'initialization'! |
|
96 |
|
97 initialize |
|
98 DeviceErrorSignal isNil ifTrue:[ |
|
99 DeviceErrorSignal := (Signal new) mayProceed:true. |
|
100 DeviceErrorSignal notifierString:'device error'. |
|
101 ]. |
|
102 ! |
74 |
103 |
75 initializeConstants |
104 initializeConstants |
76 "initialize some (soft) constants" |
105 "initialize some (soft) constants" |
77 |
106 |
78 MultiClickTimeDelta := 300. |
107 MultiClickTimeDelta := 300. |
79 ButtonTranslation := #(1 2 3) "identity translation" |
108 ButtonTranslation := #(1 2 3) "identity translation" |
|
109 ! ! |
|
110 |
|
111 !DeviceWorkstation class methodsFor:'signal access'! |
|
112 |
|
113 deviceErrorSignal |
|
114 "return the signal used for device error reporting" |
|
115 |
|
116 ^ DeviceErrorSignal |
80 ! ! |
117 ! ! |
81 |
118 |
82 !DeviceWorkstation class methodsFor:'accessing'! |
119 !DeviceWorkstation class methodsFor:'accessing'! |
83 |
120 |
84 buttonTranslation:anArray |
121 buttonTranslation:anArray |
199 |
238 |
200 (OperatingSystem getSystemType = 'next') ifTrue:[ |
239 (OperatingSystem getSystemType = 'next') ifTrue:[ |
201 " |
240 " |
202 kludge for my next server with german keyboard: |
241 kludge for my next server with german keyboard: |
203 the modifier map does not allow me to include alt-key |
242 the modifier map does not allow me to include alt-key |
204 modification. |
243 modification - therefore, its done here, which is stupid |
205 " |
244 " |
206 keyboardMap bindValue:$~ to:#Alt1. |
245 keyboardMap bindValue:$~ to:#Alt1. |
207 keyboardMap bindValue:$< to:#Alt4. |
246 keyboardMap bindValue:$< to:#Alt4. |
208 keyboardMap bindValue:$> to:#Alt5. |
247 keyboardMap bindValue:$> to:#Alt5. |
209 keyboardMap bindValue:$| to:#Alt6. |
248 keyboardMap bindValue:$| to:#Alt6. |
224 keyboardMap bindValue:(Character value:16rF6) to:#odiaeresis. |
263 keyboardMap bindValue:(Character value:16rF6) to:#odiaeresis. |
225 keyboardMap bindValue:(Character value:16rDC) to:#Udiaeresis. |
264 keyboardMap bindValue:(Character value:16rDC) to:#Udiaeresis. |
226 keyboardMap bindValue:(Character value:16rC4) to:#Adiaeresis. |
265 keyboardMap bindValue:(Character value:16rC4) to:#Adiaeresis. |
227 keyboardMap bindValue:(Character value:16rD6) to:#Odiaeresis. |
266 keyboardMap bindValue:(Character value:16rD6) to:#Odiaeresis. |
228 keyboardMap bindValue:(Character value:16rDF) to:#ssharp. |
267 keyboardMap bindValue:(Character value:16rDF) to:#ssharp. |
|
268 " |
|
269 and also the pre-translated characters |
|
270 for those characters which are already translated by |
|
271 modifier map |
|
272 " |
|
273 keyboardMap bindValue:$~ to:#'Cmd~'. |
|
274 keyboardMap bindValue:$\ to:#'Cmd\'. |
|
275 keyboardMap bindValue:$| to:#'Cmd|'. |
|
276 keyboardMap bindValue:${ to:#'Cmd{'. |
|
277 keyboardMap bindValue:$[ to:#'Cmd['. |
|
278 keyboardMap bindValue:$] to:#'Cmd]'. |
|
279 keyboardMap bindValue:$} to:#'Cmd}'. |
|
280 keyboardMap bindValue:$@ to:#'Cmd@'. |
229 |
281 |
230 " |
282 " |
231 more needed, french for example ... |
283 more needed, french for example ... |
232 " |
284 " |
233 |
285 |
237 keyboardMap bindValue:(Character value:16rA7) to:#section. |
289 keyboardMap bindValue:(Character value:16rA7) to:#section. |
238 keyboardMap bindValue:(Character value:16rB0) to:#degree. |
290 keyboardMap bindValue:(Character value:16rB0) to:#degree. |
239 keyboardMap bindValue:(Character value:16rB2) to:#twosuperior. |
291 keyboardMap bindValue:(Character value:16rB2) to:#twosuperior. |
240 keyboardMap bindValue:(Character value:16rB3) to:#threesuperior. |
292 keyboardMap bindValue:(Character value:16rB3) to:#threesuperior. |
241 keyboardMap bindValue:(Character value:16rB5) to:#mu. |
293 keyboardMap bindValue:(Character value:16rB5) to:#mu. |
|
294 ! ! |
|
295 |
|
296 !DeviceWorkstation class methodsFor:'error handling'! |
|
297 |
|
298 resourceIdOfLastError |
|
299 "return the resource id responsible for the last error" |
|
300 |
|
301 ^ self subclassResponsibility |
|
302 ! |
|
303 |
|
304 lastError |
|
305 "return a string descibing the last error" |
|
306 |
|
307 ^ self subclassResponsibility |
|
308 ! |
|
309 |
|
310 errorInterrupt |
|
311 "x-error interrupt" |
|
312 |
|
313 |badId badResource| |
|
314 |
|
315 badId := self resourceIdOfLastError. |
|
316 badId ~~ 0 ifTrue:[ |
|
317 badResource := self resourceOfId:badId. |
|
318 ]. |
|
319 ^ DeviceErrorSignal |
|
320 raiseRequestWith:badResource |
|
321 errorString: 'Display error: ' , (self lastError) |
|
322 ! |
|
323 |
|
324 resourceOfId:id |
|
325 "search thru all device stuff for a resource. |
|
326 Needed for error handling" |
|
327 |
|
328 Form allInstances do:[:f | |
|
329 f id == id ifTrue:[^ f] |
|
330 ]. |
|
331 |
|
332 self allInstances do:[:aDisplay | |
|
333 |views| |
|
334 |
|
335 views := aDisplay knownViews. |
|
336 views notNil ifTrue:[ |
|
337 views do:[:v | |
|
338 v id == id ifTrue:[^ v]. |
|
339 v gcId == id ifTrue:[^ v] |
|
340 ]. |
|
341 ]. |
|
342 ]. |
|
343 |
|
344 Color allInstances do:[:c | |
|
345 c colorId == id ifTrue:[^ c] |
|
346 ]. |
|
347 |
|
348 Font allInstances do:[:f | |
|
349 f fontId == id ifTrue:[^ f] |
|
350 ]. |
|
351 ^ nil |
242 ! ! |
352 ! ! |
243 |
353 |
244 !DeviceWorkstation methodsFor:'misc'! |
354 !DeviceWorkstation methodsFor:'misc'! |
245 |
355 |
246 metaDown |
356 metaDown |
953 |
1063 |
954 endIndex := timeOutBlocks size. |
1064 endIndex := timeOutBlocks size. |
955 (endIndex ~~ 0) ifTrue:[ |
1065 (endIndex ~~ 0) ifTrue:[ |
956 now := OperatingSystem getMillisecondTime. |
1066 now := OperatingSystem getMillisecondTime. |
957 index := 1. |
1067 index := 1. |
|
1068 blocksToEvaluate := nil. |
958 [index <= endIndex] whileTrue:[ |
1069 [index <= endIndex] whileTrue:[ |
959 tBlock := timeOutTimes at:index. |
1070 tBlock := timeOutTimes at:index. |
960 (OperatingSystem millisecondTime:tBlock isAfter:now) ifFalse:[ |
1071 (OperatingSystem millisecondTime:tBlock isAfter:now) ifFalse:[ |
961 block := timeOutBlocks at:index. |
1072 block := timeOutBlocks at:index. |
962 timeOutTimes removeIndex:index. |
1073 timeOutTimes removeIndex:index. |
1038 |
1145 |
1039 dispatchCheckingIdleAndTimeoutsFor:aViewIdOrNil |
1146 dispatchCheckingIdleAndTimeoutsFor:aViewIdOrNil |
1040 "if there is any event pending, process it; |
1147 "if there is any event pending, process it; |
1041 otherwise evaluate idle blocks (if any)" |
1148 otherwise evaluate idle blocks (if any)" |
1042 |
1149 |
|
1150 |limit doingGC| |
|
1151 |
1043 self eventPendingWithoutSync ifTrue:[ |
1152 self eventPendingWithoutSync ifTrue:[ |
1044 self dispatchEventFor:aViewIdOrNil withMask:nil |
1153 self dispatchEventFor:aViewIdOrNil withMask:nil |
1045 ] ifFalse:[ |
1154 ] ifFalse:[ |
|
1155 "no event pending - do background stuff" |
|
1156 |
|
1157 "if its worth doing, collect a bit of garbage" |
|
1158 limit := ObjectMemory incrementalGCLimit. |
|
1159 doingGC := limit notNil and:[ObjectMemory oldSpaceAllocatedSinceLastGC > limit]. |
|
1160 doingGC ifTrue:[ |
|
1161 ObjectMemory gcStep. |
|
1162 ]. |
1046 (idleBlocks size ~~ 0) ifTrue:[ |
1163 (idleBlocks size ~~ 0) ifTrue:[ |
1047 idleBlocks do:[:aBlock | |
1164 idleBlocks do:[:aBlock | |
1048 aBlock value |
1165 aBlock value |
|
1166 ]. |
|
1167 ] ifFalse:[ |
|
1168 doingGC ifFalse:[ |
|
1169 "no idle blocks defined, no event pending; |
|
1170 wait 'til either event arrives or time to next timeoutBlock |
|
1171 has passed ..." |
|
1172 self waitForEventOrTimeoutFor:nil |
1049 ] |
1173 ] |
1050 ] ifFalse:[ |
|
1051 "no idle blocks defined, no event pending; |
|
1052 wait 'til either event arrives or time to next timeoutBlock |
|
1053 has passed ..." |
|
1054 self waitForEventOrTimeoutFor:nil |
|
1055 ] |
1174 ] |
1056 ]. |
1175 ]. |
1057 self evaluateTimeOutBlocks |
1176 timeOutBlocks size ~~ 0 ifTrue:[ |
|
1177 self evaluateTimeOutBlocks |
|
1178 ]. |
1058 ! ! |
1179 ! ! |
1059 |
1180 |
1060 !DeviceWorkstation methodsFor:'bitmap/window creation'! |
1181 !DeviceWorkstation methodsFor:'bitmap/window creation'! |
1061 |
1182 |
1062 createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst |
1183 createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst |