diff options
| author | Po Lu | 2023-02-08 22:40:10 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-08 22:40:10 +0800 |
| commit | 0bd4b7fdab2fdf437c4a759d53dfdc9f667aefb1 (patch) | |
| tree | a1320da59f2f5e6a1c0f31b9fd504400da2fcfab | |
| parent | 7fb0df0ce2858eeb03ec18b540acf49a5b8d90c9 (diff) | |
| download | emacs-0bd4b7fdab2fdf437c4a759d53dfdc9f667aefb1.tar.gz emacs-0bd4b7fdab2fdf437c4a759d53dfdc9f667aefb1.zip | |
Update Android port
* doc/lispref/frames.texi (On-Screen Keyboards): Describe return
value of `frame-toggle-on-screen-keyboard'.
* java/org/gnu/emacs/EmacsSurfaceView.java (surfaceChanged)
(surfaceCreated, EmacsSurfaceView): Remove unuseful
synchronization code. The framework doesn't seem to look at
this at all.
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(onLayout): Lay out the window after children.
(swapBuffers): Properly implement `force'.
(windowUpdated): Delete function.
* lisp/frame.el (frame-toggle-on-screen-keyboard): Return
whether or not the on screen keyboard might've been displayed.
* lisp/minibuffer.el (minibuffer-on-screen-keyboard-timer):
(minibuffer-on-screen-keyboard-displayed):
(minibuffer-setup-on-screen-keyboard):
(minibuffer-exit-on-screen-keyboard): Improve OSK dismissal when
there are consecutive minibuffers.
* lisp/touch-screen.el (touch-screen-window-selection-changed):
New function.
(touch-screen-handle-point-up): Register it as a window
selection changed function.
* src/android.c (struct android_emacs_window)
(android_init_emacs_window): Remove references to
`windowUpdated'.
(android_window_updated): Delete function.
* src/android.h (struct android_output): Remove
`last_configure_serial'.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Remove frame
synchronization, as that does not work on Android.
| -rw-r--r-- | doc/lispref/frames.texi | 4 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsSurfaceView.java | 54 | ||||
| -rw-r--r-- | java/org/gnu/emacs/EmacsView.java | 58 | ||||
| -rw-r--r-- | lisp/frame.el | 7 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 35 | ||||
| -rw-r--r-- | lisp/touch-screen.el | 26 | ||||
| -rw-r--r-- | src/android.c | 21 | ||||
| -rw-r--r-- | src/android.h | 1 | ||||
| -rw-r--r-- | src/androidterm.c | 18 | ||||
| -rw-r--r-- | src/androidterm.h | 5 |
10 files changed, 94 insertions, 135 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 497715bdb19..6ffefe8184f 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -3828,6 +3828,10 @@ This function displays or hides the on-screen keyboard on behalf of | |||
| 3828 | the frame @var{frame}. If @var{hide} is non-@code{nil}, then the | 3828 | the frame @var{frame}. If @var{hide} is non-@code{nil}, then the |
| 3829 | on-screen keyboard is hidden; otherwise, it is displayed. | 3829 | on-screen keyboard is hidden; otherwise, it is displayed. |
| 3830 | 3830 | ||
| 3831 | It returns whether or not the on screen keyboard @strong{may} have | ||
| 3832 | been displayed, which should be used to determine whether or not to | ||
| 3833 | hide the on-screen keyboard later. | ||
| 3834 | |||
| 3831 | This has no effect if the system automatically detects when to display | 3835 | This has no effect if the system automatically detects when to display |
| 3832 | the on-screen keyboard, or when it does not provide any on-screen | 3836 | the on-screen keyboard, or when it does not provide any on-screen |
| 3833 | keyboard. | 3837 | keyboard. |
diff --git a/java/org/gnu/emacs/EmacsSurfaceView.java b/java/org/gnu/emacs/EmacsSurfaceView.java index 2fe9e103b2b..f6cb77bb2b8 100644 --- a/java/org/gnu/emacs/EmacsSurfaceView.java +++ b/java/org/gnu/emacs/EmacsSurfaceView.java | |||
| @@ -45,14 +45,11 @@ public class EmacsSurfaceView extends SurfaceView | |||
| 45 | surfaceChanged (SurfaceHolder holder, int format, | 45 | surfaceChanged (SurfaceHolder holder, int format, |
| 46 | int width, int height) | 46 | int width, int height) |
| 47 | { | 47 | { |
| 48 | Log.d (TAG, "surfaceChanged: " + view + ", " + view.pendingConfigure); | 48 | Canvas canvas; |
| 49 | 49 | ||
| 50 | /* Make sure not to swap buffers if there is pending | 50 | Log.d (TAG, "surfaceChanged: " + view + ", "); |
| 51 | configuration, because otherwise the redraw callback will not | ||
| 52 | run correctly. */ | ||
| 53 | 51 | ||
| 54 | if (view.pendingConfigure == 0) | 52 | view.swapBuffers (true); |
| 55 | view.swapBuffers (); | ||
| 56 | } | 53 | } |
| 57 | 54 | ||
| 58 | @Override | 55 | @Override |
| @@ -67,7 +64,7 @@ public class EmacsSurfaceView extends SurfaceView | |||
| 67 | 64 | ||
| 68 | /* Drop the lock when doing this, or a deadlock can | 65 | /* Drop the lock when doing this, or a deadlock can |
| 69 | result. */ | 66 | result. */ |
| 70 | view.swapBuffers (); | 67 | view.swapBuffers (true); |
| 71 | } | 68 | } |
| 72 | 69 | ||
| 73 | @Override | 70 | @Override |
| @@ -82,44 +79,6 @@ public class EmacsSurfaceView extends SurfaceView | |||
| 82 | } | 79 | } |
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | /* And this is the callback used on Android 26 and later. It is | ||
| 86 | used because it can tell the system when drawing completes. */ | ||
| 87 | |||
| 88 | private class Callback2 extends Callback implements SurfaceHolder.Callback2 | ||
| 89 | { | ||
| 90 | @Override | ||
| 91 | public void | ||
| 92 | surfaceRedrawNeeded (SurfaceHolder holder) | ||
| 93 | { | ||
| 94 | /* This version is not supported. */ | ||
| 95 | return; | ||
| 96 | } | ||
| 97 | |||
| 98 | @Override | ||
| 99 | public void | ||
| 100 | surfaceRedrawNeededAsync (SurfaceHolder holder, | ||
| 101 | Runnable drawingFinished) | ||
| 102 | { | ||
| 103 | Runnable old; | ||
| 104 | |||
| 105 | Log.d (TAG, "surfaceRedrawNeededAsync: " + view.pendingConfigure); | ||
| 106 | |||
| 107 | /* The system calls this function when it wants to know whether | ||
| 108 | or not Emacs is still configuring itself in response to a | ||
| 109 | resize. | ||
| 110 | |||
| 111 | If the view did not send an outstanding ConfigureNotify | ||
| 112 | event, then call drawingFinish immediately. Else, give it to | ||
| 113 | the view to execute after drawing completes. */ | ||
| 114 | |||
| 115 | if (view.pendingConfigure == 0) | ||
| 116 | drawingFinished.run (); | ||
| 117 | else | ||
| 118 | /* And set this runnable to run once drawing completes. */ | ||
| 119 | view.drawingFinished = drawingFinished; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | public | 82 | public |
| 124 | EmacsSurfaceView (final EmacsView view) | 83 | EmacsSurfaceView (final EmacsView view) |
| 125 | { | 84 | { |
| @@ -128,10 +87,7 @@ public class EmacsSurfaceView extends SurfaceView | |||
| 128 | this.surfaceChangeLock = new Object (); | 87 | this.surfaceChangeLock = new Object (); |
| 129 | this.view = view; | 88 | this.view = view; |
| 130 | 89 | ||
| 131 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) | 90 | getHolder ().addCallback (new Callback ()); |
| 132 | getHolder ().addCallback (new Callback ()); | ||
| 133 | else | ||
| 134 | getHolder ().addCallback (new Callback2 ()); | ||
| 135 | } | 91 | } |
| 136 | 92 | ||
| 137 | public boolean | 93 | public boolean |
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java index 873124c86d1..fac11870ebf 100644 --- a/java/org/gnu/emacs/EmacsView.java +++ b/java/org/gnu/emacs/EmacsView.java | |||
| @@ -96,13 +96,6 @@ public class EmacsView extends ViewGroup | |||
| 96 | /* The InputMethodManager for this view's context. */ | 96 | /* The InputMethodManager for this view's context. */ |
| 97 | private InputMethodManager imManager; | 97 | private InputMethodManager imManager; |
| 98 | 98 | ||
| 99 | /* Runnable that will run once drawing completes. */ | ||
| 100 | public Runnable drawingFinished; | ||
| 101 | |||
| 102 | /* Serial of the last ConfigureNotify event sent that Emacs has not | ||
| 103 | yet responded to. 0 if there is no such outstanding event. */ | ||
| 104 | public long pendingConfigure; | ||
| 105 | |||
| 106 | /* Whether or not this view is attached to a window. */ | 99 | /* Whether or not this view is attached to a window. */ |
| 107 | public boolean isAttachedToWindow; | 100 | public boolean isAttachedToWindow; |
| 108 | 101 | ||
| @@ -110,6 +103,14 @@ public class EmacsView extends ViewGroup | |||
| 110 | displayed whenever possible. */ | 103 | displayed whenever possible. */ |
| 111 | public boolean isCurrentlyTextEditor; | 104 | public boolean isCurrentlyTextEditor; |
| 112 | 105 | ||
| 106 | /* An empty rectangle. */ | ||
| 107 | public static final Rect emptyRect; | ||
| 108 | |||
| 109 | static | ||
| 110 | { | ||
| 111 | emptyRect = new Rect (); | ||
| 112 | }; | ||
| 113 | |||
| 113 | public | 114 | public |
| 114 | EmacsView (EmacsWindow window) | 115 | EmacsView (EmacsWindow window) |
| 115 | { | 116 | { |
| @@ -286,16 +287,10 @@ public class EmacsView extends ViewGroup | |||
| 286 | int count, i; | 287 | int count, i; |
| 287 | View child; | 288 | View child; |
| 288 | Rect windowRect; | 289 | Rect windowRect; |
| 290 | int wantedWidth, wantedHeight; | ||
| 289 | 291 | ||
| 290 | count = getChildCount (); | 292 | count = getChildCount (); |
| 291 | 293 | ||
| 292 | if (changed || mustReportLayout) | ||
| 293 | { | ||
| 294 | mustReportLayout = false; | ||
| 295 | pendingConfigure | ||
| 296 | = window.viewLayout (left, top, right, bottom); | ||
| 297 | } | ||
| 298 | |||
| 299 | measuredWidth = right - left; | 294 | measuredWidth = right - left; |
| 300 | measuredHeight = bottom - top; | 295 | measuredHeight = bottom - top; |
| 301 | 296 | ||
| @@ -311,8 +306,6 @@ public class EmacsView extends ViewGroup | |||
| 311 | Log.d (TAG, "onLayout: " + child); | 306 | Log.d (TAG, "onLayout: " + child); |
| 312 | 307 | ||
| 313 | if (child == surfaceView) | 308 | if (child == surfaceView) |
| 314 | /* The child is the surface view, so give it the entire | ||
| 315 | view. */ | ||
| 316 | child.layout (0, 0, right - left, bottom - top); | 309 | child.layout (0, 0, right - left, bottom - top); |
| 317 | else if (child.getVisibility () != GONE) | 310 | else if (child.getVisibility () != GONE) |
| 318 | { | 311 | { |
| @@ -326,6 +319,14 @@ public class EmacsView extends ViewGroup | |||
| 326 | windowRect.right, windowRect.bottom); | 319 | windowRect.right, windowRect.bottom); |
| 327 | } | 320 | } |
| 328 | } | 321 | } |
| 322 | |||
| 323 | /* Now report the layout change to the window. */ | ||
| 324 | |||
| 325 | if (changed || mustReportLayout) | ||
| 326 | { | ||
| 327 | mustReportLayout = false; | ||
| 328 | window.viewLayout (left, top, right, bottom); | ||
| 329 | } | ||
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | public void | 332 | public void |
| @@ -352,7 +353,7 @@ public class EmacsView extends ViewGroup | |||
| 352 | 353 | ||
| 353 | synchronized (damageRegion) | 354 | synchronized (damageRegion) |
| 354 | { | 355 | { |
| 355 | if (damageRegion.isEmpty ()) | 356 | if (!force && damageRegion.isEmpty ()) |
| 356 | return; | 357 | return; |
| 357 | 358 | ||
| 358 | bitmap = getBitmap (); | 359 | bitmap = getBitmap (); |
| @@ -363,7 +364,10 @@ public class EmacsView extends ViewGroup | |||
| 363 | 364 | ||
| 364 | synchronized (surfaceView.surfaceChangeLock) | 365 | synchronized (surfaceView.surfaceChangeLock) |
| 365 | { | 366 | { |
| 366 | damageRect = damageRegion.getBounds (); | 367 | if (!force) |
| 368 | damageRect = damageRegion.getBounds (); | ||
| 369 | else | ||
| 370 | damageRect = emptyRect; | ||
| 367 | 371 | ||
| 368 | if (!surfaceView.isCreated ()) | 372 | if (!surfaceView.isCreated ()) |
| 369 | return; | 373 | return; |
| @@ -612,24 +616,6 @@ public class EmacsView extends ViewGroup | |||
| 612 | isCurrentlyTextEditor = false; | 616 | isCurrentlyTextEditor = false; |
| 613 | } | 617 | } |
| 614 | 618 | ||
| 615 | public void | ||
| 616 | windowUpdated (long serial) | ||
| 617 | { | ||
| 618 | Log.d (TAG, "windowUpdated: serial is " + serial); | ||
| 619 | |||
| 620 | if (pendingConfigure <= serial | ||
| 621 | /* Detect wraparound. */ | ||
| 622 | || pendingConfigure - serial >= 0x7fffffff) | ||
| 623 | { | ||
| 624 | pendingConfigure = 0; | ||
| 625 | |||
| 626 | if (drawingFinished != null) | ||
| 627 | drawingFinished.run (); | ||
| 628 | |||
| 629 | drawingFinished = null; | ||
| 630 | } | ||
| 631 | } | ||
| 632 | |||
| 633 | @Override | 619 | @Override |
| 634 | public InputConnection | 620 | public InputConnection |
| 635 | onCreateInputConnection (EditorInfo info) | 621 | onCreateInputConnection (EditorInfo info) |
diff --git a/lisp/frame.el b/lisp/frame.el index a88af24a152..d925a87153c 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -2564,11 +2564,16 @@ On systems with an on-screen keyboard, display the on screen | |||
| 2564 | keyboard on behalf of the frame FRAME if HIDE is nil. Else, hide | 2564 | keyboard on behalf of the frame FRAME if HIDE is nil. Else, hide |
| 2565 | the on screen keyboard. | 2565 | the on screen keyboard. |
| 2566 | 2566 | ||
| 2567 | Return whether or not the on screen keyboard may have been | ||
| 2568 | displayed; that is, return t on systems with an on screen | ||
| 2569 | keyboard, and nil on those without. | ||
| 2570 | |||
| 2567 | FRAME must already have the input focus for this to work | 2571 | FRAME must already have the input focus for this to work |
| 2568 | reliably." | 2572 | reliably." |
| 2569 | (let ((frame-type (framep-on-display frame))) | 2573 | (let ((frame-type (framep-on-display frame))) |
| 2570 | (cond ((eq frame-type 'android) | 2574 | (cond ((eq frame-type 'android) |
| 2571 | (android-toggle-on-screen-keyboard frame hide))))) | 2575 | (android-toggle-on-screen-keyboard frame hide) t) |
| 2576 | (t nil)))) | ||
| 2572 | 2577 | ||
| 2573 | 2578 | ||
| 2574 | ;;;; Frame geometry values | 2579 | ;;;; Frame geometry values |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3b110e8416f..8c1a0d4b21c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -4577,20 +4577,49 @@ is included in the return value." | |||
| 4577 | ;; Try to display the on screen keyboard whenever entering the | 4577 | ;; Try to display the on screen keyboard whenever entering the |
| 4578 | ;; mini-buffer, and hide it whenever leaving. | 4578 | ;; mini-buffer, and hide it whenever leaving. |
| 4579 | 4579 | ||
| 4580 | (defvar minibuffer-on-screen-keyboard-timer nil | ||
| 4581 | "Timer run upon exiting the minibuffer. | ||
| 4582 | It will hide the on screen keyboard when necessary.") | ||
| 4583 | |||
| 4584 | (defvar minibuffer-on-screen-keyboard-displayed nil | ||
| 4585 | "Whether or not the on-screen keyboard has been displayed. | ||
| 4586 | Set inside `minibuffer-setup-on-screen-keyboard'.") | ||
| 4587 | |||
| 4580 | (defun minibuffer-setup-on-screen-keyboard () | 4588 | (defun minibuffer-setup-on-screen-keyboard () |
| 4581 | "Maybe display the on-screen keyboard in the current frame. | 4589 | "Maybe display the on-screen keyboard in the current frame. |
| 4582 | Display the on-screen keyboard in the current frame if the | 4590 | Display the on-screen keyboard in the current frame if the |
| 4583 | last device to have sent an input event is not a keyboard. | 4591 | last device to have sent an input event is not a keyboard. |
| 4584 | This is run upon minibuffer setup." | 4592 | This is run upon minibuffer setup." |
| 4593 | ;; Don't hide the on screen keyboard later on. | ||
| 4594 | (when minibuffer-on-screen-keyboard-timer | ||
| 4595 | (cancel-timer minibuffer-on-screen-keyboard-timer) | ||
| 4596 | (setq minibuffer-on-screen-keyboard-timer nil)) | ||
| 4597 | (setq minibuffer-on-screen-keyboard-displayed nil) | ||
| 4585 | (when (not (memq (device-class last-event-frame | 4598 | (when (not (memq (device-class last-event-frame |
| 4586 | last-event-device) | 4599 | last-event-device) |
| 4587 | '(keyboard core-keyboard))) | 4600 | '(keyboard core-keyboard))) |
| 4588 | (frame-toggle-on-screen-keyboard (selected-frame) nil))) | 4601 | (setq minibuffer-on-screen-keyboard-displayed |
| 4602 | (frame-toggle-on-screen-keyboard (selected-frame) nil)))) | ||
| 4589 | 4603 | ||
| 4590 | (defun minibuffer-exit-on-screen-keyboard () | 4604 | (defun minibuffer-exit-on-screen-keyboard () |
| 4591 | "Hide the on-screen keyboard if it was displayed. | 4605 | "Hide the on-screen keyboard if it was displayed. |
| 4592 | This is run upon minibuffer exit." | 4606 | Hide the on-screen keyboard in a timer set to run in 0.1 seconds. |
| 4593 | (frame-toggle-on-screen-keyboard (selected-frame) t)) | 4607 | It will be cancelled if the minibuffer is displayed again within |
| 4608 | that timeframe. | ||
| 4609 | |||
| 4610 | Do not hide the on screen keyboard inside a recursive edit. | ||
| 4611 | Likewise, do not hide the on screen keyboard if point in the | ||
| 4612 | window that will be selected after exiting the minibuffer is not | ||
| 4613 | on read-only text. | ||
| 4614 | |||
| 4615 | The latter is implemented in `touch-screen.el'." | ||
| 4616 | (unless (or (not minibuffer-on-screen-keyboard-displayed) | ||
| 4617 | (> (recursion-depth) 1)) | ||
| 4618 | (when minibuffer-on-screen-keyboard-timer | ||
| 4619 | (cancel-timer minibuffer-on-screen-keyboard-timer)) | ||
| 4620 | (setq minibuffer-on-screen-keyboard-timer | ||
| 4621 | (run-with-timer 0.1 nil #'frame-toggle-on-screen-keyboard | ||
| 4622 | (selected-frame) t)))) | ||
| 4594 | 4623 | ||
| 4595 | (add-hook 'minibuffer-setup-hook #'minibuffer-setup-on-screen-keyboard) | 4624 | (add-hook 'minibuffer-setup-hook #'minibuffer-setup-on-screen-keyboard) |
| 4596 | (add-hook 'minibuffer-exit-hook #'minibuffer-exit-on-screen-keyboard) | 4625 | (add-hook 'minibuffer-exit-hook #'minibuffer-exit-on-screen-keyboard) |
diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 8c4a73f326d..01e56f1d499 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el | |||
| @@ -351,6 +351,21 @@ then move point to the position of POINT." | |||
| 351 | (goto-char (1+ (window-end nil t)))) | 351 | (goto-char (1+ (window-end nil t)))) |
| 352 | (redisplay)))))))))))) | 352 | (redisplay)))))))))))) |
| 353 | 353 | ||
| 354 | (defun touch-screen-window-selection-changed (frame) | ||
| 355 | "Notice that FRAME's selected window has changed. | ||
| 356 | If point is now on read only text, hide the on screen keyboard. | ||
| 357 | Otherwise, cancel any timer that is supposed to hide the keyboard | ||
| 358 | in response to the minibuffer being closed." | ||
| 359 | (with-selected-frame frame | ||
| 360 | (if (or buffer-read-only | ||
| 361 | (get-text-property (point) 'read-only)) | ||
| 362 | (frame-toggle-on-screen-keyboard (selected-frame) t) | ||
| 363 | ;; Prevent hiding the minibuffer from hiding the on screen | ||
| 364 | ;; keyboard. | ||
| 365 | (when minibuffer-on-screen-keyboard-timer | ||
| 366 | (cancel-timer minibuffer-on-screen-keyboard-timer) | ||
| 367 | (setq minibuffer-on-screen-keyboard-timer nil))))) | ||
| 368 | |||
| 354 | (defun touch-screen-handle-point-up (point) | 369 | (defun touch-screen-handle-point-up (point) |
| 355 | "Notice that POINT has been removed from the screen. | 370 | "Notice that POINT has been removed from the screen. |
| 356 | POINT should be the point currently tracked as | 371 | POINT should be the point currently tracked as |
| @@ -404,7 +419,16 @@ is not read-only." | |||
| 404 | (when (memq command touch-screen-set-point-commands) | 419 | (when (memq command touch-screen-set-point-commands) |
| 405 | (if (not (or buffer-read-only | 420 | (if (not (or buffer-read-only |
| 406 | (get-text-property (point) 'read-only))) | 421 | (get-text-property (point) 'read-only))) |
| 407 | (frame-toggle-on-screen-keyboard (selected-frame) nil) | 422 | ;; Once the on-screen keyboard has been opened, |
| 423 | ;; add `touch-screen-window-selection-changed' | ||
| 424 | ;; as a window selection change function This | ||
| 425 | ;; allows the on screen keyboard to be hidden | ||
| 426 | ;; if the selected window's point becomes read | ||
| 427 | ;; only at some point in the future. | ||
| 428 | (progn | ||
| 429 | (add-hook 'window-selection-change-functions | ||
| 430 | #'touch-screen-window-selection-changed) | ||
| 431 | (frame-toggle-on-screen-keyboard (selected-frame) nil)) | ||
| 408 | ;; Otherwise, hide the on screen keyboard now. | 432 | ;; Otherwise, hide the on screen keyboard now. |
| 409 | (frame-toggle-on-screen-keyboard (selected-frame) t)))))))))) | 433 | (frame-toggle-on-screen-keyboard (selected-frame) t)))))))))) |
| 410 | 434 | ||
diff --git a/src/android.c b/src/android.c index a0e64471a05..ebd374addbf 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -125,7 +125,6 @@ struct android_emacs_window | |||
| 125 | jclass class; | 125 | jclass class; |
| 126 | jmethodID swap_buffers; | 126 | jmethodID swap_buffers; |
| 127 | jmethodID toggle_on_screen_keyboard; | 127 | jmethodID toggle_on_screen_keyboard; |
| 128 | jmethodID window_updated; | ||
| 129 | }; | 128 | }; |
| 130 | 129 | ||
| 131 | /* The API level of the current device. */ | 130 | /* The API level of the current device. */ |
| @@ -1830,7 +1829,6 @@ android_init_emacs_window (void) | |||
| 1830 | FIND_METHOD (swap_buffers, "swapBuffers", "()V"); | 1829 | FIND_METHOD (swap_buffers, "swapBuffers", "()V"); |
| 1831 | FIND_METHOD (toggle_on_screen_keyboard, | 1830 | FIND_METHOD (toggle_on_screen_keyboard, |
| 1832 | "toggleOnScreenKeyboard", "(Z)V"); | 1831 | "toggleOnScreenKeyboard", "(Z)V"); |
| 1833 | FIND_METHOD (window_updated, "windowUpdated", "(J)V"); | ||
| 1834 | #undef FIND_METHOD | 1832 | #undef FIND_METHOD |
| 1835 | } | 1833 | } |
| 1836 | 1834 | ||
| @@ -4325,25 +4323,6 @@ android_toggle_on_screen_keyboard (android_window window, bool show) | |||
| 4325 | android_exception_check (); | 4323 | android_exception_check (); |
| 4326 | } | 4324 | } |
| 4327 | 4325 | ||
| 4328 | /* Tell the window system that all configure events sent to WINDOW | ||
| 4329 | have been fully processed, and that it is now okay to display its | ||
| 4330 | new contents. SERIAL is the serial of the last configure event | ||
| 4331 | processed. */ | ||
| 4332 | |||
| 4333 | void | ||
| 4334 | android_window_updated (android_window window, unsigned long serial) | ||
| 4335 | { | ||
| 4336 | jobject object; | ||
| 4337 | jmethodID method; | ||
| 4338 | |||
| 4339 | object = android_resolve_handle (window, ANDROID_HANDLE_WINDOW); | ||
| 4340 | method = window_class.window_updated; | ||
| 4341 | |||
| 4342 | (*android_java_env)->CallVoidMethod (android_java_env, object, | ||
| 4343 | method, (jlong) serial); | ||
| 4344 | android_exception_check (); | ||
| 4345 | } | ||
| 4346 | |||
| 4347 | 4326 | ||
| 4348 | 4327 | ||
| 4349 | /* When calling the system's faccessat, make sure to clear the flag | 4328 | /* When calling the system's faccessat, make sure to clear the flag |
diff --git a/src/android.h b/src/android.h index da5c4379800..9006f5f34c5 100644 --- a/src/android.h +++ b/src/android.h | |||
| @@ -88,7 +88,6 @@ extern void android_exception_check (void); | |||
| 88 | extern void android_get_keysym_name (int, char *, size_t); | 88 | extern void android_get_keysym_name (int, char *, size_t); |
| 89 | extern void android_wait_event (void); | 89 | extern void android_wait_event (void); |
| 90 | extern void android_toggle_on_screen_keyboard (android_window, bool); | 90 | extern void android_toggle_on_screen_keyboard (android_window, bool); |
| 91 | extern void android_window_updated (android_window, unsigned long); | ||
| 92 | extern _Noreturn void android_restart_emacs (void); | 91 | extern _Noreturn void android_restart_emacs (void); |
| 93 | extern int android_get_current_api_level (void); | 92 | extern int android_get_current_api_level (void); |
| 94 | 93 | ||
diff --git a/src/androidterm.c b/src/androidterm.c index d5dafe9b0d7..4aee1a90b68 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -591,17 +591,7 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 591 | android_clear_under_internal_border (f); | 591 | android_clear_under_internal_border (f); |
| 592 | SET_FRAME_GARBAGED (f); | 592 | SET_FRAME_GARBAGED (f); |
| 593 | cancel_mouse_face (f); | 593 | cancel_mouse_face (f); |
| 594 | |||
| 595 | /* Now stash the serial of this configure event somewhere, | ||
| 596 | and call android_window_updated with it once the redraw | ||
| 597 | completes. */ | ||
| 598 | FRAME_OUTPUT_DATA (f)->last_configure_serial | ||
| 599 | = configureEvent.xconfigure.serial; | ||
| 600 | } | 594 | } |
| 601 | else | ||
| 602 | /* Reply to this ConfigureNotify event immediately. */ | ||
| 603 | android_window_updated (FRAME_ANDROID_WINDOW (f), | ||
| 604 | configureEvent.xconfigure.serial); | ||
| 605 | 595 | ||
| 606 | goto OTHER; | 596 | goto OTHER; |
| 607 | 597 | ||
| @@ -1352,14 +1342,6 @@ android_frame_up_to_date (struct frame *f) | |||
| 1352 | /* The frame is now complete, as its contents have been drawn. */ | 1342 | /* The frame is now complete, as its contents have been drawn. */ |
| 1353 | FRAME_ANDROID_COMPLETE_P (f) = true; | 1343 | FRAME_ANDROID_COMPLETE_P (f) = true; |
| 1354 | 1344 | ||
| 1355 | /* If there was an outstanding configure event, then tell system | ||
| 1356 | that the update has finished and the new contents can now be | ||
| 1357 | displayed. */ | ||
| 1358 | if (FRAME_OUTPUT_DATA (f)->last_configure_serial) | ||
| 1359 | android_window_updated (FRAME_ANDROID_WINDOW (f), | ||
| 1360 | FRAME_OUTPUT_DATA (f)->last_configure_serial); | ||
| 1361 | FRAME_OUTPUT_DATA (f)->last_configure_serial = 0; | ||
| 1362 | |||
| 1363 | /* Shrink the scanline buffer used by the font backend. */ | 1345 | /* Shrink the scanline buffer used by the font backend. */ |
| 1364 | sfntfont_android_shrink_scanline_buffer (); | 1346 | sfntfont_android_shrink_scanline_buffer (); |
| 1365 | unblock_input (); | 1347 | unblock_input (); |
diff --git a/src/androidterm.h b/src/androidterm.h index 8cc31f1ab57..ac845187a66 100644 --- a/src/androidterm.h +++ b/src/androidterm.h | |||
| @@ -241,11 +241,6 @@ struct android_output | |||
| 241 | /* List of all tools (either styluses or fingers) pressed onto the | 241 | /* List of all tools (either styluses or fingers) pressed onto the |
| 242 | frame. */ | 242 | frame. */ |
| 243 | struct android_touch_point *touch_points; | 243 | struct android_touch_point *touch_points; |
| 244 | |||
| 245 | /* Event serial of the last ConfigureNotify event received that has | ||
| 246 | not yet been drawn. This is used to synchronize resize with the | ||
| 247 | window system. 0 if no such outstanding event exists. */ | ||
| 248 | unsigned long last_configure_serial; | ||
| 249 | }; | 244 | }; |
| 250 | 245 | ||
| 251 | enum | 246 | enum |