mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-24 02:02:17 -05:00
Added Input.Mouse features and Window.SetTarget.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@5 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
65f6b01bc4
commit
7e57ca60bb
@ -5,13 +5,19 @@ unit Input;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, mufasatypes;
|
||||
Classes, SysUtils,
|
||||
mufasatypes, // for common mufasa types
|
||||
windowutil // for mufasa window utils
|
||||
{$IFDEF LINUX}
|
||||
,x, xlib // for X* stuff
|
||||
{$ENDIF};
|
||||
type
|
||||
TMInput = class(TObject)
|
||||
constructor Create(Client: TObject);
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure GetMousePos(var X, Y: Integer);
|
||||
procedure SetMousePos(X, Y: Integer);
|
||||
|
||||
public
|
||||
Client: TObject;
|
||||
@ -36,8 +42,33 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMInput.GetMousePos(var X, Y: Integer);
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
b:integer;
|
||||
root, child: twindow;
|
||||
xmask: Cardinal;
|
||||
Old_Handler: TXErrorHandler;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||
XQueryPointer(TClient(Client).MWindow.XDisplay,TClient(Client).MWindow.CurWindow,@root,@child,@b,@b,@x,@y,@xmask);
|
||||
XSetErrorHandler(Old_Handler);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TMInput.SetMousePos(X, Y: Integer);
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
Old_Handler: TXErrorHandler;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||
XWarpPointer(TClient(Client).MWindow.XDisplay, 0, TClient(Client).MWindow.CurWindow, 0, 0, 0, 0, X, Y);
|
||||
XFlush(TClient(Client).MWindow.XDisplay);
|
||||
XSetErrorHandler(Old_Handler);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -5,7 +5,8 @@ unit Window;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, mufasatypes, graphics
|
||||
Classes, SysUtils, mufasatypes, graphics,
|
||||
LCLType
|
||||
|
||||
{$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF};
|
||||
|
||||
@ -16,9 +17,13 @@ type
|
||||
procedure GetDimensions(var W, H: Integer);
|
||||
function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
|
||||
|
||||
function SetTarget(XWindow: QWord): integer; overload;
|
||||
function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
|
||||
function SetTarget(ArrPtr: PRGB32): integer; overload;
|
||||
|
||||
constructor Create(Client: TObject);
|
||||
destructor Destroy; override;
|
||||
protected
|
||||
public
|
||||
// Reference to client.
|
||||
Client: TObject;
|
||||
|
||||
@ -109,22 +114,6 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
// Too global.
|
||||
{$IFDEF LINUX}
|
||||
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
|
||||
begin;
|
||||
result := 0;
|
||||
Writeln('X Error: ');
|
||||
writeln('Error code: ' + inttostr(para2^.error_code));
|
||||
writeln('Display: ' + inttostr(LongWord(para2^.display)));
|
||||
writeln('Minor code: ' + inttostr(para2^.minor_code));
|
||||
writeln('Request code: ' + inttostr(para2^.request_code));
|
||||
writeln('Resource ID: ' + inttostr(para2^.resourceid));
|
||||
writeln('Serial: ' + inttostr(para2^.serial));
|
||||
writeln('Type: ' + inttostr(para2^._type));
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TMWindow.ReturnData(xs, ys, width, height: Integer): PRGB32;
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
@ -155,7 +144,7 @@ begin
|
||||
{$ELSE}
|
||||
WriteLn('Windows doesn''t support XImage');
|
||||
{$ENDIF}
|
||||
End;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -257,14 +246,40 @@ begin
|
||||
{$ELSE}
|
||||
WriteLn('You dummy! How are you going to use w_XWindow on non Linux systems?');
|
||||
{$ENDIF}
|
||||
End;
|
||||
end;
|
||||
w_ArrayPtr:
|
||||
begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMWindow.SetTarget(XWindow: QWord): integer; overload;
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
Old_Handler: TXErrorHandler;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
|
||||
Self.CurWindow := XWindow;
|
||||
Self.TargetMode:= w_XWindow;
|
||||
XSetErrorHandler(Old_Handler);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TMWindow.SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
|
||||
begin
|
||||
if NewType in [ w_XWindow, w_ArrayPtr ] then
|
||||
begin
|
||||
// throw exception
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMWindow.SetTarget(ArrPtr: PRGB32): integer; overload;
|
||||
begin
|
||||
|
||||
Self.TargetMode:= w_ArrayPtr;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -5,7 +5,8 @@ unit windowutil;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils
|
||||
Classes, SysUtils,
|
||||
ctypes // for cint, etc
|
||||
{$IFDEF LINUX},
|
||||
x, xlib, // For X* stuff.
|
||||
GraphType // For TRawImage
|
||||
@ -13,11 +14,27 @@ uses
|
||||
|
||||
{$IFDEF LINUX}
|
||||
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
|
||||
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
{$IFDEF LINUX}
|
||||
|
||||
// Too global.
|
||||
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
|
||||
begin;
|
||||
result := 0;
|
||||
Writeln('X Error: ');
|
||||
writeln('Error code: ' + inttostr(para2^.error_code));
|
||||
writeln('Display: ' + inttostr(LongWord(para2^.display)));
|
||||
writeln('Minor code: ' + inttostr(para2^.minor_code));
|
||||
writeln('Request code: ' + inttostr(para2^.request_code));
|
||||
writeln('Resource ID: ' + inttostr(para2^.resourceid));
|
||||
writeln('Serial: ' + inttostr(para2^.serial));
|
||||
writeln('Type: ' + inttostr(para2^._type));
|
||||
end;
|
||||
|
||||
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
|
||||
Begin
|
||||
RawImage.Init; { Calls raw.Description.Init as well }
|
||||
|
236
project1.lpi
236
project1.lpi
@ -6,7 +6,7 @@
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="5"/>
|
||||
<ActiveEditorIndexAtStart Value="6"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -30,26 +30,26 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="17">
|
||||
<Units Count="24">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="69" Y="7"/>
|
||||
<CursorPos X="12" Y="10"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="28"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="37"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<CursorPos X="73" Y="40"/>
|
||||
<TopLine Value="25"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Loaded Value="True"/>
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="33" Y="57"/>
|
||||
<TopLine Value="32"/>
|
||||
<UsageCount Value="37"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="client.pas"/>
|
||||
@ -57,15 +57,15 @@
|
||||
<UnitName Value="Client"/>
|
||||
<CursorPos X="18" Y="34"/>
|
||||
<TopLine Value="10"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="37"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||
<UnitName Value="CompTypes"/>
|
||||
<CursorPos X="55" Y="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="1" Y="507"/>
|
||||
<TopLine Value="486"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="15"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
@ -74,7 +74,7 @@
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="52" Y="20"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="37"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="window.pas"/>
|
||||
@ -82,13 +82,13 @@
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="4" Y="100"/>
|
||||
<TopLine Value="85"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="37"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../Documents/fpc/rtl/inc/systemh.inc"/>
|
||||
<CursorPos X="3" Y="261"/>
|
||||
<TopLine Value="246"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="input.pas"/>
|
||||
@ -96,15 +96,15 @@
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="5" Y="20"/>
|
||||
<TopLine Value="15"/>
|
||||
<UsageCount Value="27"/>
|
||||
<UsageCount Value="36"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<UnitName Value="CompInput"/>
|
||||
<CursorPos X="39" Y="486"/>
|
||||
<TopLine Value="469"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="13"/>
|
||||
<CursorPos X="34" Y="979"/>
|
||||
<TopLine Value="971"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="17"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
@ -113,45 +113,43 @@
|
||||
<CursorPos X="19" Y="4"/>
|
||||
<TopLine Value="12"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="11"/>
|
||||
<CursorPos X="41" Y="20"/>
|
||||
<TopLine Value="6"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="Units/MMLCore/mufasatypes.pas"/>
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<CursorPos X="20" Y="17"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="11"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="11" Y="214"/>
|
||||
<TopLine Value="195"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="11"/>
|
||||
<CursorPos X="18" Y="272"/>
|
||||
<TopLine Value="254"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="windowutil"/>
|
||||
<CursorPos X="55" Y="8"/>
|
||||
<CursorPos X="45" Y="13"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="29"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
@ -159,7 +157,7 @@
|
||||
<CursorPos X="15" Y="1287"/>
|
||||
<TopLine Value="1272"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
@ -167,137 +165,189 @@
|
||||
<UnitName Value="CompBitmaps"/>
|
||||
<CursorPos X="1" Y="109"/>
|
||||
<TopLine Value="92"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="10"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="../../Documents/lazarus/lcl/include/rasterimage.inc"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="691"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="../../Documents/fpc/packages/x11/src/xlib.pp"/>
|
||||
<UnitName Value="xlib"/>
|
||||
<CursorPos X="4" Y="1360"/>
|
||||
<TopLine Value="1345"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="49" Y="63"/>
|
||||
<TopLine Value="33"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||
<UnitName Value="CompColors"/>
|
||||
<CursorPos X="44" Y="914"/>
|
||||
<TopLine Value="897"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="../../Documents/fpc/packages/x11/src/x.pp"/>
|
||||
<UnitName Value="x"/>
|
||||
<CursorPos X="14" Y="41"/>
|
||||
<TopLine Value="26"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="../../Documents/fpc/rtl/unix/aliasctp.inc"/>
|
||||
<CursorPos X="30" Y="50"/>
|
||||
<TopLine Value="30"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compdragger.pas"/>
|
||||
<UnitName Value="CompDragger"/>
|
||||
<CursorPos X="33" Y="14"/>
|
||||
<TopLine Value="6"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="../../Documents/lazarus/lcl/lcltype.pp"/>
|
||||
<UnitName Value="LCLType"/>
|
||||
<CursorPos X="9" Y="99"/>
|
||||
<TopLine Value="83"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit23>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="127" Column="1" TopLine="111"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="10" Column="40" TopLine="1"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="112" Column="1" TopLine="100"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="49" Column="22" TopLine="30"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="180" Column="59" TopLine="154"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="6" Column="75" TopLine="1"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="123" Column="1" TopLine="94"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="8" Column="22" TopLine="1"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="204" Column="16" TopLine="180"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="63" Column="26" TopLine="37"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="1" Column="16" TopLine="1"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="62" Column="86" TopLine="38"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="8" Column="53" TopLine="1"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="7" Column="69" TopLine="1"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="8" Column="42" TopLine="1"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="10" Column="12" TopLine="1"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="15" Column="13" TopLine="8"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="60" Column="29" TopLine="37"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="18" Column="13" TopLine="1"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="35" Column="79" TopLine="32"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="8" Column="42" TopLine="2"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="56" Column="24" TopLine="43"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="17" Column="71" TopLine="2"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||
<Caret Line="22" Column="23" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
|
||||
<Caret Line="8" Column="36" TopLine="1"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||
<Caret Line="35" Column="29" TopLine="20"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
|
||||
<Caret Line="37" Column="29" TopLine="22"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="18" Column="45" TopLine="1"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="177" Column="17" TopLine="168"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||
<Caret Line="115" Column="53" TopLine="101"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="176" Column="25" TopLine="161"/>
|
||||
<Caret Line="21" Column="82" TopLine="1"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="178" Column="8" TopLine="173"/>
|
||||
<Caret Line="9" Column="10" TopLine="5"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="181" Column="7" TopLine="166"/>
|
||||
<Caret Line="274" Column="1" TopLine="246"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="179" Column="16" TopLine="161"/>
|
||||
<Caret Line="257" Column="19" TopLine="249"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="201" Column="46" TopLine="186"/>
|
||||
<Caret Line="132" Column="10" TopLine="117"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="180" Column="19" TopLine="177"/>
|
||||
<Caret Line="160" Column="6" TopLine="145"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="181" Column="17" TopLine="170"/>
|
||||
<Caret Line="177" Column="23" TopLine="162"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="71" Column="43" TopLine="61"/>
|
||||
<Caret Line="262" Column="39" TopLine="249"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="38" Column="42" TopLine="18"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="267" Column="34" TopLine="249"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="44" Column="12" TopLine="25"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="264" Column="3" TopLine="244"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="800" Column="25" TopLine="785"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="262" Column="72" TopLine="244"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="827" Column="71" TopLine="812"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="63" Column="33" TopLine="41"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="835" Column="17" TopLine="812"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||
<Caret Line="110" Column="30" TopLine="83"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
<Caret Line="2447" Column="13" TopLine="2433"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="258" Column="28" TopLine="243"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="210" Column="21" TopLine="195"/>
|
||||
<Caret Line="273" Column="10" TopLine="252"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -7,7 +7,7 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, Unit1, LResources, Client, MufasaTypes, Window, Input, windowutil;
|
||||
Forms, TestUnit, LResources, Client, MufasaTypes, Window, Input, windowutil;
|
||||
|
||||
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
unit Unit1;
|
||||
unit TestUnit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Client;
|
||||
StdCtrls, Client, MufasaTypes;
|
||||
|
||||
type
|
||||
|
||||
@ -31,8 +31,10 @@ implementation
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
Var
|
||||
Client: TClient;
|
||||
w,h:integer;
|
||||
w,h, x, y, xx, yy:integer;
|
||||
bmp: TBitmap;
|
||||
ptr: PRGB32;
|
||||
t:integer;
|
||||
|
||||
begin
|
||||
Client := TClient.Create;
|
||||
@ -40,11 +42,27 @@ begin
|
||||
writeln(inttostr(w) + ' , ' + inttostr(h));
|
||||
|
||||
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
|
||||
//writeln(inttostr(bmp.Width));
|
||||
bmp.SaveToFile('/tmp/test.bmp');
|
||||
bmp.Free;
|
||||
|
||||
Client.MInput.GetMousePos(x, y);
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y));
|
||||
|
||||
Client.MInput.SetMousePos(50, 50);
|
||||
Client.MInput.GetMousePos(x, y);
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y));
|
||||
|
||||
ptr := Client.MWindow.ReturnData(0, 0, w, h);
|
||||
for yy := 0 to h - 1 do
|
||||
for xx := 0 to w - 1 do
|
||||
begin
|
||||
{ Do comparison here }
|
||||
inc(ptr);
|
||||
end;
|
||||
Client.MWindow.FreeReturnData;
|
||||
|
||||
Client.Destroy;
|
||||
writeln('Test completed successfully');
|
||||
end;
|
||||
|
||||
initialization
|
Loading…
Reference in New Issue
Block a user