diff options
| author | Po Lu | 2023-02-19 13:17:43 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-19 13:17:43 +0800 |
| commit | c8f49c9276d34741bfbe7752dd38391c0b8d782b (patch) | |
| tree | 02f627d6bcbc83900ce459570c59ec77a63152da /src | |
| parent | c6809eb92780f8206423898151cc40c959921753 (diff) | |
| download | emacs-c8f49c9276d34741bfbe7752dd38391c0b8d782b.tar.gz emacs-c8f49c9276d34741bfbe7752dd38391c0b8d782b.zip | |
Implement `fullscreen' on Android 4.0 and later
* doc/emacs/android.texi (Android Windowing): Document what new
frame parameters are now supported.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New
field `isFullscreen'.
(detachWindow, attachWindow): Sync fullscreen state.
(onWindowFocusChanged): Add more logging.
(onResume): Restore previous fullscreen state.
(syncFullscreen): New function.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(setFullscreen): New function.
* src/android.c (struct android_emacs_window): Add new method.
(android_init_emacs_window): Look up new method.
(android_set_fullscreen): New function.
* src/androidgui.h:
* src/androidterm.c (android_fullscreen_hook): Implement
accordingly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 32 | ||||
| -rw-r--r-- | src/androidgui.h | 1 | ||||
| -rw-r--r-- | src/androidterm.c | 24 |
3 files changed, 54 insertions, 3 deletions
diff --git a/src/android.c b/src/android.c index d21aaabc1ac..fc5e6d278ed 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -136,6 +136,7 @@ struct android_emacs_window | |||
| 136 | jmethodID swap_buffers; | 136 | jmethodID swap_buffers; |
| 137 | jmethodID toggle_on_screen_keyboard; | 137 | jmethodID toggle_on_screen_keyboard; |
| 138 | jmethodID lookup_string; | 138 | jmethodID lookup_string; |
| 139 | jmethodID set_fullscreen; | ||
| 139 | }; | 140 | }; |
| 140 | 141 | ||
| 141 | /* The API level of the current device. */ | 142 | /* The API level of the current device. */ |
| @@ -1920,6 +1921,7 @@ android_init_emacs_window (void) | |||
| 1920 | FIND_METHOD (toggle_on_screen_keyboard, | 1921 | FIND_METHOD (toggle_on_screen_keyboard, |
| 1921 | "toggleOnScreenKeyboard", "(Z)V"); | 1922 | "toggleOnScreenKeyboard", "(Z)V"); |
| 1922 | FIND_METHOD (lookup_string, "lookupString", "(I)Ljava/lang/String;"); | 1923 | FIND_METHOD (lookup_string, "lookupString", "(I)Ljava/lang/String;"); |
| 1924 | FIND_METHOD (set_fullscreen, "setFullscreen", "(Z)V"); | ||
| 1923 | #undef FIND_METHOD | 1925 | #undef FIND_METHOD |
| 1924 | } | 1926 | } |
| 1925 | 1927 | ||
| @@ -5475,6 +5477,36 @@ android_reset_ic (android_window window, enum android_ic_mode mode) | |||
| 5475 | 5477 | ||
| 5476 | 5478 | ||
| 5477 | 5479 | ||
| 5480 | /* Window decoration management functions. */ | ||
| 5481 | |||
| 5482 | /* Make the specified WINDOW fullscreen, i.e. obscure all of the | ||
| 5483 | system navigation and status bars. If not FULLSCREEN, make it | ||
| 5484 | maximized instead. | ||
| 5485 | |||
| 5486 | Value is 1 if the system does not support this, else 0. */ | ||
| 5487 | |||
| 5488 | int | ||
| 5489 | android_set_fullscreen (android_window window, bool fullscreen) | ||
| 5490 | { | ||
| 5491 | jobject object; | ||
| 5492 | |||
| 5493 | /* Android 4.0 and earlier don't support fullscreen windows. */ | ||
| 5494 | |||
| 5495 | if (android_api_level < 16) | ||
| 5496 | return 1; | ||
| 5497 | |||
| 5498 | object = android_resolve_handle (window, ANDROID_HANDLE_WINDOW); | ||
| 5499 | |||
| 5500 | (*android_java_env)->CallVoidMethod (android_java_env, | ||
| 5501 | object, | ||
| 5502 | window_class.set_fullscreen, | ||
| 5503 | (jboolean) fullscreen); | ||
| 5504 | android_exception_check (); | ||
| 5505 | return 0; | ||
| 5506 | } | ||
| 5507 | |||
| 5508 | |||
| 5509 | |||
| 5478 | #else /* ANDROID_STUBIFY */ | 5510 | #else /* ANDROID_STUBIFY */ |
| 5479 | 5511 | ||
| 5480 | /* X emulation functions for Android. */ | 5512 | /* X emulation functions for Android. */ |
diff --git a/src/androidgui.h b/src/androidgui.h index 25dc6754fff..84419457a8a 100644 --- a/src/androidgui.h +++ b/src/androidgui.h | |||
| @@ -614,6 +614,7 @@ extern int android_wc_lookup_string (android_key_pressed_event *, | |||
| 614 | extern void android_update_ic (android_window, ptrdiff_t, ptrdiff_t, | 614 | extern void android_update_ic (android_window, ptrdiff_t, ptrdiff_t, |
| 615 | ptrdiff_t, ptrdiff_t); | 615 | ptrdiff_t, ptrdiff_t); |
| 616 | extern void android_reset_ic (android_window, enum android_ic_mode); | 616 | extern void android_reset_ic (android_window, enum android_ic_mode); |
| 617 | extern int android_set_fullscreen (android_window, bool); | ||
| 617 | 618 | ||
| 618 | #endif | 619 | #endif |
| 619 | 620 | ||
diff --git a/src/androidterm.c b/src/androidterm.c index 0fbee1e9867..62a8d5d12b3 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -1792,12 +1792,30 @@ android_make_frame_visible_invisible (struct frame *f, bool visible) | |||
| 1792 | static void | 1792 | static void |
| 1793 | android_fullscreen_hook (struct frame *f) | 1793 | android_fullscreen_hook (struct frame *f) |
| 1794 | { | 1794 | { |
| 1795 | /* Explicitly setting fullscreen is not supported on Android. */ | 1795 | Lisp_Object wanted; |
| 1796 | 1796 | ||
| 1797 | if (!FRAME_PARENT_FRAME (f)) | 1797 | if (!FRAME_PARENT_FRAME (f)) |
| 1798 | store_frame_param (f, Qfullscreen, Qmaximized); | 1798 | { |
| 1799 | /* Explicitly setting fullscreen is not supported on older | ||
| 1800 | Android versions. */ | ||
| 1801 | |||
| 1802 | wanted = (f->want_fullscreen == FULLSCREEN_BOTH | ||
| 1803 | ? Qfullscreen : Qmaximized); | ||
| 1804 | |||
| 1805 | if (android_set_fullscreen (FRAME_ANDROID_WINDOW (f), | ||
| 1806 | EQ (wanted, Qfullscreen))) | ||
| 1807 | store_frame_param (f, Qfullscreen, Qmaximized); | ||
| 1808 | else | ||
| 1809 | store_frame_param (f, Qfullscreen, wanted); | ||
| 1810 | } | ||
| 1799 | else | 1811 | else |
| 1800 | store_frame_param (f, Qfullscreen, Qnil); | 1812 | { |
| 1813 | store_frame_param (f, Qfullscreen, Qnil); | ||
| 1814 | |||
| 1815 | /* If this is a child frame, don't keep it fullscreen | ||
| 1816 | anymore. */ | ||
| 1817 | android_set_fullscreen (FRAME_ANDROID_WINDOW (f), false); | ||
| 1818 | } | ||
| 1801 | } | 1819 | } |
| 1802 | 1820 | ||
| 1803 | void | 1821 | void |