From d0572ddc181ca17c8a7b164d9a7f1318aeeb7e43 Mon Sep 17 00:00:00 2001 From: Wizzup? Date: Mon, 30 Nov 2009 19:57:26 +0000 Subject: [PATCH] Several bugfixes. For the record: - One in wait. Integer -> DWord. - ActivateClient did not call XFlush(), and wasn't exported either. - Bug in SendKeys where it did not release the VK_SHIFT key. - Overloaded + and - operators for TPoints git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@253 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- Units/MMLAddon/PSInc/Wrappers/other.inc | 4 +++- Units/MMLAddon/PSInc/Wrappers/window.inc | 5 +++++ Units/MMLAddon/PSInc/pscompile.inc | 1 + Units/MMLAddon/mmlpsthread.pas | 1 + Units/MMLCore/input.pas | 4 +++- Units/MMLCore/mufasatypes.pas | 20 +++++++++++++++++++- Units/MMLCore/window.pas | 1 + 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/other.inc b/Units/MMLAddon/PSInc/Wrappers/other.inc index 0d2b7c9..70c8b07 100644 --- a/Units/MMLAddon/PSInc/Wrappers/other.inc +++ b/Units/MMLAddon/PSInc/Wrappers/other.inc @@ -28,7 +28,7 @@ begin end; {$else} var - EndTime : integer; + EndTime : DWord; begin if t > 50 then begin; @@ -36,7 +36,9 @@ begin while (CurrThread.PSScript.Exec.Status = isRunning) and (GetTickCount < EndTime) do Sleep(16); end else + begin sleep(t); + end; end; {$endif} diff --git a/Units/MMLAddon/PSInc/Wrappers/window.inc b/Units/MMLAddon/PSInc/Wrappers/window.inc index 15c5ab4..72e7251 100644 --- a/Units/MMLAddon/PSInc/Wrappers/window.inc +++ b/Units/MMLAddon/PSInc/Wrappers/window.inc @@ -51,3 +51,8 @@ procedure SetTargetArray(P: Integer; Size: TPoint); begin CurrThread.Client.MWindow.SetTarget(PRGB32(P), Size); end; + +procedure activateclient; +begin + CurrThread.Client.MWindow.ActivateClient; +end; diff --git a/Units/MMLAddon/PSInc/pscompile.inc b/Units/MMLAddon/PSInc/pscompile.inc index 1dace00..c198aef 100644 --- a/Units/MMLAddon/PSInc/pscompile.inc +++ b/Units/MMLAddon/PSInc/pscompile.inc @@ -72,6 +72,7 @@ Sender.AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h Sender.AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);'); Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient'); Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);'); +Sender.AddFunction(@ActivateClient, 'procedure activateclient;'); {files} Sender.AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;'); diff --git a/Units/MMLAddon/mmlpsthread.pas b/Units/MMLAddon/mmlpsthread.pas index 055d645..4cc8832 100644 --- a/Units/MMLAddon/mmlpsthread.pas +++ b/Units/MMLAddon/mmlpsthread.pas @@ -200,6 +200,7 @@ end; {$I PSInc/Wrappers/other.inc} {$I PSInc/Wrappers/bitmap.inc} {$I PSInc/Wrappers/window.inc} + {$I PSInc/Wrappers/colour.inc} {$I PSInc/Wrappers/math.inc} {$I PSInc/Wrappers/mouse.inc} diff --git a/Units/MMLCore/input.pas b/Units/MMLCore/input.pas index c9dcbfb..752a0f6 100644 --- a/Units/MMLCore/input.pas +++ b/Units/MMLCore/input.pas @@ -182,7 +182,7 @@ begin for i := 1 to length(text) do begin if((text[i] >= 'A') and (text[i] <= 'Z')) then - begin; + begin Self.KeyDown(VK_SHIFT); HoldShift:= True; Text[i] := lowerCase(Text[i]); @@ -194,6 +194,8 @@ begin end; Self.PressKey( GetSimpleKeyCode(Text[i])); end; + if HoldShift then + Self.KeyUp(VK_SHIFT); end; function TMInput.isKeyDown(key: Word): Boolean; diff --git a/Units/MMLCore/mufasatypes.pas b/Units/MMLCore/mufasatypes.pas index 60e9672..22a90a2 100644 --- a/Units/MMLCore/mufasatypes.pas +++ b/Units/MMLCore/mufasatypes.pas @@ -34,7 +34,16 @@ const DS = DirectorySeparator; MEOL = {$ifdef MSWINDOWS}#13+{$endif}#10; +{ Overloaded Operators} + +{ TPoint add } +operator + (PT1,PT2 : TPoint) : TPoint; + +{ TPoint sub } +operator - (PT1,PT2 : TPoint) : TPoint; + type + TRGB32 = packed record B, G, R, A: Byte; end; @@ -283,6 +292,15 @@ var ); implementation - +operator+(PT1, PT2: TPoint): TPoint; +begin + Result.x := PT1.x + PT2.x; + Result.y := Pt1.y + PT2.y; +end; +operator-(PT1, PT2: TPoint): TPoint; +begin + Result.x := PT1.x - PT2.x; + Result.y := Pt1.y - PT2.y; +end; end. diff --git a/Units/MMLCore/window.pas b/Units/MMLCore/window.pas index 5dd4d6e..855804b 100644 --- a/Units/MMLCore/window.pas +++ b/Units/MMLCore/window.pas @@ -531,6 +531,7 @@ begin begin; Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime); + XFlush(Self.XDisplay); XSetErrorHandler(Old_Handler); end; {$ENDIF}