mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 20:09:27 +02:00
+ added and implemented procedure SetMousePos in unit ptcmouse
git-svn-id: trunk@43059 -
This commit is contained in:
parent
d352dbe044
commit
667e090e2b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 2013 by Nikolay Nikolov (nickysn@users.sourceforge.net)
|
Copyright (c) 2013,2019 by Nikolay Nikolov (nickysn@users.sourceforge.net)
|
||||||
Copyright (c) 1999-2000 by Florian Klaempfl
|
Copyright (c) 1999-2000 by Florian Klaempfl
|
||||||
member of the Free Pascal development team
|
member of the Free Pascal development team
|
||||||
|
|
||||||
@ -47,10 +47,10 @@ function RPressed: Boolean;
|
|||||||
{ returns true if the middle button is pressed }
|
{ returns true if the middle button is pressed }
|
||||||
function MPressed: Boolean;
|
function MPressed: Boolean;
|
||||||
|
|
||||||
(*!!!!! the following functions aren't implemented yet:
|
|
||||||
{ positions the mouse pointer }
|
{ positions the mouse pointer }
|
||||||
procedure SetMousePos(x,y: LongInt);
|
procedure SetMousePos(x,y: LongInt);
|
||||||
|
|
||||||
|
(*!!!!! the following functions aren't implemented yet:
|
||||||
{ returns at which position "button" was last pressed in x,y and returns the
|
{ returns at which position "button" was last pressed in x,y and returns the
|
||||||
number of times this button has been pressed since the last time this
|
number of times this button has been pressed since the last time this
|
||||||
function was called with "button" as parameter. For button you can use the
|
function was called with "button" as parameter. For button you can use the
|
||||||
@ -197,6 +197,12 @@ begin
|
|||||||
buttons := MouseButtonState;
|
buttons := MouseButtonState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetMousePos(x,y: LongInt);
|
||||||
|
begin
|
||||||
|
if InGraphMode then
|
||||||
|
PTCWrapperObject.MoveMouseTo(x, y);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
MouseFound := True;
|
MouseFound := True;
|
||||||
end.
|
end.
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
0.99.x
|
||||||
|
- added and implemented SetMousePos in unit ptcmouse
|
||||||
|
|
||||||
0.99.15
|
0.99.15
|
||||||
- dead key support under Windows and X11 (via XIM)
|
- dead key support under Windows and X11 (via XIM)
|
||||||
- more character scripts (Latin 2, Latin 3, Latin 4, Latin 9, Katakana,
|
- more character scripts (Latin 2, Latin 3, Latin 4, Latin 9, Katakana,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
Free Pascal PTCPas framebuffer library threaded wrapper
|
Free Pascal PTCPas framebuffer library threaded wrapper
|
||||||
Copyright (C) 2010, 2011, 2012, 2013 Nikolay Nikolov (nickysn@users.sourceforge.net)
|
Copyright (C) 2010, 2011, 2012, 2013, 2019 Nikolay Nikolov (nickysn@users.sourceforge.net)
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
@ -87,6 +87,13 @@ type
|
|||||||
Result: TPTCModeList;
|
Result: TPTCModeList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TPTCWrapperMoveMouseToRequest = record
|
||||||
|
X, Y: Integer;
|
||||||
|
|
||||||
|
Processed: Boolean;
|
||||||
|
Result: Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
TPTCWrapperThread = class(TThread)
|
TPTCWrapperThread = class(TThread)
|
||||||
private
|
private
|
||||||
FConsole: IPTCConsole;
|
FConsole: IPTCConsole;
|
||||||
@ -109,6 +116,7 @@ type
|
|||||||
FCloseRequest: TPTCWrapperCloseRequest;
|
FCloseRequest: TPTCWrapperCloseRequest;
|
||||||
FOptionRequest: TPTCWrapperOptionRequest;
|
FOptionRequest: TPTCWrapperOptionRequest;
|
||||||
FGetModesRequest: TPTCWrapperGetModesRequest;
|
FGetModesRequest: TPTCWrapperGetModesRequest;
|
||||||
|
FMoveMouseToRequest: TPTCWrapperMoveMouseToRequest;
|
||||||
protected
|
protected
|
||||||
procedure Execute; override;
|
procedure Execute; override;
|
||||||
public
|
public
|
||||||
@ -136,6 +144,8 @@ type
|
|||||||
function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean;
|
function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean;
|
||||||
function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent;
|
function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent;
|
||||||
|
|
||||||
|
function MoveMouseTo(AX, AY: Integer): Boolean;
|
||||||
|
|
||||||
property IsOpen: Boolean read FOpen;
|
property IsOpen: Boolean read FOpen;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -160,6 +170,7 @@ begin
|
|||||||
FCloseRequest.Processed := True;
|
FCloseRequest.Processed := True;
|
||||||
FOptionRequest.Processed := True;
|
FOptionRequest.Processed := True;
|
||||||
FGetModesRequest.Processed := True;
|
FGetModesRequest.Processed := True;
|
||||||
|
FMoveMouseToRequest.Processed := True;
|
||||||
|
|
||||||
FSurfaceCriticalSection := TCriticalSection.Create;
|
FSurfaceCriticalSection := TCriticalSection.Create;
|
||||||
|
|
||||||
@ -257,6 +268,12 @@ procedure TPTCWrapperThread.Execute;
|
|||||||
FGetModesRequest.Result := FConsole.Modes;
|
FGetModesRequest.Result := FConsole.Modes;
|
||||||
FGetModesRequest.Processed := True;
|
FGetModesRequest.Processed := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if not FMoveMouseToRequest.Processed then
|
||||||
|
begin
|
||||||
|
FMoveMouseToRequest.Result := FConsole.MoveMouseTo(FMoveMouseToRequest.X, FMoveMouseToRequest.Y);
|
||||||
|
FMoveMouseToRequest.Processed := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -523,4 +540,24 @@ begin
|
|||||||
until (not AWait) or (Result <> nil);
|
until (not AWait) or (Result <> nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TPTCWrapperThread.MoveMouseTo(AX, AY: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
FSurfaceCriticalSection.Acquire;
|
||||||
|
try
|
||||||
|
with FMoveMouseToRequest do
|
||||||
|
begin
|
||||||
|
X := AX;
|
||||||
|
Y := AY;
|
||||||
|
Processed := False;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FSurfaceCriticalSection.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
repeat
|
||||||
|
ThreadSwitch;
|
||||||
|
until FMoveMouseToRequest.Processed;
|
||||||
|
Result := FMoveMouseToRequest.Result;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user