Results 1 to 5 of 5

Thread: X11 KeySyms and KeyCodes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    I'm using scancodes everywhere and here is my old solution...
    Code:
    function xkey_to_scancode( XKey, KeyCode : Integer ) : Byte;
    begin
      case XKey of
        XK_Pause:        Result := K_PAUSE;
    
        XK_Up:           Result := K_UP;
        XK_Down:         Result := K_DOWN;
        XK_Left:         Result := K_LEFT;
        XK_Right:        Result := K_RIGHT;
    
        XK_Insert:       Result := K_INSERT;
        XK_Delete:       Result := K_DELETE;
        XK_Home:         Result := K_HOME;
        XK_End:          Result := K_END;
        XK_Page_Up:      Result := K_PAGEUP;
        XK_Page_Down:    Result := K_PAGEDOWN;
    
        XK_Control_R:    Result := K_CTRL_R;
        XK_Alt_R:        Result := K_ALT_R;
        XK_Super_L:      Result := K_SUPER_L;
        XK_Super_R:      Result := K_SUPER_R;
        XK_Menu:         Result := K_APP_MENU;
    
        XK_KP_Divide:    Result := K_KP_DIV;
      else
        Result := ( KeyCode - 8 ) and $FF;
      end;
    end;
    
    // Somewhere in code
    xkey_to_scancode( XLookupKeysym( @event.xkey, 0 ), event.xkey.keycode );
    Last edited by Andru; 29-08-2011 at 07:29 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •