emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 08a3749794b 1/2: Update Android port


From: Po Lu
Subject: feature/android 08a3749794b 1/2: Update Android port
Date: Sun, 12 Mar 2023 19:52:29 -0400 (EDT)

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

    Update Android port
    
    * src/android.c (android_get_screen_width):
    (android_get_screen_height):
    (android_get_mm_width):
    (android_get_mm_height):
    (android_detect_mouse): Correctly handle Java exceptions.
---
 src/android.c | 73 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 54 insertions(+), 19 deletions(-)

diff --git a/src/android.c b/src/android.c
index a2c239736a7..16c645ced1e 100644
--- a/src/android.c
+++ b/src/android.c
@@ -4880,45 +4880,80 @@ android_damage_window (android_drawable handle,
 int
 android_get_screen_width (void)
 {
-  return (*android_java_env)->CallIntMethod (android_java_env,
-                                            emacs_service,
-                                            service_class.get_screen_width,
-                                            (jboolean) false);
+  int rc;
+  jmethodID method;
+
+  method = service_class.get_screen_width;
+  rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
+                                                    emacs_service,
+                                                    service_class.class,
+                                                    method,
+                                                    (jboolean) false);
+  android_exception_check ();
+  return rc;
 }
 
 int
 android_get_screen_height (void)
 {
-  return (*android_java_env)->CallIntMethod (android_java_env,
-                                            emacs_service,
-                                            service_class.get_screen_height,
-                                            (jboolean) false);
+  int rc;
+  jmethodID method;
+
+  method = service_class.get_screen_height;
+  rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
+                                                    emacs_service,
+                                                    service_class.class,
+                                                    method,
+                                                    (jboolean) false);
+  android_exception_check ();
+  return rc;
 }
 
 int
 android_get_mm_width (void)
 {
-  return (*android_java_env)->CallIntMethod (android_java_env,
-                                            emacs_service,
-                                            service_class.get_screen_width,
-                                            (jboolean) true);
+  int rc;
+  jmethodID method;
+
+  method = service_class.get_screen_width;
+  rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
+                                                    emacs_service,
+                                                    service_class.class,
+                                                    method,
+                                                    (jboolean) true);
+  android_exception_check ();
+  return rc;
 }
 
 int
 android_get_mm_height (void)
 {
-  return (*android_java_env)->CallIntMethod (android_java_env,
-                                            emacs_service,
-                                            service_class.get_screen_height,
-                                            (jboolean) true);
+  int rc;
+  jmethodID method;
+
+  method = service_class.get_screen_height;
+  rc = (*android_java_env)->CallNonvirtualIntMethod (android_java_env,
+                                                    emacs_service,
+                                                    service_class.class,
+                                                    method,
+                                                    (jboolean) true);
+  android_exception_check ();
+  return rc;
 }
 
 bool
 android_detect_mouse (void)
 {
-  return (*android_java_env)->CallBooleanMethod (android_java_env,
-                                                emacs_service,
-                                                service_class.detect_mouse);
+  bool rc;
+  jmethodID method;
+
+  method = service_class.detect_mouse;
+  rc = (*android_java_env)->CallNonvirtualBooleanMethod (android_java_env,
+                                                        emacs_service,
+                                                        service_class.class,
+                                                        method);
+  android_exception_check ();
+  return rc;
 }
 
 void



reply via email to

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