+/* Update a TTY frame F that has a menu dropped down over some of its
+ glyphs. This is like the second part of update_frame, but it
+ doesn't call build_frame_matrix, because we already have the
+ desired matrix prepared, and don't want it to be overwritten by the
+ text of the normal display.
+
+ ROW and COL, if non-negative, are the row and column of the TTY
+ frame where to position the cursor after the frame update is
+ complete. Negative values mean ask update_frame_1 to position the
+ cursor "normally", i.e. at point in the selected window. */
+void
+update_frame_with_menu (struct frame *f, int row, int col)
+{
+ struct window *root_window = XWINDOW (f->root_window);
+ bool paused_p, cursor_at_point_p;
+
+ eassert (FRAME_TERMCAP_P (f));
+
+ /* We are working on frame matrix basis. Set the frame on whose
+ frame matrix we operate. */
+ set_frame_matrix_frame (f);
+
+ /* Update the display. */
+ update_begin (f);
+ cursor_at_point_p = !(row >= 0 && col >= 0);
+ /* Force update_frame_1 not to stop due to pending input, and not
+ try scrolling. */
+ paused_p = update_frame_1 (f, 1, 1, cursor_at_point_p);
+ /* ROW and COL tell us where in the menu to position the cursor, so
+ that screen readers know the active region on the screen. */
+ if (!cursor_at_point_p)
+ cursor_to (f, row, col);
+ update_end (f);
+
+ if (FRAME_TTY (f)->termscript)
+ fflush (FRAME_TTY (f)->termscript);
+ fflush (FRAME_TTY (f)->output);
+ /* Check window matrices for lost pointers. */
+#if GLYPH_DEBUG
+#if 0
+ /* We cannot possibly survive the matrix pointers check, since
+ we have overwritten parts of the frame glyph matrix without
+ making any updates to the window matrices. */
+ check_window_matrix_pointers (root_window);
+#endif
+ add_frame_display_history (f, paused_p);
+#endif
+
+ /* Reset flags indicating that a window should be updated. */
+ set_window_update_flags (root_window, false);
+ display_completed = !paused_p;
+}