From f857b1afd3b2e4bd65d7a5ca20e3e487c0d4ed8b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 2 Jun 2018 12:08:13 +0530 Subject: [PATCH] Add a --debug-keyboard command line option It's a little more discoverable than the env var. --- kitty/cli.py | 5 +++++ kitty/main.py | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/kitty/cli.py b/kitty/cli.py index 06eaf1e7c..f4d191e2c 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -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 +--debug-keyboard +type=bool-set +This option will cause kitty to print out what key events as they are received + + --debug-font-fallback type=bool-set Print out information about the selection of fallback fonts for characters not present in the main font. diff --git a/kitty/main.py b/kitty/main.py index 8567047eb..744836f72 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -31,10 +31,14 @@ def load_all_shaders(semi_transparent=0): 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') + if debug_keyboard: + os.environ['GLFW_DEBUG_KEYBOARD'] = '1' if not glfw_init(glfw_path(glfw_module)): raise SystemExit('GLFW initialization failed') + if debug_keyboard: + os.environ.pop('GLFW_DEBUG_KEYBOARD') return glfw_module @@ -184,7 +188,7 @@ def _main(): opts = create_opts(args) if opts.editor != '.': os.environ['EDITOR'] = opts.editor - init_graphics() + init_graphics(args.debug_keyboard) try: with setup_profiling(args): # Avoid needing to launch threads to reap zombies