Qt: added GetX11WindowAttributes() helper function.

git-svn-id: trunk@51863 -
This commit is contained in:
zeljko 2016-03-08 20:21:14 +00:00
parent 6d052f5c97
commit e875017759
2 changed files with 25 additions and 0 deletions

View File

@ -266,6 +266,7 @@ type
procedure MapX11Window(AWinID: LongWord);
{$IFDEF QtUseAccurateFrame}
function GetX11WindowRealized(AWinID: LongWord): boolean;
function GetX11WindowAttributes(AWinID: LongWord; out ALeft, ATop, ABorder, AWidth, AHeight: integer): boolean;
function GetX11SupportedAtoms(AWinID: LongWord; AList: TStrings): boolean;
{Ask for _NET_FRAME_EXTENTS,_KDE_NET_WM_SHADOW,_GTK_NET_FRAME_EXTENTS}
function GetX11RectForAtom(AWinID: LongWord; const AAtomName: string; out ARect: TRect): boolean;

View File

@ -367,6 +367,30 @@ begin
Result := (AXWinAttr.map_installed > 0) and (AXWinAttr.map_state = 2);
end;
function GetX11WindowAttributes(AWinID: LongWord; out ALeft, ATop, ABorder, AWidth, AHeight: integer): boolean;
var
d: PDisplay;
Attr: TXWindowAttributes;
begin
Result := False;
d := QX11Info_display;
ALeft := MAXINT;
ATop := MAXINT;
ABorder := MAXINT;
AWidth := MAXINT;
AHeight := MAXINT;
XGetWindowAttributes(d, TWindow(AWinID), @Attr);
Result := (Attr.map_installed > 0) and (Attr.map_state = 2);
if Result then
begin
ALeft := Attr.x;
ATop := Attr.y;
ABorder := Attr.border_width;
AWidth := Attr.width;
AHeight := Attr.height;
end;
end;
function GetX11WindowPos(AWinID: LongWord; out ALeft, ATop: integer): boolean;
var
D: PDisplay;