From 74ff67acd3a51253c4941bc7322af346d408f47b Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 9 Dec 2014 18:27:07 +1100 Subject: Create configuration option to control middle click tab close. Some might argue that this shouldn't be able to be configured as it is "common" behaviour in other programs such as web browsers, but for me it is an annoyance because for 15 years this has not been the behaviour of X-Chat. Quite simply, this creates a configuration option for 537fb856, as unobtrusively as possible, under the channel switcher preferences tab. Closes #1232 --- src/common/cfgfiles.c | 2 ++ src/common/hexchat.h | 1 + src/fe-gtk/maingui.c | 2 +- src/fe-gtk/setup.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index eda24f6b..63f34720 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -434,6 +434,7 @@ const struct prefs vars[] = {"gui_tab_dots", P_OFFINT (hex_gui_tab_dots), TYPE_BOOL}, {"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL}, {"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT}, + {"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL}, {"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT}, {"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT}, {"gui_tab_scrollchans", P_OFFINT (hex_gui_tab_scrollchans), TYPE_BOOL}, @@ -759,6 +760,7 @@ load_default_config(void) prefs.hex_gui_tab_chans = 1; prefs.hex_gui_tab_dialogs = 1; prefs.hex_gui_tab_icons = 1; + prefs.hex_gui_tab_middleclose = 1; prefs.hex_gui_tab_server = 1; prefs.hex_gui_tab_sort = 1; prefs.hex_gui_topicbar = 1; diff --git a/src/common/hexchat.h b/src/common/hexchat.h index c9c281cc..27df0b6f 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -262,6 +262,7 @@ struct hexchatprefs int hex_gui_search_pos; int hex_gui_slist_select; int hex_gui_tab_layout; + int hex_gui_tab_middleclose; int hex_gui_tab_newtofront; int hex_gui_tab_pos; int hex_gui_tab_small; diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index f61c93a1..5edd4ee8 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1617,7 +1617,7 @@ static gboolean mg_tab_contextmenu_cb (chanview *cv, chan *ch, int tag, gpointer ud, GdkEventButton *event) { /* middle-click or shift-click to close a tab */ - if ((event->button == 2 || (event->button == 1 && event->state & STATE_SHIFT)) + if (((prefs.hex_gui_tab_middleclose && event->button == 2) || (event->button == 1 && event->state & STATE_SHIFT)) && event->type == GDK_BUTTON_PRESS) { mg_xbutton_cb (cv, ch, tag, ud); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index e4372dc9..a517fa82 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -314,6 +314,7 @@ static const setting tabs_settings[] = {ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0}, {ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0}, {ST_TOGGLE, N_("Scroll mouse-wheel to change tabs"), P_OFFINTNL (hex_gui_tab_scrollchans), 0, 0, 0}, + {ST_TOGGLE, N_("Middle click to close tab"), P_OFFINTNL(hex_gui_tab_middleclose), 0, 0, 0}, {ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0}, {ST_MENU, N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0}, {ST_MENU, N_("Placement of notices:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0}, -- cgit 1.4.1