public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] Disable mouse events if the command window has focos
Date: Mon,  7 Jun 2021 18:30:02 +0200	[thread overview]
Message-ID: <20210607163003.621-2-ssbssa@yahoo.de> (raw)
In-Reply-To: <20210607163003.621-1-ssbssa@yahoo.de>

This is necessary because if the command window has focus, the keypad is
disabled, and without the keypad the mouse escape sequences are not handled
by curses, and instead seen by gdb as console input.

gdb/ChangeLog:

2021-06-07  Hannes Domani  <ssbssa@yahoo.de>

	* tui/tui-data.c (tui_set_win_focus_to): Add mousemask call.
	* tui/tui-io.c (tui_prep_terminal): Only call mousemask if
	command window doesn't have focus.
---
 gdb/tui/tui-data.c | 6 ++++++
 gdb/tui/tui-io.c   | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 89afdb429ba..e6452386628 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -74,6 +74,12 @@ tui_set_win_focus_to (struct tui_win_info *win_info)
       /* Enable the keypad if any window except the command window has
 	 the focus.  */
       keypad (TUI_CMD_WIN->handle.get (), win_info != TUI_CMD_WIN);
+
+#ifdef NCURSES_MOUSE_VERSION
+      /* The mouse events only work with enabled keypad, so enable them
+	 accordingly.  */
+      mousemask (win_info != TUI_CMD_WIN ? ALL_MOUSE_EVENTS : 0, NULL);
+#endif
     }
 }
 
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 7df0e2f1bd3..4570e55231b 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -640,7 +640,8 @@ static void
 tui_prep_terminal (int notused1)
 {
 #ifdef NCURSES_MOUSE_VERSION
-  mousemask (ALL_MOUSE_EVENTS, NULL);
+  if (tui_win_with_focus () != TUI_CMD_WIN)
+    mousemask (ALL_MOUSE_EVENTS, NULL);
 #endif
 }
 
-- 
2.31.1


  reply	other threads:[~2021-06-07 16:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210607163003.621-1-ssbssa.ref@yahoo.de>
2021-06-07 16:30 ` [PATCH 1/3] Refactor keypad calls to tui_set_win_focus_to Hannes Domani
2021-06-07 16:30   ` Hannes Domani [this message]
2021-06-07 16:30   ` [PATCH 3/3] Add setting to enable/disable TUI mouse handling Hannes Domani
2021-06-07 16:49     ` Eli Zaretskii
2021-06-17 14:54   ` [PATCH 1/3] Refactor keypad calls to tui_set_win_focus_to Hannes Domani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210607163003.621-2-ssbssa@yahoo.de \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).