From 58530e0ae686edd91aa6bc5800d599004f381ace Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 17 Feb 2015 23:51:22 +0000 Subject: [PATCH] LCL: gtk2: GetPreferredSize: subtract client area git-svn-id: branches/fixes_1_4@47870 - --- lcl/interfaces/gtk2/gtk2proc.inc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lcl/interfaces/gtk2/gtk2proc.inc b/lcl/interfaces/gtk2/gtk2proc.inc index 6c22af445d..7aa042a27e 100644 --- a/lcl/interfaces/gtk2/gtk2proc.inc +++ b/lcl/interfaces/gtk2/gtk2proc.inc @@ -6405,23 +6405,41 @@ procedure GetGTKDefaultWidgetSize(AWinControl: TWinControl; var Widget: PGtkWidget; Requisition: TGtkRequisition; + FixedWidget: PGtkWidget; begin Widget := {%H-}PGtkWidget(AWinControl.Handle); + //if AWinControl.Name='OtherInfoGroupBox' then + // DebugLn(['GetGTKDefaultWidgetSize ',GetWidgetDebugReport(Widget)]); + // set size to default - //DebugLn(['GetGTKDefaultWidgetSize ',GetWidgetDebugReport(Widget)]); gtk_widget_set_size_request(Widget, -1, -1); // ask default size gtk_widget_size_request(Widget,@Requisition); PreferredWidth:=Requisition.width; PreferredHeight:=Requisition.height; - {DebugLn(['GetGTKDefaultWidgetSize Allocation=',Widget^.allocation.x,',',Widget^.allocation.y,',',Widget^.allocation.width,',',Widget^.allocation.height, - ' requisition=',Widget^.requisition.width,',',Widget^.requisition.height, - ' PreferredWidth=',PreferredWidth,' PreferredHeight=',PreferredHeight, - ' WithThemeSpace=',WithThemeSpace]);} + + {if AWinControl.Name='OtherInfoGroupBox' then + DebugLn(['GetGTKDefaultWidgetSize Allocation=',Widget^.allocation.x,',',Widget^.allocation.y,',',Widget^.allocation.width,',',Widget^.allocation.height, + ' requisition=',Widget^.requisition.width,',',Widget^.requisition.height, + ' PreferredWidth=',PreferredWidth,' PreferredHeight=',PreferredHeight, + ' WithThemeSpace=',WithThemeSpace]); } + + if GtkWidgetIsA(Widget,GTK_TYPE_EVENT_BOX) then begin + FixedWidget:=PGtkWidget(GetFixedWidget(Widget)); + if FixedWidget<>nil then begin + {if AWinControl.Name='OtherInfoGroupBox' then + debugln(['GetGTKDefaultWidgetSize Fixed ', + ' allocation=',FixedWidget^.allocation.x,',',FixedWidget^.allocation.y,',',FixedWidget^.allocation.width,',',FixedWidget^.allocation.height, + ' requisition=',FixedWidget^.requisition.width,',',FixedWidget^.requisition.height]);} + dec(PreferredWidth,Max(0,FixedWidget^.requisition.width)); + dec(PreferredHeight,Max(0,FixedWidget^.requisition.height)); + end; + end; // restore size gtk_widget_set_size_request(Widget, AWinControl.Width, AWinControl.Height); - //debugln('GetGTKDefaultSize PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); + //if AWinControl.Name='OtherInfoGroupBox' then + // debugln('GetGTKDefaultSize PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); end; procedure SendSizeNotificationToLCL(aWidget: PGtkWidget);