mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 11:18:10 +02:00
Gtk2: fix wrong ClientRect. LCL may cache ClientRect, invalidate the cache if the correct Rect was not available. Fix Issue #40284 "wrong main bar height"
This commit is contained in:
parent
63a4789e76
commit
14d60ce6a0
@ -451,10 +451,14 @@ type
|
||||
wwiInvalidEvent, // special mark for widgetinfo
|
||||
// see gtkchanged_editbox and
|
||||
// gtkchanged_editbox_backspace in gtkcallback.inc
|
||||
wwiTabWidgetFocusCheck // TabWidget have nasty behaviour when clicked
|
||||
wwiTabWidgetFocusCheck, // TabWidget have nasty behaviour when clicked
|
||||
// by mouse: switches focus here and there, so
|
||||
// focused control triggers OnExit and it looks
|
||||
// like it triggered OnEnter.issue #20493
|
||||
wwiClientRectWhilePendingSize // A wrong clientrect may have been returned.
|
||||
// The LCL asks for clientrect, while a resize
|
||||
// request was pending. The LCL would have
|
||||
// expected a value for the new size;
|
||||
);
|
||||
TWidgetInfoFlags = set of TWidgetInfoFlag;
|
||||
tGtkStateEnumRange = 0..31;
|
||||
|
@ -4670,6 +4670,7 @@ function GetWidgetClientRect(TheWidget: PGtkWidget): TRect;
|
||||
var
|
||||
Widget, ClientWidget: PGtkWidget;
|
||||
AChild: PGtkWidget;
|
||||
WidgetInfo: PWidgetInfo;
|
||||
|
||||
procedure GetNoteBookClientRect(NBWidget: PGtkNotebook);
|
||||
var
|
||||
@ -4707,6 +4708,12 @@ begin
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
Widget := TheWidget;
|
||||
ClientWidget := GetFixedWidget(Widget);
|
||||
|
||||
if FWidgetsWithResizeRequest.Contains(Widget) then begin
|
||||
WidgetInfo := GetWidgetInfo(Widget);
|
||||
if WidgetInfo <> nil then include(WidgetInfo^.Flags, wwiClientRectWhilePendingSize);
|
||||
end;
|
||||
|
||||
if (ClientWidget <> nil) then
|
||||
Widget := ClientWidget;
|
||||
if (Widget <> nil) then
|
||||
@ -6643,6 +6650,8 @@ var
|
||||
end;
|
||||
|
||||
procedure UpdateLCLSize;
|
||||
var
|
||||
WidgetInfo: PWidgetInfo;
|
||||
begin
|
||||
LCLWidth:=LCLControl.Width;
|
||||
LCLHeight:=LCLControl.Height;
|
||||
@ -6651,6 +6660,11 @@ var
|
||||
WidthHeightChanged:=true;
|
||||
//DebugLn(['UpdateLCLSize InvalidateClientRectCache ',DbgSName(LCLControl)]);
|
||||
LCLControl.InvalidateClientRectCache(false);
|
||||
end
|
||||
else begin
|
||||
WidgetInfo := GetWidgetInfo(aWidget);
|
||||
if (WidgetInfo <> nil) and (wwiClientRectWhilePendingSize in WidgetInfo^.Flags) then
|
||||
LCLControl.InvalidateClientRectCache(false);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -2277,6 +2277,7 @@ procedure TGtk2WidgetSet.SendCachedLCLMessages;
|
||||
IsTopLevelWidget: boolean;
|
||||
TopologicalList: TFPList; // list of PGtkWidget;
|
||||
i: integer;
|
||||
WidgetInfo: PWidgetInfo;
|
||||
|
||||
procedure RaiseWidgetWithoutControl;
|
||||
begin
|
||||
@ -2322,6 +2323,8 @@ procedure TGtk2WidgetSet.SendCachedLCLMessages;
|
||||
SetWindowSizeAndPosition(PgtkWindow(Widget),TWinControl(LCLControl));
|
||||
end;
|
||||
|
||||
WidgetInfo := GetWidgetInfo(Widget);
|
||||
if WidgetInfo <> nil then exclude(WidgetInfo^.Flags, wwiClientRectWhilePendingSize);
|
||||
end;
|
||||
TopologicalList.Free;
|
||||
FWidgetsWithResizeRequest.Clear;
|
||||
|
Loading…
Reference in New Issue
Block a user