aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Möllmann2025-01-25 09:39:11 +0100
committerGerd Möllmann2025-01-25 09:39:11 +0100
commitd93d822285813b89f2444ef93c5747cbeb67a46b (patch)
treeae5f53b1a577beb27b50bf0cf08a66e1f3c430c2 /src
parent57b7c07b3709d9a2b2c70e0c8218a52448368a12 (diff)
downloademacs-d93d822285813b89f2444ef93c5747cbeb67a46b.tar.gz
emacs-d93d822285813b89f2444ef93c5747cbeb67a46b.zip
Revert "Multi-tty: selected frame can be a GUI frame"
This reverts commit 57b7c07b3709d9a2b2c70e0c8218a52448368a12.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c53
1 files changed, 15 insertions, 38 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index bc37230d70c..5a8064a1a02 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3906,44 +3906,26 @@ is_in_matrix (struct frame *f, int x, int y)
3906 return true; 3906 return true;
3907} 3907}
3908 3908
3909/* Return the frame of the selected window of frame F. 3909/* Is the terminal cursor of the selected frame obscured by a child
3910 Value is NULL if we can't tell. */ 3910 frame? */
3911
3912static struct frame *
3913frame_selected_window_frame (struct frame *f)
3914{
3915 /* Paranoia. It should not happen that window or frame not valid. */
3916 Lisp_Object frame;
3917 if (WINDOWP (f->selected_window)
3918 && (frame = XWINDOW (f->selected_window)->frame,
3919 FRAMEP (frame)))
3920 return XFRAME (frame);
3921 return NULL;
3922}
3923
3924/* Is the terminal cursor of ROOT obscured by a child frame? */
3925 3911
3926static bool 3912static bool
3927is_cursor_obscured (struct frame *root) 3913is_cursor_obscured (void)
3928{ 3914{
3929 /* Determine in which frame on ROOT the cursor could be. */
3930 struct frame *sf = frame_selected_window_frame (root);
3931 if (sf == NULL)
3932 return false;
3933
3934 /* Give up if we can't tell where the cursor currently is. */ 3915 /* Give up if we can't tell where the cursor currently is. */
3935 int x, y; 3916 int x, y;
3936 if (!abs_cursor_pos (sf, &x, &y)) 3917 if (!abs_cursor_pos (SELECTED_FRAME (), &x, &y))
3937 return false; 3918 return false;
3938 3919
3939 /* (x, y) may be outside of the root frame in case the selected frame is a 3920 /* (x, y) may be outside of the root frame in case the selected frame is a
3940 child frame which is clipped. */ 3921 child frame which is clipped. */
3922 struct frame *root = root_frame (SELECTED_FRAME ());
3941 if (!is_in_matrix (root, x, y)) 3923 if (!is_in_matrix (root, x, y))
3942 return true; 3924 return true;
3943 3925
3944 struct glyph_row *cursor_row = MATRIX_ROW (root->current_matrix, y); 3926 struct glyph_row *cursor_row = MATRIX_ROW (root->current_matrix, y);
3945 struct glyph *cursor_glyph = cursor_row->glyphs[0] + x; 3927 struct glyph *cursor_glyph = cursor_row->glyphs[0] + x;
3946 return cursor_glyph->frame != sf; 3928 return cursor_glyph->frame != SELECTED_FRAME ();
3947} 3929}
3948 3930
3949/* Decide where to show the cursor, and whether to hide it. 3931/* Decide where to show the cursor, and whether to hide it.
@@ -3957,7 +3939,7 @@ static void
3957terminal_cursor_magic (struct frame *root, struct frame *topmost_child) 3939terminal_cursor_magic (struct frame *root, struct frame *topmost_child)
3958{ 3940{
3959 /* By default, prevent the cursor "shining through" child frames. */ 3941 /* By default, prevent the cursor "shining through" child frames. */
3960 if (is_cursor_obscured (root)) 3942 if (is_cursor_obscured ())
3961 tty_hide_cursor (FRAME_TTY (root)); 3943 tty_hide_cursor (FRAME_TTY (root));
3962 3944
3963 /* If the terminal cursor is not in the topmost child, the topmost 3945 /* If the terminal cursor is not in the topmost child, the topmost
@@ -3965,8 +3947,7 @@ terminal_cursor_magic (struct frame *root, struct frame *topmost_child)
3965 non-nil, display the cursor in this "non-selected" topmost child 3947 non-nil, display the cursor in this "non-selected" topmost child
3966 frame to compensate for the fact that we can't display a 3948 frame to compensate for the fact that we can't display a
3967 non-selected cursor like on a window system frame. */ 3949 non-selected cursor like on a window system frame. */
3968 struct frame *sf = frame_selected_window_frame (root); 3950 if (topmost_child != SELECTED_FRAME ())
3969 if (sf && topmost_child != sf)
3970 { 3951 {
3971 Lisp_Object frame; 3952 Lisp_Object frame;
3972 XSETFRAME (frame, topmost_child); 3953 XSETFRAME (frame, topmost_child);
@@ -3978,23 +3959,25 @@ terminal_cursor_magic (struct frame *root, struct frame *topmost_child)
3978 if (is_in_matrix (root, x, y)) 3959 if (is_in_matrix (root, x, y))
3979 { 3960 {
3980 cursor_to (root, y, x); 3961 cursor_to (root, y, x);
3981 tty_show_cursor (FRAME_TTY (root)); 3962 tty_show_cursor (FRAME_TTY (topmost_child));
3982 } 3963 }
3983 else 3964 else
3984 tty_hide_cursor (FRAME_TTY (root)); 3965 tty_hide_cursor (FRAME_TTY (root));
3985 } 3966 }
3986 } 3967 }
3987} 3968}
3988 3969
3970#endif /* !HAVE_ANDROID */
3971
3989void 3972void
3990combine_updates_for_frame (struct frame *f, bool inhibit_scrolling) 3973combine_updates_for_frame (struct frame *f, bool inhibit_scrolling)
3991{ 3974{
3975#ifndef HAVE_ANDROID
3992 struct frame *root = root_frame (f); 3976 struct frame *root = root_frame (f);
3993 3977
3994 /* Determine visible frames on the root frame, including the root 3978 /* Determine visible frames on the root frame, including the root
3995 frame itself. Note that there are cases, see bug#75056, where we 3979 frame itself. Note that there are cases, see bug#75056, where we
3996 can be called for invisible frames. This looks like a bug with 3980 can be called for invisible frames. */
3997 multi-tty, but the old update code didn't check visibility either. */
3998 Lisp_Object z_order = frames_in_reverse_z_order (root, true); 3981 Lisp_Object z_order = frames_in_reverse_z_order (root, true);
3999 if (NILP (z_order)) 3982 if (NILP (z_order))
4000 { 3983 {
@@ -4035,14 +4018,8 @@ combine_updates_for_frame (struct frame *f, bool inhibit_scrolling)
4035 add_frame_display_history (f, false); 4018 add_frame_display_history (f, false);
4036#endif 4019#endif
4037 } 4020 }
4038}
4039
4040#else /* HAVE_ANDROID */
4041void
4042combine_updates_for_frame (struct frame *f, bool inhibit_scrolling)
4043{
4044}
4045#endif /* HAVE_ANDROID */ 4021#endif /* HAVE_ANDROID */
4022}
4046 4023
4047/* Update on the screen all root frames ROOTS. Called from 4024/* Update on the screen all root frames ROOTS. Called from
4048 redisplay_internal as the last step of redisplaying. */ 4025 redisplay_internal as the last step of redisplaying. */