[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7b43d70c737: Update Android port
From: |
Po Lu |
Subject: |
master 7b43d70c737: Update Android port |
Date: |
Wed, 27 Sep 2023 20:47:10 -0400 (EDT) |
branch: master
commit 7b43d70c7379e89318e6333739f991f158b447f6
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Update Android port
* doc/emacs/android.texi (Android Windowing): Document
`android-keyboard-bell-duration'.
* java/org/gnu/emacs/EmacsService.java (ringBell): New argument
DURATION.
* src/android.c (android_init_emacs_service): Adjust
correspondingly.
(android_bell): Provide the duration of the vibration.
* src/androidfns.c (syms_of_androidfns)
<android_keyboard_bell_duration>: New variable.
---
doc/emacs/android.texi | 9 +++++++++
java/org/gnu/emacs/EmacsService.java | 9 +++++----
src/android.c | 11 +++++++++--
src/androidfns.c | 8 ++++++++
4 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi
index 07b689ca23b..9f3cca2b137 100644
--- a/doc/emacs/android.texi
+++ b/doc/emacs/android.texi
@@ -690,6 +690,15 @@ these key sequences before they can be filtered by the
input method.
disabled by setting the variable
@code{android-intercept-control-space} to @code{nil}.
+@vindex android-keyboard-bell-duration
+@cindex keyboard bell, android
+ The keyboard bell installed within Android systems takes the form of
+a vibrating element that is activated for a number of milliseconds
+whenever the bell is rung. The duration of this vibration can be
+customized through altering the variable
+@code{android-keyboard-bell-duration} to any value between @code{10}
+and @code{1000}.
+
@node Android Fonts
@section Font Backends and Selection under Android
@cindex fonts, android
diff --git a/java/org/gnu/emacs/EmacsService.java
b/java/org/gnu/emacs/EmacsService.java
index 05952f98cf1..997c6923fcc 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -448,12 +448,13 @@ public final class EmacsService extends Service
@SuppressWarnings ("deprecation")
public void
- ringBell ()
+ ringBell (int duration)
{
Vibrator vibrator;
VibrationEffect effect;
VibratorManager vibratorManager;
Object tem;
+ int amplitude;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
{
@@ -467,13 +468,13 @@ public final class EmacsService extends Service
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
+ amplitude = VibrationEffect.DEFAULT_AMPLITUDE;
effect
- = VibrationEffect.createOneShot (50,
- VibrationEffect.DEFAULT_AMPLITUDE);
+ = VibrationEffect.createOneShot (duration, amplitude);
vibrator.vibrate (effect);
}
else
- vibrator.vibrate (50);
+ vibrator.vibrate (duration);
}
public short[]
diff --git a/src/android.c b/src/android.c
index 4df9d71b1b1..aa4033c676f 100644
--- a/src/android.c
+++ b/src/android.c
@@ -1552,7 +1552,7 @@ android_init_emacs_service (void)
"(Lorg/gnu/emacs/EmacsWindow;)V");
FIND_METHOD (clear_area, "clearArea",
"(Lorg/gnu/emacs/EmacsWindow;IIII)V");
- FIND_METHOD (ring_bell, "ringBell", "()V");
+ FIND_METHOD (ring_bell, "ringBell", "(I)V");
FIND_METHOD (query_tree, "queryTree",
"(Lorg/gnu/emacs/EmacsWindow;)[S");
FIND_METHOD (get_screen_width, "getScreenWidth", "(Z)I");
@@ -4900,10 +4900,17 @@ android_put_image (android_pixmap handle, struct
android_image *image)
void
android_bell (void)
{
+ jint duration;
+
+ /* Restrict android_keyboard_bell_duration to values between 10 and
+ 1000. */
+ duration = MIN (1000, MAX (0, android_keyboard_bell_duration));
+
(*android_java_env)->CallNonvirtualVoidMethod (android_java_env,
emacs_service,
service_class.class,
- service_class.ring_bell);
+ service_class.ring_bell,
+ duration);
android_exception_check ();
}
diff --git a/src/androidfns.c b/src/androidfns.c
index f151be5b9a6..3ee9f7634aa 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -3232,6 +3232,14 @@ restrictions.
This option has no effect on Android 9 and earlier. */);
android_use_exec_loader = true;
+ DEFVAR_INT ("android-keyboard-bell-duration",
+ android_keyboard_bell_duration,
+ doc: /* Number of milliseconds to vibrate after ringing the keyboard bell.
+The keyboard bell under Android systems takes the form of a vibrating
+element that is activated for a given number of milliseconds upon the
+bell being rung. */);
+ android_keyboard_bell_duration = 50;
+
/* Functions defined. */
defsubr (&Sx_create_frame);
defsubr (&Sxw_color_defined_p);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7b43d70c737: Update Android port,
Po Lu <=