]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix omission of updates to child frames on Android
authorPo Lu <luangruo@yahoo.com>
Mon, 24 Jun 2024 04:04:05 +0000 (12:04 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 24 Jun 2024 07:27:41 +0000 (09:27 +0200)
* java/org/gnu/emacs/EmacsView.java (onAttachedFromWindow):
Force a layout cycle rather than report exposure immediately.
(prepareForLayout): Delete function.

* java/org/gnu/emacs/EmacsWindow.java (mapWindow): Remove
redundant calls to prepareForLayout.

* src/androidterm.c (handle_one_android_event): Do not swap
buffers when exposure is registered by a frame only partially
updated.

(cherry picked from commit 73a58329a6946f5abc62fee2647efba56cce236b)

java/org/gnu/emacs/EmacsView.java
java/org/gnu/emacs/EmacsWindow.java
src/androidterm.c

index 82792c3fcca414d46fa11ef318ff9cd18ff33753..1c06d39481723c35d38775a4d2e438943dcab456 100644 (file)
@@ -267,13 +267,6 @@ public final class EmacsView extends ViewGroup
     return canvas;
   }
 
-  public synchronized void
-  prepareForLayout (int wantedWidth, int wantedHeight)
-  {
-    measuredWidth = wantedWidth;
-    measuredHeight = wantedWidth;
-  }
-
   @Override
   protected void
   onMeasure (int widthMeasureSpec, int heightMeasureSpec)
@@ -773,23 +766,30 @@ public final class EmacsView extends ViewGroup
 
     /* Collect the bitmap storage; it could be large.  */
     Runtime.getRuntime ().gc ();
-
     super.onDetachedFromWindow ();
   }
 
   @Override
-  public synchronized void
+  public void
   onAttachedToWindow ()
   {
-    isAttachedToWindow = true;
-
-    /* Dirty the bitmap, as it was destroyed when onDetachedFromWindow
-       was called.  */
-    bitmapDirty = true;
+    synchronized (this)
+      {
+       isAttachedToWindow = true;
+
+       /* Dirty the bitmap, as it was destroyed when
+          onDetachedFromWindow was called.  */
+       bitmapDirty = true;
+
+       /* Rather than unconditionally generating an exposure event upon
+          window attachment, avoid delivering successive Exposure
+          events if the size of the window has changed but is still to
+          be reported by clearing the measured width and height, and
+          requesting another layout computation.  */
+       measuredWidth = measuredHeight = 0;
+      }
 
-    /* Now expose the view contents again.  */
-    EmacsNative.sendExpose (this.window.handle, 0, 0,
-                           measuredWidth, measuredHeight);
+    requestLayout ();
     super.onAttachedToWindow ();
   }
 
index 1316abfc687e71b19333d7d37d3463af0600ed3d..5ffe11281720a3be881ea4b8ede887b1aeffc3af 100644 (file)
@@ -492,7 +492,6 @@ public final class EmacsWindow extends EmacsHandleObject
                  /* Attach the view.  */
                  try
                    {
-                     view.prepareForLayout (width, height);
                      windowManager.addView (view, params);
 
                      /* Record the window manager being used in the
@@ -517,11 +516,6 @@ public final class EmacsWindow extends EmacsHandleObject
            public void
            run ()
            {
-             /* Prior to mapping the view, set its measuredWidth and
-                measuredHeight to some reasonable value, in order to
-                avoid excessive bitmap dirtying.  */
-
-             view.prepareForLayout (width, height);
              view.setVisibility (View.VISIBLE);
 
              if (!getDontFocusOnMap ())
index 837cc50bfa14ddfa201cfe7f2b25e9016619a6f8..4561f2d1df392971a41851972dc99dcf1e774000 100644 (file)
@@ -1279,7 +1279,12 @@ handle_one_android_event (struct android_display_info *dpyinfo,
             {
               expose_frame (f, event->xexpose.x, event->xexpose.y,
                            event->xexpose.width, event->xexpose.height);
-             show_back_buffer (f);
+
+             /* Do not display the back buffer if F is yet being
+                updated, as this might trigger premature bitmap
+                reconfiguration.  */
+             if (FRAME_ANDROID_COMPLETE_P (f))
+               show_back_buffer (f);
            }
         }