From patchwork Wed Dec 31 17:45:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Zaretskii X-Patchwork-Id: 4470 Received: (qmail 17435 invoked by alias); 31 Dec 2014 17:45:28 -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 17409 invoked by uid 89); 31 Dec 2014 17:45:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_SEMBACKSCATTER, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout25.012.net.il Received: from mtaout25.012.net.il (HELO mtaout25.012.net.il) (80.179.55.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 Dec 2014 17:45:22 +0000 Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NHG00J00JA9CD00@mtaout25.012.net.il> for gdb-patches@sourceware.org; Wed, 31 Dec 2014 19:41:12 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NHG00FHEJSON150@mtaout25.012.net.il> for gdb-patches@sourceware.org; Wed, 31 Dec 2014 19:41:12 +0200 (IST) Date: Wed, 31 Dec 2014 19:45:11 +0200 From: Eli Zaretskii Subject: [PATCHSET] [2/4] Fix various issue in TUI To: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83y4pnbtnc.fsf@gnu.org> X-IsSubscribed: yes This patch fixes the problem whereby setting the border attributes had no effect whatsoever. Turns out no one was calling the functions that detected changes in these settings and applied them to windows. While at that, this also fixes a copy/paste error in a comment to a function. OK? 2014-12-31 Eli Zaretskii * tui/tui-win.c (tui_rehighlight_all): New function. * tui/tui-win.h: Add prototype for tui_rehighlight_all. * tui/tui-command.c (tui_dispatch_ctrl_char): When Ctrl-L was pressed, call tui_rehighlight_all if tui_update_variables indicates it should be. * tui/tui-win.c (tui_refresh_all_command): Call tui_rehighlight_all if tui_update_variables indicates it should be. * tui/tui-hooks.c (tui_note_setting_change): New function. (tui_install_hooks): Install an observer for "command parameter changed". (tui_remove_hooks): Uninstall the observer. --- gdb/tui/tui-win.h~0 2014-06-11 18:34:41 +0300 +++ gdb/tui/tui-win.h 2014-12-31 13:38:18 +0200 @@ -35,6 +35,7 @@ extern void tui_set_win_focus_to (struct tui_win_info *); extern void tui_resize_all (void); extern void tui_refresh_all_win (void); +extern void tui_rehighlight_all (void); extern chtype tui_border_ulcorner; extern chtype tui_border_urcorner; --- gdb/tui/tui-command.c~0 2014-10-29 21:45:50 +0200 +++ gdb/tui/tui-command.c 2014-12-31 13:49:43 +0200 @@ -50,7 +50,12 @@ /* Handle the CTRL-L refresh for each window. */ if (ch == '\f') - tui_refresh_all_win (); + { + if (tui_update_variables ()) + tui_rehighlight_all (); + + tui_refresh_all_win (); + } /* If the command window has the logical focus, or no-one does assume it is the command window; in this case, pass the character --- gdb/tui/tui-hooks.c~0 2014-06-11 18:34:41 +0300 +++ gdb/tui/tui-hooks.c 2014-12-31 14:41:11 +0200 @@ -247,12 +247,23 @@ tui_display_main (); } +/* Refresh the display when settings important to us change. */ +static void +tui_note_setting_change (const char *param, const char *value) +{ + if (tui_active + && strncmp (param, "tui ", sizeof ("tui ") - 1) == 0 + && tui_update_variables ()) + tui_rehighlight_all (); +} + /* Observers created when installing TUI hooks. */ static struct observer *tui_bp_created_observer; static struct observer *tui_bp_deleted_observer; static struct observer *tui_bp_modified_observer; static struct observer *tui_inferior_exit_observer; static struct observer *tui_about_to_proceed_observer; +static struct observer *tui_setting_changed_observer; /* Install the TUI specific hooks. */ void @@ -278,6 +289,9 @@ = observer_attach_about_to_proceed (tui_about_to_proceed); deprecated_register_changed_hook = tui_register_changed_hook; + + tui_setting_changed_observer + = observer_attach_command_param_changed (tui_note_setting_change); } /* Remove the TUI specific hooks. */ @@ -300,6 +314,8 @@ tui_inferior_exit_observer = NULL; observer_detach_about_to_proceed (tui_about_to_proceed_observer); tui_about_to_proceed_observer = NULL; + observer_detach_command_param_changed (tui_setting_changed_observer); + tui_setting_changed_observer = NULL; } void _initialize_tui_hooks (void); --- gdb/tui/tui-win.c~0 2014-10-29 21:45:50 +0200 +++ gdb/tui/tui-win.c 2014-12-31 13:55:32 +0200 @@ -649,6 +649,16 @@ } +void +tui_rehighlight_all (void) +{ + enum tui_win_type type; + + for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++) + tui_check_and_display_highlight_if_needed (tui_win_list[type]); +} + + /* Resize all the windows based on the terminal size. This function gets called from within the readline sinwinch handler. */ void @@ -985,11 +995,14 @@ /* Make sure the curses mode is enabled. */ tui_enable (); + if (tui_update_variables ()) + tui_rehighlight_all (); + tui_refresh_all_win (); } -/* Set the height of the specified window. */ +/* Set the tab width of the specified window. */ static void tui_set_tab_width_command (char *arg, int from_tty) {