Add a --debug-keyboard command line option

It's a little more discoverable than the env var.
This commit is contained in:
Kovid Goyal 2018-06-02 12:08:13 +05:30
parent 5cd9af6c37
commit f857b1afd3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 2 deletions

View File

@ -129,6 +129,11 @@ Debug OpenGL commands. This will cause all OpenGL calls to check for errors
instead of ignoring them. Useful when debugging rendering problems instead of ignoring them. Useful when debugging rendering problems
--debug-keyboard
type=bool-set
This option will cause kitty to print out what key events as they are received
--debug-font-fallback --debug-font-fallback
type=bool-set type=bool-set
Print out information about the selection of fallback fonts for characters not present in the main font. Print out information about the selection of fallback fonts for characters not present in the main font.

View File

@ -31,10 +31,14 @@ def load_all_shaders(semi_transparent=0):
load_borders_program() load_borders_program()
def init_graphics(): def init_graphics(debug_keyboard=False):
glfw_module = 'cocoa' if is_macos else ('wayland' if is_wayland else 'x11') glfw_module = 'cocoa' if is_macos else ('wayland' if is_wayland else 'x11')
if debug_keyboard:
os.environ['GLFW_DEBUG_KEYBOARD'] = '1'
if not glfw_init(glfw_path(glfw_module)): if not glfw_init(glfw_path(glfw_module)):
raise SystemExit('GLFW initialization failed') raise SystemExit('GLFW initialization failed')
if debug_keyboard:
os.environ.pop('GLFW_DEBUG_KEYBOARD')
return glfw_module return glfw_module
@ -184,7 +188,7 @@ def _main():
opts = create_opts(args) opts = create_opts(args)
if opts.editor != '.': if opts.editor != '.':
os.environ['EDITOR'] = opts.editor os.environ['EDITOR'] = opts.editor
init_graphics() init_graphics(args.debug_keyboard)
try: try:
with setup_profiling(args): with setup_profiling(args):
# Avoid needing to launch threads to reap zombies # Avoid needing to launch threads to reap zombies