mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:17:18 +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
|
wwiInvalidEvent, // special mark for widgetinfo
|
||||||
// see gtkchanged_editbox and
|
// see gtkchanged_editbox and
|
||||||
// gtkchanged_editbox_backspace in gtkcallback.inc
|
// 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
|
// by mouse: switches focus here and there, so
|
||||||
// focused control triggers OnExit and it looks
|
// focused control triggers OnExit and it looks
|
||||||
// like it triggered OnEnter.issue #20493
|
// 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;
|
TWidgetInfoFlags = set of TWidgetInfoFlag;
|
||||||
tGtkStateEnumRange = 0..31;
|
tGtkStateEnumRange = 0..31;
|
||||||
|
@ -4670,6 +4670,7 @@ function GetWidgetClientRect(TheWidget: PGtkWidget): TRect;
|
|||||||
var
|
var
|
||||||
Widget, ClientWidget: PGtkWidget;
|
Widget, ClientWidget: PGtkWidget;
|
||||||
AChild: PGtkWidget;
|
AChild: PGtkWidget;
|
||||||
|
WidgetInfo: PWidgetInfo;
|
||||||
|
|
||||||
procedure GetNoteBookClientRect(NBWidget: PGtkNotebook);
|
procedure GetNoteBookClientRect(NBWidget: PGtkNotebook);
|
||||||
var
|
var
|
||||||
@ -4707,6 +4708,12 @@ begin
|
|||||||
Result := Rect(0, 0, 0, 0);
|
Result := Rect(0, 0, 0, 0);
|
||||||
Widget := TheWidget;
|
Widget := TheWidget;
|
||||||
ClientWidget := GetFixedWidget(Widget);
|
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
|
if (ClientWidget <> nil) then
|
||||||
Widget := ClientWidget;
|
Widget := ClientWidget;
|
||||||
if (Widget <> nil) then
|
if (Widget <> nil) then
|
||||||
@ -6643,6 +6650,8 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateLCLSize;
|
procedure UpdateLCLSize;
|
||||||
|
var
|
||||||
|
WidgetInfo: PWidgetInfo;
|
||||||
begin
|
begin
|
||||||
LCLWidth:=LCLControl.Width;
|
LCLWidth:=LCLControl.Width;
|
||||||
LCLHeight:=LCLControl.Height;
|
LCLHeight:=LCLControl.Height;
|
||||||
@ -6651,6 +6660,11 @@ var
|
|||||||
WidthHeightChanged:=true;
|
WidthHeightChanged:=true;
|
||||||
//DebugLn(['UpdateLCLSize InvalidateClientRectCache ',DbgSName(LCLControl)]);
|
//DebugLn(['UpdateLCLSize InvalidateClientRectCache ',DbgSName(LCLControl)]);
|
||||||
LCLControl.InvalidateClientRectCache(false);
|
LCLControl.InvalidateClientRectCache(false);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
WidgetInfo := GetWidgetInfo(aWidget);
|
||||||
|
if (WidgetInfo <> nil) and (wwiClientRectWhilePendingSize in WidgetInfo^.Flags) then
|
||||||
|
LCLControl.InvalidateClientRectCache(false);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2277,6 +2277,7 @@ procedure TGtk2WidgetSet.SendCachedLCLMessages;
|
|||||||
IsTopLevelWidget: boolean;
|
IsTopLevelWidget: boolean;
|
||||||
TopologicalList: TFPList; // list of PGtkWidget;
|
TopologicalList: TFPList; // list of PGtkWidget;
|
||||||
i: integer;
|
i: integer;
|
||||||
|
WidgetInfo: PWidgetInfo;
|
||||||
|
|
||||||
procedure RaiseWidgetWithoutControl;
|
procedure RaiseWidgetWithoutControl;
|
||||||
begin
|
begin
|
||||||
@ -2322,6 +2323,8 @@ procedure TGtk2WidgetSet.SendCachedLCLMessages;
|
|||||||
SetWindowSizeAndPosition(PgtkWindow(Widget),TWinControl(LCLControl));
|
SetWindowSizeAndPosition(PgtkWindow(Widget),TWinControl(LCLControl));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
WidgetInfo := GetWidgetInfo(Widget);
|
||||||
|
if WidgetInfo <> nil then exclude(WidgetInfo^.Flags, wwiClientRectWhilePendingSize);
|
||||||
end;
|
end;
|
||||||
TopologicalList.Free;
|
TopologicalList.Free;
|
||||||
FWidgetsWithResizeRequest.Clear;
|
FWidgetsWithResizeRequest.Clear;
|
||||||
|
Loading…
Reference in New Issue
Block a user