mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-17 07:40:11 -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
|
interface
|
||||||
|
|
||||||
uses
|
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
|
type
|
||||||
TMInput = class(TObject)
|
TMInput = class(TObject)
|
||||||
constructor Create(Client: TObject);
|
constructor Create(Client: TObject);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure GetMousePos(var X, Y: Integer);
|
procedure GetMousePos(var X, Y: Integer);
|
||||||
|
procedure SetMousePos(X, Y: Integer);
|
||||||
|
|
||||||
public
|
public
|
||||||
Client: TObject;
|
Client: TObject;
|
||||||
@ -36,8 +42,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMInput.GetMousePos(var X, Y: Integer);
|
procedure TMInput.GetMousePos(var X, Y: Integer);
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
var
|
||||||
|
b:integer;
|
||||||
|
root, child: twindow;
|
||||||
|
xmask: Cardinal;
|
||||||
|
Old_Handler: TXErrorHandler;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
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;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -5,7 +5,8 @@ unit Window;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, mufasatypes, graphics
|
Classes, SysUtils, mufasatypes, graphics,
|
||||||
|
LCLType
|
||||||
|
|
||||||
{$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF};
|
{$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF};
|
||||||
|
|
||||||
@ -16,9 +17,13 @@ type
|
|||||||
procedure GetDimensions(var W, H: Integer);
|
procedure GetDimensions(var W, H: Integer);
|
||||||
function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
|
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);
|
constructor Create(Client: TObject);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
protected
|
public
|
||||||
// Reference to client.
|
// Reference to client.
|
||||||
Client: TObject;
|
Client: TObject;
|
||||||
|
|
||||||
@ -109,22 +114,6 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
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;
|
function TMWindow.ReturnData(xs, ys, width, height: Integer): PRGB32;
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
var
|
var
|
||||||
@ -155,7 +144,7 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
WriteLn('Windows doesn''t support XImage');
|
WriteLn('Windows doesn''t support XImage');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
End;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -257,14 +246,40 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
WriteLn('You dummy! How are you going to use w_XWindow on non Linux systems?');
|
WriteLn('You dummy! How are you going to use w_XWindow on non Linux systems?');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
End;
|
end;
|
||||||
w_ArrayPtr:
|
w_ArrayPtr:
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
end;
|
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.
|
end.
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ unit windowutil;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils
|
Classes, SysUtils,
|
||||||
|
ctypes // for cint, etc
|
||||||
{$IFDEF LINUX},
|
{$IFDEF LINUX},
|
||||||
x, xlib, // For X* stuff.
|
x, xlib, // For X* stuff.
|
||||||
GraphType // For TRawImage
|
GraphType // For TRawImage
|
||||||
@ -13,11 +14,27 @@ uses
|
|||||||
|
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
|
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
|
||||||
|
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFDEF LINUX}
|
{$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);
|
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
|
||||||
Begin
|
Begin
|
||||||
RawImage.Init; { Calls raw.Description.Init as well }
|
RawImage.Init; { Calls raw.Description.Init as well }
|
||||||
|
236
project1.lpi
236
project1.lpi
@ -6,7 +6,7 @@
|
|||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<ActiveEditorIndexAtStart Value="5"/>
|
<ActiveEditorIndexAtStart Value="6"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -30,26 +30,26 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="17">
|
<Units Count="24">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="project1.lpr"/>
|
<Filename Value="project1.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="project1"/>
|
<UnitName Value="project1"/>
|
||||||
<CursorPos X="69" Y="7"/>
|
<CursorPos X="12" Y="10"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="28"/>
|
<EditorIndex Value="2"/>
|
||||||
|
<UsageCount Value="37"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="unit1.pas"/>
|
<Filename Value="unit1.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="Unit1"/>
|
<UnitName Value="TestUnit"/>
|
||||||
<CursorPos X="73" Y="40"/>
|
<CursorPos X="33" Y="57"/>
|
||||||
<TopLine Value="25"/>
|
<TopLine Value="32"/>
|
||||||
<EditorIndex Value="2"/>
|
<UsageCount Value="37"/>
|
||||||
<UsageCount Value="28"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="client.pas"/>
|
<Filename Value="client.pas"/>
|
||||||
@ -57,15 +57,15 @@
|
|||||||
<UnitName Value="Client"/>
|
<UnitName Value="Client"/>
|
||||||
<CursorPos X="18" Y="34"/>
|
<CursorPos X="18" Y="34"/>
|
||||||
<TopLine Value="10"/>
|
<TopLine Value="10"/>
|
||||||
<UsageCount Value="28"/>
|
<UsageCount Value="37"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||||
<UnitName Value="CompTypes"/>
|
<UnitName Value="CompTypes"/>
|
||||||
<CursorPos X="55" Y="12"/>
|
<CursorPos X="1" Y="507"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="486"/>
|
||||||
<EditorIndex Value="7"/>
|
<EditorIndex Value="7"/>
|
||||||
<UsageCount Value="15"/>
|
<UsageCount Value="19"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<UnitName Value="MufasaTypes"/>
|
<UnitName Value="MufasaTypes"/>
|
||||||
<CursorPos X="52" Y="20"/>
|
<CursorPos X="52" Y="20"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<UsageCount Value="28"/>
|
<UsageCount Value="37"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="window.pas"/>
|
<Filename Value="window.pas"/>
|
||||||
@ -82,13 +82,13 @@
|
|||||||
<UnitName Value="Window"/>
|
<UnitName Value="Window"/>
|
||||||
<CursorPos X="4" Y="100"/>
|
<CursorPos X="4" Y="100"/>
|
||||||
<TopLine Value="85"/>
|
<TopLine Value="85"/>
|
||||||
<UsageCount Value="28"/>
|
<UsageCount Value="37"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="../../Documents/fpc/rtl/inc/systemh.inc"/>
|
<Filename Value="../../Documents/fpc/rtl/inc/systemh.inc"/>
|
||||||
<CursorPos X="3" Y="261"/>
|
<CursorPos X="3" Y="261"/>
|
||||||
<TopLine Value="246"/>
|
<TopLine Value="246"/>
|
||||||
<UsageCount Value="9"/>
|
<UsageCount Value="8"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="input.pas"/>
|
<Filename Value="input.pas"/>
|
||||||
@ -96,15 +96,15 @@
|
|||||||
<UnitName Value="Input"/>
|
<UnitName Value="Input"/>
|
||||||
<CursorPos X="5" Y="20"/>
|
<CursorPos X="5" Y="20"/>
|
||||||
<TopLine Value="15"/>
|
<TopLine Value="15"/>
|
||||||
<UsageCount Value="27"/>
|
<UsageCount Value="36"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||||
<UnitName Value="CompInput"/>
|
<UnitName Value="CompInput"/>
|
||||||
<CursorPos X="39" Y="486"/>
|
<CursorPos X="34" Y="979"/>
|
||||||
<TopLine Value="469"/>
|
<TopLine Value="971"/>
|
||||||
<EditorIndex Value="8"/>
|
<EditorIndex Value="9"/>
|
||||||
<UsageCount Value="13"/>
|
<UsageCount Value="17"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
@ -113,45 +113,43 @@
|
|||||||
<CursorPos X="19" Y="4"/>
|
<CursorPos X="19" Y="4"/>
|
||||||
<TopLine Value="12"/>
|
<TopLine Value="12"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit9>
|
</Unit9>
|
||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="Units/MMLCore/input.pas"/>
|
<Filename Value="Units/MMLCore/input.pas"/>
|
||||||
<UnitName Value="Input"/>
|
<UnitName Value="Input"/>
|
||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="41" Y="20"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="6"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="4"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
<Unit11>
|
<Unit11>
|
||||||
<Filename Value="Units/MMLCore/mufasatypes.pas"/>
|
<Filename Value="Units/MMLCore/mufasatypes.pas"/>
|
||||||
<UnitName Value="MufasaTypes"/>
|
<UnitName Value="MufasaTypes"/>
|
||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="20" Y="17"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="5"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<UnitName Value="Window"/>
|
<UnitName Value="Window"/>
|
||||||
<CursorPos X="11" Y="214"/>
|
<CursorPos X="18" Y="272"/>
|
||||||
<TopLine Value="195"/>
|
<TopLine Value="254"/>
|
||||||
<EditorIndex Value="5"/>
|
<EditorIndex Value="6"/>
|
||||||
<UsageCount Value="11"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="windowutil"/>
|
<UnitName Value="windowutil"/>
|
||||||
<CursorPos X="55" Y="8"/>
|
<CursorPos X="45" Y="13"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="6"/>
|
<UsageCount Value="29"/>
|
||||||
<UsageCount Value="21"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||||
@ -159,7 +157,7 @@
|
|||||||
<CursorPos X="15" Y="1287"/>
|
<CursorPos X="15" Y="1287"/>
|
||||||
<TopLine Value="1272"/>
|
<TopLine Value="1272"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="14"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit14>
|
</Unit14>
|
||||||
<Unit15>
|
<Unit15>
|
||||||
@ -167,137 +165,189 @@
|
|||||||
<UnitName Value="CompBitmaps"/>
|
<UnitName Value="CompBitmaps"/>
|
||||||
<CursorPos X="1" Y="109"/>
|
<CursorPos X="1" Y="109"/>
|
||||||
<TopLine Value="92"/>
|
<TopLine Value="92"/>
|
||||||
<EditorIndex Value="9"/>
|
<EditorIndex Value="10"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="14"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit15>
|
</Unit15>
|
||||||
<Unit16>
|
<Unit16>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/include/rasterimage.inc"/>
|
<Filename Value="../../Documents/lazarus/lcl/include/rasterimage.inc"/>
|
||||||
<CursorPos X="1" Y="1"/>
|
<CursorPos X="1" Y="1"/>
|
||||||
<TopLine Value="691"/>
|
<TopLine Value="691"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="9"/>
|
||||||
</Unit16>
|
</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>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/input.pas"/>
|
||||||
<Caret Line="127" Column="1" TopLine="111"/>
|
<Caret Line="10" Column="40" TopLine="1"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/input.pas"/>
|
||||||
<Caret Line="112" Column="1" TopLine="100"/>
|
<Caret Line="49" Column="22" TopLine="30"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||||
<Caret Line="180" Column="59" TopLine="154"/>
|
<Caret Line="6" Column="75" TopLine="1"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||||
<Caret Line="123" Column="1" TopLine="94"/>
|
<Caret Line="8" Column="22" TopLine="1"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/input.pas"/>
|
||||||
<Caret Line="204" Column="16" TopLine="180"/>
|
<Caret Line="63" Column="26" TopLine="37"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
<Filename Value="Units/MMLCore/input.pas"/>
|
||||||
<Caret Line="1" Column="16" TopLine="1"/>
|
<Caret Line="62" Column="86" TopLine="38"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="Units/MMLCore/windowutil.pas"/>
|
<Filename Value="project1.lpr"/>
|
||||||
<Caret Line="8" Column="53" TopLine="1"/>
|
<Caret Line="7" Column="69" TopLine="1"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="project1.lpr"/>
|
||||||
<Caret Line="8" Column="42" TopLine="1"/>
|
<Caret Line="10" Column="12" TopLine="1"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="15" Column="13" TopLine="8"/>
|
<Caret Line="60" Column="29" TopLine="37"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="18" Column="13" TopLine="1"/>
|
<Caret Line="35" Column="79" TopLine="32"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="testunit.pas"/>
|
||||||
<Caret Line="8" Column="42" TopLine="2"/>
|
<Caret Line="56" Column="24" TopLine="43"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||||
<Caret Line="17" Column="71" TopLine="2"/>
|
<Caret Line="22" Column="23" TopLine="1"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/compcolors.pas"/>
|
||||||
<Caret Line="8" Column="36" TopLine="1"/>
|
<Caret Line="35" Column="29" TopLine="20"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="37" Column="29" TopLine="22"/>
|
<Caret Line="18" Column="45" TopLine="1"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||||
<Caret Line="177" Column="17" TopLine="168"/>
|
<Caret Line="115" Column="53" TopLine="101"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="176" Column="25" TopLine="161"/>
|
<Caret Line="21" Column="82" TopLine="1"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="178" Column="8" TopLine="173"/>
|
<Caret Line="9" Column="10" TopLine="5"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="181" Column="7" TopLine="166"/>
|
<Caret Line="274" Column="1" TopLine="246"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="179" Column="16" TopLine="161"/>
|
<Caret Line="257" Column="19" TopLine="249"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="201" Column="46" TopLine="186"/>
|
<Caret Line="132" Column="10" TopLine="117"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="180" Column="19" TopLine="177"/>
|
<Caret Line="160" Column="6" TopLine="145"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="181" Column="17" TopLine="170"/>
|
<Caret Line="177" Column="23" TopLine="162"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="71" Column="43" TopLine="61"/>
|
<Caret Line="262" Column="39" TopLine="249"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="unit1.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="38" Column="42" TopLine="18"/>
|
<Caret Line="267" Column="34" TopLine="249"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="unit1.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="44" Column="12" TopLine="25"/>
|
<Caret Line="264" Column="3" TopLine="244"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="800" Column="25" TopLine="785"/>
|
<Caret Line="262" Column="72" TopLine="244"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="827" Column="71" TopLine="812"/>
|
<Caret Line="63" Column="33" TopLine="41"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||||
<Caret Line="835" Column="17" TopLine="812"/>
|
<Caret Line="110" Column="30" TopLine="83"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="2447" Column="13" TopLine="2433"/>
|
<Caret Line="258" Column="28" TopLine="243"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="Units/MMLCore/window.pas"/>
|
<Filename Value="Units/MMLCore/window.pas"/>
|
||||||
<Caret Line="210" Column="21" TopLine="195"/>
|
<Caret Line="273" Column="10" TopLine="252"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -7,7 +7,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
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}
|
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
unit Unit1;
|
unit TestUnit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, Client;
|
StdCtrls, Client, MufasaTypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -31,8 +31,10 @@ implementation
|
|||||||
procedure TForm1.Button1Click(Sender: TObject);
|
procedure TForm1.Button1Click(Sender: TObject);
|
||||||
Var
|
Var
|
||||||
Client: TClient;
|
Client: TClient;
|
||||||
w,h:integer;
|
w,h, x, y, xx, yy:integer;
|
||||||
bmp: TBitmap;
|
bmp: TBitmap;
|
||||||
|
ptr: PRGB32;
|
||||||
|
t:integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Client := TClient.Create;
|
Client := TClient.Create;
|
||||||
@ -40,11 +42,27 @@ begin
|
|||||||
writeln(inttostr(w) + ' , ' + inttostr(h));
|
writeln(inttostr(w) + ' , ' + inttostr(h));
|
||||||
|
|
||||||
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
|
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
|
||||||
//writeln(inttostr(bmp.Width));
|
|
||||||
bmp.SaveToFile('/tmp/test.bmp');
|
bmp.SaveToFile('/tmp/test.bmp');
|
||||||
bmp.Free;
|
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;
|
Client.Destroy;
|
||||||
|
writeln('Test completed successfully');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
@ -1,5 +1,3 @@
|
|||||||
{ This is an automatically generated lazarus resource file }
|
|
||||||
|
|
||||||
LazarusResources.Add('TForm1','FORMDATA',[
|
LazarusResources.Add('TForm1','FORMDATA',[
|
||||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'%'#1#6'Height'#3#4#2#3'Top'#3#200#0#5'Wid'
|
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'%'#1#6'Height'#3#4#2#3'Top'#3#200#0#5'Wid'
|
||||||
+'th'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientHe'
|
+'th'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientHe'
|
||||||
|
Loading…
Reference in New Issue
Block a user