mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 11:19:31 +02:00
LCL-CustomDrawn-X11: Implements GetCursorPos
git-svn-id: trunk@36571 -
This commit is contained in:
parent
1bf4624e3c
commit
0a48c5dbe4
@ -2714,15 +2714,35 @@ end;*)
|
|||||||
Returns: True if succesful
|
Returns: True if succesful
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCDWidgetSet.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
function TCDWidgetSet.GetCursorPos(var lpPoint: TPoint ): Boolean;
|
||||||
{var
|
var
|
||||||
vPoint: TQtPoint;}
|
number_of_screens, i: cint;
|
||||||
|
root_windows: PWindow;
|
||||||
|
window_returned: TWindow;
|
||||||
|
root_x, root_y, win_x, win_y: cint;
|
||||||
|
mask_return: cuint;
|
||||||
|
olderrorhandler: TXErrorHandler;
|
||||||
|
lScreen: XLib.TScreen;
|
||||||
begin
|
begin
|
||||||
// QCursor_pos(@vPoint);
|
root_x := 0;
|
||||||
|
root_y := 0;
|
||||||
|
|
||||||
lpPoint.x := 1;
|
//olderrorhandler := XSetErrorHandler(_XlibErrorHandler);
|
||||||
lpPoint.y := 1;
|
number_of_screens := XScreenCount(FDisplay);
|
||||||
|
//lScreen := XLib.DefaultScreen(FDisplay);
|
||||||
|
root_windows := GetMem(sizeof(TWindow) * number_of_screens);
|
||||||
|
|
||||||
Result := True;
|
for i := 0 to number_of_screens-1 do
|
||||||
|
begin
|
||||||
|
root_windows[i] := XRootWindow(FDisplay, i);
|
||||||
|
Result := XQueryPointer(FDisplay, root_windows[i], @window_returned,
|
||||||
|
@window_returned, @root_x, @root_y, @win_x, @win_y, @mask_return);
|
||||||
|
if Result then Break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
lpPoint.x := root_x;
|
||||||
|
lpPoint.y := root_y;
|
||||||
|
|
||||||
|
FreeMem(root_windows);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*{------------------------------------------------------------------------------
|
(*{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user