Commit e5859961 authored by Peter Achten's avatar Peter Achten
Browse files

(PA) CcRqBEGINPAINT-CcRqENDPAINT-WinInvalidateWindow

sequences shortened by CcRqFAKEPAINT crosscall. Should
eliminate some update problems, and is less inefficient.
parent 1784b256
......@@ -4602,6 +4602,17 @@ HandleCleanRequest (CrossCallInfo * pcci)
MakeReturn0Cci (pcci);
}
break;
case CcRqFAKEPAINT: /* hwnd; no result. */
{
HWND hwnd = (HWND) pcci->p1;
BeginPaint (hwnd, &gPaintStruct);
EndPaint (hwnd,&gPaintStruct);
InvalidateRect (hwnd, NULL, FALSE);
MakeReturn0Cci (pcci);
}
break;
case CcRqDOMESSAGE: // idleTimerOn, sleeptime; no result.
{
MSG ms;
......
......@@ -161,6 +161,7 @@
//#define CcRqINVALIDATEWINDOW 1407 PA: has become obsolete because implemented as direct C call
//#define CcRqRELEASEDC 1406 PA: has become obsolete because implemented as direct C call
//#define CcRqGETDC 1405 PA: has become obsolete because implemented as direct C call
#define CcRqFAKEPAINT 1405 /* PA: added combination of BeginPaint; EndPaint; InvalidateRect; */
#define CcRqENDPAINT 1404
#define CcRqBEGINPAINT 1403
#define CcRqDESTROYWINDOW 1402
......
......@@ -167,6 +167,7 @@ CcRqUPDATEWINDOWRECT :== 1412 /* PA: added for updating rect part of a window/
CcRqGETWINDOWTEXT :== 1411
CcRqSETWINDOWTITLE :== 1410
CcRqFAKEPAINT :== 1405 /* PA: added combination of BeginPaint; EndPaint; InvalidateRect; */
CcRqENDPAINT :== 1404
CcRqBEGINPAINT :== 1403
CcRqDESTROYWINDOW :== 1402
......
......@@ -316,6 +316,7 @@ CcRqUPDATEWINDOWRECT :== 1412 /* PA: added for updating rect part of a window/
CcRqGETWINDOWTEXT :== 1411
CcRqSETWINDOWTITLE :== 1410
CcRqFAKEPAINT :== 1405 /* PA: added combination of BeginPaint; EndPaint; InvalidateRect; */
CcRqENDPAINT :== 1404
CcRqBEGINPAINT :== 1403
CcRqDESTROYWINDOW :== 1402
......
......@@ -5,7 +5,7 @@ implementation module osdocumentinterface
import StdMaybe, StdTuple
import clCrossCall_12, ostoolbar, ossystem, ostypes, windowCCall_12, windowCrossCall_12
import clCrossCall_12, ostoolbar, ossystem, ostypes, windowCrossCall_12
from commondef import FatalError,String
from StdIOCommon import DocumentInterface, MDI, SDI, NDI
......@@ -164,7 +164,7 @@ osDestroyProcessWindowCallback _ {ccMsg=CcWmACTIVATE} tb
osDestroyProcessWindowCallback _ {ccMsg=CcWmKEYBOARD} tb
= (Return0Cci,tb)
osDestroyProcessWindowCallback _ {ccMsg=CcWmPAINT,p1=hwnd} tb
= (Return0Cci,WinInvalidateWindow hwnd (WinEndPaint hwnd (WinBeginPaint hwnd tb)))
= (Return0Cci,WinFakePaint hwnd tb)
osDestroyProcessWindowCallback function {ccMsg} tb
= osdocumentinterfaceFatalError function ("received message nr:"+++toString ccMsg)
......
......@@ -163,7 +163,7 @@ where
-> (!CrossCallInfo,!(.s,[DelayActivationInfo]),!*OSToolbox)
OScreateDialogCallback _ _ _ {ccMsg=CcWmPAINT,p1=hwnd} s tb
= //trace_n "OScreateDialogCallback CcWmPAINT"
(Return0Cci, s, OSdelayWindowUpdate hwnd tb)
(Return0Cci, s, WinFakePaint hwnd tb)
OScreateDialogCallback _ _ _ {ccMsg=CcWmACTIVATE,p1=hwnd} (control_info,delay_info) tb
= //trace_n "OScreateDialogCallback CcWmACTIVATE"
(Return0Cci, (control_info,[DelayActivatedWindow hwnd:delay_info]), tb)
......@@ -258,6 +258,7 @@ OScreateWindowCallback :: !Bool !(!Int,!Int) !(!Int,!Int)
!(OSWindowPtr->OSWindowPtr->OSPictContext->.s->*OSToolbox->(.s,*OSToolbox))
!CrossCallInfo !(.s,[DelayActivationInfo]) !*OSToolbox
-> (!CrossCallInfo,!(.s,[DelayActivationInfo]),!*OSToolbox)
/* PA: This alternative replaced by WinFakePaint function.
OScreateWindowCallback _ _ _ _ _ {ccMsg=CcWmPAINT,p1=hwnd} s tb
= //trace "OScreateWindowCallback CcWmPAINT"
(Return0Cci, s, OSdummyWindowUpdate hwnd tb)
......@@ -266,6 +267,10 @@ where
OSdummyWindowUpdate wPtr tb
# (hdc,tb) = WinBeginPaint wPtr tb
= WinEndPaint wPtr (hdc,tb)
*/
OScreateWindowCallback _ _ _ _ _ {ccMsg=CcWmPAINT,p1=hwnd} s tb
= //trace "OScreateWindowCallback CcWmPAINT"
(Return0Cci, s, WinFakePaint hwnd tb)
OScreateWindowCallback _ _ _ _ _ {ccMsg=CcWmACTIVATE,p1=hwnd} (control_info,delay_info) tb
= //trace "OScreateWindowCallback CcWmACTIVATE"
(Return0Cci, (control_info,[DelayActivatedWindow hwnd:delay_info]), tb)
......@@ -298,13 +303,6 @@ OScreateWindowCallback _ _ _ _ _ {ccMsg} s tb
= oswindowFatalError "OScreateWindowCallback" ("unknown message type ("+++toString ccMsg+++")")
OSdelayWindowUpdate :: !OSWindowPtr !*OSToolbox -> *OSToolbox
OSdelayWindowUpdate wPtr tb
# (hdc,tb) = WinBeginPaint wPtr tb
# tb = WinEndPaint wPtr (hdc,tb)
= WinInvalidateWindow wPtr tb
/* PA: new function that creates modal dialog and handles events until termination.
The Bool result is True iff no error occurred.
*/
......@@ -358,12 +356,12 @@ where
-> (!CrossCallInfo,![DelayActivationInfo],!*OSToolbox)
OScreateGameWindowCallback {ccMsg=CcWmPAINT,p1=hwnd} s tb
= //trace "OScreateGameWindowCallback CcWmPAINT"
(Return0Cci, s, OSdummyWindowUpdate hwnd tb)
where
(Return0Cci, s, WinFakePaint hwnd tb)//OSdummyWindowUpdate hwnd tb)
/* where
OSdummyWindowUpdate :: !OSWindowPtr !*OSToolbox -> *OSToolbox
OSdummyWindowUpdate wPtr tb
# (hdc,tb) = WinBeginPaint wPtr tb
= WinEndPaint wPtr (hdc,tb)
= WinEndPaint wPtr (hdc,tb) */
OScreateGameWindowCallback {ccMsg=CcWmACTIVATE,p1=hwnd} delay_info tb
= //trace "OScreateGameWindowCallback CcWmACTIVATE"
(Return0Cci, [DelayActivatedWindow hwnd:delay_info], tb)
......@@ -387,13 +385,13 @@ oswindowCreateError arity function
osIgnoreCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox)
osIgnoreCallback ccinfo=:{ccMsg=CcWmPAINT,p1=hwnd} tb
= (Return0Cci,WinEndPaint hwnd (WinBeginPaint hwnd tb))
= (Return0Cci,WinFakePaint hwnd tb)//WinEndPaint hwnd (WinBeginPaint hwnd tb))
osIgnoreCallback ccinfo tb
= (Return0Cci,tb)
osIgnoreCallback` :: !CrossCallInfo ![DelayActivationInfo] !*OSToolbox -> (!CrossCallInfo,![DelayActivationInfo],!*OSToolbox)
osIgnoreCallback` {ccMsg=CcWmPAINT,p1=hwnd} s tb
= (Return0Cci,s,WinEndPaint hwnd (WinBeginPaint hwnd tb))
= (Return0Cci,s,WinFakePaint hwnd tb)//WinEndPaint hwnd (WinBeginPaint hwnd tb))
osIgnoreCallback` {ccMsg=CcWmACTIVATE,p1=hwnd} delayinfo tb
= (Return0Cci,[DelayActivatedWindow hwnd:delayinfo],tb)
osIgnoreCallback` {ccMsg=CcWmDEACTIVATE,p1=hwnd} delayinfo tb
......@@ -650,7 +648,7 @@ where
osDelayCallback :: !CrossCallInfo ![DelayActivationInfo] !*OSToolbox
-> (!CrossCallInfo,![DelayActivationInfo],!*OSToolbox)
osDelayCallback {ccMsg=CcWmPAINT,p1=wPtr} s tb
= (Return0Cci,s,OSdelayWindowUpdate wPtr tb)
= (Return0Cci,s,WinFakePaint wPtr tb)
osDelayCallback {ccMsg=CcWmACTIVATE,p1=wPtr} delayinfo tb
= (Return0Cci,[DelayActivatedWindow wPtr:delayinfo],tb)
osDelayCallback {ccMsg=CcWmDEACTIVATE,p1=wPtr} delayinfo tb
......@@ -735,7 +733,7 @@ where
osDestroyControlCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox)
osDestroyControlCallback info=:{ccMsg} tb
| ccMsg==CcWmPAINT
= (Return0Cci,WinEndPaint info.p1 (WinBeginPaint info.p1 tb))
= (Return0Cci,WinFakePaint info.p1 tb)//WinEndPaint info.p1 (WinBeginPaint info.p1 tb))
| expected
= (Return0Cci,tb)
| otherwise
......@@ -1004,7 +1002,7 @@ OSactivateControl parentWindow controlPtr tb
where
osIgnoreCallback` :: !CrossCallInfo ![DelayActivationInfo] !*OSToolbox -> (!CrossCallInfo,![DelayActivationInfo],!*OSToolbox)
osIgnoreCallback` {ccMsg=CcWmPAINT,p1=hwnd} s tb
= (Return0Cci,s,WinEndPaint hwnd (WinBeginPaint hwnd tb))
= (Return0Cci,s,WinFakePaint hwnd tb)//WinEndPaint hwnd (WinBeginPaint hwnd tb))
osIgnoreCallback` {ccMsg=CcWmKILLFOCUS,p1=hwnd,p2=cptr} delayinfo tb
= (Return0Cci,[DelayDeactivatedControl hwnd cptr:delayinfo],tb)
osIgnoreCallback` {ccMsg=CcWmSETFOCUS,p1=hwnd,p2=cptr} delayinfo tb
......
......@@ -95,6 +95,8 @@ WinUpdateWindowRect :: !HWND !(!Int,!Int,!Int,!Int) !*OSToolbox -> *OSToolbox
WinSetSelectStateWindow :: !HWND !(!Bool,!Bool) !Bool !Bool !*OSToolbox -> *OSToolbox
WinBeginPaint :: !HWND !*OSToolbox -> (!HDC, !*OSToolbox)
WinEndPaint :: !HWND !(!HDC, !*OSToolbox) -> *OSToolbox
// PA: new function to fake an update. Added for efficiency reasons.
WinFakePaint :: !HWND !*OSToolbox -> *OSToolbox
WinGetClientSize :: !HWND !*OSToolbox -> (!(!Int,!Int), !*OSToolbox)
WinGetWindowSize :: !HWND !*OSToolbox -> (!(!Int,!Int), !*OSToolbox) // PA: added; returns bounding size of window
WinSetClientSize :: !HWND !(!Int,!Int) !*OSToolbox -> *OSToolbox // PA: added
......
......@@ -149,6 +149,10 @@ WinEndPaint :: !HWND !(!HDC, !*OSToolbox) -> *OSToolbox
WinEndPaint hwnd (hdc,tb)
= snd (IssueCleanRequest2 (ErrorCallback2 "EndPaint") (Rq2Cci CcRqENDPAINT hwnd hdc) tb)
WinFakePaint :: !HWND !*OSToolbox -> *OSToolbox
WinFakePaint hwnd tb
= snd (IssueCleanRequest2 (ErrorCallback2 "FakePaint") (Rq1Cci CcRqFAKEPAINT hwnd) tb)
WinGetClientSize :: !HWND !*OSToolbox -> (!(!Int,!Int), !*OSToolbox)
WinGetClientSize hwnd tb
# (rcci,tb) = IssueCleanRequest2 (ErrorCallback2 "WinGetClientSize") (Rq1Cci CcRqGETCLIENTSIZE hwnd) tb
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment