From 97f926b82d5674f90a16327b0ad4d6b226fcacb4 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 9 Jul 2023 12:50:15 +0800 Subject: [PATCH] Update Android port * java/org/gnu/emacs/EmacsService.java (onStartCommand): Fix typo in notification message. * java/org/gnu/emacs/EmacsWindow.java (onFocusChanged): Reset the recorded modifier state upon a change to the window focus. --- java/org/gnu/emacs/EmacsService.java | 2 +- java/org/gnu/emacs/EmacsWindow.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java index a7e83e276f2..0543c3a1bdd 100644 --- a/java/org/gnu/emacs/EmacsService.java +++ b/java/org/gnu/emacs/EmacsService.java @@ -147,7 +147,7 @@ public final class EmacsService extends Service manager = (NotificationManager) tem; infoBlurb = ("This notification is displayed to keep Emacs" + " running while it is in the background. You" - + " may disable if you want;" + + " may disable it if you want;" + " see (emacs)Android Environment."); channel = new NotificationChannel ("emacs", "Emacs persistent notification", diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java index 739a1f43b7d..2d8a8627468 100644 --- a/java/org/gnu/emacs/EmacsWindow.java +++ b/java/org/gnu/emacs/EmacsWindow.java @@ -99,7 +99,8 @@ public final class EmacsWindow extends EmacsHandleObject private EmacsGC scratchGC; /* The button state and keyboard modifier mask at the time of the - last button press or release event. */ + last button press or release event. The modifier mask is reset + upon each window focus change. */ public int lastButtonState, lastModifiers; /* Whether or not the window is mapped. */ @@ -670,6 +671,12 @@ public final class EmacsWindow extends EmacsHandleObject onFocusChanged (boolean gainFocus) { EmacsActivity.invalidateFocus (); + + /* If focus has been lost, reset the keyboard modifier state, as + subsequent changes will not be recorded. */ + + if (!gainFocus) + lastModifiers = 0; } /* Notice that the activity has been detached or destroyed. -- 2.39.2