Gtk2::Gdk::Device(3)
π Gtk2::Gdk::Device β the manual page, but make it a group chat π
okay bestie, so this is Gtk2::Gdk::Device, and it's a thing from the User Contributed Perl Documentation corner of the world. it's a wrapper for GdkDevice β¨ like, it's the little Perl-friendly glow-up around the C struct, and honestly? she ate. let's get into it π«Ά
π HIERARCHY π
here's the family tree, and yes she's an only child:
Glib::Object
+----Gtk2::Gdk::Device
so like, everything Glib::Object can do, she can do too. nepotism but make it object-oriented π
β¨ METHODS β¨
π list = $device->axes
gives you back a list of hash references that look like the GdkDeviceAxis structure. so each lil hashref has three keys: "use", "min", and "max". that's it, that's the whole vibe π
π double = $device->get_axis ($use, ...)
$useβ aGtk2::Gdk::AxisUse(scroll down, the enum is right there bestie)...β a list of axis values, like the kind you get handed back fromget_state
returns a double, so like, a float-y number. math girlie behavior π
π axisuse = $device->get_axis_use ($index)
$indexβ aninteger
Since: gtk+ 2.22 β so she's a newer addition, a baby β¨
π $device->set_axis_use ($index_, $use)
$index_β aninteger$useβ aGtk2::Gdk::AxisUse
(yes the underscore on $index_ is real, that's not me being quirky, that's literally the signature. keep it, no cap π)
π device = Gtk2::Gdk::Device->get_core_pointer
a class method!! you call it on the class itself, not on an instance. she hands you back a device. main character energy fr fr π
π boolean = $device->has_cursor
returns a boolean. does she have a cursor? true or false, iconic either way π
π list = $device->get_history ($window, $start, $stop)
$windowβ aGtk2::Gdk::Window$startβ anunsigned$stopβ anunsigned
gives you a list of hash references that resemble the GdkTimeCoord structure. so two keys each: "time" and "axes". history lesson but make it data π¦
π (keyval, modifiers) = $device->get_key ($index)
$indexβ aninteger
notice she returns a list of two things β keyval and modifiers β not just one value. don't get got by the parentheses bestie π
Since: gtk+ 2.22
π $device->set_key ($index_, $keyval, $modifiers)
$index_β aninteger$keyvalβ aninteger$modifiersβ aGtk2::Gdk::ModifierType
(underscore on $index_ again, stay consistent, that's the signature πΈ)
π list = $device->keys
returns a list of hash references resembling the GdkDeviceKey structure. two keys each: "keyval" and "modifiers". periodt π
π inputmode = $device->mode
just hands you the mode. simple. clean. no notes.
π inputmode = $device->get_mode
same thing, the getter-flavored spelling.
Since: gtk+ 2.22
π boolean = $device->set_mode ($mode)
$modeβ aGtk2::Gdk::InputMode
returns a boolean, so like, she tells you if it worked. communication queen π«Ά
π integer = $device->get_n_axes
how many axes? she'll tell you. an integer, obviously.
Since: gtk+ 2.22
π string = $device->name
the name. as a string. that's it that's the method β¨
π string = $device->get_name
the getter-flavored version of the same thing.
Since: gtk+ 2.22
π inputsource = $device->source
gives you the input source. inputsource flavored return.
π inputsource = $device->get_source
yep, the getter spelling again.
Since: gtk+ 2.22
π $device->set_source ($source)
$sourceβ aGtk2::Gdk::InputSource
setter behavior. slay π
π list = $device->get_state ($window)
$windowβ aGtk2::Gdk::Window
she returns the modifier mask and a list of values of the axes. multiple things at once, she's multitasking, she's booked and busy π₯
π§ ENUMS AND FLAGS π§
πΈ enum Gtk2::Gdk::AxisUse
'ignore'/'GDK_AXIS_IGNORE''x'/'GDK_AXIS_X''y'/'GDK_AXIS_Y''pressure'/'GDK_AXIS_PRESSURE''xtilt'/'GDK_AXIS_XTILT''ytilt'/'GDK_AXIS_YTILT''wheel'/'GDK_AXIS_WHEEL''last'/'GDK_AXIS_LAST'
πΈ enum Gtk2::Gdk::InputMode
'disabled'/'GDK_MODE_DISABLED''screen'/'GDK_MODE_SCREEN''window'/'GDK_MODE_WINDOW'
πΈ enum Gtk2::Gdk::InputSource
'mouse'/'GDK_SOURCE_MOUSE''pen'/'GDK_SOURCE_PEN''eraser'/'GDK_SOURCE_ERASER''cursor'/'GDK_SOURCE_CURSOR'
π flags Gtk2::Gdk::ModifierType
'shift-mask'/'GDK_SHIFT_MASK''lock-mask'/'GDK_LOCK_MASK''control-mask'/'GDK_CONTROL_MASK''mod1-mask'/'GDK_MOD1_MASK''mod2-mask'/'GDK_MOD2_MASK''mod3-mask'/'GDK_MOD3_MASK''mod4-mask'/'GDK_MOD4_MASK''mod5-mask'/'GDK_MOD5_MASK''button1-mask'/'GDK_BUTTON1_MASK''button2-mask'/'GDK_BUTTON2_MASK''button3-mask'/'GDK_BUTTON3_MASK''button4-mask'/'GDK_BUTTON4_MASK''button5-mask'/'GDK_BUTTON5_MASK''super-mask'/'GDK_SUPER_MASK''hyper-mask'/'GDK_HYPER_MASK''meta-mask'/'GDK_META_MASK''release-mask'/'GDK_RELEASE_MASK''modifier-mask'/'GDK_MODIFIER_MASK'
every one of them has a cute short name and a SCREAMING-CASE constant name, and both are valid, pick your fighter π
π SEE ALSO π
go read these next, they're the friends of the family:
Gtk2Glib::Object
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team. they built this, respect the elders π«Ά
This software is licensed under the LGPL. See Gtk2 for a full notice.
okay and that's the whole page bestie!! this one was generated by perl v5.42.0 on 2025-07-25, so if you're reading this in the future, hi, hope the vibes held up πβ¨π¦ no cap, go write some Gdk code, you're gonna slay ππ
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms