From 801eb8f478e1617f3c49de16aba7d4de4163ccd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 16 Jan 2021 14:17:58 -0800 Subject: [PATCH] Enable TTY mouse-face support when built without GPM support * src/term.c (tty_write_glyphs_with_face): Move definition out of ifdef block. * src/xdisp.c (draw_row_with_mouse_face): Move call to tty_draw_row_with_mouse_face out of ifdef block. --- src/term.c | 35 ++++++++++++++++------------------- src/xdisp.c | 3 +-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/term.c b/src/term.c index 2e2ab2bf43..37c06a560d 100644 --- a/src/term.c +++ b/src/term.c @@ -790,8 +790,6 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) cmcheckmagic (tty); } -#ifdef HAVE_GPM /* Only used by GPM code. */ - static void tty_write_glyphs_with_face (register struct frame *f, register struct glyph *string, register int len, register int face_id) @@ -847,7 +845,6 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str cmcheckmagic (tty); } -#endif /* An implementation of insert_glyphs for termcap frames. */ @@ -2380,22 +2377,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0, Mouse ***********************************************************************/ -#ifdef HAVE_GPM - -void -term_mouse_moveto (int x, int y) -{ - /* TODO: how to set mouse position? - const char *name; - int fd; - name = (const char *) ttyname (0); - fd = emacs_open (name, O_WRONLY, 0); - SOME_FUNCTION (x, y, fd); - emacs_close (fd); - last_mouse_x = x; - last_mouse_y = y; */ -} - /* Implementation of draw_row_with_mouse_face for TTY/GPM. */ void tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, @@ -2428,6 +2409,22 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, cursor_to (f, save_y, save_x); } +#ifdef HAVE_GPM + +void +term_mouse_moveto (int x, int y) +{ + /* TODO: how to set mouse position? + const char *name; + int fd; + name = (const char *) ttyname (0); + fd = emacs_open (name, O_WRONLY, 0); + SOME_FUNCTION (x, y, fd); + emacs_close (fd); + last_mouse_x = x; + last_mouse_y = y; */ +} + /* Return the current time, as a Time value. Wrap around on overflow. */ static Time current_Time (void) diff --git a/src/xdisp.c b/src/xdisp.c index 32e9773b54..e1e4ff4136 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31927,9 +31927,8 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, return; } #endif -#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT) + tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw); -#endif } /* Display the active region described by mouse_face_* according to DRAW. */ -- 2.20.1