Gtk3::TargetEntry

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Gtk3::TargetEntry

Jeff
Hi all,

In migrating my Gtk2 application to Gtk3, I am struggling to find the
new name for the Gtk3::TargetFlags

This doesn't work:

    my $target_entry = Gtk3::TargetEntry->new(
        'Glib::Scalar',    # some string representing the drag type
        Gtk3::TARGET_SAME_WIDGET,     # Gtk3::TargetFlags
        $ID_PAGE,          # some app-defined integer identifier
    );

Looking at the source, I can replace Gtk3::TARGET_SAME_WIDGET with 2,
which works, but rather isn't the point.

Thanks for any help.

Regards

Jeff


_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Gtk3::TargetEntry

Torsten Schoenfeld
On 06.12.2017 18:15, Jeff wrote:

> In migrating my Gtk2 application to Gtk3, I am struggling to find the
> new name for the Gtk3::TargetFlags
>
> This doesn't work:
>
>      my $target_entry = Gtk3::TargetEntry->new(
>          'Glib::Scalar',    # some string representing the drag type
>          Gtk3::TARGET_SAME_WIDGET,     # Gtk3::TargetFlags
>          $ID_PAGE,          # some app-defined integer identifier
>      );

GtkTargetFlags is represented as a normal flags class, so you should be
able to simply use, e.g., qw/same-widget/.  However, for some reason,
the C-level constructor underlying Gtk3::TargetEntry->new has the flags
argument typed simply as an unsigned integer, not as GtkTargetFlags.
Hence, all the conversion magic is never invoked.  I see three options
for you:

* Use the recently introduced
Glib::Object::Introspection->convert_sv_to_flags:

        Glib::Object::Introspection->convert_sv_to_flags (
                "Gtk3::TargetFlags", qw/same-widget/)

* Use the undocumented implementation detail that Glib::Flags objects
dereference to the underlying integer:

        ${Gtk3::TargetFlags->new (qw/same-widget/)}

* Add an override for Gtk3::TargetEntry->new to Gtk3.pm that takes care
of this automatically and submit a patch.  The override for
Gtk3::Widget->set_events might serve as an example.

-Torsten
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Gtk3 DragContext

Jeff
On 19/12/17 18:50, Torsten Schönfeld wrote:
>     ${Gtk3::TargetFlags->new (qw/same-widget/)}

Thanks for this.

Which leads me to my next problem:

It seems to be that the "drag-motion" signal shouldn't have changed
since Gtk2:

https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-drag-motion

However, the context seems to be now passed as
Glib::Object::_Unregistered::GdkX11DragContext. How do I dig out the
actions flag (i.e. move or copy) from this?

Regards

Jeff


_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Gtk3 DragContext

Torsten Schoenfeld
On 04.01.2018 18:43, Jeff wrote:
> It seems to be that the "drag-motion" signal shouldn't have changed
> since Gtk2:
>
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-drag-motion
>
> However, the context seems to be now passed as
> Glib::Object::_Unregistered::GdkX11DragContext. How do I dig out the
> actions flag (i.e. move or copy) from this?

This context object's class should inherit from Gtk3::Gdk::DragContext
so that you should be able to use the get_actions() method on the object.
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list