From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway31.websitewelcome.com (gateway31.websitewelcome.com [192.185.144.96]) by sourceware.org (Postfix) with ESMTPS id 3393D3835424 for ; Wed, 2 Jun 2021 18:48:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3393D3835424 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tromey.com Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 6409116BC7D for ; Wed, 2 Jun 2021 13:48:18 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id oVublhksPnrr4oVuclWeKt; Wed, 02 Jun 2021 13:48:18 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7uo75x8I4l4/fJLJSz4UXBqAiW/qEtiN9uNIIpy6x4E=; b=CPRXcf9G1BDfMH2Tk1tcY5mCt1 nyAhwnraQ1d1VWDHo7FkOhg59T3JupHORW6DRfHkCwMdQUIpChg6/6cAWNvG4kDUy58uWeJP8usJC IxzJUDD9kjAghL3734vWUoTir; Received: from 75-166-132-3.hlrn.qwest.net ([75.166.132.3]:49116 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1loVub-0045IA-KV; Wed, 02 Jun 2021 12:48:17 -0600 From: Tom Tromey To: Hannes Domani via Gdb-patches Subject: Re: [PATCHv2 1/2] Initial TUI mouse support References: <20210529142636.11432-1-ssbssa.ref@yahoo.de> <20210529142636.11432-1-ssbssa@yahoo.de> X-Attribution: Tom Date: Wed, 02 Jun 2021 12:48:16 -0600 In-Reply-To: <20210529142636.11432-1-ssbssa@yahoo.de> (Hannes Domani via Gdb-patches's message of "Sat, 29 May 2021 16:26:35 +0200") Message-ID: <87fsy0p0gf.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.132.3 X-Source-L: No X-Exim-ID: 1loVub-0045IA-KV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-132-3.hlrn.qwest.net (murgatroyd) [75.166.132.3]:49116 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3032.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NEUTRAL, 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: Wed, 02 Jun 2021 18:48:34 -0000 >>>>> "Hannes" == Hannes Domani via Gdb-patches writes: Hannes> Implements an overridable tui_win_info::click method whose arguments Hannes> are the mouse coordinates inside the specific window, and the mouse Hannes> button clicked. Hannes> And if the curses implementation supports 5 buttons, the 4th and 5th Hannes> buttons are used for scrolling. Thank you for doing this. I have a few minor comments. Hannes> Should there be a configure option for this at build time? Hannes> I don't know if the mousemask/getmouse functions are available for Hannes> all curses variants, so I would imagine an option --enable-mouse: Hannes> - yes -> error if getmouse can't be linked Hannes> - no -> just disable Hannes> - auto -> enable if getmouse can be linked I think it's fine to move forward, and if we have problems with it, we can add a configure check for 'mousemask' and use that to disable the new code. The ncurses man page says we could check NCURSES_MOUSE_VERSION to see if this is available. So maybe new configure code isn't even needed. The feature macro NCURSES_MOUSE_VERSION is provided so the preprocessor can be used to test whether these features are present. Hannes> + /* Called for each mouse click inside this window. */ Hannes> + virtual void click (int mouse_x, int mouse_y, int mouse_button) Hannes> + { I think it would be nice if this comment documented the meaning of x/y (are they window- or terminal-relative? And 0- or 1-based?) and also the possible/typical values of mouse_button (0- or 1-based?). Hannes> diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c Hannes> index a2be4d4353e..7787789f0c7 100644 Hannes> --- a/gdb/tui/tui-io.c Hannes> +++ b/gdb/tui/tui-io.c Hannes> @@ -33,6 +33,7 @@ Hannes> #include "tui/tui-wingeneral.h" Hannes> #include "tui/tui-file.h" Hannes> #include "tui/tui-out.h" Hannes> +#include "tui/tui-source.h" Why was this needed? Hannes> + if ((mev.bstate & BUTTON1_CLICKED) Hannes> + || (mev.bstate & BUTTON2_CLICKED) Hannes> + || (mev.bstate & BUTTON3_CLICKED)) gdb style would use a '!= 0' after each test. Hannes> + { Hannes> + int button = (mev.bstate & BUTTON1_CLICKED) ? 1 Hannes> + : (mev.bstate & BUTTON2_CLICKED) ? 2 Hannes> + : 3; The right-hand-side here would normally have an extra layer of () so that the continuation lines are indented. Also it would be good to reformat that so the "?..:" parts line up more clearly. thanks, Tom