11-- ----------------------------------------------------------------------------
22-- GtkAda - Ada95 binding for Gtk+/Gnome --
33-- --
4- -- Copyright (C) 2001-2019 , AdaCore --
4+ -- Copyright (C) 2001-2020 , AdaCore --
55-- --
66-- This library is free software; you can redistribute it and/or modify it --
77-- under terms of the GNU General Public License as published by the Free --
@@ -3394,11 +3394,16 @@ package body Gtkada.MDI is
33943394 Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return MDI_Child
33953395 is
33963396 Tmp : Widget_List.Glist;
3397+ Child_Widget : constant Gtk_Widget :=
3398+ (if Widget /= null then
3399+ Gtk_Widget_Record (Widget.all )'Unchecked_Access
3400+ else
3401+ null );
33973402 begin
33983403 Tmp := First (MDI.Items);
33993404
34003405 while Tmp /= Null_List loop
3401- if MDI_Child (Get_Data (Tmp)).Initial = Gtk_Widget (Widget) then
3406+ if MDI_Child (Get_Data (Tmp)).Initial = Child_Widget then
34023407 return Insert_Child_If_Needed (MDI, MDI_Child (Get_Data (Tmp)));
34033408 end if ;
34043409
@@ -3591,7 +3596,8 @@ package body Gtkada.MDI is
35913596 -- Temporary fool the system, so that the child doesn't necessarily
35923597 -- gain the focus. Otherwise, switching a notebook page gives the
35933598 -- child the focus.
3594- Child.MDI.Focus_Child := MDI_Child (Child);
3599+ Child.MDI.Focus_Child :=
3600+ MDI_Child_Record (Child.all )'Unchecked_Access;
35953601
35963602 -- There could be no parent if we are in all-floating mode
35973603 if Note /= null then
@@ -3724,11 +3730,13 @@ package body Gtkada.MDI is
37243730
37253731 procedure Set_Focus_Child (Child : not null access MDI_Child_Record) is
37263732 Old : constant MDI_Child := Child.MDI.Focus_Child;
3727- C : constant MDI_Child := MDI_Child ( Child) ;
3733+ C : constant MDI_Child := Child. all 'Unchecked_Access ;
37283734 Tmp : Boolean;
37293735 pragma Unreferenced (Tmp);
37303736
37313737 Previous_Focus_Child : constant MDI_Child := Child.MDI.Focus_Child;
3738+ Widget : constant Gtk_Widget :=
3739+ Gtk_Widget_Record (Child.all )'Unchecked_Access;
37323740 begin
37333741 if Child.MDI.Loading_Desktop then
37343742 return ;
@@ -3752,7 +3760,7 @@ package body Gtkada.MDI is
37523760 -- point (might be called because we insert the child in a notebook
37533761 -- first for instance)
37543762
3755- if Widget_List.Find (C.MDI.Items, Gtk_Widget (Child) ) = Null_List then
3763+ if Widget_List.Find (C.MDI.Items, Widget ) = Null_List then
37563764 return ;
37573765 end if ;
37583766
@@ -3775,8 +3783,8 @@ package body Gtkada.MDI is
37753783 Update_Tab_Color (Get_Notebook (C), True);
37763784
37773785 Ref (C);
3778- Remove (C.MDI.Items, Gtk_Widget (Child) );
3779- Prepend (C.MDI.Items, Gtk_Widget (Child) );
3786+ Remove (C.MDI.Items, Widget );
3787+ Prepend (C.MDI.Items, Widget );
37803788 Unref (C);
37813789
37823790 -- Make sure the page containing Child in a notebook is put on top.
0 commit comments