mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 22:57:15 +01:00
gtk intf: resize messages for fixed/client widgets are now kept back and sent for main widgets
git-svn-id: trunk@11184 -
This commit is contained in:
parent
8d6bdc994f
commit
759a269ca6
@ -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]
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -717,6 +717,8 @@ type
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property ChildSizing;
|
||||
property ClientHeight;
|
||||
property ClientWidth;
|
||||
property Color;
|
||||
property ColumnLayout;
|
||||
property Columns;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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}
|
||||
LCLControl:=TWinControl(GetLCLObject(MainWidget));
|
||||
DebugLn('SendSizeNotificationToLCL ',DbgSName(LCLControl),' MainWidget=',WidgetFlagsToString(MainWidget),' Ignored, because not realized ');
|
||||
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(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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -56,7 +56,6 @@ begin
|
||||
True : gtk_combo_box_popup(Combo);
|
||||
False: gtk_combo_box_popdown(Combo);
|
||||
end;
|
||||
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user