261 Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
261 Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
262 |
262 |
263 activeProcess := Processor activeProcess. |
263 activeProcess := Processor activeProcess. |
264 " caching the last value ..." |
264 " caching the last value ..." |
265 activeProcess == LastActiveProcess ifTrue:[ |
265 activeProcess == LastActiveProcess ifTrue:[ |
266 LastActiveGroup process == LastActiveProcess ifTrue:[ |
266 LastActiveGroup process == LastActiveProcess ifTrue:[ |
267 ^ LastActiveGroup |
267 ^ LastActiveGroup |
268 ] |
268 ] |
269 ]. |
269 ]. |
270 |
270 |
271 wg := WindowGroupQuerySignal raise. |
271 wg := WindowGroupQuerySignal raise. |
272 |
272 |
273 wg isNil ifTrue:[ |
273 wg isNil ifTrue:[ |
274 "/ mhmh - noone willing to answer that question ... |
274 "/ mhmh - noone willing to answer that question ... |
275 "/ (how can this happen ?) |
275 "/ (how can this happen ?) |
276 groups := self scheduledWindowGroups |
276 groups := self scheduledWindowGroups |
277 select:[:wg | wg process == activeProcess]. |
277 select:[:wg | wg process == activeProcess]. |
278 groups size == 1 ifTrue:[ |
278 groups size == 1 ifTrue:[ |
279 wg := groups anElement |
279 wg := groups anElement |
280 ] ifFalse:[ |
280 ] ifFalse:[ |
281 wg := groups detect:[:wg | wg isModal] ifNone:nil. |
281 wg := groups detect:[:wg | wg isModal] ifNone:nil. |
282 wg isNil ifTrue:[ |
282 wg isNil ifTrue:[ |
283 wg := groups anElement |
283 wg := groups anElement |
284 ] |
284 ] |
285 ]. |
285 ]. |
286 ]. |
286 ]. |
287 |
287 |
288 wg notNil ifTrue:[ |
288 wg notNil ifTrue:[ |
289 LastActiveProcess := activeProcess. |
289 LastActiveProcess := activeProcess. |
290 LastActiveGroup := wg. |
290 LastActiveGroup := wg. |
291 ]. |
291 ]. |
292 ^ wg |
292 ^ wg |
293 |
293 |
294 " |
294 " |
295 WindowGroup activeGroup |
295 WindowGroup activeGroup |
916 "wait-for and process events. |
916 "wait-for and process events. |
917 Stay in this loop while there are still any views to dispatch for, |
917 Stay in this loop while there are still any views to dispatch for, |
918 and aBlock evaluates to true. |
918 and aBlock evaluates to true. |
919 |
919 |
920 Some signals are caught & handled: |
920 Some signals are caught & handled: |
921 LeaveSignal forces an exit from the eventLoop; |
921 LeaveSignal forces an exit from the eventLoop; |
922 AbortSignal brings us back into the loop, processing the next event; |
922 AbortSignal brings us back into the loop, processing the next event; |
923 ActivityNotifications send a #showActivity: if nonModal, |
923 ActivityNotifications send a #showActivity: if nonModal, |
924 otherwise they are ignored." |
924 otherwise they are ignored." |
925 |
925 |
926 |thisProcess sigs mainSema prevSema| |
926 |thisProcess sigs mainSema prevSema| |
927 |
927 |
928 thisProcess := Processor activeProcess. |
928 thisProcess := Processor activeProcess. |
929 |
929 |
930 sigs := SignalSet |
930 sigs := SignalSet |
931 with:AbortSignal |
931 with:AbortSignal |
932 with:LeaveSignal |
932 with:LeaveSignal |
933 with:(self class activityNotificationSignal). |
933 with:(self class activityNotificationSignal). |
934 |
934 |
935 [ |
935 [ |
936 |p g s mainGroup mySema waitSema groupForSema| |
936 |p g s mainGroup mySema waitSema groupForSema| |
937 |
937 |
938 waitSema := mySema := mySensor eventSemaphore. |
938 waitSema := mySema := mySensor eventSemaphore. |
939 |
939 |
940 isModal ifTrue:[ |
940 isModal ifTrue:[ |
941 mainGroup := self mainGroup. |
941 mainGroup := self mainGroup. |
942 mainGroup == self ifTrue:[ |
942 mainGroup == self ifTrue:[ |
943 mainGroup := nil |
943 mainGroup := nil |
944 ]. |
944 ]. |
945 ] ifFalse:[ |
945 ] ifFalse:[ |
946 mainGroup := previousGroup |
946 mainGroup := previousGroup |
947 ]. |
947 ]. |
948 |
948 |
949 mainGroup notNil ifTrue:[ |
949 mainGroup notNil ifTrue:[ |
950 mainSema := mainGroup sensor eventSemaphore. |
950 mainSema := mainGroup sensor eventSemaphore. |
951 waitSema := SemaphoreSet with:mySema with:mainSema. |
951 waitSema := SemaphoreSet with:mySema with:mainSema. |
952 |
952 |
953 "/ must also care for all other groups in between |
953 "/ must also care for all other groups in between |
954 "/ (in case its a modal dialog opened from a modal dialog) |
954 "/ (in case its a modal dialog opened from a modal dialog) |
955 |
955 |
956 g := previousGroup. |
956 g := previousGroup. |
957 g ~~ mainGroup ifTrue:[ |
957 g ~~ mainGroup ifTrue:[ |
958 groupForSema := IdentityDictionary new. |
958 groupForSema := IdentityDictionary new. |
959 [g ~~ mainGroup] whileTrue:[ |
959 [g ~~ mainGroup] whileTrue:[ |
960 s := g sensor eventSemaphore. |
960 s := g sensor eventSemaphore. |
961 waitSema add:s. |
961 waitSema add:s. |
962 groupForSema at:s put:g. |
962 groupForSema at:s put:g. |
963 g := g previousGroup. |
963 g := g previousGroup. |
964 ] |
964 ] |
965 ]. |
965 ]. |
966 ]. |
966 ]. |
967 |
967 |
968 [aBlock value] whileTrue:[ |
968 [aBlock value] whileTrue:[ |
969 LastActiveGroup := self. |
969 LastActiveGroup := self. |
970 LastActiveProcess := thisProcess. |
970 LastActiveProcess := thisProcess. |
971 |
971 |
972 (views isNil and:[topViews isNil]) ifTrue:[ |
972 (views isNil and:[topViews isNil]) ifTrue:[ |
973 myProcess notNil ifTrue:[ |
973 myProcess notNil ifTrue:[ |
974 p := myProcess. |
974 p := myProcess. |
975 myProcess := nil. |
975 myProcess := nil. |
976 p terminate. |
976 p terminate. |
977 "not reached - there is no life after death" |
977 "not reached - there is no life after death" |
978 ]. |
978 ]. |
979 " |
979 " |
980 this is the end of a modal loop |
980 this is the end of a modal loop |
981 (not having a private process ...) |
981 (not having a private process ...) |
982 " |
982 " |
983 ^ self |
983 ^ self |
984 ]. |
984 ]. |
985 |
985 |
986 sigs handle:[:ex | |
986 sigs handle:[:ex | |
987 |theSig| |
987 |theSig| |
988 |
988 |
989 (theSig := ex signal) == AbortSignal ifTrue:[ |
989 (theSig := ex signal) == AbortSignal ifTrue:[ |
990 "/ |
990 "/ |
991 "/ on abort, stay in loop |
991 "/ on abort, stay in loop |
992 "/ |
992 "/ |
993 ex return |
993 ex return |
994 ]. |
994 ]. |
995 theSig == LeaveSignal ifTrue:[ |
995 theSig == LeaveSignal ifTrue:[ |
996 "/ |
996 "/ |
997 "/ on leave, exit the event loop |
997 "/ on leave, exit the event loop |
998 "/ |
998 "/ |
999 ^ self |
999 ^ self |
1000 ]. |
1000 ]. |
1001 |
1001 |
1002 "/ ActivityNotification |
1002 "/ ActivityNotification |
1003 "/ |
1003 "/ |
1004 "/ if I am a modal-group, let it be handled |
1004 "/ if I am a modal-group, let it be handled |
1005 "/ by the outer main-groups handler |
1005 "/ by the outer main-groups handler |
1006 "/ otherwise show the activityMessage and continue. |
1006 "/ otherwise show the activityMessage and continue. |
1007 "/ |
1007 "/ |
1008 isModal ifTrue:[ |
1008 isModal ifTrue:[ |
1009 ex reject |
1009 ex reject |
1010 "never reached" |
1010 "never reached" |
1011 ]. |
1011 ]. |
1012 self showActivity:(ex errorString). |
1012 self showActivity:(ex errorString). |
1013 ex proceed. |
1013 ex proceed. |
1014 ] do:[ |
1014 ] do:[ |
1015 |dev gotSema mainView| |
1015 |dev gotSema mainView| |
1016 |
1016 |
1017 "/ Flush device output before going to sleep. |
1017 "/ Flush device output before going to sleep. |
1018 "/ This may produce more events to arrive. |
1018 "/ This may produce more events to arrive. |
1019 "/ Q: is this still needed (see suspendAction) ? |
1019 "/ Q: is this still needed (see suspendAction) ? |
1020 |
1020 |
1021 "/ dev := self graphicsDevice. |
1021 "/ dev := self graphicsDevice. |
1022 "/ dev notNil ifTrue:[dev flush]. |
1022 "/ dev notNil ifTrue:[dev flush]. |
1023 |
1023 |
1024 "/ now, wait for an event to arrive |
1024 "/ now, wait for an event to arrive |
1025 thisProcess setStateTo:#eventWait if:#active. |
1025 thisProcess setStateTo:#eventWait if:#active. |
1026 waitSema isNil ifTrue:[ |
1026 waitSema isNil ifTrue:[ |
1027 "/ oops - how can this happen .... |
1027 "/ oops - how can this happen .... |
1028 ^ self. |
1028 ^ self. |
1029 ]. |
1029 ]. |
1030 gotSema := waitSema wait. |
1030 gotSema := waitSema wait. |
1031 LastActiveGroup := self. |
1031 LastActiveGroup := self. |
1032 LastActiveProcess := thisProcess. |
1032 LastActiveProcess := thisProcess. |
1033 |
1033 |
1034 "/ some bad guy ;-) could have closed all down |
1034 "/ some bad guy ;-) could have closed all down |
1035 "/ in the meanwhile ... |
1035 "/ in the meanwhile ... |
1036 |
1036 |
1037 mySensor notNil ifTrue:[ |
1037 mySensor notNil ifTrue:[ |
1038 gotSema == mySema ifTrue:[ |
1038 gotSema == mySema ifTrue:[ |
1039 "/ |
1039 "/ |
1040 "/ an event for me |
1040 "/ an event for me |
1041 "/ |
1041 "/ |
1042 self processEventsWithModalGroup:nil |
1042 self processEventsWithModalGroup:nil |
1043 ] ifFalse:[ |
1043 ] ifFalse:[ |
1044 groupForSema notNil ifTrue:[ |
1044 groupForSema notNil ifTrue:[ |
1045 g := groupForSema at:gotSema ifAbsent:nil. |
1045 g := groupForSema at:gotSema ifAbsent:nil. |
1046 g := g ? mainGroup. |
1046 g := g ? mainGroup. |
1047 ] ifFalse:[ |
1047 ] ifFalse:[ |
1048 g := mainGroup |
1048 g := mainGroup |
1049 ]. |
1049 ]. |
1050 |
1050 |
1051 "/ |
1051 "/ |
1052 "/ an event for my mainGroup |
1052 "/ an event for my mainGroup |
1053 "/ |
1053 "/ |
1054 g topViews notNil ifTrue:[ |
1054 g topViews notNil ifTrue:[ |
1055 mainView := g topViews first |
1055 mainView := g topViews first |
1056 ]. |
1056 ]. |
1057 mainView notNil ifTrue:[ |
1057 mainView notNil ifTrue:[ |
1058 "/ |
1058 "/ |
1059 "/ if anything happened to the mainGroup |
1059 "/ if anything happened to the mainGroup |
1060 "/ bring my own topView back to the front |
1060 "/ bring my own topView back to the front |
1061 "/ This keeps modalBoxes visible |
1061 "/ This keeps modalBoxes visible |
1062 "/ |
1062 "/ |
1063 (g sensor hasConfigureEventFor:mainView) ifTrue:[ |
1063 (g sensor hasConfigureEventFor:mainView) ifTrue:[ |
1064 topViews size > 0 ifTrue:[ |
1064 topViews size > 0 ifTrue:[ |
1065 topViews first raiseDeiconified |
1065 topViews first raiseDeiconified |
1066 ] |
1066 ] |
1067 ] |
1067 ] |
1068 ]. |
1068 ]. |
1069 " |
1069 " |
1070 if modal, also check for redraw events in my maingroup |
1070 if modal, also check for redraw events in my maingroup |
1071 (we arrive here after we woke up on maingroup sensor eventSemaphore) |
1071 (we arrive here after we woke up on maingroup sensor eventSemaphore) |
1072 " |
1072 " |
1073 g processEventsWithModalGroup:self. |
1073 g processEventsWithModalGroup:self. |
1074 ] |
1074 ] |
1075 ] |
1075 ] |
1076 ]. |
1076 ]. |
1077 ]. |
1077 ]. |
1078 ] valueNowOrOnUnwindDo:[ |
1078 ] valueNowOrOnUnwindDo:[ |
1079 "/ |
1079 "/ |
1080 "/ perform any cleanupActions |
1080 "/ perform any cleanupActions |
1081 "/ |
1081 "/ |
1082 cleanupActions notNil ifTrue:[cleanupActions value] |
1082 cleanupActions notNil ifTrue:[cleanupActions value] |
1083 ] |
1083 ] |
1084 |
1084 |
1085 "Modified: / 14.12.1995 / 11:12:24 / stefan" |
1085 "Modified: / 14.12.1995 / 11:12:24 / stefan" |
1086 "Modified: / 4.8.1998 / 18:17:59 / cg" |
1086 "Modified: / 4.8.1998 / 18:17:59 / cg" |
1087 ! |
1087 ! |
1114 |
1114 |
1115 self processExposeEvents. |
1115 self processExposeEvents. |
1116 |
1116 |
1117 [mySensor notNil |
1117 [mySensor notNil |
1118 and:[(event := mySensor nextEvent) notNil]] whileTrue:[ |
1118 and:[(event := mySensor nextEvent) notNil]] whileTrue:[ |
1119 ignore := false. |
1119 ignore := false. |
1120 focus := focusView. |
1120 focus := focusView. |
1121 modalDelegate := false. |
1121 modalDelegate := false. |
1122 |
1122 |
1123 modalGroup notNil ifTrue:[ |
1123 modalGroup notNil ifTrue:[ |
1124 "/ an incoming event for a masterView, |
1124 "/ an incoming event for a masterView, |
1125 "/ while being blocked by some other modalView. |
1125 "/ while being blocked by some other modalView. |
1126 |
1126 |
1127 modalTops := modalGroup topViews. |
1127 modalTops := modalGroup topViews. |
1128 modalTops size > 0 ifTrue:[ |
1128 modalTops size > 0 ifTrue:[ |
1129 modalTop := modalTops first. |
1129 modalTop := modalTops first. |
1130 ]. |
1130 ]. |
1131 |
1131 |
1132 event isKeyEvent ifTrue:[ |
1132 event isKeyEvent ifTrue:[ |
1133 "/ forward keyboard events to my modal |
1133 "/ forward keyboard events to my modal |
1134 "/ groups first topView ... |
1134 "/ groups first topView ... |
1135 modalTop notNil ifTrue:[ |
1135 modalTop notNil ifTrue:[ |
1136 focus := modalTop. |
1136 focus := modalTop. |
1137 modalDelegate := true. |
1137 modalDelegate := true. |
1138 ] |
1138 ] |
1139 ] ifFalse:[ |
1139 ] ifFalse:[ |
1140 event isFocusEvent ifTrue:[ |
1140 event isFocusEvent ifTrue:[ |
1141 event isFocusInEvent ifTrue:[ |
1141 event isFocusInEvent ifTrue:[ |
1142 "/ focusIn is forwarded to the modalGroup |
1142 "/ focusIn is forwarded to the modalGroup |
1143 "/ (since keyboard is forwarded) |
1143 "/ (since keyboard is forwarded) |
1144 event view:modalTop. |
1144 event view:modalTop. |
1145 focus := modalTop. |
1145 focus := modalTop. |
1146 ] ifFalse:[ |
1146 ] ifFalse:[ |
1147 "/ focusOut goes to both the modal and |
1147 "/ focusOut goes to both the modal and |
1148 "/ the blocked main-group |
1148 "/ the blocked main-group |
1149 "/ (actually, only the very first focusOut |
1149 "/ (actually, only the very first focusOut |
1150 "/ is needed in the mainGroup (to turn off the cursor) |
1150 "/ is needed in the mainGroup (to turn off the cursor) |
1151 "/ all others are only needed in the modalGroup) |
1151 "/ all others are only needed in the modalGroup) |
1152 "/ syntheticEvent := event copy. |
1152 "/ syntheticEvent := event copy. |
1153 "/ syntheticEvent view:modalTop. |
1153 "/ syntheticEvent view:modalTop. |
1154 "/ LastEventQuerySignal handle:[:ex | |
1154 "/ LastEventQuerySignal handle:[:ex | |
1155 "/ ex proceedWith:syntheticEvent |
1155 "/ ex proceedWith:syntheticEvent |
1156 "/ ] do:[ |
1156 "/ ] do:[ |
1157 "/ syntheticEvent sendEventWithFocusOn:nil. |
1157 "/ syntheticEvent sendEventWithFocusOn:nil. |
1158 "/ ]. |
1158 "/ ]. |
1159 event view:modalTop. |
1159 event view:modalTop. |
1160 ]. |
1160 ]. |
1161 modalDelegate := true. |
1161 modalDelegate := true. |
1162 ] ifFalse:[ |
1162 ] ifFalse:[ |
1163 event isPointerLeaveEvent ifTrue:[ |
1163 event isPointerLeaveEvent ifTrue:[ |
1164 ] ifFalse:[ |
1164 ] ifFalse:[ |
1165 event isUserEvent ifTrue:[ |
1165 event isUserEvent ifTrue:[ |
1166 ignore := true |
1166 ignore := true |
1167 ] |
1167 ] |
1168 ] |
1168 ] |
1169 ] |
1169 ] |
1170 ] |
1170 ] |
1171 ]. |
1171 ]. |
1172 |
1172 |
1173 ignore ifFalse:[ |
1173 ignore ifFalse:[ |
1174 (views notNil or:[topViews notNil]) ifTrue:[ |
1174 (views notNil or:[topViews notNil]) ifTrue:[ |
1175 LastEventQuerySignal handle:[:ex | |
1175 LastEventQuerySignal handle:[:ex | |
1176 ex proceedWith:event |
1176 ex proceedWith:event |
1177 ] do:[ |
1177 ] do:[ |
1178 (preEventHook notNil |
1178 (preEventHook notNil |
1179 and:[preEventHook processEvent:event]) ifTrue:[ |
1179 and:[preEventHook processEvent:event]) ifTrue:[ |
1180 ignore := true. |
1180 ignore := true. |
1181 ]. |
1181 ]. |
1182 |
1182 |
1183 ignore ifFalse:[ |
1183 ignore ifFalse:[ |
1184 evView := event view. |
1184 evView := event view. |
1185 |
1185 |
1186 event isKeyPressEvent ifTrue:[ |
1186 event isKeyPressEvent ifTrue:[ |
1187 key := event key. |
1187 key := event key. |
1188 |
1188 |
1189 key == #Escape ifTrue:[ |
1189 key == #Escape ifTrue:[ |
1190 modalDelegate ifTrue:[ |
1190 modalDelegate ifTrue:[ |
1191 modalTop hideRequest |
1191 modalTop hideRequest |
1192 ] ifFalse:[ |
1192 ] ifFalse:[ |
1193 isModal ifTrue:[ |
1193 isModal ifTrue:[ |
1194 topViews first hideRequest |
1194 topViews first hideRequest |
1195 ] |
1195 ] |
1196 ] |
1196 ] |
1197 ] |
1197 ] |
1198 ] ifFalse:[ |
1198 ] ifFalse:[ |
1199 "/ |
1199 "/ |
1200 "/ keep track of which view has the pointer |
1200 "/ keep track of which view has the pointer |
1201 "/ |
1201 "/ |
1202 event isPointerEnterEvent ifTrue:[ |
1202 event isPointerEnterEvent ifTrue:[ |
1203 pointerView := evView |
1203 pointerView := evView |
1204 ] ifFalse:[ |
1204 ] ifFalse:[ |
1205 event isPointerLeaveEvent ifTrue:[ |
1205 event isPointerLeaveEvent ifTrue:[ |
1206 pointerView := nil |
1206 pointerView := nil |
1207 ] |
1207 ] |
1208 ] |
1208 ] |
1209 ]. |
1209 ]. |
1210 |
1210 |
1211 "/ |
1211 "/ |
1212 "/ buttonPress events turn off explicit focus, and revert |
1212 "/ buttonPress events turn off explicit focus, and revert |
1213 "/ to implicit focus control |
1213 "/ to implicit focus control |
1214 "/ |
1214 "/ |
1215 (focusView notNil |
1215 (focusView notNil |
1216 and:[event isButtonPressEvent]) ifTrue:[ |
1216 and:[event isButtonPressEvent]) ifTrue:[ |
1217 self focusView:nil |
1217 self focusView:nil |
1218 ]. |
1218 ]. |
1219 |
1219 |
1220 LastActiveGroup := self. |
1220 LastActiveGroup := self. |
1221 LastActiveProcess := Processor activeProcess. |
1221 LastActiveProcess := Processor activeProcess. |
1222 |
1222 |
1223 " |
1223 " |
1224 if there is no view information in the event, |
1224 if there is no view information in the event, |
1225 it must have been sent directly to the sensor. |
1225 it must have been sent directly to the sensor. |
1226 Send it to the first topView. |
1226 Send it to the first topView. |
1227 " |
1227 " |
1228 evType := event type. |
1228 evType := event type. |
1229 evArgs := event arguments. |
1229 evArgs := event arguments. |
1230 |
1230 |
1231 evView isNil ifTrue:[ |
1231 evView isNil ifTrue:[ |
1232 (firstTop := topViews first) notNil ifTrue:[ |
1232 (firstTop := topViews first) notNil ifTrue:[ |
1233 firstTop perform:evType withArguments:evArgs |
1233 firstTop perform:evType withArguments:evArgs |
1234 ] |
1234 ] |
1235 ] ifFalse:[ |
1235 ] ifFalse:[ |
1236 evView |
1236 evView |
1237 dispatchEvent:evType |
1237 dispatchEvent:evType |
1238 arguments:evArgs |
1238 arguments:evArgs |
1239 withFocusOn:focus |
1239 withFocusOn:focus |
1240 delegate:true |
1240 delegate:true |
1241 ] |
1241 ] |
1242 ]. |
1242 ]. |
1243 |
1243 |
1244 postEventHook notNil ifTrue:[ |
1244 postEventHook notNil ifTrue:[ |
1245 postEventHook processEvent:event |
1245 postEventHook processEvent:event |
1246 ]. |
1246 ]. |
1247 ] |
1247 ] |
1248 ] |
1248 ] |
1249 ]. |
1249 ]. |
1250 ] |
1250 ] |
1251 |
1251 |
1252 "Created: / 5.3.1997 / 11:33:11 / cg" |
1252 "Created: / 5.3.1997 / 11:33:11 / cg" |
1253 "Modified: / 4.8.1998 / 18:18:55 / cg" |
1253 "Modified: / 4.8.1998 / 18:18:55 / cg" |
1254 ! |
1254 ! |
1258 |
1258 |
1259 |event view rect x y w h sensor thisProcess| |
1259 |event view rect x y w h sensor thisProcess| |
1260 |
1260 |
1261 (sensor := mySensor) isNil ifTrue:[^ self]. |
1261 (sensor := mySensor) isNil ifTrue:[^ self]. |
1262 (sensor damageCount ~~ 0) ifTrue:[ |
1262 (sensor damageCount ~~ 0) ifTrue:[ |
1263 thisProcess := Processor activeProcess. |
1263 thisProcess := Processor activeProcess. |
1264 |
1264 |
1265 [(event := sensor nextDamage) notNil] whileTrue:[ |
1265 [(event := sensor nextDamage) notNil] whileTrue:[ |
1266 LastActiveGroup := self. |
1266 LastActiveGroup := self. |
1267 LastActiveProcess := thisProcess. |
1267 LastActiveProcess := thisProcess. |
1268 |
1268 |
1269 (views notNil or:[topViews notNil]) ifTrue:[ |
1269 (views notNil or:[topViews notNil]) ifTrue:[ |
1270 LastEventQuerySignal handle:[:ex | |
1270 LastEventQuerySignal handle:[:ex | |
1271 ex proceedWith:event |
1271 ex proceedWith:event |
1272 ] do:[ |
1272 ] do:[ |
1273 (preEventHook notNil |
1273 (preEventHook notNil |
1274 and:[preEventHook processEvent:event]) ifFalse:[ |
1274 and:[preEventHook processEvent:event]) ifFalse:[ |
1275 view := event view. |
1275 view := event view. |
1276 |
1276 |
1277 event isDamage ifTrue:[ |
1277 event isDamage ifTrue:[ |
1278 "/ |
1278 "/ |
1279 "/ if the view is no longer shown (iconified or closed), |
1279 "/ if the view is no longer shown (iconified or closed), |
1280 "/ this is a leftover event and ignored. |
1280 "/ this is a leftover event and ignored. |
1281 "/ |
1281 "/ |
1282 view shown ifTrue:[ |
1282 view shown ifTrue:[ |
1283 LastActiveGroup := self. |
1283 LastActiveGroup := self. |
1284 LastActiveProcess := thisProcess. |
1284 LastActiveProcess := thisProcess. |
1285 |
1285 |
1286 view |
1286 view |
1287 dispatchEvent:(event type) |
1287 dispatchEvent:(event type) |
1288 arguments:(event arguments) |
1288 arguments:(event arguments) |
1289 withFocusOn:nil |
1289 withFocusOn:nil |
1290 delegate:true |
1290 delegate:true |
1291 |
1291 |
1292 "/ ] ifFalse:[ |
1292 "/ ] ifFalse:[ |
1293 "/ ('WGROUP: damage for ' , view displayString , ' ignored') infoPrintCR. |
1293 "/ ('WGROUP: damage for ' , view displayString , ' ignored') infoPrintCR. |
1294 ] |
1294 ] |
1295 ] ifFalse:[ |
1295 ] ifFalse:[ |
1296 " |
1296 " |
1297 mhmh - could we possibly arrive here ? |
1297 mhmh - could we possibly arrive here ? |
1298 " |
1298 " |
1299 LastActiveGroup := self. |
1299 LastActiveGroup := self. |
1300 LastActiveProcess := thisProcess. |
1300 LastActiveProcess := thisProcess. |
1301 "/ event sendEventWithFocusOn:nil. |
1301 "/ event sendEventWithFocusOn:nil. |
1302 view |
1302 view |
1303 dispatchEvent:(event type) |
1303 dispatchEvent:(event type) |
1304 arguments:(event arguments) |
1304 arguments:(event arguments) |
1305 withFocusOn:nil |
1305 withFocusOn:nil |
1306 delegate:true |
1306 delegate:true |
1307 ] |
1307 ] |
1308 ]. |
1308 ]. |
1309 postEventHook notNil ifTrue:[ |
1309 postEventHook notNil ifTrue:[ |
1310 postEventHook processEvent:event |
1310 postEventHook processEvent:event |
1311 ] |
1311 ] |
1312 ] |
1312 ] |
1313 ] |
1313 ] |
1314 ] |
1314 ] |
1315 ] |
1315 ] |
1316 |
1316 |
1317 "Modified: / 17.6.1998 / 09:09:48 / cg" |
1317 "Modified: / 17.6.1998 / 09:09:48 / cg" |
1318 ! |
1318 ! |
1319 |
1319 |
1338 sensor damageCount == 0 ifTrue:[^ self]. |
1338 sensor damageCount == 0 ifTrue:[^ self]. |
1339 |
1339 |
1340 thisProcess := Processor activeProcess. |
1340 thisProcess := Processor activeProcess. |
1341 |
1341 |
1342 [true] whileTrue:[ |
1342 [true] whileTrue:[ |
1343 LastActiveGroup := self. |
1343 LastActiveGroup := self. |
1344 LastActiveProcess := thisProcess. |
1344 LastActiveProcess := thisProcess. |
1345 |
1345 |
1346 "/ event := aView nextDamage. |
1346 "/ event := aView nextDamage. |
1347 event := sensor nextExposeEventFor:someViewOrNil. |
1347 event := sensor nextExposeEventFor:someViewOrNil. |
1348 event isNil ifTrue:[^ self]. |
1348 event isNil ifTrue:[^ self]. |
1349 |
1349 |
1350 (views notNil or:[topViews notNil]) ifTrue:[ |
1350 (views notNil or:[topViews notNil]) ifTrue:[ |
1351 LastEventQuerySignal handle:[:ex | |
1351 LastEventQuerySignal handle:[:ex | |
1352 ex proceedWith:event |
1352 ex proceedWith:event |
1353 ] do:[ |
1353 ] do:[ |
1354 (preEventHook notNil |
1354 (preEventHook notNil |
1355 and:[preEventHook processEvent:event]) ifFalse:[ |
1355 and:[preEventHook processEvent:event]) ifFalse:[ |
1356 view := event view. |
1356 view := event view. |
1357 "/ |
1357 "/ |
1358 "/ if the view is no longer shown (iconified or closed), |
1358 "/ if the view is no longer shown (iconified or closed), |
1359 "/ this is a leftover event and ignored. |
1359 "/ this is a leftover event and ignored. |
1360 "/ |
1360 "/ |
1361 view shown ifTrue:[ |
1361 view shown ifTrue:[ |
1362 rect := event rectangle. |
1362 rect := event rectangle. |
1363 x := rect left. |
1363 x := rect left. |
1364 y := rect top. |
1364 y := rect top. |
1365 w := rect width. |
1365 w := rect width. |
1366 h := rect height. |
1366 h := rect height. |
1367 LastActiveGroup := self. |
1367 LastActiveGroup := self. |
1368 LastActiveProcess := thisProcess. |
1368 LastActiveProcess := thisProcess. |
1369 view transformation notNil ifTrue:[ |
1369 view transformation notNil ifTrue:[ |
1370 view deviceExposeX:x y:y width:w height:h |
1370 view deviceExposeX:x y:y width:w height:h |
1371 ] ifFalse:[ |
1371 ] ifFalse:[ |
1372 view exposeX:x y:y width:w height:h |
1372 view exposeX:x y:y width:w height:h |
1373 ] |
1373 ] |
1374 ] |
1374 ] |
1375 ]. |
1375 ]. |
1376 postEventHook notNil ifTrue:[ |
1376 postEventHook notNil ifTrue:[ |
1377 postEventHook processEvent:event |
1377 postEventHook processEvent:event |
1378 ] |
1378 ] |
1379 ] |
1379 ] |
1380 ] |
1380 ] |
1381 ] |
1381 ] |
1382 |
1382 |
1383 "Created: / 2.7.1997 / 14:32:19 / cg" |
1383 "Created: / 2.7.1997 / 14:32:19 / cg" |
1384 "Modified: / 5.4.1998 / 11:35:43 / cg" |
1384 "Modified: / 5.4.1998 / 11:35:43 / cg" |
1385 ! |
1385 ! |
1714 |
1725 |
1715 |oldCursors dev deviceCursor action| |
1726 |oldCursors dev deviceCursor action| |
1716 |
1727 |
1717 dev := self graphicsDevice. |
1728 dev := self graphicsDevice. |
1718 dev isNil ifTrue:[ |
1729 dev isNil ifTrue:[ |
1719 ^ aBlock value |
1730 ^ aBlock value |
1720 ]. |
1731 ]. |
1721 |
1732 |
1722 deviceCursor := aCursor onDevice:dev. |
1733 deviceCursor := aCursor onDevice:dev. |
1723 |
1734 |
1724 " |
1735 " |
1725 get mapping of view->cursor for all of my subviews |
1736 get mapping of view->cursor for all of my subviews |
1726 " |
1737 " |
1727 oldCursors := IdentityDictionary new. |
1738 oldCursors := IdentityDictionary new. |
1728 self allViewsDo:[:aView | |
1739 self allViewsDo:[:aView | |
1729 |old| |
1740 |old| |
1730 |
1741 |
1731 old := aView cursor. |
1742 old := aView cursor. |
1732 old ~~ aCursor ifTrue:[ |
1743 old ~~ aCursor ifTrue:[ |
1733 oldCursors at:aView put:old. |
1744 oldCursors at:aView put:old. |
1734 aView cursor:deviceCursor now:false |
1745 aView cursor:deviceCursor now:false |
1735 ] |
1746 ] |
1736 ]. |
1747 ]. |
1737 |
1748 |
1738 oldCursors size == 0 ifTrue:[ |
1749 oldCursors size == 0 ifTrue:[ |
1739 action := aBlock |
1750 action := aBlock |
1740 ] ifFalse:[ |
1751 ] ifFalse:[ |
1741 action := [ |
1752 action := [ |
1742 |rslt| |
1753 |rslt| |
1743 |
1754 |
1744 "/ |
1755 "/ |
1745 "/ here sync looks better; flush leads to almost invisible cursors when accepting. |
1756 "/ here sync looks better; flush leads to almost invisible cursors when accepting. |
1746 "/ I dont really know why (maybe unix does not context-switch to the Xserver |
1757 "/ I dont really know why (maybe unix does not context-switch to the Xserver |
1747 "/ early enough after the requests have been sent ?) |
1758 "/ early enough after the requests have been sent ?) |
1748 "/ |
1759 "/ |
1749 dev sync. |
1760 dev sync. |
1750 |
1761 |
1751 rslt := aBlock valueNowOrOnUnwindDo:[ |
1762 rslt := aBlock valueNowOrOnUnwindDo:[ |
1752 " |
1763 " |
1753 restore cursors from the mapping |
1764 restore cursors from the mapping |
1754 " |
1765 " |
1755 oldCursors keysAndValuesDo:[:view :cursor | |
1766 oldCursors keysAndValuesDo:[:view :cursor | |
1756 view cursor:cursor now:false. |
1767 view cursor:cursor now:false. |
1757 ]. |
1768 ]. |
1758 dev flush |
1769 dev flush |
1759 ]. |
1770 ]. |
1760 rslt |
1771 rslt |
1761 ] |
1772 ] |
1762 ]. |
1773 ]. |
1763 |
1774 |
1764 "/ (self isModal and:[previousGroup notNil]) ifTrue:[ |
1775 "/ (self isModal and:[previousGroup notNil]) ifTrue:[ |
1765 "/ "/ pass the work to my parentGroup |
1776 "/ "/ pass the work to my parentGroup |
1766 "/ ^ previousGroup withCursor:aCursor do:action |
1777 "/ ^ previousGroup withCursor:aCursor do:action |