mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 13:00:17 +02:00
Qt: fixed weird frameGeometry behaviour under X11, as explained here http://doc.qt.nokia.com/4.7/application-windows.html#window-geometry issue #18658
git-svn-id: trunk@29330 -
This commit is contained in:
parent
d8e8be06c2
commit
9f1e2fbd9c
@ -3043,7 +3043,7 @@ end;
|
||||
procedure TQtWidget.SlotMove(Event: QEventH); cdecl;
|
||||
var
|
||||
Msg: TLMMove;
|
||||
Pos: TQtPoint;
|
||||
APos, ACurrPos: TQtPoint;
|
||||
FrameRect, WindowRect: TRect;
|
||||
begin
|
||||
{$ifdef VerboseQt}
|
||||
@ -3068,12 +3068,27 @@ begin
|
||||
|
||||
Msg.MoveType := Msg.MoveType or Move_SourceIsInterface;
|
||||
|
||||
Pos := QMoveEvent_pos(QMoveEventH(Event))^;
|
||||
APos := QMoveEvent_pos(QMoveEventH(Event))^;
|
||||
FrameRect := getFrameGeometry;
|
||||
WindowRect := getGeometry;
|
||||
|
||||
Msg.XPos := Pos.x - (WindowRect.Left - FrameRect.Left);
|
||||
Msg.YPos := Pos.y - (WindowRect.Top - FrameRect.Top);
|
||||
// here is explanation why frameGeometry sometimes
|
||||
// doesn't return correct results under X11
|
||||
// http://doc.qt.nokia.com/4.7/application-windows.html#window-geometry
|
||||
// issue #18658
|
||||
{$IFDEF HASX11}
|
||||
if (LCLObject is TCustomForm) and EqualRect(FrameRect, WindowRect) and
|
||||
(TCustomForm(LCLObject).BorderStyle <> bsNone) and
|
||||
not (TCustomForm(LCLObject).FormStyle in [fsMDIChild,fsSplash]) then
|
||||
begin
|
||||
ACurrPos := getPos;
|
||||
if (ACurrPos.X = WindowRect.Left) and (ACurrPos.Y = WindowRect.Top) then
|
||||
OffsetRect(FrameRect,-WindowRect.Left,-WindowRect.Top);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
Msg.XPos := APos.x - (WindowRect.Left - FrameRect.Left);
|
||||
Msg.YPos := APos.y - (WindowRect.Top - FrameRect.Top);
|
||||
|
||||
DeliverMessage(Msg);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user