Update Android port
* doc/emacs/android.texi (Android Windowing): Document how to pass multimedia keys to the system. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function. * java/org/gnu/emacs/EmacsView.java (onKeyDown, onKeyMultiple) (onKeyUp): Check that function. * java/org/gnu/emacs/EmacsWindow.java (defineCursor): Handle cases where cursor is NULL. * src/android.c (NATIVE_NAME): New function. * src/androidfns.c (syms_of_androidfns): New variable. * src/keyboard.c (lispy_function_keys): Add volume keys.
This commit is contained in:
parent
98d43dbef5
commit
1eb546309b
7 changed files with 61 additions and 1 deletions
|
@ -498,6 +498,16 @@ selection, Emacs provides an emulation instead. This means there is
|
|||
no way to transfer the contents of the primary selection to another
|
||||
application via cut-and-paste.
|
||||
|
||||
@vindex android-pass-multimedia-buttons-to-system
|
||||
@cindex volume/multimedia buttons, Android
|
||||
The volume keys are normally reserved by Emacs and used to provide
|
||||
the ability to quit Emacs without a physical keyboard
|
||||
(@pxref{On-Screen-Keyboards}.) However, if you want them to adjust
|
||||
the volume instead, you can set the variable
|
||||
@code{android-pass-multimedia-buttons-to-system} to a non-@code{nil}
|
||||
value; note that you will no longer be able to quit Emacs using the
|
||||
volume buttons in that case.
|
||||
|
||||
@node Android Fonts
|
||||
@section Font backends and selection under Android
|
||||
@cindex fonts, android
|
||||
|
|
|
@ -174,6 +174,10 @@ public static native long sendExpose (short window, int x, int y,
|
|||
main thread's looper to respond. */
|
||||
public static native void endSynchronous ();
|
||||
|
||||
/* Return whether or not KEYCODE_VOLUME_DOWN, KEYCODE_VOLUME_UP and
|
||||
KEYCODE_VOLUME_MUTE should be forwarded to Emacs. */
|
||||
public static native boolean shouldForwardMultimediaButtons ();
|
||||
|
||||
|
||||
|
||||
/* Input connection functions. These mostly correspond to their
|
||||
|
|
|
@ -361,6 +361,12 @@ else if (child.getVisibility () != GONE)
|
|||
public boolean
|
||||
onKeyDown (int keyCode, KeyEvent event)
|
||||
{
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_MUTE)
|
||||
&& !EmacsNative.shouldForwardMultimediaButtons ())
|
||||
return false;
|
||||
|
||||
window.onKeyDown (keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
@ -369,6 +375,12 @@ else if (child.getVisibility () != GONE)
|
|||
public boolean
|
||||
onKeyMultiple (int keyCode, int repeatCount, KeyEvent event)
|
||||
{
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_MUTE)
|
||||
&& !EmacsNative.shouldForwardMultimediaButtons ())
|
||||
return false;
|
||||
|
||||
window.onKeyDown (keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
@ -377,6 +389,12 @@ else if (child.getVisibility () != GONE)
|
|||
public boolean
|
||||
onKeyUp (int keyCode, KeyEvent event)
|
||||
{
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_MUTE)
|
||||
&& !EmacsNative.shouldForwardMultimediaButtons ())
|
||||
return false;
|
||||
|
||||
window.onKeyUp (keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1234,7 +1234,10 @@ else if (EmacsWindow.this.isMapped)
|
|||
public void
|
||||
run ()
|
||||
{
|
||||
view.setPointerIcon (cursor.icon);
|
||||
if (cursor != null)
|
||||
view.setPointerIcon (cursor.icon);
|
||||
else
|
||||
view.setPointerIcon (null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2825,6 +2825,15 @@ NATIVE_NAME (sendExpose) (JNIEnv *env, jobject object,
|
|||
return event_serial;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
NATIVE_NAME (shouldForwardMultimediaButtons) (JNIEnv *env,
|
||||
jobject object)
|
||||
{
|
||||
/* Yes, android_pass_multimedia_buttons_to_system is being
|
||||
read from the UI thread. */
|
||||
return !android_pass_multimedia_buttons_to_system;
|
||||
}
|
||||
|
||||
/* Forward declarations of deadlock prevention functions. */
|
||||
|
||||
static void android_begin_query (void);
|
||||
|
|
|
@ -3075,6 +3075,17 @@ syms_of_androidfns (void)
|
|||
doc: /* SKIP: real doc in xfns.c. */);
|
||||
Vx_max_tooltip_size = Qnil;
|
||||
|
||||
DEFVAR_BOOL ("android-pass-multimedia-buttons-to-system",
|
||||
android_pass_multimedia_buttons_to_system,
|
||||
doc: /* Whether or not to pass volume control buttons to the system.
|
||||
Generally, the `volume-up', `volume-down' and `volume-mute' keys are
|
||||
processed by Emacs, but setting this to non-nil they are passed to the
|
||||
operating system instead of being intercepted by Emacs.
|
||||
|
||||
Note that if you set this, you will no longer be able to quit Emacs
|
||||
using the volume down button. */);
|
||||
android_pass_multimedia_buttons_to_system = false;
|
||||
|
||||
/* Functions defined. */
|
||||
defsubr (&Sx_create_frame);
|
||||
defsubr (&Sxw_color_defined_p);
|
||||
|
|
|
@ -4972,6 +4972,7 @@ const char *const lispy_function_keys[] =
|
|||
[111] = "escape",
|
||||
[112] = "delete",
|
||||
[121] = "break",
|
||||
[120] = "sysrq",
|
||||
[122] = "home",
|
||||
[123] = "end",
|
||||
[124] = "insert",
|
||||
|
@ -4988,6 +4989,7 @@ const char *const lispy_function_keys[] =
|
|||
[141] = "f11",
|
||||
[142] = "f12",
|
||||
[160] = "kp-ret",
|
||||
[164] = "volume-mute",
|
||||
[19] = "up",
|
||||
[20] = "down",
|
||||
[213] = "muhenkan",
|
||||
|
@ -4996,6 +4998,8 @@ const char *const lispy_function_keys[] =
|
|||
[218] = "kana",
|
||||
[21] = "left",
|
||||
[22] = "right",
|
||||
[24] = "volume-up",
|
||||
[25] = "volume-down",
|
||||
[259] = "help",
|
||||
[268] = "kp-up-left",
|
||||
[269] = "kp-down-left",
|
||||
|
@ -5010,6 +5014,7 @@ const char *const lispy_function_keys[] =
|
|||
[66] = "return",
|
||||
[67] = "backspace",
|
||||
[82] = "menu",
|
||||
[84] = "find",
|
||||
[92] = "prior",
|
||||
[93] = "next",
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue