mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 14:18:14 +01:00
gtk2: remove Get/SetHiddenLCLObject and related code. The only place that was still being called is a dead code since at least 2003. Fixes issue #21021
git-svn-id: trunk@34592 -
This commit is contained in:
parent
5a73f54727
commit
4e8a2856a5
@ -225,7 +225,7 @@ end;
|
|||||||
function gtkRealizeAfterCB(Widget: PGtkWidget; Data: Pointer): GBoolean; cdecl;
|
function gtkRealizeAfterCB(Widget: PGtkWidget; Data: Pointer): GBoolean; cdecl;
|
||||||
var
|
var
|
||||||
WinWidgetInfo: PWidgetInfo;
|
WinWidgetInfo: PWidgetInfo;
|
||||||
HiddenLCLObject, LCLObject: TObject;
|
LCLObject: TObject;
|
||||||
NewEventMask: TGdkEventMask;
|
NewEventMask: TGdkEventMask;
|
||||||
TheWinControl: TWinControl;
|
TheWinControl: TWinControl;
|
||||||
ClientWidget: PGtkWidget;
|
ClientWidget: PGtkWidget;
|
||||||
@ -239,65 +239,56 @@ begin
|
|||||||
EventTrace('realizeafter', nil);
|
EventTrace('realizeafter', nil);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
HiddenLCLObject:=GetHiddenLCLObject(Widget);
|
MainWidget:=GetMainWidget(Widget);
|
||||||
if HiddenLCLObject=nil then begin
|
WinWidgetInfo:=GetWidgetInfo(MainWidget,true);
|
||||||
// this is a normal lcl wigdet
|
LCLObject:=GetLCLObject(MainWidget);
|
||||||
|
if (LCLObject<>nil) and (WinWidgetInfo<>nil) then begin
|
||||||
|
ClientWidget:=GetFixedWidget(Widget);
|
||||||
|
if (LCLObject is TWinControl) then
|
||||||
|
TheWinControl:=TWinControl(LCLObject)
|
||||||
|
else
|
||||||
|
TheWinControl:=nil;
|
||||||
|
|
||||||
MainWidget:=GetMainWidget(Widget);
|
// set extra signal masks after the widget window is created
|
||||||
WinWidgetInfo:=GetWidgetInfo(MainWidget,true);
|
// define extra events we're interrested in
|
||||||
LCLObject:=GetLCLObject(MainWidget);
|
//write('GTKRealizeAfterCB ');
|
||||||
if (LCLObject<>nil) and (WinWidgetInfo<>nil) then begin
|
//if TheWinControl<>nil then DbgOut(' ',TheWinControl.Name,':',TheWinControl.ClassName,' ',DbgS(TheWinControl.Handle));
|
||||||
ClientWidget:=GetFixedWidget(Widget);
|
//DebugLn(' Widget=',DbgS(Widget),' Fixed=',DbgS(GetFixedWidget(Widget)),' Main=',DbgS(GetMainWidget(Widget)));
|
||||||
if (LCLObject is TWinControl) then
|
if (TheWinControl<>nil) then begin
|
||||||
TheWinControl:=TWinControl(LCLObject)
|
//DebugLn(['gtkRealizeAfterCB ',GetWidgetDebugReport(Widget)]);
|
||||||
else
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
TheWinControl:=nil;
|
|
||||||
|
|
||||||
// set extra signal masks after the widget window is created
|
NewEventMask:=gdk_window_get_events(GetControlWindow(Widget))
|
||||||
// define extra events we're interrested in
|
or WinWidgetInfo^.EventMask;
|
||||||
//write('GTKRealizeAfterCB ');
|
gtk_widget_add_events(Widget,NewEventMask);
|
||||||
//if TheWinControl<>nil then DbgOut(' ',TheWinControl.Name,':',TheWinControl.ClassName,' ',DbgS(TheWinControl.Handle));
|
gdk_window_set_events(GetControlWindow(Widget),NewEventMask);
|
||||||
//DebugLn(' Widget=',DbgS(Widget),' Fixed=',DbgS(GetFixedWidget(Widget)),' Main=',DbgS(GetMainWidget(Widget)));
|
|
||||||
if (TheWinControl<>nil) then begin
|
|
||||||
//DebugLn(['gtkRealizeAfterCB ',GetWidgetDebugReport(Widget)]);
|
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
|
||||||
|
|
||||||
NewEventMask:=gdk_window_get_events(GetControlWindow(Widget))
|
if (ClientWidget<>nil) and (GetControlWindow(ClientWidget)<>nil)
|
||||||
|
and (GetControlWindow(ClientWidget)<>GetControlWindow(Widget)) then begin
|
||||||
|
//DebugLn(['gtkRealizeAfterCB ClientWindow<>Window']);
|
||||||
|
NewEventMask:=gdk_window_get_events(GetControlWindow(ClientWidget))
|
||||||
or WinWidgetInfo^.EventMask;
|
or WinWidgetInfo^.EventMask;
|
||||||
gtk_widget_add_events(Widget,NewEventMask);
|
gtk_widget_add_events(ClientWidget,WinWidgetInfo^.EventMask);
|
||||||
gdk_window_set_events(GetControlWindow(Widget),NewEventMask);
|
gdk_window_set_events(GetControlWindow(ClientWidget),NewEventMask);
|
||||||
|
|
||||||
if (ClientWidget<>nil) and (GetControlWindow(ClientWidget)<>nil)
|
|
||||||
and (GetControlWindow(ClientWidget)<>GetControlWindow(Widget)) then begin
|
|
||||||
//DebugLn(['gtkRealizeAfterCB ClientWindow<>Window']);
|
|
||||||
NewEventMask:=gdk_window_get_events(GetControlWindow(ClientWidget))
|
|
||||||
or WinWidgetInfo^.EventMask;
|
|
||||||
gtk_widget_add_events(ClientWidget,WinWidgetInfo^.EventMask);
|
|
||||||
gdk_window_set_events(GetControlWindow(ClientWidget),NewEventMask);
|
|
||||||
end;
|
|
||||||
//DebugLn('BBB1 ',DbgS(NewEventMask),8),' ',DbgS(Cardinal(gdk_window_get_events(Widget^.Window)));
|
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
//DebugLn('BBB1 ',DbgS(NewEventMask),8),' ',DbgS(Cardinal(gdk_window_get_events(Widget^.Window)));
|
||||||
if TheWinControl<>nil then
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
begin
|
|
||||||
TheWinControl.CNPreferredSizeChanged;
|
|
||||||
TGtkPrivateWidgetClass(TheWinControl.WidgetSetClass.WSPrivate).UpdateCursor(WinWidgetInfo);
|
|
||||||
ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
|
|
||||||
|
|
||||||
if TheWinControl is TCustomPage then
|
|
||||||
UpdateNotebookPageTab(nil,TheWinControl);
|
|
||||||
|
|
||||||
if TheWinControl is TCustomForm then
|
|
||||||
SetFormShowInTaskbar(TCustomForm(TheWinControl),
|
|
||||||
TCustomForm(TheWinControl).ShowInTaskbar);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end else begin
|
|
||||||
// this is a hidden child widget of a lcl widget
|
if TheWinControl<>nil then
|
||||||
if HiddenLCLObject is TWinControl then
|
begin
|
||||||
ConnectInternalWidgetsSignals(Widget,TWinControl(HiddenLCLObject));
|
TheWinControl.CNPreferredSizeChanged;
|
||||||
|
TGtkPrivateWidgetClass(TheWinControl.WidgetSetClass.WSPrivate).UpdateCursor(WinWidgetInfo);
|
||||||
|
ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
|
||||||
|
|
||||||
|
if TheWinControl is TCustomPage then
|
||||||
|
UpdateNotebookPageTab(nil,TheWinControl);
|
||||||
|
|
||||||
|
if TheWinControl is TCustomForm then
|
||||||
|
SetFormShowInTaskbar(TCustomForm(TheWinControl),
|
||||||
|
TCustomForm(TheWinControl).ShowInTaskbar);
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -3708,22 +3708,6 @@ begin
|
|||||||
else Result := nil;
|
else Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
|
||||||
Some need the HiddenLCLobject which created a parent of this widget.
|
|
||||||
|
|
||||||
MWE: is this obsolete ?
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
procedure SetHiddenLCLObject(const Widget: Pointer; const AnObject: TObject);
|
|
||||||
begin
|
|
||||||
if (Widget <> nil) then
|
|
||||||
gtk_object_set_data(Widget, 'LCLHiddenClass', Pointer(AnObject));
|
|
||||||
end;
|
|
||||||
|
|
||||||
function GetHiddenLCLObject(const Widget: Pointer): TObject;
|
|
||||||
begin
|
|
||||||
Result := TObject(gtk_object_get_data(Widget, 'LCLHiddenClass'));
|
|
||||||
end;
|
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
function GetNearestLCLObject(Widget: PGtkWidget): TObject;
|
function GetNearestLCLObject(Widget: PGtkWidget): TObject;
|
||||||
|
|
||||||
@ -4927,13 +4911,6 @@ end;
|
|||||||
procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
|
procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
|
||||||
AWinControl: TWinControl);
|
AWinControl: TWinControl);
|
||||||
|
|
||||||
function WidgetIsInternal(TheWidget: PGtkWidget): boolean;
|
|
||||||
begin
|
|
||||||
Result:=(TheWidget<>nil)
|
|
||||||
and (PGtkWidget(AWinControl.Handle)<>TheWidget)
|
|
||||||
and (gtk_object_get_data(PGtkObject(TheWidget), 'Main')=nil);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ConnectSignals(TheWidget: PGtkWidget); forward;
|
procedure ConnectSignals(TheWidget: PGtkWidget); forward;
|
||||||
|
|
||||||
procedure ConnectChilds(TheWidget: PGtkWidget);
|
procedure ConnectChilds(TheWidget: PGtkWidget);
|
||||||
@ -4975,7 +4952,7 @@ procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
|
|||||||
|
|
||||||
procedure ConnectSignals(TheWidget: PGtkWidget);
|
procedure ConnectSignals(TheWidget: PGtkWidget);
|
||||||
var
|
var
|
||||||
LCLObject, HiddenLCLObject: TObject;
|
LCLObject: TObject;
|
||||||
DesignSignalType: TDesignSignalType;
|
DesignSignalType: TDesignSignalType;
|
||||||
DesignFlags: TConnectSignalFlags;
|
DesignFlags: TConnectSignalFlags;
|
||||||
begin
|
begin
|
||||||
@ -4983,13 +4960,9 @@ procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
|
|||||||
if TheWidget=nil then exit;
|
if TheWidget=nil then exit;
|
||||||
// check if TheWidget belongs to another LCL object
|
// check if TheWidget belongs to another LCL object
|
||||||
LCLObject:=GetLCLObject(TheWidget);
|
LCLObject:=GetLCLObject(TheWidget);
|
||||||
HiddenLCLObject:=GetHiddenLCLObject(TheWidget);
|
|
||||||
if (LCLObject<>nil) and (LCLObject<>AWinControl) then begin
|
if (LCLObject<>nil) and (LCLObject<>AWinControl) then begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if (HiddenLCLObject<>nil) and (HiddenLCLObject<>AWinControl) then begin
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
//if AWinControl is TListView then DebugLn('ConnectSignals B ',DbgS(TheWidget));
|
//if AWinControl is TListView then DebugLn('ConnectSignals B ',DbgS(TheWidget));
|
||||||
// connect signals needed for design mode:
|
// connect signals needed for design mode:
|
||||||
@ -5008,10 +4981,6 @@ procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
|
|||||||
DesignFlags);
|
DesignFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if WidgetIsInternal(TheWidget) then
|
|
||||||
// mark widget as 'hidden' connected
|
|
||||||
SetHiddenLCLObject(TheWidget,AWinControl);
|
|
||||||
|
|
||||||
// connect recursively ...
|
// connect recursively ...
|
||||||
ConnectChilds(TheWidget);
|
ConnectChilds(TheWidget);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -341,8 +341,6 @@ procedure DestroyWidget(Widget: PGtkWidget);
|
|||||||
procedure SetLCLObject(const Widget: Pointer; const AnObject: TObject);
|
procedure SetLCLObject(const Widget: Pointer; const AnObject: TObject);
|
||||||
function GetLCLObject(const Widget: Pointer): TObject;
|
function GetLCLObject(const Widget: Pointer): TObject;
|
||||||
function GetNearestLCLObject(Widget: PGtkWidget): TObject;
|
function GetNearestLCLObject(Widget: PGtkWidget): TObject;
|
||||||
procedure SetHiddenLCLObject(const Widget: Pointer; const AnObject: TObject);
|
|
||||||
function GetHiddenLCLObject(const Widget: Pointer): TObject;
|
|
||||||
function GetWinControlWidget(Child: PGtkWidget): PGtkWidget;
|
function GetWinControlWidget(Child: PGtkWidget): PGtkWidget;
|
||||||
function GetWinControlFixedWidget(Child: PGtkWidget): PGtkWidget;
|
function GetWinControlFixedWidget(Child: PGtkWidget): PGtkWidget;
|
||||||
function FindFixedChildListItem(ParentFixed: PGtkFixed; Child: PGtkWidget): PGList;
|
function FindFixedChildListItem(ParentFixed: PGtkFixed; Child: PGtkWidget): PGList;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user