From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic302-20.consmr.mail.ir2.yahoo.com (sonic302-20.consmr.mail.ir2.yahoo.com [87.248.110.83]) by sourceware.org (Postfix) with ESMTPS id 11AE7389364A for ; Mon, 7 Jun 2021 16:30:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 11AE7389364A X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1623083431; bh=8bf10K5ZbnxtniRsxwPN0lOC7p5dsibJ0fj/NTzRDf8=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=HzbhAGGpIf5WcOTHFc/ZRKfRoh0DlpH1HeoxOeelzGPQVxdDSfruNlpRlOWj/a+umKSMF+kQqBZt7RSp8XSEpif7/fsSg1Kggwzj52ESLj/bpX11h7aCrw3ydMCagF2aglMU0LcTLlrO6a3v4kS87KTMGeCfn5V97Xd1YIuUyQhu7P9FLnd2l2XXXiYl2lXPqoqTjCfISosKBMpxH+QuTbgfSWbMhiXDpwkFy5z/k0+MfvDvWK44De0T7ZvWrde0BVjBW3ZASe2Fw8M4H+dj8Eecb4Dw6LV3aZb3Zq/IT/FLsMPCv2+rDUoUQyPi/plXMSG7vIKuMFVgRfb5xMd3TQ== X-YMail-OSG: dpZUxQsVM1l_Ys5JniU6l8D8_XFb6_4kA_VKmM6g18UD6tytiI43wSoqYjDuixf qurQU.qrJ8B6oemAhxWoyRORXn4EOEic8H8G3lnHobG.0G0z1Ety3MRhPXoBA8aaUqZYLv6UHv8l BeLZFtpGfzDTtEFBmccO1kezYX3Dd4o9yOT9nz.PDuWFBRNSrvlkG3PNlwRBp6sR03GcBdpAOS5B nMmcJ.w_nxl39GHIRM1gp9DZscbkJjFVTLeEi7D7SdusW_NwaFmpunjzGJjnSTTnVXikXyG5OguO qLnyS0VdOgnebuJvDLczFYSlDh90AeCsPi4hPd022Eu5QEejyEtq3VY8C1Q3rDGYdvrht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KJPkRqIg9tqhUY 2uebRz0wckLk7sPI- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ir2.yahoo.com with HTTP; Mon, 7 Jun 2021 16:30:31 +0000 Received: by kubenode550.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 86869961c06f18b14dd725624d84c1da; Mon, 07 Jun 2021 16:30:30 +0000 (UTC) From: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH 3/3] Add setting to enable/disable TUI mouse handling Date: Mon, 7 Jun 2021 18:30:03 +0200 Message-Id: <20210607163003.621-3-ssbssa@yahoo.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210607163003.621-1-ssbssa@yahoo.de> References: <20210607163003.621-1-ssbssa@yahoo.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 210607-4, 06/07/2021), Outbound message X-Antivirus-Status: Clean X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 16:30:36 -0000 Useful if the mouse events don't work correctly on a system, or the user just doesn't need them. gdb/ChangeLog: 2021-06-07 Hannes Domani * tui/tui-data.c (tui_set_win_focus_to): Handle mouse setting. * tui/tui-io.c (tui_prep_terminal): Likewise. * tui/tui-win.c (tui_mouse): New global. (tui_set_mouse, tui_show_mouse_function): New functions. (_initialize_tui_win): Add mouse setting. * tui/tui-win.h (tui_mouse): Declare. gdb/doc/ChangeLog: 2021-06-07 Hannes Domani * gdb.texinfo (TUI Configuration): Document mouse setting. --- gdb/doc/gdb.texinfo | 4 ++++ gdb/tui/tui-data.c | 3 ++- gdb/tui/tui-io.c | 2 +- gdb/tui/tui-win.c | 36 ++++++++++++++++++++++++++++++++++++ gdb/tui/tui-win.h | 3 +++ 5 files changed, 46 insertions(+), 2 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 90d827a50e7..76d6bc8d321 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -28909,6 +28909,10 @@ The default display uses more space for line numbers and starts the source text at the next tab stop; the compact display uses only as much space as is needed for the line numbers in the current file, and only a single space to separate the line numbers from the source. + +@item set tui mouse @r{[}on@r{|}off@r{]} +@kindex set tui mouse +Set whether the TUI handles mouse events. @end table Note that the colors of the TUI borders can be controlled using the diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index e6452386628..43538766857 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -78,7 +78,8 @@ tui_set_win_focus_to (struct tui_win_info *win_info) #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); + mousemask ((tui_mouse && 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 4570e55231b..075b4fa58c8 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -640,7 +640,7 @@ static void tui_prep_terminal (int notused1) { #ifdef NCURSES_MOUSE_VERSION - if (tui_win_with_focus () != TUI_CMD_WIN) + if (tui_mouse && tui_win_with_focus () != TUI_CMD_WIN) mousemask (ALL_MOUSE_EVENTS, NULL); #endif } diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 094b503eae8..2211f987fc4 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -822,6 +822,34 @@ tui_show_compact_source (struct ui_file *file, int from_tty, printf_filtered (_("TUI source window compactness is %s.\n"), value); } +/* See tui-win.h. */ + +bool tui_mouse = false; + +/* Callback for "set tui mouse". */ + +static void +tui_set_mouse (const char *ignore, int from_tty, + struct cmd_list_element *c) +{ +#ifndef NCURSES_MOUSE_VERSION + if (tui_mouse) + { + tui_mouse = false; + error (_("The curses library does not provide mouse events.")); + } +#endif +} + +/* Callback for "show tui mouse". */ + +static void +tui_show_mouse_function (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + printf_filtered (_("Handling of mouse events in TUI is %s.\n"), value); +} + /* Set the tab width of the specified window. */ static void tui_set_tab_width_command (const char *arg, int from_tty) @@ -1119,6 +1147,14 @@ the line numbers and uses less horizontal space."), tui_set_compact_source, tui_show_compact_source, &tui_setlist, &tui_showlist); + add_setshow_boolean_cmd ("mouse", class_tui, + &tui_mouse, _("\ +Set whether the TUI handles mouse events."), _("\ +Show whether the TUI handles mouse events."), + nullptr, + tui_set_mouse, tui_show_mouse_function, + &tui_setlist, &tui_showlist); + tui_border_style.changed.attach (tui_rehighlight_all, "tui-win"); tui_active_border_style.changed.attach (tui_rehighlight_all, "tui-win"); } diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h index e9da9b98477..f771ec87400 100644 --- a/gdb/tui/tui-win.h +++ b/gdb/tui/tui-win.h @@ -51,4 +51,7 @@ struct cmd_list_element **tui_get_cmd_list (void); /* Whether compact source display should be used. */ extern bool compact_source; +/* Whether the TUI handles mouse events. */ +extern bool tui_mouse; + #endif /* TUI_TUI_WIN_H */ -- 2.31.1