return canvas;
}
- public synchronized void
- prepareForLayout (int wantedWidth, int wantedHeight)
- {
- measuredWidth = wantedWidth;
- measuredHeight = wantedWidth;
- }
-
@Override
protected void
onMeasure (int widthMeasureSpec, int heightMeasureSpec)
/* 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 ();
}
/* Attach the view. */
try
{
- view.prepareForLayout (width, height);
windowManager.addView (view, params);
/* Record the window manager being used in the
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 ())
{
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);
}
}