Intertangle::API::Gtk3::Helper - Collection of helper utilities for Gtk3 and Glib
version 0.007
fun _setup_disable_xinput2() {
Checks to see if running under X11 and that the environment variable $ENV{INTERTANGLE_API_GTK3_USE_XINPUT2} is not set to a true value. If so, disables the XInput 2 extension.
$ENV{INTERTANGLE_API_GTK3_USE_XINPUT2}
This is necessary because GDK has an issue with some forms of mouse scrolling under XInput 2. XInput 2 provides support for smooth scrolling, but sometimes it sends emulated smooth scroll events that have zero for their deltas when dealing with mice that do not support smooth scrolling natively (i.e., they use buttons 4 and 5). This prevents widgets from responding.
This is similar to $ENV{GDK_CORE_DEVICE_EVENTS} as documented here https://developer.gnome.org/gtk3/stable/gtk-x11.html.
$ENV{GDK_CORE_DEVICE_EVENTS}
fun _setup_gtk()
Setup Gtk3.
First, this calls _setup_disable_xinput2().
_setup_disable_xinput2()
Then this initialises Gtk3.
gval
classmethod gval( $glib_typename, $value )
Given a Glib type name, wraps a Perl value in an object that can be passed to other Glib-based functions.
$glib_typename
The name of a type under the Glib:: namespace. For example, passing in "int" gives a wrapper to the gint C type which is known as Glib::Int in Perl.
Glib::
"int"
gint
Glib::Int
$value
The value to put inside the wrapper.
See Glib::Object::Introspection::GValueWrapper in Glib::Object::Introspection for more information.
classmethod genum( $package, $sv )
Returns an enumeration value of type $package which contains the matching enum value given in $sv as a string.
$package
$sv
The package name of a Glib enumeration.
A string representation of the enumeration value.
For example, for GtkPackType enum, we set $package to 'Gtk3::PackType' and $sv to 'GTK_PACK_START'. This can be passed on to other Glib::Object::Introspection methods.
'Gtk3::PackType'
'GTK_PACK_START'
classmethod callback( $invocant, $callback_name, @args )
A helper function to redirect to other callback functions. Given an $invocant and the name of the callback function, $callback_name, which is defined in the package of $invocant, calls that function with arguments ( @args, $invocant ).
$invocant
$callback_name
( @args, $invocant )
For example, if we are trying to call the callback function Target::Package::on_event_cb and $target is a blessed reference of type Target::Package, then by using
Target::Package::on_event_cb
$target
Target::Package
Intertangle::API::Gtk3::Helper->callback( $target, on_event_cb => @rest_of_args );
effectively calls
Target::Package::on_event_cb( @rest_of_args, $target );
Zakariyya Mughal <zmughal@cpan.org>
This software is copyright (c) 2017 by Zakariyya Mughal.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Intertangle::API::Gtk3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Intertangle::API::Gtk3
CPAN shell
perl -MCPAN -e shell install Intertangle::API::Gtk3
For more information on module installation, please visit the detailed CPAN module installation guide.