MODULE DisplayRefresher;
IMPORT
Modules, KernelLog, Inputs, WMMessages, WMWindowManager;
VAR
manager : WMWindowManager.WindowManager;
viewport : WMWindowManager.ViewPort;
PROCEDURE Handle(VAR msg : WMMessages.Message; VAR discard : BOOLEAN);
VAR meta : BOOLEAN;
BEGIN
discard := FALSE;
IF msg.msgType = WMMessages.MsgKey THEN
meta := (msg.flags * Inputs.Meta # {}) OR ((msg.flags * Inputs.Alt # {}) & (msg.flags * Inputs.Shift # {}));
IF ~meta & (msg.y = 0FFC6H) THEN
manager.RefreshView(viewport);
END;
END;
END Handle;
PROCEDURE Install*;
BEGIN
END Install;
PROCEDURE Cleanup;
BEGIN
IF (manager # NIL) THEN manager.RemoveMessagePreview(Handle); END;
END Cleanup;
BEGIN
Modules.InstallTermHandler(Cleanup);
manager := WMWindowManager.GetDefaultManager();
viewport := WMWindowManager.GetDefaultView();
IF (manager # NIL) & (viewport # NIL) THEN
manager.InstallMessagePreview(Handle);
KernelLog.String("DisplayRefresher installed.");
ELSE
KernelLog.String("DisplayRefresher installation failed (could not find window manager or viewport) ");
END;
KernelLog.Ln;
END DisplayRefresher.
DisplayRefresher.Install ~
SystemTools.Free DisplayRefresher ~