Gtk2::Accelerator(3)

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

πŸ’– Gtk2::Accelerator πŸ’–

okay bestie, so this is the Gtk2::Accelerator page β€” it's the lil module that handles keyboard accelerators (aka keyboard shortcuts, the thing that makes Ctrl+S save your doc instead of doing nothing and making you cry). it ships as part of the gtk2-perl docs, the "User Contributed Perl Documentation" corner of the world. it's not long, but every single method here is carrying its weight, so let's get into it ✨


✨ NAME ✨

Gtk2::Accelerator β€” the vibe is: shortcuts, but make it Perl πŸŽ€


🌸 METHODS 🌸

πŸ¦‹ modifiertype = Gtk2::Accelerator->get_default_mod_mask

reads out the current default modifier mask. that's the set of modifier keys (shift, ctrl, alt-ish stuff) that count as "modifiers" by default when an accelerator gets parsed. no arguments, it just tells you what's up πŸ’…


🫢 Gtk2::Accelerator->set_default_mod_mask ($default_mod_mask)

sets that default modifier mask to whatever you hand it. one arg:

  • $default_mod_mask β€” a Gtk2::Gdk::ModifierType (that's the flag type, we get to it lower down)

⭐ string = Gtk2::Accelerator->get_label ($accelerator_key, $accelerator_mods)

gives you back the human-readable label for an accelerator β€” the cute lil string you'd actually show a user. takes two things:

  • $accelerator_key β€” an integer (the key itself)
  • $accelerator_mods β€” a Gtk2::Gdk::ModifierType
Since: gtk+ 2.6 β€” so if you're on anything older, this one's just not there, no cap

πŸ’œ string = Gtk2::Accelerator->name ($accelerator_key, $accelerator_mods)

same energy as get_label but gives you the accelerator's name string. args:

  • $accelerator_key β€” an integer
  • $accelerator_mods β€” a Gtk2::Gdk::ModifierType

πŸ”₯ (accelerator_key, accelerator_mods) = Gtk2::Accelerator->parse ($accelerator)

the glow-up method ✨ you hand it an accelerator string and it breaks it apart into its pieces. args:

  • $accelerator β€” a string

and it returns two things:

  • accelerator_key β€” an unsigned integer
  • accelerator_mods β€” a Gtk2::Gdk::ModifierType

it's giving "one string in, two values out", and honestly? iconic πŸ‘‘


πŸŽ€ boolean = Gtk2::Accelerator->valid ($keyval, $modifiers)

the vibe check πŸ’… returns a boolean telling you whether this key + modifier combo is actually a valid accelerator. args:

  • $keyval β€” an integer
  • $modifiers β€” a Gtk2::Gdk::ModifierType

🌈 ENUMS AND FLAGS 🌈

🧚 flags Gtk2::Gdk::ModifierType

here's the whole roster of modifier flags, each one with its Perl-style name and its C-style name. every single one, bestie, we are not skipping anybody:

  • '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'

πŸ‘€ SEE ALSO πŸ‘€

  • Gtk2 β€” the whole big parent module, go say hi 🫢

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice. (fr fr, go read it if you need the legal deets πŸ’œ)


and that's the whole page, bestie!! πŸŽ‰ no notes, ate and left no crumbs. this was generated by perl v5.42.0 and dated 2025-07-25 β€” mwah πŸ’‹ see you in the next manpage πŸ¦‹βœ¨

πŸ“¦ where this page comes from