Allow very long middle clicks to close tabs

This commit is contained in:
Kovid Goyal 2021-10-25 12:23:54 +05:30
parent 4385acd3c6
commit f78feb5abf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -998,8 +998,7 @@ class TabManager: # {{{
self.set_active_tab_idx(i) self.set_active_tab_idx(i)
elif button == GLFW_MOUSE_BUTTON_MIDDLE and action == GLFW_RELEASE and self.recent_mouse_events: elif button == GLFW_MOUSE_BUTTON_MIDDLE and action == GLFW_RELEASE and self.recent_mouse_events:
p = self.recent_mouse_events[-1] p = self.recent_mouse_events[-1]
ci = get_click_interval() if p.button == button and p.action == GLFW_PRESS and p.tab_idx == i:
if p.button == button and p.action == GLFW_PRESS and p.tab_idx == i and now - p.at <= ci:
tab = self.tabs[i] tab = self.tabs[i]
get_boss().close_tab(tab) get_boss().close_tab(tab)
self.recent_mouse_events.append(TabMouseEvent(button, modifiers, action, now, i)) self.recent_mouse_events.append(TabMouseEvent(button, modifiers, action, now, i))