From patchwork Fri Apr 24 00:53:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 6416 Received: (qmail 122356 invoked by alias); 24 Apr 2015 00:54:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 122079 invoked by uid 89); 24 Apr 2015 00:53:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-vn0-f52.google.com Received: from mail-vn0-f52.google.com (HELO mail-vn0-f52.google.com) (209.85.216.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 24 Apr 2015 00:53:56 +0000 Received: by vnbf129 with SMTP id f129so2869568vnb.9 for ; Thu, 23 Apr 2015 17:53:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bAbOcW11YwWYaiNYMF4i7EVdOkR2TI7sTsqNvmLfDcg=; b=R9mHnvsQzdNcmrj7wC0zrhzZ9RCqsjyiO4Xxz1ofkwRouN7/DfGI3dlTGRkacz7b4q jaeSrSGSoaui6SGN71IMdlCmEDXrBVJRVHEKfH3RIN1DAOBKTlWuKuxnFJh8E2HGr6Js jpN6XuOv048/SLd6h10hEZWXcnN7YEYN6RNRyWb2UUbehj3Xdmg7hSIeZg03qlu/4sn0 6dEnYjRzGh+c/2H6AsPg2DxincOEC/jmRDUw9sAajPuR8O6j3RFlvyOoZCXGX0TrEs3O kQ6MyjqhHmsD2GO2C0EUtlU2WR29/+VPxmSXm4tYU8ZN/F1IvLKhvUuqg8HKmPUPy0L4 BtUg== X-Gm-Message-State: ALoCoQl16kDsnlnOQotJmCTpbIwzY8NjU5mPitdbt8AXZLv308TpQVYDnO8voLNvXqEn00FLEaOo X-Received: by 10.52.32.34 with SMTP id f2mr6151520vdi.11.1429836834082; Thu, 23 Apr 2015 17:53:54 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id r7sm3450884vdw.23.2015.04.23.17.53.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Apr 2015 17:53:53 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH 2/3] Update our idea of our terminal's dimensions even outside of TUI Date: Thu, 23 Apr 2015 20:53:20 -0400 Message-Id: <1429836801-14218-2-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <1429836801-14218-1-git-send-email-patrick@parcs.ath.cx> References: <1429836801-14218-1-git-send-email-patrick@parcs.ath.cx> When in the CLI, GDB's "width" and "height" variables are not kept in sync when the underlying terminal gets resized. This patch fixes this issue by making sure sure to update GDB's "width" and "height" variables in the !tui_active case of our SIGWINCH handler. gdb/ChangeLog: * tui/tui-win.c (tui_sigwinch_handler): Remove now-stale comment. (tui_sigwinch_handler): Still update our idea of the terminal's width and height even when TUI is not active. --- gdb/tui/tui-win.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 6830977..2de73ed 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -836,12 +836,6 @@ static struct async_signal_handler *tui_sigwinch_token; static void tui_sigwinch_handler (int signal) { - /* Set win_resized to TRUE and asynchronously invoke our resize callback. If - the callback is invoked while TUI is active then it ought to successfully - resize the screen, resetting win_resized to FALSE. Of course, if the - callback is invoked while TUI is inactive then it will do nothing; in that - case, win_resized will remain TRUE until we get a chance to synchronously - resize the screen from tui_enable(). */ mark_async_signal_handler (tui_sigwinch_token); tui_set_win_resized_to (TRUE); } @@ -850,15 +844,26 @@ tui_sigwinch_handler (int signal) static void tui_async_resize_screen (gdb_client_data arg) { - if (!tui_active) - return; - rl_resize_terminal (); - tui_resize_all (); - tui_refresh_all_win (); - tui_update_gdb_sizes (); - tui_set_win_resized_to (FALSE); - tui_redisplay_readline (); + + if (!tui_active) + { + int screen_height, screen_width; + + rl_get_screen_size (&screen_height, &screen_width); + set_screen_width_and_height (screen_width, screen_height); + + /* win_resized will be untoggled and the windows resized in the next call + to tui_enable(). */ + } + else + { + tui_resize_all (); + tui_refresh_all_win (); + tui_update_gdb_sizes (); + tui_set_win_resized_to (FALSE); + tui_redisplay_readline (); + } } #endif