Re: Use of Gtk3::Gdk::EventMask with Gtk3::Widget::{set,get,add}_events



On 12.04.2017 20:51, Zakariyya Mughal wrote:
I noticed that the methods

    $widget->set_events( ... )
    $widget->get_events( ... )
    $widget->add_events( ... )

did not seem to be taking a `Glib::Flags` of type `Gtk3::Gdk::EventMask`
as would be expected by reading the documentation. Looking at the
`gtk+-3` source code, I see that the function signatures are using
`gint` instead of `GdkEventMask`. It looks like the type annotation
needs to be updated.

Yes, that's the core of the problem, and the bug reports are there to
make the gtk+ devs know.

Until the issue is fixed in gtk+, we could use overrides in Gtk3 to hide
the problem.  With the helper functions I just added to G:O:I*, this can
be done with the attached patch.  The problem is that this would change
the semantics of Gtk3::Widget::get_events: it would now return a
Glib::Flags object instead of a raw integer.  Since Glib::Flags
currently does not support raw integers, comparisons like
$widget->get_events == 0 would now fail.  (The corresponding tests in
the patch fail.)

So, should we worry about this?  Or just go ahead anyway and document
the change?

*
https://git.gnome.org/browse/perl-Glib-Object-Introspection/commit/?id=15c0b5122fbcf588625b4f3c2c9135e78b7f321a

Attachment: 0001-Add-overrides-for-Gtk3-Widget-add_events-set_events-.patch
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]