keybindings.tcl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Since we are now supporting specific platforms we need a
  2. # solution to support key bindings for multiple devices.
  3. variable is_dingux [string match dingux "[openmsx_info platform]"]
  4. variable is_android [string match android "[openmsx_info platform]"]
  5. # cycle_machine
  6. bind_default CTRL+PAGEUP cycle_machine
  7. bind_default CTRL+PAGEDOWN cycle_back_machine
  8. # osd_keyboard
  9. if {$is_dingux} {
  10. # Use the SELECT button.
  11. bind_default "keyb ESCAPE" toggle_osd_keyboard
  12. } elseif {$is_android} {
  13. # TODO: This key code no longer exists.
  14. # We probably should create our own virtual keyboard anyway.
  15. # Android maps one of the virtual keys to WORLD_95
  16. # listen to that one in order to show the keyboard
  17. #bind_default "keyb WORLD_95" toggle_osd_keyboard
  18. }
  19. # osd_menu
  20. if {$tcl_platform(os) eq "Darwin"} { ;# Mac
  21. bind_default "keyb META+O" main_menu_toggle
  22. } elseif {$is_dingux} { ;# OpenDingux
  23. bind_default "keyb RETURN" main_menu_toggle ;# START button
  24. bind_default "keyb HOME" main_menu_toggle ;# power slider flick
  25. } else { ;# any other
  26. bind_default "keyb MENU" main_menu_toggle
  27. }
  28. # pause
  29. if {$is_dingux} {
  30. # Power slider lock position.
  31. bind_default "keyb PAUSE" "set pause on"
  32. bind_default "keyb PAUSE,release" "set pause off"
  33. }
  34. # osd_widgets
  35. if {$is_dingux} {
  36. bind_default TAB -repeat "volume_control -2"
  37. bind_default BACKSPACE -repeat "volume_control +2"
  38. }
  39. # reverse
  40. # note: you can't use bindings with modifiers like SHIFT, because they
  41. # will already stop the replay, as they are MSX keys as well
  42. bind_default PAGEUP -repeat "go_back_one_step"
  43. bind_default PAGEDOWN -repeat "go_forward_one_step"
  44. # savestate
  45. if {$tcl_platform(os) eq "Darwin"} {
  46. bind_default META+S savestate
  47. bind_default META+R loadstate
  48. } else {
  49. bind_default ALT+F8 savestate
  50. bind_default ALT+F7 loadstate
  51. }
  52. # vdrive
  53. bind_default ALT+F9 "vdrive diska"
  54. bind_default SHIFT+ALT+F9 "vdrive diska -1"
  55. bind_default ALT+F10 "vdrive diskb"
  56. bind_default SHIFT+ALT+F10 "vdrive diskb -1"
  57. # copy/paste (use middle-click for all platforms and also something similar to
  58. # CTRL-C/CTRL-V, but not exactly that, as these combinations are also used on
  59. # MSX. By adding META, the combination will be so rarely used that we can
  60. # assume it's OK).
  61. set my_type_command {type [regsub -all "\r?\n" [get_clipboard_text] "\r"]}
  62. bind_default "mouse button2 down" "$my_type_command"
  63. if {$tcl_platform(os) eq "Darwin"} { ;# Mac
  64. bind_default "keyb META+C" {set_clipboard_text [get_screen]}
  65. bind_default "keyb META+V" "$my_type_command"
  66. } else { ;# any other
  67. bind_default "keyb META+CTRL+C" {set_clipboard_text [get_screen]}
  68. bind_default "keyb META+CTRL+V" "$my_type_command"
  69. }
  70. unset my_type_command