From 759a269ca601dbaaa730c3096361aacbad82deab Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 23 May 2007 17:32:10 +0000 Subject: [PATCH] gtk intf: resize messages for fixed/client widgets are now kept back and sent for main widgets git-svn-id: trunk@11184 - --- components/codetools/Makefile.fpc | 1 - components/codetools/allcodetoolunits.pp | 2 ++ lcl/extctrls.pp | 2 ++ lcl/interfaces/gtk/gtkcallback.inc | 30 ++++++++++++------------ lcl/interfaces/gtk/gtkglobals.pp | 2 ++ lcl/interfaces/gtk/gtkobject.inc | 1 + lcl/interfaces/gtk/gtkproc.inc | 29 +++++++++++++++-------- lcl/interfaces/gtk/gtkproc.pp | 2 +- lcl/interfaces/gtk2/gtk2lclintf.inc | 1 - lcl/interfaces/gtk2/gtk2wsstdctrls.pp | 2 +- lcl/themes.pas | 10 ++++---- tools/install/rpm/fpc.spec.template | 23 ++++++++++-------- 12 files changed, 61 insertions(+), 44 deletions(-) diff --git a/components/codetools/Makefile.fpc b/components/codetools/Makefile.fpc index 621378569a..cac5936e37 100644 --- a/components/codetools/Makefile.fpc +++ b/components/codetools/Makefile.fpc @@ -23,7 +23,6 @@ implicitunits=codetoolsstrconsts avl_tree basiccodetools codecache sourcelog \ methodjumptool eventcodetool codecompletiontool codeatom codetree \ definetemplates expreval keywordfunclists linkscanner sourcechanger \ fileprocs codetoolsstructs codetoolmanager \ - memcheck \ laz_dom laz_xmlcfg laz_xmlread laz_xmlwrite [clean] diff --git a/components/codetools/allcodetoolunits.pp b/components/codetools/allcodetoolunits.pp index 927b973c27..4ee61a05ba 100644 --- a/components/codetools/allcodetoolunits.pp +++ b/components/codetools/allcodetoolunits.pp @@ -14,7 +14,9 @@ unit AllCodeToolUnits; interface uses + {$IF defined(VER2_0) or defined(VER2_1) or defined(VER2_2)} MemCheck, + {$ENDIF} CodeToolManager, CustomCodeTool, PascalParserTool, PascalReaderTool, FindDeclarationTool, StdCodeTools, MethodJumpTool, EventCodeTool, CodeCompletionTool, LinkScanner, FindDeclarationCache, BasicCodeTools, diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index cf8a2e0a8b..9cea4ed52e 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -717,6 +717,8 @@ type property BorderSpacing; property Caption; property ChildSizing; + property ClientHeight; + property ClientWidth; property Color; property ColumnLayout; property Columns; diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index 331ff0463b..577597eacb 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -1122,6 +1122,8 @@ begin if TheForm.Parent = nil then begin // toplevel window // send a WMSize Message (see TCustomForm.WMSize) + // ToDo: this might be too early to use the Widget^.Allocation + // Either send this message later or find a better way to determine the size (including the client area) GtkWidth:=Widget^.Allocation.Width; if GtkWidth<0 then GtkWidth:=0; GtkHeight:=Widget^.Allocation.Height; @@ -2350,13 +2352,6 @@ begin exit; end; - { The gtk sends the size messages after the resizing. Therefore the parent - widget is already resized, but the parent resize message will be emitted - after all its childs. So, the gtk resizes in top-bottom order, just like the - LCL. But it sends size messages in bottom-top order, which results in - many resizes in the LCL. - Therefore all resize messages between lcl and gtk are cached. - } {$IFDEF VerboseSizeMsg} DebugLn('gtksize_allocateCB: ', TControl(Data).Name+':'+TControl(Data).ClassName, @@ -2373,13 +2368,19 @@ begin DebugLn('VFP gtksize_allocateCB: ',TControl(Data).ClassName,' ',dbgs(Size^.X),',',dbgs(Size^.Y)); {$ENDIF} if GTK_WIDGET_REALIZED(Widget) then begin + { The gtk sends the size messages after the resizing. Therefore the parent + widget is already resized, but the parent resize message will be emitted + after all its childs. So, the gtk resizes in top-bottom order, just like the + LCL. But it sends size messages in bottom-top order, which can result in + many resizes in the LCL. + } {$IFDEF Gtk1} + // All resize messages between lcl and gtk1 are cached. SaveSizeNotification(Widget); {$ELSE} - if GetFixedWidget(Widget)=Widget then - SendSizeNotificationToLCL(Widget) - else - SaveSizeNotification(Widget); + // The resize messages of the inner widget of a Control is cached. + // This is the resize of a outer widget and sent to the LCL immediately. + SendSizeNotificationToLCL(Widget); {$ENDIF} end; end; @@ -2409,11 +2410,10 @@ begin MainWidget:=PGtkWidget(TWinControl(Data).Handle); ClientWidget:=GetFixedWidget(MainWidget); if GTK_WIDGET_REALIZED(ClientWidget) then begin - {$IFDEF Gtk1} + // the gtk resizes bottom to top, that means the + // inner widget (client area) is resized before the outer widget + // is resized. Because the LCL reads both sizes, keep this message back. SaveClientSizeNotification(ClientWidget); - {$ELSE} - SendSizeNotificationToLCL(MainWidget); - {$ENDIF} end; end else begin // owner is not TWinControl -> ignore diff --git a/lcl/interfaces/gtk/gtkglobals.pp b/lcl/interfaces/gtk/gtkglobals.pp index 584b5b21b4..9a2e34c2dc 100644 --- a/lcl/interfaces/gtk/gtkglobals.pp +++ b/lcl/interfaces/gtk/gtkglobals.pp @@ -374,6 +374,8 @@ var // each fixed widget that was resized by the gtk is stored here // (hasharray of PGtkWidget) FFixWidgetsResized: TDynHashArray; + // each widget that should be to the LCL bounds is stored here + // (hasharray of PGtkWidget) FWidgetsWithResizeRequest: TDynHashArray; // hasharray of PGtkWidget const diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 1d175d8460..f0620cfe50 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -1592,6 +1592,7 @@ Begin aWinControl.Parent := nil; aWinControl.Parent := aParent; end; + DebugLn(['TGtkWidgetSet.RecreateWnd ',DbgSName(Sender)]); ResizeChild(Sender,aWinControl.Left,aWinControl.Top, aWinControl.Width,aWinControl.Height); ShowHide(Sender); diff --git a/lcl/interfaces/gtk/gtkproc.inc b/lcl/interfaces/gtk/gtkproc.inc index d9a9d63e4f..c7854f3aa2 100644 --- a/lcl/interfaces/gtk/gtkproc.inc +++ b/lcl/interfaces/gtk/gtkproc.inc @@ -6442,7 +6442,7 @@ begin //debugln('GetGTKDefaultSize PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); end; -procedure SendSizeNotificationToLCL(MainWidget: PGtkWidget); +procedure SendSizeNotificationToLCL(aWidget: PGtkWidget); var LCLControl: TWinControl; LCLLeft, LCLTop, LCLWidth, LCLHeight: integer; @@ -6452,6 +6452,8 @@ var SizeMsg: TLMSize; MoveMsg: TLMMove; PosMsg : TLMWindowPosChanged; + MainWidget: PGtkWidget; + FixedWidget: PGtkWidget; procedure UpdateLCLRect; begin @@ -6465,20 +6467,27 @@ var end; begin - if not GTK_WIDGET_REALIZED(MainWidget) then begin + LCLControl:=TWinControl(GetLCLObject(aWidget)); + if LCLControl=nil then exit; + {$IFDEF VerboseSizeMsg} + DebugLn('SendSizeNotificationToLCL checking ... ',DbgSName(LCLControl),' aidget=',WidgetFlagsToString(aWidget)); + {$ENDIF} + MainWidget:=PGtkWidget(LCLControl.Handle); + FixedWidget:=PGtkWidget(GetFixedWidget(MainWidget)); + + FWidgetsResized.Remove(MainWidget); + FFixWidgetsResized.Remove(FixedWidget); + + if not GTK_WIDGET_REALIZED(aWidget) then begin + // the widget is not yet realized, so this GTK resize was not a user change. + // => ignore {$IFDEF VerboseSizeMsg} - LCLControl:=TWinControl(GetLCLObject(MainWidget)); - DebugLn('SendSizeNotificationToLCL ',DbgSName(LCLControl),' MainWidget=',WidgetFlagsToString(MainWidget),' Ignored, because not realized '); + LCLControl:=TWinControl(GetLCLObject(aWidget)); + DebugLn('SendSizeNotificationToLCL ',DbgSName(LCLControl),' aWidget=',WidgetFlagsToString(aWidget),' Ignored, because not realized '); {$ENDIF} exit; end; - LCLControl:=TWinControl(GetLCLObject(MainWidget)); - if LCLControl=nil then exit; - {$IFDEF VerboseSizeMsg} - DebugLn('SendSizeNotificationToLCL checking ... ',DbgSName(LCLControl),' MainWidget=',WidgetFlagsToString(MainWidget)); - {$ENDIF} - GtkLeft:=MainWidget^.Allocation.X; GtkTop:=MainWidget^.Allocation.Y; diff --git a/lcl/interfaces/gtk/gtkproc.pp b/lcl/interfaces/gtk/gtkproc.pp index 82b780fa93..4c5f20492a 100644 --- a/lcl/interfaces/gtk/gtkproc.pp +++ b/lcl/interfaces/gtk/gtkproc.pp @@ -704,7 +704,7 @@ procedure SaveClientSizeNotification(FixWidget: PGtkWidget); function CreateTopologicalSortedWidgets(HashArray: TDynHashArray): TFPList; procedure GetGTKDefaultWidgetSize(AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); -procedure SendSizeNotificationToLCL(MainWidget: PGtkWidget); +procedure SendSizeNotificationToLCL(aWidget: PGtkWidget); procedure SendCachedGtkResizeNotifications; procedure RealizeWidgetSize(Widget: PGtkWidget; NewWidth, NewHeight: integer); procedure SetWidgetSizeAndPosition(LCLControl: TWinControl); diff --git a/lcl/interfaces/gtk2/gtk2lclintf.inc b/lcl/interfaces/gtk2/gtk2lclintf.inc index 3849c117e7..e63847e3bf 100644 --- a/lcl/interfaces/gtk2/gtk2lclintf.inc +++ b/lcl/interfaces/gtk2/gtk2lclintf.inc @@ -56,7 +56,6 @@ begin True : gtk_combo_box_popup(Combo); False: gtk_combo_box_popdown(Combo); end; - Result:=true; end; diff --git a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp index eadd8a282a..6bec5a32ac 100644 --- a/lcl/interfaces/gtk2/gtk2wsstdctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wsstdctrls.pp @@ -1281,7 +1281,7 @@ begin Max(0,aHeight-FrameBorders.Top-FrameBorders.Bottom)); Result:=true; end; - //if Result then DebugLn(['TGtk2WSCustomGroupBox.GetDefaultClientRect AAA2 FrameBorders=',dbgs(FrameBorders),' aClientRect=',dbgs(aClientRect)]); + //if Result then DebugLn(['TGtk2WSCustomGroupBox.GetDefaultClientRect END FrameBorders=',dbgs(FrameBorders),' aClientRect=',dbgs(aClientRect)]); end; initialization diff --git a/lcl/themes.pas b/lcl/themes.pas index d20aba42b9..bf1160a49e 100644 --- a/lcl/themes.pas +++ b/lcl/themes.pas @@ -474,16 +474,16 @@ function ThemeServices: TThemeServices; function ThemedElementDetailsEqual(D1, D2: TThemedElementDetails): Boolean; //---------------------------------------------------------------------------------------------------------------------- +const + // Do not modify the copyright in any way! Usage of this unit is prohibited without the copyright notice + // in the compiled binary file. + ThemeManagerCopyright: string = 'Theme manager © 2001-2005 Mike Lischke'; + implementation uses SysUtils, ComCtrls, InterfaceBase, LCLIntf, GraphType, Graphics; -const - // Do not modify the copyright in any way! Usage of this unit is prohibited without the copyright notice - // in the compiled binary file. - Copyright: string = 'Theme manager © 2001-2005 Mike Lischke'; - //---------------------------------------------------------------------------------------------------------------------- function ThemeServices: TThemeServices; diff --git a/tools/install/rpm/fpc.spec.template b/tools/install/rpm/fpc.spec.template index 6bb0fb8e68..80ef5c0722 100644 --- a/tools/install/rpm/fpc.spec.template +++ b/tools/install/rpm/fpc.spec.template @@ -60,9 +60,11 @@ automatical-code generation purposes. %build # The source-files: mkdir -p fpcsrc -cp -a rtl fpcsrc -cp -a fcl fpcsrc -cp -a packages fpcsrc +cp -a rtl fpcsrc/ +if [ -d fcl ]; then + cp -a fcl fpcsrc/ +fi +cp -a packages fpcsrc/ rm -rf packages/extra/amunits rm -rf packages/extra/winunits @@ -72,14 +74,15 @@ fi NEWPP=`pwd`/compiler/%{ppcname} NEWFPDOC=`pwd`/utils/fpdoc/fpdoc DATA2INC=`pwd`/utils/data2inc -make compiler_cycle FPC=${STARTPP} -make rtl_clean rtl_smart FPC=${NEWPP} -make packages_base_smart FPC=${NEWPP} -make fcl_smart FPC=${NEWPP} +make clean all FPC=${STARTPP} +#make compiler_cycle FPC=${STARTPP} +#make rtl_clean rtl_smart FPC=${NEWPP} +#make packages_base_smart FPC=${NEWPP} +#make fcl_smart FPC=${NEWPP} #make fv_smart FPC=${NEWPP} -make packages_extra_smart FPC=${NEWPP} +#make packages_extra_smart FPC=${NEWPP} #make ide_all FPC=${NEWPP} -make utils_all FPC=${NEWPP} DATA2INC=${DATA2INC} +#make utils_all FPC=${NEWPP} DATA2INC=${DATA2INC} # disable the debuginfo package %define debug_package %{nil} @@ -100,7 +103,7 @@ INSTALLOPTS="FPC=${NEWPP} FPCMAKE=${FPCMAKE} \ make compiler_install ${INSTALLOPTS} make rtl_install ${INSTALLOPTS} make packages_install ${INSTALLOPTS} -make fcl_install ${INSTALLOPTS} +#make fcl_install ${INSTALLOPTS} #make fv_install ${INSTALLOPTS} #make ide_install ${INSTALLOPTS} make utils_install ${INSTALLOPTS}