Commit e9cc54aa authored by Peter Achten's avatar Peter Achten

(PA) Removed 2 bugs.

(1) setActiveWindow + activate/deactivate events now OK
(2) closeProcess in modal dialog now OK
Corrected all examples (lower-case function names)
parent a23fa7b4
......@@ -70,7 +70,7 @@ where
= pst
where
// window defines the window that displays the barrel and the current balls.
window = Window name NilLS
window = Window name NilLS
[ WindowId wId
, WindowLook False (updateBalls initLocal)
, WindowViewSize windowSize
......@@ -85,7 +85,7 @@ where
) []
// timer defines the timer that calculates the movements of the current balls.
timer = Timer 0 NilLS
timer = Timer /*ticksPerSecond*/0 NilLS
[ TimerId tId
, TimerFunction (noLS1 (bounceBalls splitWalls))
]
......
......@@ -838,6 +838,7 @@ bebouwd
bebouwen
bebouwing
becijferd
bed
bedaard
bedachtzaam
bedacht
......@@ -2691,6 +2692,7 @@ dorps
dorp
dorre
dorst
dos
dosis
dossier
douanegebied
......@@ -3450,6 +3452,7 @@ gebakken
gebaren
gebarsten
gebaseerd
gebed
gebeden
gebeds
gebed
......@@ -3776,6 +3779,7 @@ gelukkiger
gelukkig
gelukt
geluk
gem
gemaakt
gemaal
gemakkelijker
......@@ -3815,6 +3819,7 @@ gemoeid
gemompel
gemonteerd
gemotiveerd
gen
genaamd
genade
geneeskunde
......@@ -4641,6 +4646,7 @@ hervorming
herziening
herzien
her
hes
heten
heterdaad
hetgeen
......@@ -5922,6 +5928,7 @@ lachend
lacht
lach
ladder
lade
laden
lade
lading
......@@ -6972,6 +6979,7 @@ noordster
noordzijde
noord
noot
nop
nopens
noren
normaal
......@@ -7056,6 +7064,7 @@ olie
olifant
olijfolie
olympisch
om
oma
ombudsman
omdat
......@@ -7532,6 +7541,7 @@ oosters
oostkant
oostzijde
oost
op
opa
opbellen
opbouwwerker
......@@ -7813,6 +7823,7 @@ originele
orkest
orthodoxe
orthodox
os
oscar
os
otter
......@@ -8906,6 +8917,7 @@ rooms
room
rooster
roos
ros
rose
rots
rotzooi
......@@ -12124,6 +12136,7 @@ watje
watten
wat
wazig
we
wedde
weddenschap
wedden
......@@ -12227,6 +12240,7 @@ welzijnswerk
welzijnszaken
welzijn
wel
wen
wending
wendt
wend
......@@ -12334,6 +12348,7 @@ wiens
wierp
wier
wieren
wig
wijdde
wijd
wijf
......
......@@ -75,7 +75,7 @@ where
keyFilter (CharKey _ (KeyDown repeat))
= not repeat
keyFilter (SpecialKey key (KeyDown repeat) _)
= isMember key [BackSpaceKey,DeleteKey] && not repeat
= isMember key [backSpaceKey,deleteKey] && not repeat
keyFilter _
= False
......
......@@ -136,7 +136,7 @@ where
, foodsupply = foods1
, grow = 0
, points = initpoints
, dir = RightKey
, dir = rightKey
, worm = initworm
, lives = initlives
}
......@@ -194,14 +194,14 @@ where
// The MakeTurn function is called when an arrow key is pressed.
KeyFilter :: KeyboardState -> Bool
KeyFilter (SpecialKey key (KeyDown _) _)
= isMember key [DownKey,LeftKey,RightKey,UpKey]
= isMember key [downKey,leftKey,rightKey,upKey]
KeyFilter _
= False
MakeTurn :: KeyboardState (PSt Local) -> PSt Local
MakeTurn (SpecialKey key _ _) pst=:{ls=ls=:{state=state=:{dir}}}
| (dir==UpKey || dir==DownKey) && (key==LeftKey || key==RightKey) = OneStep 1 {pst & ls={ls & state={state & dir=key}}}
| (dir==LeftKey || dir==RightKey) && (key==UpKey || key==DownKey ) = OneStep 1 {pst & ls={ls & state={state & dir=key}}}
| (dir==upKey || dir==downKey) && (key==leftKey || key==rightKey) = OneStep 1 {pst & ls={ls & state={state & dir=key}}}
| (dir==leftKey || dir==rightKey) && (key==upKey || key==downKey ) = OneStep 1 {pst & ls={ls & state={state & dir=key}}}
| otherwise = pst
// The function for the Timer device: do one step of the worm game.
......@@ -256,10 +256,10 @@ where
NewHead :: SpecialKey Segment -> Segment
NewHead key segment=:{x,y}
| key==UpKey = {segment & y=y-1}
| key==DownKey = {segment & y=y+1}
| key==LeftKey = {segment & x=x-1}
| key==RightKey = {segment & x=x+1}
| key==upKey = {segment & y=y-1}
| key==downKey = {segment & y=y+1}
| key==leftKey = {segment & x=x-1}
| key==rightKey = {segment & x=x+1}
| otherwise = abort ("NewHead applied to unknown SpecialKey: "+++toString key)
SwitchLevel :: Level [Food] Points Points HiScores Lives (PSt Local) -> PSt Local
......@@ -275,7 +275,7 @@ where
, foodsupply = foods1
, grow = 0
, points = newPoints
, dir = RightKey
, dir = rightKey
, worm = initworm
, best = high
, lives = if (newPoints>oldPoints) (lives+1) (lives-1)
......@@ -316,7 +316,7 @@ where
= DeadWormAlert id worm {pst & ls={ls & state={state & food = newfood
, foodsupply = foods1
, grow = 0
, dir = RightKey
, dir = rightKey
, worm = newworm
, lives = lives-1
}
......
......@@ -56,7 +56,7 @@ InitState best
, foodsupply = []
, grow = 0
, points = 0
, dir = RightKey
, dir = rightKey
, worm = initworm
, best = best
, lives = NrOfWorms
......
......@@ -13,8 +13,8 @@ from StdMaybe import Maybe, Just, Nothing
:: *OSEvents
osNewEvents :: OSEvents
osCopyEvents :: !OSEvents -> (!OSEvents,!OSEvents)
osAppendEvents :: !*[OSEvent] !OSEvents -> OSEvents // osAppendEvents adds events at the end of the queue
osInsertEvents :: !*[OSEvent] !OSEvents -> OSEvents // osAppendEvents adds events at the front of the queue
osIsEmptyEvents :: !OSEvents -> (!Bool,!OSEvents)
osRemoveEvent :: !OSEvents -> (!OSEvent,!OSEvents)
......
......@@ -19,11 +19,14 @@ oseventFatalError function error
:: *OSEvents
:== [OSEvent]
osAppendEvents :: !*[OSEvent] !OSEvents -> OSEvents
osAppendEvents newEvents osEvents
= osEvents ++ newEvents
osInsertEvents :: !*[OSEvent] !OSEvents -> OSEvents
osInsertEvents newEvents osEvents
= newEvents ++ osEvents
osIsEmptyEvents :: !OSEvents -> (!Bool,!OSEvents)
osIsEmptyEvents []
= (True, [])
......@@ -36,14 +39,6 @@ osRemoveEvent [osEvent:osEvents]
osRemoveEvent []
= oseventFatalError "osRemoveEvent" "OSEvents argument is empty"
osCopyEvents :: !OSEvents -> (!OSEvents,!OSEvents)
osCopyEvents []
= ([],[])
osCopyEvents [e:es]
= ([e:es1],[e:es2])
where
(es1,es2) = osCopyEvents es
osNewEvents :: OSEvents
osNewEvents = []
......
......@@ -934,16 +934,21 @@ where
/* osCallback delays activate and deactivate events.
All other events are passed to the callback function.
PA: is now identical to osStackWindow!!
*/ osCallback :: !(OSEvent->(.s,*OSToolbox)->(.s,*OSToolbox)) !CrossCallInfo !(![DelayActivationInfo],!.s) !*OSToolbox
-> (!CrossCallInfo,!(![DelayActivationInfo],!.s),!*OSToolbox)
osCallback handleOSEvent {ccMsg=CcWmACTIVATE,p1=hwnd} (delayinfo,s) tb
= (return0Cci,([DelayActivatedWindow hwnd:delayinfo],s),tb)
osCallback handleOSEvent {ccMsg=CcWmDEACTIVATE,p1=hwnd} (delayinfo,s) tb
= (return0Cci,([DelayDeactivatedWindow hwnd:delayinfo],s),tb)
osCallback handleOSEvent osEvent (delayinfo,s) tb
# (s,tb) = handleOSEvent osEvent (s,tb)
= (return0Cci,(delayinfo,s),tb)
osCallback handleOSEvent osEvent=:{ccMsg,p1,p2} (delayinfo,s) tb
| isDelayEvent
= (return0Cci,([delayEvent:delayinfo],s),tb)
| otherwise
# (s,tb) = handleOSEvent osEvent (s,tb)
= (return0Cci,(delayinfo,s),tb)
where
(isDelayEvent,delayEvent) = case ccMsg of
CcWmACTIVATE -> (True,DelayActivatedWindow p1)
CcWmDEACTIVATE -> (True,DelayDeactivatedWindow p1)
CcWmKILLFOCUS -> (True,DelayDeactivatedControl p1 p2)
CcWmSETFOCUS -> (True,DelayActivatedControl p1 p2)
_ -> (False,undef)
osActivateControl :: !OSWindowPtr !OSWindowPtr !*OSToolbox -> (![DelayActivationInfo],!*OSToolbox)
......
......@@ -468,9 +468,6 @@ filterOSEvent _ {ccMsg=CcWmDEACTIVATE,p1=wPtr} windows ioState
# (found,wsH,windows) = getWindowHandlesWindow (toWID wPtr) windows
| not found
= (False,Nothing,Nothing,windows,ioState)
# (active,wsH) = getWindowStateHandleActive wsH
| not active // The window is already inactive, skip
= (True,Nothing,Nothing,setWindowHandlesWindow wsH windows,ioState)
| otherwise
# (wids,wsH) = getWindowStateHandleWIDS wsH
windows = setWindowHandlesWindow wsH windows
......@@ -632,10 +629,12 @@ filterOSEvent _ {ccMsg=CcWmKILLFOCUS,p1=wPtr,p2=cPtr} windows ioState
# (found,wsH,windows) = getWindowHandlesWindow (toWID wPtr) windows
| not found
= (False,Nothing,Nothing,windows,ioState)
# (wids,wsH) = getWindowStateHandleWIDS wsH
(found,itemNr,wsH) = getControlKeyFocusItemNr False cPtr wsH
windows = setWindowHandlesWindow wsH windows
| not found
= (True,Nothing,Nothing,windows,ioState)
| otherwise
# (wids,wsH) = getWindowStateHandleWIDS wsH
(itemNr,wsH) = getControlKeyFocusItemNr False cPtr wsH
windows = setWindowHandlesWindow wsH windows
= (True,Nothing,Just (ControlLooseKeyFocus {ckfWIDS=wids,ckfItemNr=itemNr,ckfItemPtr=cPtr}),windows,ioState)
filterOSEvent _ {ccMsg=CcWmLOSTKEY,p1=wPtr,p2=cPtr} windows ioState
......@@ -818,7 +817,7 @@ filterOSEvent _ {ccMsg=CcWmMOUSE,p1=wPtr,p2=cPtr,p3=action,p4=x,p5=y,p6=mods} wi
= (True,Nothing,deviceEvent,setWindowHandlesWindow wsH windows,ioState)
with
okWindowMouseState :: !Int !Point2 !(WindowStateHandle .pst) !(Maybe InputTrack)
-> (!Bool,MouseState,!WindowStateHandle .pst, ! Maybe InputTrack)
-> (!Bool,MouseState,!WindowStateHandle .pst, ! Maybe InputTrack)
okWindowMouseState action eventPos wsH=:{wshHandle=Just {wlsHandle={whKind,whWindowInfo,whAtts}}} inputTrack
| whKind==IsDialog
= (False,undef,wsH,inputTrack)
......@@ -858,7 +857,7 @@ filterOSEvent _ {ccMsg=CcWmMOUSE,p1=wPtr,p2=cPtr,p3=action,p4=x,p5=y,p6=mods} wi
= (True,Nothing,deviceEvent,setWindowHandlesWindow wsH windows,ioState)
with
okControlItemsNrMouseState :: !OSWindowPtr !OSWindowPtr !Int !Point2 !(WindowStateHandle .pst) !(Maybe InputTrack)
-> (!Bool,!Int,MouseState,!WindowStateHandle .pst, ! Maybe InputTrack)
-> (!Bool,!Int,MouseState, !WindowStateHandle .pst, ! Maybe InputTrack)
okControlItemsNrMouseState wPtr itemPtr action eventPos wsH=:{wshHandle=Just wlsH=:{wlsHandle=wH=:{whItems}}} inputTrack
# (_,ok,itemNr,itemPos,itemHs,inputTrack)
= okControlsItemNrMouseState True wPtr itemPtr action eventPos whItems inputTrack
......@@ -946,10 +945,12 @@ filterOSEvent _ {ccMsg=CcWmSETFOCUS,p1=wPtr,p2=cPtr} windows ioState
# (found,wsH,windows) = getWindowHandlesWindow (toWID wPtr) windows
| not found
= (False,Nothing,Nothing,windows,ioState)
# (wids,wsH) = getWindowStateHandleWIDS wsH
(found,itemNr,wsH) = getControlKeyFocusItemNr True cPtr wsH
windows = setWindowHandlesWindow wsH windows
| not found
= (True,Nothing,Nothing,windows,ioState)
| otherwise
# (wids,wsH) = getWindowStateHandleWIDS wsH
(itemNr,wsH) = getControlKeyFocusItemNr True cPtr wsH
windows = setWindowHandlesWindow wsH windows
= (True,Nothing,Just (ControlGetKeyFocus {ckfWIDS=wids,ckfItemNr=itemNr,ckfItemPtr=cPtr}),windows,ioState)
filterOSEvent wMetrics {ccMsg=CcWmSIZE,p1=wPtr,p2=w,p3=h,p4=usersizing} windows ioState
......@@ -1024,52 +1025,46 @@ where
alton = i bitand ALTBIT <> 0
ctrlon = i bitand CTRLBIT <> 0
getControlKeyFocusItemNr :: !Bool !OSWindowPtr !(WindowStateHandle .pst) -> (!Int,!WindowStateHandle .pst)
getControlKeyFocusItemNr :: !Bool !OSWindowPtr !(WindowStateHandle .pst) -> (!Bool,!Int,!WindowStateHandle .pst)
getControlKeyFocusItemNr activated cPtr wsH=:{wshHandle=Just wlsH=:{wlsHandle=wH}}
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr wH.whItems
= (itemNr,{wsH & wshHandle=Just {wlsH & wlsHandle={wH & whItems=itemHs}}})
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr wH.whItems
= (found,itemNr,{wsH & wshHandle=Just {wlsH & wlsHandle={wH & whItems=itemHs}}})
where
getControlsKeyFocusItemNr` :: !Bool !OSWindowPtr ![WElementHandle .ls .pst] -> (!Int,![WElementHandle .ls .pst])
getControlsKeyFocusItemNr` :: !Bool !OSWindowPtr ![WElementHandle .ls .pst] -> (!Bool,!Int,![WElementHandle .ls .pst])
getControlsKeyFocusItemNr` activated cPtr []
= (0,[])
= (False,0,[])
getControlsKeyFocusItemNr` activated cPtr [itemH:itemHs]
# (itemNr,itemH) = getControlKeyFocusItemNr` activated cPtr itemH
| itemNr<>0
= (itemNr,[itemH:itemHs])
# (found,itemNr,itemH) = getControlKeyFocusItemNr` activated cPtr itemH
| found
= (found,itemNr,[itemH:itemHs])
| otherwise
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (itemNr,[itemH:itemHs])
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (found,itemNr,[itemH:itemHs])
where
getControlKeyFocusItemNr` :: !Bool !OSWindowPtr !(WElementHandle .ls .pst) -> (!Int,!WElementHandle .ls .pst)
getControlKeyFocusItemNr` :: !Bool !OSWindowPtr !(WElementHandle .ls .pst) -> (!Bool,!Int,!WElementHandle .ls .pst)
getControlKeyFocusItemNr` activated cPtr (WItemHandle itemH=:{wItemPtr,wItemNr,wItemKind,wItemSelect,wItemAtts,wItems})
| cPtr==wItemPtr
| not (isMember wItemKind [IsCompoundControl,IsCustomControl,IsEditControl,IsPopUpControl])
= (0,WItemHandle itemH)
| not wItemSelect
= (0,WItemHandle itemH)
| contains reqAttribute wItemAtts
= (wItemNr,WItemHandle itemH)
= (True,0,WItemHandle itemH)
// otherwise
= (0,WItemHandle itemH)
= (True,wItemNr,WItemHandle itemH)
| not (isRecursiveControl wItemKind)
= (0,WItemHandle itemH)
= (False,0,WItemHandle itemH)
| otherwise
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr wItems
= (itemNr,WItemHandle {itemH & wItems=itemHs})
where
reqAttribute = if activated isControlActivate isControlDeactivate
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr wItems
= (found,itemNr,WItemHandle {itemH & wItems=itemHs})
getControlKeyFocusItemNr` activated cPtr (WListLSHandle itemHs)
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (itemNr,WListLSHandle itemHs)
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (found,itemNr,WListLSHandle itemHs)
getControlKeyFocusItemNr` activated cPtr (WExtendLSHandle wExH=:{wExtendItems=itemHs})
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (itemNr,WExtendLSHandle {wExH & wExtendItems=itemHs})
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (found,itemNr,WExtendLSHandle {wExH & wExtendItems=itemHs})
getControlKeyFocusItemNr` activated cPtr (WChangeLSHandle wChH=:{wChangeItems=itemHs})
# (itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (itemNr,WChangeLSHandle {wChH & wChangeItems=itemHs})
# (found,itemNr,itemHs) = getControlsKeyFocusItemNr` activated cPtr itemHs
= (found,itemNr,WChangeLSHandle {wChH & wChangeItems=itemHs})
getControlKeyFocusItemNr _ _ _
= windoweventFatalError "getControlKeyFocusItemNr" "window placeholder not expected"
......
......@@ -378,10 +378,10 @@ access _ n []
accessList :: !(St .x .y) ![.x] -> (![.y],![.x])
accessList acc [x:xs]
# (y, x) = acc x
# (ys,xs) = accessList acc xs
= ([y:ys],[x:xs])
accessList _ _
#! (y, x) = acc x
#! (ys,xs) = accessList acc xs
= ([y:ys],[x:xs])
accessList _ []
= ([],[])
remove :: !(Cond x) x !u:[x] -> (!Bool,x,!u:[x])
......
......@@ -119,8 +119,9 @@ ioStSetRcvDisabled :: !Bool !(IOSt .l) -> IOSt .l /* MW11++*/
ioStSwapIO :: !(![*World],!CProcesses) !(IOSt .l) -> (!(![*World],!CProcesses),!IOSt .l)
ioStLastInteraction :: !(IOSt .l) -> (!Bool, !IOSt .l)
ioStHasDevice :: !Device !(IOSt .l) -> (!Bool, !IOSt .l)
ioStLastInteraction :: !(IOSt .l) -> (!Bool, !IOSt .l)
ioStHasDevice :: !Device !(IOSt .l) -> (!Bool, !IOSt .l)
ioStHasDevices :: !(IOSt .l) -> (!Bool, !IOSt .l)
ioStGetDevices :: !(IOSt .l) -> (![Device],!IOSt .l)
ioStGetDevice :: !Device !(IOSt .l) -> (!Bool,DeviceSystemState (PSt .l),!IOSt .l)
......
This diff is collapsed.
......@@ -60,8 +60,7 @@ contextGetSleepTime context=:{cTimerTable=tt,cReceiverTable}
contextGetOSEvents :: !Context -> (!OSEvents,!Context)
contextGetOSEvents context=:{cEnvs=envs=:{envsEvents=es}}
# (es1,es2) = osCopyEvents es
= (es1,{context & cEnvs={envs & envsEvents=es2}})
= (es,{context & cEnvs={envs & envsEvents=osNewEvents}})
contextSetOSEvents :: !(!OSEvents,!Context) -> Context
contextSetOSEvents (osEvents,context=:{cEnvs=envs})
......@@ -298,10 +297,13 @@ where
= (closed,{localIO & localIOSt=ioState})
processModal :: !CProcess -> (!Bool,!CProcess)
processModal localIO=:{localIOSt}
/* processModal localIO=:{localIOSt}
# (optModal,ioState)= ioStGetIOIsModal localIOSt
# (myId,ioState) = ioStGetIOId ioState
= (isJust optModal && myId==fromJust optModal,{localIO & localIOSt=ioState})
*/ processModal localIO=:{localIOSt}
# (notEmpty,ioState) = ioStHasDevices localIOSt
= (notEmpty,{localIO & localIOSt=ioState})
handleEventForLocalIO :: !Bool !SchedulerEvent !CProcess !Context
-> (!Bool,!SchedulerEvent,!CProcess,!Context)
......
......@@ -489,24 +489,32 @@ where
= [x]
addWindowHandlesActiveWindow :: !(WindowStateHandle .pst) !(WindowHandles .pst) -> WindowHandles .pst
addWindowHandlesActiveWindow wsH wHs=:{whsWindows}
addWindowHandlesActiveWindow wsH=:{wshIds=wids} wHs=:{whsWindows}
# (mode,wsH) = getWindowStateHandleWindowMode wsH
| mode==Modal
= {wHs & whsWindows=[wsH:whsWindows]}
= {wHs & whsWindows=[{wsH & wshIds=widsActive}:whsWindows]}
| otherwise
#! wsHs = addBehindLastModal wsH whsWindows
#! wsHs = addBehindLastModal False wsH whsWindows
= {wHs & whsWindows=wsHs}
with
addBehindLastModal :: !(WindowStateHandle .pst) ![WindowStateHandle .pst] -> [WindowStateHandle .pst]
addBehindLastModal wsH [wsH`:wsHs]
# (mode`,wsH`) = getWindowStateHandleWindowMode wsH`
| mode`==Modal
#! wsHs = addBehindLastModal wsH wsHs
= [wsH`:wsHs]
| otherwise
= [wsH,wsH`:wsHs]
addBehindLastModal wsH _
where
widsActive = {wids & wActive=True}
addBehindLastModal :: !Bool !(WindowStateHandle .pst) ![WindowStateHandle .pst] -> [WindowStateHandle .pst]
addBehindLastModal modalsExist wsH [wsH`:wsHs]
# (mode`,wsH`) = getWindowStateHandleWindowMode wsH`
isModal = mode`==Modal
| isModal
#! wsHs = addBehindLastModal (isModal || modalsExist) wsH wsHs
= [wsH`:wsHs]
| modalsExist
= [wsH,wsH`:wsHs]
| otherwise
= [{wsH & wshIds=widsActive},wsH`:wsHs]
addBehindLastModal modalsExist wsH _
| modalsExist
= [wsH]
| otherwise
= [{wsH & wshIds=widsActive}]
/* disableWindowSystem disables all current windows.
......
......@@ -53,6 +53,7 @@ openmodalwindow wId {wlsState,wlsHandle} pState=:{io=ioState}
# pState = {pState & io=ioState}
# (noError,pState,_) = osCreateModalDialog closable title osdinfo (mapMaybe (\{wPtr}->wPtr) modalWIDS)
getOSEvent setOSEvent handleOSEvent pState OSNewToolbox
errorReport = if noError NoError (OtherError "could not create modal dialog")
(delayMouse,delayKey) = case inputTrack of // after handling modal dialog, generate proper (Mouse/Key)Lost events
Nothing -> ([],[])
Just it=:{itWindow,itControl,itKind}
......@@ -63,8 +64,14 @@ openmodalwindow wId {wlsState,wlsHandle} pState=:{io=ioState}
# (osEvents,ioState) = ioStGetEvents ioState
# ioState = ioStSetEvents (osAppendEvents osDelayEvents osEvents) ioState
# (finalLS,ioState) = getFinalModalDialogLS noError (toWID wId) ioState
# pState = {pState & io=ioState}
= (if noError NoError (OtherError "could not create modal dialog"),finalLS,pState)
| isJust modalWIDS // there still are modal dialogs
= (errorReport,finalLS,{pState & io=ioState})
# (closed,ioState) = ioStClosed ioState
| closed // process has been requested to close; remove WindowDevice, so process can removed (scheduler)
# (_,_,ioState) = ioStGetDevice WindowDevice ioState
= (errorReport,finalLS,{pState & io=ioState})
| otherwise
= (errorReport,finalLS,{pState & io=ioState})
where
handleOSEvent :: !OSEvent !(PSt .l) -> (![Int],!PSt .l)
handleOSEvent osEvent pState = accContext (handleContextOSEvent osEvent) pState
......
......@@ -185,39 +185,39 @@ where
(wsH1,pState2) = windowStateControlKeyboardActionIO info wsH pState1
windowIO deviceEvent=:(ControlLooseKeyFocus info) pState
# (_,wDevice,ioState) = ioStGetDevice WindowDevice pState.io
windows = windowSystemStateGetWindowHandles wDevice
wids = info.ckfWIDS
(found,wsH,windows) = getWindowHandlesWindow (toWID wids.wId) windows
# (_,wDevice,ioState) = ioStGetDevice WindowDevice pState.io
windows = windowSystemStateGetWindowHandles wDevice
wids = info.ckfWIDS
(found,wsH,windows) = getWindowHandlesWindow (toWID wids.wId) windows
| not found
= windowdeviceFatalError "windowIO (ControlLooseKeyFocus _) _" "window could not be found"
# (oldInputTrack,ioState) = ioStGetInputTrack ioState
# (oldInputTrack,ioState) = ioStGetInputTrack ioState
(newInputTrack,lostMouse,lostKey)
= case oldInputTrack of
Just it=:{itWindow,itControl,itKind}
-> if (itWindow==wids.wPtr && itControl==info.ckfItemNr)
( Nothing
, if itKind.itkMouse [createOSLooseMouseEvent itWindow itControl] []
, if itKind.itkKeyboard [createOSLooseKeyEvent itWindow itControl] []
)
(oldInputTrack,[],[])
nothing -> (nothing,[],[])
# ioState = ioStSetInputTrack newInputTrack ioState
lostInputEvents = lostMouse ++ lostKey
| isEmpty lostInputEvents // no input was being tracked: simply evaluate control deactivate function
= case oldInputTrack of
Just it=:{itWindow,itControl,itKind}
-> if (itWindow==wids.wPtr && itControl==info.ckfItemNr)
( Nothing