Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.4.25 - Mar 20, 2026

- Added setPressAndHoldEnabled to allow users to toggle that behaviour on the Mac #303

# 0.4.24 - Feb 24, 2026

- Strip absolute paths from binaries #302
Expand Down
12 changes: 11 additions & 1 deletion macos/cc/JWMMainView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,17 @@ - (void)keyDown:(NSEvent *)event {
}

// Allow TSM to look at the event and potentially send back NSTextInputClient messages.
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
if (jwm::kPressAndHoldEnabled) {
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
} else {
// Bypass text input system to avoid press-and-hold popup,
// but still deliver typed characters
NSString *characters = [event characters];
if ([characters length] > 0) {
[self insertText:characters replacementRange:NSMakeRange(NSNotFound,
0)];
}
}

if (wasInPressAndHold) {
switch(keyCode) {
Expand Down
5 changes: 5 additions & 0 deletions macos/cc/WindowMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,8 @@ static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
jwm::WindowMac* instance = reinterpret_cast<jwm::WindowMac*>(jwm::classes::Native::fromJava(env, obj));
instance->close();
}

extern "C" JNIEXPORT void JNICALL Java_io_github_humbleui_jwm_WindowMac__1nSetPressAndHoldEnabled
(JNIEnv *env, jclass cls, jboolean enabled) {
jwm::kPressAndHoldEnabled = enabled;
}
6 changes: 6 additions & 0 deletions macos/java/WindowMac.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ public void close() {
super.close();
}

public static void setPressAndHoldEnabled(boolean enabled) {
assert _onUIThread() : "Should be run on UI thread";
_nSetPressAndHoldEnabled(enabled);
}

@ApiStatus.Internal public static native long _nMake();
@ApiStatus.Internal public native IRect _nGetWindowRect();
@ApiStatus.Internal public native IRect _nGetContentRect();
Expand Down Expand Up @@ -328,4 +333,5 @@ public void close() {
@ApiStatus.Internal public native void _nSetZOrder(int zOrder);
@ApiStatus.Internal public native void _nSetProgressBar(float value);
@ApiStatus.Internal public native void _nClose();
@ApiStatus.Internal public static native void _nSetPressAndHoldEnabled(boolean enabled);
}