1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-20 04:51:51 -05:00

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
This commit is contained in:
Wizzup? 2009-11-30 19:57:26 +00:00
parent 8e3c093fbb
commit d0572ddc18
7 changed files with 33 additions and 3 deletions

View File

@ -28,7 +28,7 @@ begin
end; end;
{$else} {$else}
var var
EndTime : integer; EndTime : DWord;
begin begin
if t > 50 then if t > 50 then
begin; begin;
@ -36,8 +36,10 @@ begin
while (CurrThread.PSScript.Exec.Status = isRunning) and (GetTickCount < EndTime) do while (CurrThread.PSScript.Exec.Status = isRunning) and (GetTickCount < EndTime) do
Sleep(16); Sleep(16);
end else end else
begin
sleep(t); sleep(t);
end; end;
end;
{$endif} {$endif}
procedure SaveScreenshot(FileName: string); procedure SaveScreenshot(FileName: string);

View File

@ -51,3 +51,8 @@ procedure SetTargetArray(P: Integer; Size: TPoint);
begin begin
CurrThread.Client.MWindow.SetTarget(PRGB32(P), Size); CurrThread.Client.MWindow.SetTarget(PRGB32(P), Size);
end; end;
procedure activateclient;
begin
CurrThread.Client.MWindow.ActivateClient;
end;

View File

@ -72,6 +72,7 @@ Sender.AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h
Sender.AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);'); Sender.AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);');
Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient'); Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);'); Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);');
Sender.AddFunction(@ActivateClient, 'procedure activateclient;');
{files} {files}
Sender.AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;'); Sender.AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;');

View File

@ -200,6 +200,7 @@ end;
{$I PSInc/Wrappers/other.inc} {$I PSInc/Wrappers/other.inc}
{$I PSInc/Wrappers/bitmap.inc} {$I PSInc/Wrappers/bitmap.inc}
{$I PSInc/Wrappers/window.inc} {$I PSInc/Wrappers/window.inc}
{$I PSInc/Wrappers/colour.inc} {$I PSInc/Wrappers/colour.inc}
{$I PSInc/Wrappers/math.inc} {$I PSInc/Wrappers/math.inc}
{$I PSInc/Wrappers/mouse.inc} {$I PSInc/Wrappers/mouse.inc}

View File

@ -182,7 +182,7 @@ begin
for i := 1 to length(text) do for i := 1 to length(text) do
begin begin
if((text[i] >= 'A') and (text[i] <= 'Z')) then if((text[i] >= 'A') and (text[i] <= 'Z')) then
begin; begin
Self.KeyDown(VK_SHIFT); Self.KeyDown(VK_SHIFT);
HoldShift:= True; HoldShift:= True;
Text[i] := lowerCase(Text[i]); Text[i] := lowerCase(Text[i]);
@ -194,6 +194,8 @@ begin
end; end;
Self.PressKey( GetSimpleKeyCode(Text[i])); Self.PressKey( GetSimpleKeyCode(Text[i]));
end; end;
if HoldShift then
Self.KeyUp(VK_SHIFT);
end; end;
function TMInput.isKeyDown(key: Word): Boolean; function TMInput.isKeyDown(key: Word): Boolean;

View File

@ -34,7 +34,16 @@ const
DS = DirectorySeparator; DS = DirectorySeparator;
MEOL = {$ifdef MSWINDOWS}#13+{$endif}#10; MEOL = {$ifdef MSWINDOWS}#13+{$endif}#10;
{ Overloaded Operators}
{ TPoint add }
operator + (PT1,PT2 : TPoint) : TPoint;
{ TPoint sub }
operator - (PT1,PT2 : TPoint) : TPoint;
type type
TRGB32 = packed record TRGB32 = packed record
B, G, R, A: Byte; B, G, R, A: Byte;
end; end;
@ -283,6 +292,15 @@ var
); );
implementation 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. end.

View File

@ -531,6 +531,7 @@ begin
begin; begin;
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime); XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime);
XFlush(Self.XDisplay);
XSetErrorHandler(Old_Handler); XSetErrorHandler(Old_Handler);
end; end;
{$ENDIF} {$ENDIF}