emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android 26b3b8433d9 2/2: Update Android port


From: Po Lu
Subject: feature/android 26b3b8433d9 2/2: Update Android port
Date: Sun, 5 Mar 2023 02:57:51 -0500 (EST)

branch: feature/android
commit 26b3b8433d933c9f8b26b83ca96ac1bb47711907
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Don't
    set the style here.
    * java/res/values-v11/style.xml:
    * java/res/values-v14/style.xml:
    * java/res/values-v29/style.xml:
    * java/res/values/style.xml: Define styles for the emacsclient
    wrapper.
    * src/keyboard.c (read_key_sequence): Don't disable text
    conversion if use_mouse_menu or if a menu bar prefix key is
    being displayed.
---
 java/org/gnu/emacs/EmacsOpenActivity.java |  5 -----
 java/res/values-v11/style.xml             |  1 +
 java/res/values-v14/style.xml             |  1 +
 java/res/values-v29/style.xml             |  2 ++
 java/res/values/style.xml                 |  1 +
 src/keyboard.c                            | 26 +++++++++++++++++++++-----
 6 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java 
b/java/org/gnu/emacs/EmacsOpenActivity.java
index fddd5331d2f..ac643ae8a13 100644
--- a/java/org/gnu/emacs/EmacsOpenActivity.java
+++ b/java/org/gnu/emacs/EmacsOpenActivity.java
@@ -380,11 +380,6 @@ public final class EmacsOpenActivity extends Activity
        return;
       }
 
-    /* Set an appropriate theme.  */
-
-    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
-      setTheme (android.R.style.Theme_DeviceDefault);
-
     /* Now see if the action specified is supported by Emacs.  */
 
     if (action.equals ("android.intent.action.VIEW")
diff --git a/java/res/values-v11/style.xml b/java/res/values-v11/style.xml
index 50cf96e8bc5..b114758bf0d 100644
--- a/java/res/values-v11/style.xml
+++ b/java/res/values-v11/style.xml
@@ -20,4 +20,5 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. -->
 <resources>
   <!-- Style used for popup menus and relatives on Android 3.x.  -->
   <style name="EmacsStyle" parent="@android:style/Theme.Holo.NoActionBar"/>
+  <style name="EmacsStyleOpen" parent="@android:style/Theme.Holo"/>
 </resources>
diff --git a/java/res/values-v14/style.xml b/java/res/values-v14/style.xml
index 4124887ab5a..2cb54dc301b 100644
--- a/java/res/values-v14/style.xml
+++ b/java/res/values-v14/style.xml
@@ -21,4 +21,5 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. -->
   <!-- Style used for popup menus and relatives between Android 4.0
        and Android 10.  -->
   <style name="EmacsStyle" 
parent="@android:style/Theme.DeviceDefault.NoActionBar"/>
+  <style name="EmacsStyleOpen" parent="@android:style/Theme.DeviceDefault"/>
 </resources>
diff --git a/java/res/values-v29/style.xml b/java/res/values-v29/style.xml
index cd4a6dd1fec..ec7b8d14554 100644
--- a/java/res/values-v29/style.xml
+++ b/java/res/values-v29/style.xml
@@ -27,4 +27,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. -->
     <!-- Required to make sure the status bar text remains legible.  -->
     <item name="android:statusBarColor">@android:color/black</item>
   </style>
+  <style name="EmacsStyleOpen"
+        parent="@android:style/Theme.DeviceDefault.DayNight"/>
 </resources>
diff --git a/java/res/values/style.xml b/java/res/values/style.xml
index 396b7d8da39..498e844fda0 100644
--- a/java/res/values/style.xml
+++ b/java/res/values/style.xml
@@ -22,4 +22,5 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. -->
        2.3.  Styles used for newer Android versions are defined in
        the res/values- directories for their respective API levels. -->
   <style name="EmacsStyle" parent="@android:style/Theme.NoTitleBar"/>
+  <style name="EmacsStyleOpen" parent="@android:style/Theme"/>
 </resources>
diff --git a/src/keyboard.c b/src/keyboard.c
index 8cdc5027ebd..a38c7394543 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10215,14 +10215,30 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object 
prompt,
         effect, turn it off after the first character read.  This
         makes input methods send actual key events instead.
 
-         Make sure only to do this once.  */
+         Make sure only to do this once.  Also, disabling text
+         conversion seems to interact badly with menus, so don't
+         disable text conversion if a menu was displayed.  */
 
-      if (!disabled_conversion && t)
+      if (!disabled_conversion && t && !used_mouse_menu)
        {
-         disable_text_conversion ();
-         record_unwind_protect_void (resume_text_conversion);
+         int i;
+
+         /* used_mouse_menu isn't set if a menu bar prefix key has
+            just been stored.  It appears necessary to look for the
+            prefix key itself.  */
+
+         for (i = 0; i < t; ++i)
+           {
+             if (EQ (keybuf[i], Qmenu_bar))
+               break;
+           }
 
-         disabled_conversion = true;
+         if (i == t)
+           {
+             disable_text_conversion ();
+             record_unwind_protect_void (resume_text_conversion);
+             disabled_conversion = true;
+           }
        }
 #endif
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]