Skip to content

Commit dd31fc0

Browse files
Fix control binding the escape key.
When pressing the escape key while in a control binding process, then the control should get bound to escape and the settings window should still be open. This commit disables closing the settings window while binding a key. fixes: #2257
1 parent ac54ee2 commit dd31fc0

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/graphics/Window.zig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ pub fn setNextGamepadListener(listener: ?*const fn (?GamepadAxis, c_int) void) !
662662
nextGamepadListener = listener;
663663
}
664664

665+
pub fn hasNextInputListenter() bool {
666+
return (nextKeypressListener != null or nextGamepadListener != null);
667+
}
668+
665669
fn updateCursor() void {
666670
if (grabbed) {
667671
c.glfwSetInputMode(window, c.GLFW_CURSOR, c.GLFW_CURSOR_DISABLED);

‎src/main.zig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ fn logToStdErr(comptime format: []const u8, args: anytype) void {
201201

202202
// MARK: Callbacks
203203
fn escape(mods: Window.Key.Modifiers) void {
204+
if (Window.hasNextInputListenter()) return;
204205
if (gui.selectedTextInput != null) gui.setSelectedTextInput(null);
205206
inventory(mods);
206207
}

0 commit comments

Comments
 (0)