Re: Gtk::Builder::get_widget_derived() Issue on Fedora 33

Kjell Ahlstedt via gtkmm-list <[email protected]> Sun, 15 Nov 2020 13:19:19 +0100
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <[email protected]>
On 2020-11-14 14:56, ahmet öztürk via gtkmm-list wrote:
> Hi all,
>
> On Fedora 33, derived widgets does not seem to be constructed properly 
> by Gtk::Builder::get_widget_derived(). The reason I think so is that 
> the overridden methods are not called for these widgets. Apart from 
> that everything seems normal. No error message or anything.
>
> I attached a sample code with a very simple case to replicate this 
> problem. on_button_press_event() is never called for the derived widget.
>
> I have also noticed that if a dummy instance of the derived widget is 
> created separately (using another constructor) before calling 
> Gkt::Builder::add_from_string(), then the widget created by Builder 
> also works normally.
>
> Please note that this may not occur on all distributions. e.g. I know 
> that it does not occur on Arch Linux.
>
> Does anybody know if this a Fedora 33 specific issue or is it due to a 
> recent update in Gtkmm that is only affecting Fedora for now?
>
The issue does not occur on Ubuntu 20.04 with the latest gtk+3 and 
gtkmm3 from the git repo.

It looks as if the gtkmm__GtkTextView class has not been registered in 
the GType system before get_widget_derived() is called. That should have 
been done by Gtk::wrap_init() which is called from 
Gtk::Application::create().

You can test if I'm right. Add
    std::cout << "GType name: " << 
G_OBJECT_TYPE_NAME(m_TextView->gobj()) << std::endl;
after the call to get_widget_derived(). When the overloaded function is 
not called, I suspect that the output will be
    GType name: GtkTextView
When you've uncommented TVDerived dummy;, and everything is okay, the 
output is probably
   GType name: gtkmm__GtkTextView

If I'm right, it looks like a Fedora specific issue. It can't be due to 
a recent update in gtkmm (I've tested with the very latest one), unless 
there is some Fedora specific update.

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list