summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsView.java32
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java6
2 files changed, 16 insertions, 22 deletions
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index 82792c3fcca..1c06d394817 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -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;
+ synchronized (this)
+ {
+ isAttachedToWindow = true;
- /* Dirty the bitmap, as it was destroyed when onDetachedFromWindow
- was called. */
- bitmapDirty = 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 ();
}
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index 342190113b7..0a4d04971e7 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -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 ())