Gtk2::Gdk::Device(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– 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 β€” a Gtk2::Gdk::AxisUse (scroll down, the enum is right there bestie)
  • ... β€” a list of axis values, like the kind you get handed back from get_state

returns a double, so like, a float-y number. math girlie behavior 😌

πŸŽ€ axisuse = $device->get_axis_use ($index)

  • $index β€” an integer
Since: gtk+ 2.22 β€” so she's a newer addition, a baby ✨

πŸŽ€ $device->set_axis_use ($index_, $use)

  • $index_ β€” an integer
  • $use β€” a Gtk2::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 β€” a Gtk2::Gdk::Window
  • $start β€” an unsigned
  • $stop β€” an unsigned

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 β€” an integer

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_ β€” an integer
  • $keyval β€” an integer
  • $modifiers β€” a Gtk2::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 β€” a Gtk2::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 β€” a Gtk2::Gdk::InputSource

setter behavior. slay πŸ’–

πŸŽ€ list = $device->get_state ($window)

  • $window β€” a Gtk2::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:

  • Gtk2
  • Glib::Object

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