Skip to content

Commit

Permalink
Bug 1748: Failure when undocking toolbar on a system with multiple mo…
Browse files Browse the repository at this point in the history
…nitors with different DPI

https://winscp.net/tracker/1748
(cherry picked from commit 896a72c)

Source commit: 6042b9da7af371d60484205ad98f5c14388373f1
  • Loading branch information
martinprikryl committed May 27, 2019
1 parent fc63bd6 commit 152555a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions source/packages/tbx/TBX.pas
Expand Up @@ -2607,7 +2607,11 @@ procedure TTBXToolbar.SetParent(AParent: TWinControl);
begin
inherited;
if AParent is TTBXFloatingWindowParent then
begin
TTBXFloatingWindowParent(AParent).SnapDistance := SnapDistance;
// See the comment in TTBXToolbar.Rebuild
Rebuild;
end;
end;

procedure TTBXToolbar.SetSnapDistance(Value: Integer);
Expand Down Expand Up @@ -2640,8 +2644,17 @@ procedure TTBXToolbar.TBMGetViewType(var Message: TMessage);

procedure TTBXToolbar.Rebuild;
begin
if Floating then UpdateNCArea(TTBXFloatingWindowParent(Parent), GetWinViewType(Self))
else UpdateNCArea(Self, GetWinViewType(Self));
if Floating then
begin
// Is not set yet, when called from within SetParent > WMDpiChangedAfterParent while undocking on
// per-monitor-DPI system. We will call Rebuild again at the end of the SetParent
if Assigned(Parent) then
UpdateNCArea(TTBXFloatingWindowParent(Parent), GetWinViewType(Self));
end
else
begin
UpdateNCArea(Self, GetWinViewType(Self));
end;
Invalidate;
Arrange;
end;
Expand Down

0 comments on commit 152555a

Please sign in to comment.