mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
Qt5: removed -dQtUseAccurateFrame related code. This define does nothing anymore since window frame size is fixed.
git-svn-id: trunk@63041 -
This commit is contained in:
parent
53bb4453cf
commit
bf01889663
@ -17,8 +17,4 @@
|
||||
{enable this define if you have problems when dialogs are shown behind application}
|
||||
{.$DEFINE TQTMESSAGEBOXUSEPARENT}
|
||||
{$ENDIF}
|
||||
{$IFDEF HASX11}
|
||||
{.$DEFINE QtUseAccurateFrame}
|
||||
{.$DEFINE DebugQtUseAccurateFrame}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
@ -57,9 +57,6 @@ type
|
||||
{$IFDEF QtUseNativeEventLoop}
|
||||
FMainTimerID: integer;
|
||||
{$ENDIF}
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FWSFrameMargins: TRect;
|
||||
{$ENDIF}
|
||||
FIsLibraryInstance: Boolean;
|
||||
|
||||
// cache for WindowFromPoint
|
||||
@ -101,9 +98,6 @@ type
|
||||
// qt style does not have pixel metric for themed menubar (menu) height
|
||||
// so we must calculate it somehow.
|
||||
FCachedMenuBarHeight: Integer;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
function GetFrameMargins: TRect;
|
||||
{$ENDIF}
|
||||
function GetMenuHeight: Integer;
|
||||
|
||||
procedure ClearCachedColors;
|
||||
@ -235,10 +229,6 @@ type
|
||||
property AppActive: Boolean read FAppActive;
|
||||
property DragImageLock: Boolean read FDragImageLock write FDragImageLock;
|
||||
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
property WSFrameMargins: TRect read GetFrameMargins write FWSFrameMargins;
|
||||
{$ENDIF}
|
||||
|
||||
{do not create new QApplication object if we are called from library }
|
||||
property IsLibraryInstance: Boolean read FIsLibraryInstance;
|
||||
|
||||
@ -285,7 +275,8 @@ type
|
||||
function GetKdeSessionVersion: integer;
|
||||
{force mapping}
|
||||
procedure MapX11Window(AWinID: PtrUInt);
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
{$IFDEF QtUseX11Extras}
|
||||
// do not remove those
|
||||
function GetX11WindowRealized(AWinID: PtrUInt): boolean;
|
||||
function GetX11WindowAttributes(AWinID: PtrUInt; out ALeft, ATop, AWidth, AHeight, ABorder: integer): boolean;
|
||||
function GetX11SupportedAtoms(AWinID: PtrUInt; AList: TStrings): boolean;
|
||||
|
@ -21,9 +21,6 @@ begin
|
||||
FLastWFPMousePos := Point(MaxInt, MaxInt);
|
||||
FLastWFPResult := 0;
|
||||
inherited Create;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FWSFrameMargins := Rect(0, 0, 0, 0);
|
||||
{$ENDIF}
|
||||
FIsLibraryInstance := QCoreApplication_instance() <> nil;
|
||||
if FIsLibraryInstance then
|
||||
App := QApplicationH(QCoreApplication_instance())
|
||||
@ -1965,170 +1962,6 @@ begin
|
||||
Result := FCachedMenuBarHeight;
|
||||
end;
|
||||
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
function TQtWidgetSet.GetFrameMargins: TRect;
|
||||
var
|
||||
ATempWidget: QWidgetH;
|
||||
R: TRect;
|
||||
ASize, AFrameSize: TSize;
|
||||
AID: PtrUInt;
|
||||
I: integer;
|
||||
B: Boolean;
|
||||
ATicks: DWORD;
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
StartupTime: DWord;
|
||||
{$ENDIF}
|
||||
{$IFDEF HASX11}
|
||||
AWMName: String;
|
||||
//AShadowRect: TRect;
|
||||
//AList: TStringList;
|
||||
ALeft, ATop, AWidth, AHeight, ABorder: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (FWSFrameMargins.Left = 0) and (FWSFrameMargins.Top = 0) or
|
||||
(FWSFrameMargins.Right = 0) and (FWSFrameMargins.Bottom = 0) then
|
||||
begin
|
||||
{$IFDEF HASX11}
|
||||
AWMName := GetWindowManager;
|
||||
// blacklist of window managers which does not support NET_FRAME_EXTENTS
|
||||
if (AWMName = 'Blackbox') then
|
||||
begin
|
||||
DebugLn('WARNING: QtLCL: "Blackbox" wm does not implement for _NET_FRAME_EXTENTS.');
|
||||
FWSFrameMargins := Rect(1, 23, 1, 10);
|
||||
Result := FWSFrameMargins;
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
StartupTime := GetTickCount;
|
||||
{$ENDIF}
|
||||
|
||||
ATempWidget := QWidget_create(nil, QtWindow or QtDialog);
|
||||
QWidget_setAttribute(ATempWidget, QtWA_NativeWindow, True);
|
||||
|
||||
{$IFDEF HASX11}
|
||||
if QX11Info_isCompositingManagerRunning then
|
||||
QWidget_setWindowOpacity(ATempWidget, 0);
|
||||
{$ENDIF}
|
||||
|
||||
QWidget_move(ATempWidget, -MAXSHORT, -MAXSHORT);
|
||||
QWidget_resize(ATempWidget, 32, 32);
|
||||
|
||||
{$IFDEF HASX11}
|
||||
QWidget_setAttribute(ATempWidget, QtWA_ShowWithoutActivating);
|
||||
QWidget_show(ATempWidget);
|
||||
AID := QWidget_winID(ATempWidget);
|
||||
|
||||
// locks in XIfEvent() inside AskX11_NET_REQUEST_FRAME_EXTENTS()
|
||||
B := False; // AskX11_NET_REQUEST_FRAME_EXTENTS(AID, R);
|
||||
|
||||
if B and (R.Top = 0) then
|
||||
begin
|
||||
ATicks := 0;
|
||||
while R.Top = 0 do
|
||||
begin
|
||||
QWidget_size(ATempWidget, @ASize);
|
||||
QWidget_frameSize(ATempWidget, @AFrameSize);
|
||||
R.Left := (AFrameSize.cx - ASize.cx) div 2;
|
||||
R.Right := R.Left;
|
||||
R.Top := (AFrameSize.cy - ASize.cy) - R.Left;
|
||||
R.Bottom := R.Left;
|
||||
QCoreApplication_processEvents;
|
||||
ATicks += 1;
|
||||
if ATicks > 50 then
|
||||
break; // error !
|
||||
end;
|
||||
(* TODO: If shadows are enabled on KWin ask for shadow rect !
|
||||
AList := TStringList.Create;
|
||||
try
|
||||
GetX11SupportedAtoms(AID, AList);
|
||||
GetX11RectForAtom(AID,'_KDE_NET_WM_SHADOW', AShadowRect);
|
||||
finally
|
||||
AList.Free;
|
||||
end;
|
||||
*)
|
||||
end;
|
||||
if B and QX11Info_isCompositingManagerRunning then
|
||||
begin
|
||||
{TODO: some wm's have different attributes for windows with fixed sizes and modal windows,
|
||||
so we need to query attributes for such windows too.
|
||||
Currently such composited wm's is "Mutter (Muffin)", "Gnome Shell"}
|
||||
// writeln('Current WM=',GetWindowManager);
|
||||
//while not GetX11WindowRealized(QWidget_winID(ATempWidget)) do
|
||||
// QApplication_syncX();
|
||||
if GetX11WindowAttributes(QWidget_winID(ATempWidget), ALeft, ATop, AWidth, AHeight, ABorder) then
|
||||
begin
|
||||
if (ALeft > 0) and (ATop > 0) then
|
||||
R := Rect(ALeft, ATop, ALeft, ALeft);
|
||||
end;
|
||||
end;
|
||||
if not B then
|
||||
begin
|
||||
MapX11Window(AID);
|
||||
// QApplication_syncX();
|
||||
end;
|
||||
|
||||
if not B and not GetX11RectForAtom(AID, '_NET_FRAME_EXTENTS', R) then
|
||||
begin
|
||||
AId := QWidget_winID(ATempWidget);
|
||||
I := 0;
|
||||
ATicks := GetTickCount;
|
||||
while not GetX11RectForAtom(AID, '_NET_FRAME_EXTENTS', R) do
|
||||
begin
|
||||
// QApplication_syncX();
|
||||
QCoreApplication_processEvents;
|
||||
inc(I);
|
||||
{if we do not get frame extents in 100ms get out}
|
||||
if GetTickCount - ATicks > 100 then
|
||||
break;
|
||||
end;
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
DebugLn('TQtWidgetSet.GetFrameMargins: EXIT LOOP AFTER ',dbgs(GetTickCount - ATicks),' ms LOOP=',dbgs(i),' R=',dbgs(R));
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ELSE}
|
||||
// create native window
|
||||
QWidget_winId(ATempWidget);
|
||||
QWidget_size(ATempWidget, @ASize);
|
||||
QWidget_frameSize(ATempWidget, @AFrameSize);
|
||||
R.Left := (AFrameSize.cx - ASize.cx) div 2;
|
||||
R.Right := R.Left;
|
||||
R.Top := (AFrameSize.cy - ASize.cy) - R.Left;
|
||||
R.Bottom := R.Left;
|
||||
{$ENDIF}
|
||||
|
||||
FWSFrameMargins := R;
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
// just test
|
||||
{$IFDEF HASX11}
|
||||
QWidget_size(ATempWidget, @ASize);
|
||||
QWidget_frameSize(ATempWidget, @AFrameSize);
|
||||
// Qt5 fix
|
||||
while (ASize.cy = AFrameSize.cy) do
|
||||
begin
|
||||
QCoreApplication_processEvents();
|
||||
QWidget_size(ATempWidget, @ASize);
|
||||
QWidget_frameSize(ATempWidget, @AFrameSize);
|
||||
end;
|
||||
{$ENDIF}
|
||||
if (FWSFrameMargins.Top = 0) and (FWSFrameMargins.Bottom = 0) and
|
||||
(AFrameSize.cy - ASize.cy > FWSFrameMargins.Left) then
|
||||
begin
|
||||
FWSFrameMargins.Bottom := FWSFrameMargins.Left;
|
||||
FWSFrameMargins.Top := AFrameSize.cy - ASize.cy - FWSFrameMargins.Bottom;
|
||||
end;
|
||||
with FWSFrameMargins do
|
||||
DebugLn('TQtWidgetSet.GetFrameMargins: **MARGINS=',Format('l %d t %d r %d b %d QtFrame x %d y %d compositor %s sysMetrics %d startup needed %d ms',
|
||||
[Left, Top, Right, Bottom, AFrameSize.cx - ASize.cx, AFrameSize.cy - ASize.cy, BoolToStr({$IFDEF HASX11}QX11Info_isCompositingManagerRunning{$ELSE}False{$ENDIF}), GetSystemMetrics(SM_CYCAPTION),GetTickCount - StartupTime]));
|
||||
{$ENDIF}
|
||||
QWidget_hide(ATempWidget);
|
||||
QWidget_destroy(ATempWidget);
|
||||
end;
|
||||
Result := FWSFrameMargins;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TQtWidgetSet.ClearCachedColors;
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -104,9 +104,6 @@ type
|
||||
|
||||
TQtWidget = class(TQtObject, IUnknown)
|
||||
private
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FFrameMargins: TRect;
|
||||
{$ENDIF}
|
||||
FInResizeEvent: boolean;
|
||||
FWidgetState: TQtWidgetStates;
|
||||
FWidgetDefaultFont: TQtFont;
|
||||
@ -313,9 +310,6 @@ type
|
||||
nil): QPixmapH;
|
||||
property ChildOfComplexWidget: TChildOfComplexWidget read FChildOfComplexWidget write FChildOfComplexWidget;
|
||||
property Context: HDC read GetContext;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
property FrameMargins: TRect read FFrameMargins write FFrameMargins;
|
||||
{$ENDIF}
|
||||
property HasCaret: Boolean read FHasCaret write SetHasCaret;
|
||||
property HasPaint: Boolean read FHasPaint write FHasPaint;
|
||||
property InResizeEvent: boolean read FInResizeEvent write FInResizeEvent;
|
||||
@ -646,9 +640,6 @@ type
|
||||
FShowOnTaskBar: Boolean;
|
||||
FPopupParent: QWidgetH;
|
||||
FMDIStateHook: QMdiSubWindow_hookH;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FFormHasInvalidPosition: boolean;
|
||||
{$ENDIF}
|
||||
protected
|
||||
function CreateWidget(const {%H-}AParams: TCreateParams):QWidgetH; override;
|
||||
procedure ChangeParent(NewParent: QWidgetH);
|
||||
@ -677,8 +668,6 @@ type
|
||||
function getClientBounds: TRect; override;
|
||||
function getClientOffset: TPoint; override;
|
||||
|
||||
function getFrameSize: TSize; override;
|
||||
function getFrameGeometry: TRect; override;
|
||||
function getText: WideString; override;
|
||||
function getTextStatic: Boolean; override;
|
||||
|
||||
@ -693,7 +682,6 @@ type
|
||||
procedure setMenuBar(AMenuBar: QMenuBarH);
|
||||
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
|
||||
procedure MDIChildWindowStateChanged(AOldState: QtWindowStates; ANewState: QtWindowStates); cdecl;
|
||||
function IsFramedWidget: boolean; override;
|
||||
function IsMdiChild: Boolean;
|
||||
function IsModal: Boolean;
|
||||
function MdiChildCount: integer;
|
||||
@ -2051,9 +2039,6 @@ end;
|
||||
|
||||
procedure TQtWidget.InitializeWidget;
|
||||
begin
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FFrameMargins := Rect(0, 0, 0, 0);
|
||||
{$ENDIF}
|
||||
FInResizeEvent := False;
|
||||
// default states
|
||||
FWidgetState := [];
|
||||
@ -2080,16 +2065,6 @@ begin
|
||||
if GetContainerWidget <> Widget then
|
||||
QWidget_resize(GetContainerWidget, FParams.Width, FParams.Height);
|
||||
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
{$IFDEF DEBUGQTUSEACCURATEFRAME}
|
||||
DebugLn(Format('TQtWidget.InitializeWidget: proposed width %d height %d',[FParams.Width, FParams.Height]),' WSFrame=',dbgs(QtWidgetSet.WSFrameMargins),' FFrame=',dbgs(FFrameMargins));
|
||||
{$ENDIF}
|
||||
if (QtWidgetSet.WSFrameMargins.Top > 0) then
|
||||
FFrameMargins := QtWidgetSet.WSFrameMargins;
|
||||
end;
|
||||
{$ENDIF}
|
||||
Resize(FParams.Width, FParams.Height);
|
||||
|
||||
FScrollX := 0;
|
||||
@ -3998,10 +3973,6 @@ var
|
||||
APos: TQtPoint;
|
||||
{$IFDEF HASX11}
|
||||
ACurrPos: TQtPoint;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
X11Pos: TQtPoint;
|
||||
ALeft, ATop, ABorder, AWidth, AHeight: integer;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
FrameRect, WindowRect: TRect;
|
||||
ForceSendMove: boolean;
|
||||
@ -4070,62 +4041,6 @@ begin
|
||||
Msg.XPos := SmallInt(APos.x - (WindowRect.Left - FrameRect.Left));
|
||||
Msg.YPos := SmallInt(APos.y - (WindowRect.Top - FrameRect.Top));
|
||||
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
// Qt is sometimes mismatched with X11
|
||||
{$IFDEF HASX11}
|
||||
if IsFramedWidget and PointsEqual(FrameRect.TopLeft, WindowRect.TopLeft) then
|
||||
begin
|
||||
// checking code above means that we have mismatch somewhere
|
||||
// in between Qt and X11. Question is who is correct in this case X or Qt.
|
||||
// SlotMove is triggered always after form activation
|
||||
if (getWindowState and QtWindowFullScreen = QtWindowFullScreen) or
|
||||
(getWindowState and QtWindowMaximized = QtWindowMaximized) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn('WARNING: SlotMove(',dbgsName(LCLObject),') FULLSCREEN CALCULATED X=',dbgs(Msg.XPos),' Y=',dbgs(Msg.YPos));
|
||||
{$ENDIF}
|
||||
end else
|
||||
if GetX11WindowRealized(QWidget_winID(Widget)) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn('WARNING: SlotMove(',dbgsName(LCLObject),') frame and geometry have same values geom=',dbgs(WindowRect),' frame=',dbgs(FrameRect),' MARGINS=',dbgs(FrameMargins),' WS=',dbgs(QtWidgetSet.WSFrameMargins),' InvPos=',dbgs(TQtMainWindow(Self).FFormHasInvalidPosition));
|
||||
{$ENDIF}
|
||||
{TODO: KWin4 is find with FFormHasInvalidPosition := True, but gtk based wm's like
|
||||
xfce,gnome-shell and cinnamon and kwin5 aren''t, so we must use code below.}
|
||||
if (GetKdeSessionVersion = 3) then
|
||||
TQtMainWindow(Self).FFormHasInvalidPosition := True
|
||||
else
|
||||
begin
|
||||
GetX11WindowPos(QWidget_winId(Widget), X11Pos.x, X11Pos.y);
|
||||
|
||||
if GetX11WindowAttributes(QWidget_winID(Widget), ALeft, ATop, AWidth, AHeight, ABorder) then
|
||||
begin
|
||||
if ALeft = 0 then
|
||||
X11Pos.x -= FFrameMargins.Left;
|
||||
if ATop = 0 then
|
||||
X11Pos.y -= FFrameMargins.Top;
|
||||
end else
|
||||
begin
|
||||
X11Pos.x -= FFrameMargins.Left;
|
||||
X11Pos.y -= FFrameMargins.Top;
|
||||
end;
|
||||
if ((GetKdeSessionVersion = 5) or ((X11Pos.x = LCLObject.Left) and (X11Pos.y = LCLObject.Top))) and
|
||||
((QWidget_x(Widget) <> X11Pos.x) or (QWidget_y(Widget) <> X11Pos.y)) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn('1.*error: *** SlotMove(',dbgsName(LCLObject),Format(' calculated pos x %d y %d',[Msg.XPos, Msg.YPos]),' realized=',dbgs(GetX11WindowRealized(QWidget_winId(Widget))));
|
||||
DebugLn(' > ',Format('current LCL x %d y %d Qt x %d y %d X11 x %d y %d CALC x %d y %d',[LCLObject.Left, LCLObject.Top, QWidget_x(Widget), QWidget_y(Widget), X11Pos.x, X11Pos.y, Msg.XPos, Msg.YPos]));
|
||||
DebugLn(' > FrameRect=',dbgs(FrameRect),' WindowRect=',dbgs(WindowRect),' Margins=',dbgs(FFrameMargins));
|
||||
DebugLn('< sending valid values to Qt and LCL ',Format('x %d y %d compositor %s ',[X11Pos.X, X11Pos.y,dbgs(QX11Info_isCompositingManagerRunning)]));
|
||||
{$ENDIF}
|
||||
QWidget_move(Widget, X11Pos.x, X11Pos.y);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
DeliverMessage(Msg);
|
||||
end;
|
||||
|
||||
@ -4733,18 +4648,7 @@ begin
|
||||
end;
|
||||
|
||||
function TQtWidget.getHeight: Integer;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
var
|
||||
ASize: TSize;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
ASize := getFrameSize;
|
||||
Result := ASize.cy;
|
||||
end else
|
||||
{$ENDIF}
|
||||
Result := QWidget_height(Widget);
|
||||
end;
|
||||
|
||||
@ -4754,19 +4658,8 @@ begin
|
||||
end;
|
||||
|
||||
function TQtWidget.getWidth: Integer;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
var
|
||||
ASize: TSize;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
ASize := getFrameSize;
|
||||
Result := ASize.cx;
|
||||
end else
|
||||
{$ENDIF}
|
||||
Result := QWidget_width(Widget);
|
||||
Result := QWidget_width(Widget);
|
||||
end;
|
||||
|
||||
function TQtWidget.getWindow: TQtWidget;
|
||||
@ -4953,26 +4846,16 @@ var
|
||||
R1, R2: TRect;
|
||||
dw, dh: integer;
|
||||
begin
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
QWidget_resize(Widget, ANewWidth - (FFrameMargins.Right + FFrameMargins.Left),
|
||||
ANewHeight - (FFrameMargins.Bottom + FFrameMargins.Top));
|
||||
{$ELSE}
|
||||
R1 := getGeometry;
|
||||
R2 := getFrameGeometry;
|
||||
dw := (R1.Left - R2.Left) + (R2.Right - R1.Right);
|
||||
dh := (R1.Top - R2.Top) + (R2.Bottom - R1.Bottom);
|
||||
QWidget_resize(Widget, ANewWidth - dw, ANewHeight - dh);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TQtWidget.Resize(ANewWidth, ANewHeight: Integer);
|
||||
begin
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if IsFramedWidget then
|
||||
frame_resize(ANewWidth, ANewHeight)
|
||||
else
|
||||
{$ENDIF}
|
||||
QWidget_resize(Widget, ANewWidth, ANewHeight);
|
||||
QWidget_resize(Widget, ANewWidth, ANewHeight);
|
||||
end;
|
||||
|
||||
procedure TQtWidget.releaseMouse;
|
||||
@ -5087,12 +4970,6 @@ end;
|
||||
|
||||
procedure TQtWidget.setMaximumSize(AWidth, AHeight: Integer);
|
||||
begin
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if IsFramedWidget then
|
||||
QWidget_setMaximumSize(Widget, AWidth - (FFrameMargins.Right + FFrameMargins.Left),
|
||||
AHeight - (FFrameMargins.Bottom + FFrameMargins.Top))
|
||||
else
|
||||
{$ENDIF}
|
||||
QWidget_setMaximumSize(Widget, AWidth, AHeight);
|
||||
end;
|
||||
|
||||
@ -5108,12 +4985,6 @@ end;
|
||||
|
||||
procedure TQtWidget.setMinimumSize(AWidth, AHeight: Integer);
|
||||
begin
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if IsFramedWidget then
|
||||
QWidget_setMinimumSize(Widget, Max(0, AWidth - (FFrameMargins.Right + FFrameMargins.Left)),
|
||||
Max(0, AHeight - (FFrameMargins.Bottom + FFrameMargins.Top)))
|
||||
else
|
||||
{$ENDIF}
|
||||
QWidget_setMinimumSize(Widget, AWidth, AHeight);
|
||||
end;
|
||||
|
||||
@ -6905,12 +6776,7 @@ begin
|
||||
begin
|
||||
{TQtMainWindow does not send resize event if ScrollArea is assigned,
|
||||
it is done here when viewport geometry is finally updated by Qt.}
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if (FOwner.IsFramedWidget) then
|
||||
ASize := FOwner.getFrameSize
|
||||
else
|
||||
{$ENDIF}
|
||||
ASize := FOwner.getSize;
|
||||
ASize := FOwner.getSize;
|
||||
AResizeEvent := QResizeEvent_create(@ASize, @ASize);
|
||||
try
|
||||
// issue #28596 and others of TCustomControl clientrect related
|
||||
@ -6995,9 +6861,6 @@ begin
|
||||
{$ifdef VerboseQt}
|
||||
WriteLn('TQtMainWindow.CreateWidget Name: ', LCLObject.Name);
|
||||
{$endif}
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
FFormHasInvalidPosition := False;
|
||||
{$ENDIF}
|
||||
|
||||
FFirstPaintEvent := False;
|
||||
FBlocked := False;
|
||||
@ -7293,31 +7156,9 @@ begin
|
||||
if Assigned(ScrollArea) then
|
||||
begin
|
||||
if not ScrollArea.testAttribute(QtWA_PendingResizeEvent) then
|
||||
begin
|
||||
Result := ScrollArea.getClientBounds;
|
||||
{$IF DEFINED(QTUSEACCURATEFRAME) AND DEFINED(DEBUGQTUSEACCURATEFRAME)}
|
||||
DebugLn('TQtMainWindow.getClientBounds(',dbgsName(LCLObject),'): ',dbgs(Result),' FFrame=',dbgs(FFrameMargins));
|
||||
{$ENDIF}
|
||||
end else
|
||||
begin
|
||||
Result := ScrollArea.getClientBounds
|
||||
else
|
||||
Result := inherited GetClientBounds;
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
{$IFDEF DEBUGQTUSEACCURATEFRAME}
|
||||
DebugLn('>TQtMainWindow.getClientBounds(',dbgsName(LCLObject),'): ***ERROR*** ',dbgs(Result),' FFrame=',dbgs(FFrameMargins),' Assigned ? ',BoolToStr(Assigned(ScrollArea)));
|
||||
{$ENDIF}
|
||||
dec(Result.Right, FFrameMargins.Right + FFrameMargins.Left);
|
||||
dec(Result.Bottom, FFrameMargins.Bottom + FFrameMargins.Top);
|
||||
{menubar is not yet allocated, so use SM_CYMENU}
|
||||
if Assigned(TCustomForm(LCLObject).Menu) then
|
||||
dec(Result.Bottom, QtWidgetSet.GetSystemMetrics(SM_CYMENU));
|
||||
{$IFDEF DEBUGQTUSEACCURATEFRAME}
|
||||
DebugLn('<TQtMainWindow.getClientBounds(',dbgsName(LCLObject),'): ***ERROR*** NEW RESULT=',dbgs(Result));
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end else
|
||||
{$ENDIF}
|
||||
Result:=inherited getClientBounds;
|
||||
@ -7338,116 +7179,6 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TQtMainWindow.getFrameSize: TSize;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
var
|
||||
ASize, AFrameSize: TSize;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result:=inherited getFrameSize;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
ASize := GetSize;
|
||||
AFrameSize := Result;
|
||||
if (getWindowState and QtWindowMaximized = QtWindowMaximized) then
|
||||
begin
|
||||
Result.cx := ASize.cx;
|
||||
Result.cy := ASize.cy + FFrameMargins.Top + FFrameMargins.Bottom;
|
||||
end else
|
||||
if (ASize.cx = AFrameSize.cx) and (ASize.cy = AFrameSize.cy) then
|
||||
begin
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
DebugLn('>TQtMainWindow.getFrameSize ',dbgs(Result),' must apply frameMargins=',dbgs(FFrameMargins));
|
||||
{$ENDIF}
|
||||
inc(Result.cx, FrameMargins.Left + FrameMargins.Right);
|
||||
inc(Result.cy, FrameMargins.Top + FrameMargins.Bottom);
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
DebugLn('<TQtMainWindow.getFrameSize ',dbgs(Result),' must apply frameMargins=',dbgs(FFrameMargins));
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TQtMainWindow.getFrameGeometry: TRect;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
var
|
||||
ASize, AFrameSize: TSize;
|
||||
{$IFDEF HASX11}
|
||||
X11X, X11Y, X, Y: integer;
|
||||
ALeft, ATop, AWidth, AHeight, ABorder: integer;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result:=inherited getFrameGeometry;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if IsFramedWidget then
|
||||
begin
|
||||
QWidget_size(Widget, @ASize);
|
||||
QWidget_frameSize(Widget, @AFrameSize);
|
||||
|
||||
if (getWindowState and QtWindowFullScreen = QtWindowFullScreen) then
|
||||
begin
|
||||
Result.Left := 0;
|
||||
Result.Top := 0;
|
||||
Result.Right := Screen.Width;
|
||||
Result.Bottom := Screen.Height;
|
||||
FFormHasInvalidPosition := False;
|
||||
end else
|
||||
if (getWindowState and QtWindowMaximized = QtWindowMaximized) then
|
||||
begin
|
||||
Result.Left := 0;
|
||||
Result.Top := 0;
|
||||
Result.Right := ASize.cx;
|
||||
Result.Bottom := ASize.cy + FFrameMargins.Top + FFrameMargins.Bottom;
|
||||
FFormHasInvalidPosition := False;
|
||||
end else
|
||||
if (ASize.cx = AFrameSize.cx) and (ASize.cy = AFrameSize.cy) then
|
||||
begin
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
DebugLn('>TQtMainWindow.getFrameGeometry ',dbgs(Result),' must apply frameMargins=',dbgs(FFrameMargins));
|
||||
if (FFrameMargins.Left = 0) and (FFrameMargins.Top = 0) and (FFrameMargins.Right = 0) and (FFrameMargins.Bottom = 0) then
|
||||
FFrameMargins := QtWidgetSet.WSFrameMargins;
|
||||
{$ENDIF}
|
||||
inc(Result.Right, FrameMargins.Left + FrameMargins.Right);
|
||||
inc(Result.Bottom, FrameMargins.Top + FrameMargins.Bottom);
|
||||
{$IFDEF DebugQtUseAccurateFrame}
|
||||
DebugLn('<TQtMainWindow.getFrameGeometry ',dbgs(Result),' WS W=',dbgs(Result.Right - Result.Left),' H=',dbgs(Result.Bottom - Result.Top),' SIZE=',dbgs(ASize));
|
||||
{$ENDIF}
|
||||
end;
|
||||
if FFormHasInvalidPosition then
|
||||
begin
|
||||
{$IFDEF HASX11}
|
||||
if GetX11WindowPos(QWidget_winID(Widget), X11X, X11Y) then
|
||||
begin
|
||||
if GetX11WindowAttributes(QWidget_winID(Widget), ALeft, ATop, AWidth, AHeight, ABorder) then
|
||||
begin
|
||||
if ALeft = 0 then
|
||||
X11X -= FFrameMargins.Left;
|
||||
if ATop = 0 then
|
||||
X11Y -= FFrameMargins.Top;
|
||||
end else
|
||||
begin
|
||||
X11X -= FFrameMargins.Left;
|
||||
X11Y -= FFrameMargins.Top;
|
||||
end;
|
||||
|
||||
X := Result.Left;
|
||||
Y := Result.Top;
|
||||
if (X11X = x) and (X11Y = y) then
|
||||
FFormHasInvalidPosition := False
|
||||
else
|
||||
OffsetRect(Result, X11X - x, X11Y - y);
|
||||
end;
|
||||
{$ELSE}
|
||||
DebugLn('TQtMainWindow.getFrameGeometry currently implemented only on X11');
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TQtMainWindow.getText: WideString;
|
||||
begin
|
||||
WindowTitle(@Result);
|
||||
@ -7536,15 +7267,8 @@ begin
|
||||
if not IsMDIChild and not IsFrameWindow and
|
||||
(TCustomForm(LCLObject).BorderStyle in [bsDialog, bsNone, bsSingle]) and
|
||||
not (csDesigning in LCLObject.ComponentState) then
|
||||
begin
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if IsFramedWidget then
|
||||
QWidget_setFixedSize(Widget, ANewWidth - (FFrameMargins.Right + FFrameMargins.Left),
|
||||
ANewHeight - (FFrameMargins.Bottom + FFrameMargins.Top))
|
||||
else
|
||||
{$ENDIF}
|
||||
QWidget_setFixedSize(Widget, ANewWidth, ANewHeight);
|
||||
end else
|
||||
QWidget_setFixedSize(Widget, ANewWidth, ANewHeight)
|
||||
else
|
||||
inherited Resize(ANewWidth, ANewHeight);
|
||||
end;
|
||||
|
||||
@ -7573,17 +7297,6 @@ var
|
||||
AState: QtWindowStates;
|
||||
AOldState: QtWindowStates;
|
||||
CanSendEvent: Boolean;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
R: TRect;
|
||||
ASize, AFrameSize: TSize;
|
||||
{$IFDEF HASX11}
|
||||
ALeft, ATop, ABorder, AWidth, AHeight: integer;
|
||||
X11X, X11Y: integer;
|
||||
AMoveMsg: TLMMove;
|
||||
ASizeMsg: TLMSize;
|
||||
ATempFrame: TRect;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF MSWINDOWS}
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
@ -7687,162 +7400,10 @@ begin
|
||||
end;
|
||||
QEventWindowUnblocked: Blocked := False;
|
||||
QEventWindowBlocked: Blocked := True;
|
||||
{$IF DEFINED(QtUseAccurateFrame) AND DEFINED(HASX11)}
|
||||
(*
|
||||
QEventActivationChange:
|
||||
begin
|
||||
// here we still have wrong x,y from qt
|
||||
if IsFramedWidget and not FFormHasInvalidPosition then
|
||||
begin
|
||||
{This is Qt bug, so we must take care of it}
|
||||
if GetX11WindowPos(QWidget_winID(Widget), R.Left, R.Top) then
|
||||
begin
|
||||
if (R.Left - QWidget_x(Widget) = FrameMargins.Left) and (R.Top - QWidget_y(Widget) = FrameMargins.Left) then
|
||||
begin
|
||||
DebugLn('WARNING: QEventActivationChange(FALSE) ',GetWindowManager,' wm strange position: ',Format('X11 x %d y %d Qt x %d y %d',[R.Left, R.Top, QWidget_x(Widget), QWidget_y(Widget)]));
|
||||
end else
|
||||
begin
|
||||
R.Left := R.Left - FFrameMargins.Left;
|
||||
R.Top := R.Top - FFrameMargins.Top;
|
||||
if (R.Left <> QWidget_x(Widget)) or (R.Top <> QWidget_y(Widget)) then
|
||||
begin
|
||||
DebugLn('WARNING: QEventActivationChange *TRUE* ',GetWindowManager,' wm strange position: ',Format('X11 x %d y %d Qt x %d y %d',[R.Left, R.Top, QWidget_x(Widget), QWidget_y(Widget)]));
|
||||
FFormHasInvalidPosition := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
*)
|
||||
{$ENDIF}
|
||||
QEventWindowActivate:
|
||||
begin
|
||||
if not IsMDIChild then
|
||||
begin
|
||||
{$IF DEFINED(QtUseAccurateFrame) AND DEFINED(HASX11)}
|
||||
if IsFramedWidget and not (getWindowState and QtWindowFullScreen = QtWindowFullScreen) then
|
||||
begin
|
||||
{This is Qt bug, so we must take care of it}
|
||||
if GetX11WindowPos(QWidget_winID(Widget), R.Left, R.Top) then
|
||||
begin
|
||||
// fluxbox
|
||||
if (R.Left - QWidget_x(Widget) = FrameMargins.Left) and (R.Top - QWidget_y(Widget) = FrameMargins.Left) then
|
||||
begin
|
||||
GetX11WindowAttributes(QWidget_winID(Widget), ALeft, ATop, AWidth, AHeight, ABorder);
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn('WARNING: QEventWindowActivate(FALSE) ',dbgsName(LCLObject),' ',GetWindowManager,' wm strange position: ',Format('X11 x %d y %d Qt x %d y %d X11 attr x %d y %d',[R.Left, R.Top, QWidget_x(Widget), QWidget_y(Widget), ALeft, ATop]));
|
||||
{$ENDIF}
|
||||
end else
|
||||
begin
|
||||
if GetX11WindowAttributes(QWidget_winID(Widget), ALeft, ATop, AWidth, AHeight, ABorder) then
|
||||
begin
|
||||
if ALeft = 0 then
|
||||
R.Left -= FFrameMargins.Left;
|
||||
if ATop = 0 then
|
||||
R.Top -= FFrameMargins.Top;
|
||||
end else
|
||||
begin
|
||||
R.Left -= FFrameMargins.Left;
|
||||
R.Top -= FFrameMargins.Top;
|
||||
end;
|
||||
if (R.Left <> QWidget_x(Widget)) or (R.Top <> QWidget_y(Widget)) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
GetX11RectForAtom(QWidget_winID(Widget), '_NET_FRAME_EXTENTS', ATempFrame);
|
||||
DebugLn('WARNING: QEventWindowActivate(**',dbgsName(LCLObject),'**) ',
|
||||
Format('%s wm invalid form position: X11 x %d y %d Qt x %d y %d realized %s LCL x %d y %d margins %s x11m %s',
|
||||
[GetWindowManager, R.Left, R.Top, QWidget_x(Widget), QWidget_y(Widget), dbgs(GetX11WindowRealized(QWidget_winID(Widget))), LCLObject.Left, LCLObject.Top, dbgs(FrameMargins),dbgs(ATempFrame)]));
|
||||
DebugLn(' Attributes ',Format('x %d y %d w %d h %d border %d x11wob x %d y %d',[ALeft, ATop, AWidth, AHeight, ABorder,R.Left, R.Top]));
|
||||
{$ENDIF}
|
||||
FFormHasInvalidPosition := True;
|
||||
// KWin under KDE5 makes problem sometimes since
|
||||
// Qt and X11 values are totally unsynced
|
||||
if QX11Info_isCompositingManagerRunning and (GetKdeSessionVersion = 5) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn(Format('**** DO NOT TOUCH QT POSITION UNDER KWin AND KDE v.%d, but we are trying coords x %d y %d',[GetKdeSessionVersion, R.Left, R.Top]));
|
||||
{$ENDIF}
|
||||
end else
|
||||
QWidget_move(Widget, R.Left, R.Top);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
R := QtWidgetSet.WSFrameMargins;
|
||||
if (R.Left = 0) and (R.Top = 0) and (R.Bottom = 0) and (R.Right = 0) then
|
||||
begin
|
||||
GetX11RectForAtom(QWidget_winID(Widget),'_NET_FRAME_EXTENTS', R);
|
||||
QtWidgetSet.WSFrameMargins := R;
|
||||
FrameMargins := R;
|
||||
DebugLn('WARNING: TQtMainWindow.EventFilter('+dbgsName(LCLObject)+') setting widgetset frame margins to '+dbgs(R)+' from form activation !');
|
||||
end else
|
||||
begin
|
||||
if QX11Info_isCompositingManagerRunning then
|
||||
begin
|
||||
QWidget_size(Widget, @ASize);
|
||||
QWidget_frameSize(Widget, @AFrameSize);
|
||||
R.Left := (AFrameSize.cx - ASize.cx) div 2;
|
||||
R.Right := R.Left;
|
||||
R.Bottom := R.Left;
|
||||
R.Top := (AFrameSize.cy - ASize.cy) - R.Bottom;
|
||||
if (AFrameSize.cy > ASize.cy) and not EqualRect(FFrameMargins, R) then
|
||||
begin
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn('***CHANGE FRAME MARGINS ',dbgsName(LCLObject),' OLD FFFRAME=',dbgs(FFrameMargins),' NEW FFRAME=',dbgs(R));
|
||||
{$ENDIF}
|
||||
// composite wm changes _NET_FRAME_EXTENTS to + or even - for shadows
|
||||
// so update just this window FFrameMargins.
|
||||
// eg. Gnome 3 shows modal window without title, so changes frame
|
||||
// size eg from 4,27,4,4 to 1,3,1,1.
|
||||
// Cinnamon have shadows eg _NET_FRAME_EXTENTS are 4,27,4,4
|
||||
// but after shadowing we have 10,36,10,10. So keep them here !
|
||||
// More problems comes from cinnamon since titlebar size depends
|
||||
// if widget have constraints (min,max) or if widget is modal.
|
||||
// All we can do is to inform LCL that handle bounds are changed.
|
||||
FFrameMargins := R;
|
||||
GetX11WindowPos(QWidget_winID(Widget), X11X, X11Y);
|
||||
X11X -= R.Left;
|
||||
X11Y -= R.Top;
|
||||
{$IF DEFINED(DEBUGQTUSEACCURATEFRAME) OR DEFINED(DEBUGQTCHECKMOVESIZE)}
|
||||
DebugLn(Format(' =>> X11 pos x %d y %d',[X11X, X11Y]));
|
||||
{$ENDIF}
|
||||
|
||||
if QtWidgetSet.IsWidgetAtCache(HWND(Self)) then
|
||||
QtWidgetSet.InvalidateWidgetAtCache;
|
||||
|
||||
FillChar(AMoveMsg{%H-}, SizeOf(AMoveMsg), #0);
|
||||
AMoveMsg.Msg := LM_MOVE;
|
||||
AMoveMsg.MoveType := AMoveMsg.MoveType or Move_SourceIsInterface;
|
||||
AMoveMsg.XPos := SmallInt(X11X);
|
||||
AMoveMsg.YPos := SmallInt(X11Y);
|
||||
DeliverMessage(AMoveMsg);
|
||||
|
||||
FillChar(ASizeMsg{%H-}, SizeOf(ASizeMsg), #0);
|
||||
|
||||
ASizeMsg.Msg := LM_SIZE;
|
||||
|
||||
case getWindowState of
|
||||
QtWindowMinimized: ASizeMsg.SizeType := SIZE_MINIMIZED;
|
||||
QtWindowMaximized: ASizeMsg.SizeType := SIZE_MAXIMIZED;
|
||||
QtWindowFullScreen: ASizeMsg.SizeType := SIZE_FULLSCREEN;
|
||||
else
|
||||
ASizeMsg.SizeType := SIZE_RESTORED;
|
||||
end;
|
||||
|
||||
ASizeMsg.SizeType := ASizeMsg.SizeType or Size_SourceIsInterface;
|
||||
|
||||
AFrameSize := getFrameSize;
|
||||
ASizeMsg.Width := Word(AFrameSize.cx);
|
||||
ASizeMsg.Height := Word(AFrameSize.cy);
|
||||
|
||||
DeliverMessage(ASizeMsg);
|
||||
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
// issues #26463, #29744, must restore app if we activate non modal window from taskbar
|
||||
if (Application.ModalLevel > 0) and
|
||||
@ -8083,16 +7644,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TQtMainWindow.IsFramedWidget: boolean;
|
||||
begin
|
||||
Result:=inherited IsFramedWidget;
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
Result := not IsMDIChild and (LCLObject.Parent = nil) and
|
||||
(TCustomForm(LCLObject).BorderStyle <> bsNone) and
|
||||
(TCustomForm(LCLObject).FormStyle <> fsSplash);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TQtMainWindow.IsMdiChild: Boolean;
|
||||
begin
|
||||
Result := (LCLObject <> nil) and not IsFrameWindow and not
|
||||
|
@ -3893,15 +3893,6 @@ begin
|
||||
end;
|
||||
SM_CXBORDER, SM_CYBORDER:
|
||||
begin
|
||||
//The height of a window border, in pixels
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if (nIndex = SM_CYBORDER) and (WSFrameMargins.Top > 0) then
|
||||
Result := WSFrameMargins.Bottom
|
||||
else
|
||||
if (nIndex = SM_CXBORDER) and (WSFrameMargins.Top > 0) then
|
||||
Result := WSFrameMargins.Left
|
||||
else
|
||||
{$ENDIF}
|
||||
Result := GetPixelMetric(QStylePM_DefaultFrameWidth, nil, nil);
|
||||
end;
|
||||
SM_CXCURSOR:
|
||||
@ -4079,11 +4070,6 @@ begin
|
||||
end;
|
||||
SM_CYCAPTION:
|
||||
begin
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if WSFrameMargins.Top > 0 then
|
||||
Result := WSFrameMargins.Top
|
||||
else
|
||||
{$ENDIF}
|
||||
Result := GetPixelMetric(QStylePM_TitleBarHeight, nil, nil);
|
||||
end;
|
||||
SM_CYKANJIWINDOW:
|
||||
@ -4486,14 +4472,6 @@ begin
|
||||
if not IsValidHandle(Handle) then
|
||||
exit;
|
||||
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if TQtWidget(Handle).IsFramedWidget then
|
||||
begin
|
||||
ARect := TQtWidget(Handle).getFrameGeometry;
|
||||
exit(-1);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
if (TQtWidget(Handle) is TQtMainWindow) and Assigned(TQtWidget(Handle).LCLObject) and
|
||||
(TQtWidget(Handle).LCLObject.Parent = nil) and
|
||||
not TQtMainWindow(Handle).FirstPaintEvent
|
||||
@ -4566,11 +4544,7 @@ begin
|
||||
{$endif}
|
||||
if Handle = 0 then
|
||||
Exit(False);
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if TQtWidget(Handle).IsFramedWidget then
|
||||
ASize := TQtWidget(handle).getFrameSize
|
||||
else
|
||||
{$ENDIF}
|
||||
|
||||
ASize := TQtWidget(Handle).getSize;
|
||||
Height := ASize.cy;
|
||||
Width := ASize.cx;
|
||||
|
@ -537,20 +537,7 @@ begin
|
||||
TQtWidget(AWinControl.Handle).BeginUpdate;
|
||||
with R do
|
||||
begin
|
||||
{$IF DEFINED(QTUSEACCURATEFRAME) AND DEFINED(HASX11)}
|
||||
// DO NOT TOUCH THIS UNTIL COMPLETE PROBLEM IS INVESTIGATED
|
||||
// WITH OPENBOX WM. Qt most of time have wrong assumption about position.
|
||||
if TQtWidget(AWinControl.Handle).IsFramedWidget and
|
||||
GetX11WindowRealized(QWidget_winID(TQtWidget(AWinControl.Handle).Widget)) and
|
||||
(GetWindowManager = 'Openbox') then
|
||||
begin
|
||||
SetX11WindowPos(QWidget_winID(TQtWidget(AWinControl.Handle).Widget), Left, Top);
|
||||
// QApplication_syncX;
|
||||
end else
|
||||
TQtWidget(AWinControl.Handle).move(Left, Top);
|
||||
{$ELSE}
|
||||
TQtWidget(AWinControl.Handle).move(Left, Top);
|
||||
{$ENDIF}
|
||||
TQtWidget(AWinControl.Handle).resize(Right, Bottom);
|
||||
end;
|
||||
TQtWidget(AWinControl.Handle).EndUpdate;
|
||||
|
@ -132,7 +132,7 @@ type
|
||||
implementation
|
||||
|
||||
uses qtint, LCLIntf
|
||||
{$IF DEFINED(VerboseQtResize) OR DEFINED(DEBUGQTUSEACCURATEFRAME)}, LCLProc{$ENDIF}
|
||||
{$IF DEFINED(VerboseQtResize)}, LCLProc{$ENDIF}
|
||||
;
|
||||
|
||||
{ TQtWSCustomFrame }
|
||||
@ -234,11 +234,6 @@ begin
|
||||
QtMainWindow.setRealPopupParent(TQtWidget(APopupParent.Handle).Widget);
|
||||
end;
|
||||
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
if QtMainWindow.IsFramedWidget then
|
||||
QtMainWindow.FrameMargins := QtWidgetSet.WSFrameMargins;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF HASX11}
|
||||
if QtMainWindow.IsMainForm and not Application.HasOption('disableaccurateframe') then
|
||||
begin
|
||||
@ -1031,16 +1026,6 @@ begin
|
||||
Result := False;
|
||||
if AWinControl.HandleAllocated then
|
||||
begin
|
||||
{$IFDEF QTUSEACCURATEFRAME}
|
||||
if TQtMainWindow(AWinControl.Handle).IsFramedWidget then
|
||||
begin
|
||||
AClientRect := TQtMainWindow(AWinControl.Handle).getClientBounds;
|
||||
{$IFDEF DEBUGQTUSEACCURATEFRAME}
|
||||
DebugLn(Format('******TQtWSCustomForm.GetDefaultClientRect(%s): %s LCL l %d t %d w %d h %d',[dbgsName(AWinControl), dbgs(AClientRect), ALeft, ATop, aWidth, AHeight]));
|
||||
{$ENDIF}
|
||||
Result := True;
|
||||
end else
|
||||
{$ENDIF}
|
||||
if TQtMainWindow(AWinControl.Handle).testAttribute(QtWA_PendingResizeEvent) then
|
||||
begin
|
||||
if Assigned(TCustomForm(AWinControl).Menu) then
|
||||
|
@ -422,7 +422,7 @@ begin
|
||||
XMapWindow(QX11Info_display(), TWindow(AWinID));
|
||||
end;
|
||||
|
||||
{$IFDEF QtUseAccurateFrame}
|
||||
{$IFDEF QtUseX11Extras}
|
||||
|
||||
function GetX11WindowRealized(AWinID: PtrUInt): boolean;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user