Gtk2::Gdk::Keysyms(3pm)

Gtk2::Gdk::Keysyms3pm

Key codes for gtk2 programs

Usage

 use Gtk2;
 use Gtk2::Gdk::Keysyms;
 #
 # the most common use is for deciphering keycodes in key events,
 # like this:
 #
 sub key_press_handler {
         my ($widget, $event) = @_;
         if ($event->keyval == $Gtk2::Gdk::Keysyms{Escape}) {
                 abort_whatever ();
                 return 1;
         }
         elsif ($event->keyval == $Gtk2::Gdk::Keysyms{F1}) {
                 do_help_thing ();
                 return 1;
         }
         elsif ($event->keyval == $Gtk2::Gdk::Keysyms{KP_Enter}) {
                 execute_selected_text_as_command ();
                 return 1;
         }
         # we didn't handle it, pass it on...
         return 0;
 }

Overview

Gdk defines symbolic names for the codes associated with each key on a keyboard, so that you don't go nuts with numeric values in your programs. The hash %Gtk2::Gdk::Keysyms holds all those keycodes, indexed by the name, for use in your perl programs when you need to do custom key handling. This commonly occurs when you want to bind an action to a key that isn't usable as an accelerator, or when you don't have accelerators, or if you're trying to write an easter egg, or whatever.

As the list of keycodes is quite large and rather rarely used in application code, we've put it in a separately-loaded module to save space. As an alternative, you might want to investigate "Gtk2::Gdk->keyval_from_name" which offers basically the same functionality as the hash.

To get a list of all available keys, either dump %Gtk2::Gdk::Keysyms, or look at the source of this module with "perldoc -m Gtk2::Gdk::Keysyms".

Releases

7 releases since Debian 3.1 (Sarge); the text changed 6 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 9
  7. 10

Author

This module was automatically generated by a very simple perl script from gdk/gdkkeysyms.h. Programs that write programs are the happiest programs of all.

From libgtk2-perl-doc 2:1.24992-1 in Debian 10 (Buster). Parsed by carta from the page's man source.