Web lists-archives.com

GDK_KP_Decimal (on Windows)

I'm working on an app (Gtk+2) which uses the numeric keypad as 'hotkeys'. So if a user presses say, 5, on his numeric keypad, it'll get interpreted as an accelerator key and will perform some action. The same is true for the other numbers.

The same should be true for the decimal point key - but although that works fine in OS-X, we can't seem to make it work in Windows. I'm not quite sure where to start with this - but I noticed two source files:- 'gdk/quartz/gdkkeys-quartz.c' and 'gdk/win32/gdkkeys-win32.c'. The Quartz version seems to have some definitions, like so:-

const static struct {
  guint keycode;
  guint normal_keyval, keypad_keyval;
} known_numeric_keys[] = {
  { 65, GDK_period, GDK_KP_Decimal },
  { 67, GDK_asterisk, GDK_KP_Multiply },
  { 69, GDK_plus, GDK_KP_Add },

  // some others

  { 91, GDK_8, GDK_KP_8 },
  { 92, GDK_9, GDK_KP_9 }

Note that these include a definition for 'GDK_KP_Decimal'. The Windows version looks slightly different:-

    case VK_MULTIPLY:
      *ksymp = GDK_KP_Multiply; break;
    case VK_ADD:
      *ksymp = GDK_KP_Add; break;
    case VK_SEPARATOR:
      *ksymp = GDK_KP_Separator; break;
    case VK_SUBTRACT:
      *ksymp = GDK_KP_Subtract; break;

    // some others

    case VK_NUMPAD8:
      *ksymp = GDK_KP_8; break;
    case VK_NUMPAD9:
      *ksymp = GDK_KP_9; break;

However, the list for Windows doesn't seem to include 'GDK_KP_Decimal'. Might this explain why the decimal point key is getting ignored on Windows? I'm not sure if I'm even looking in the right place but I need to start somewhere. Thanks.

gtk-devel-list mailing list