mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:14:07 +02:00
Fix #1879040 [[Viewer] Right clicking in the Viewer opened without a book closes it](https://bugs.launchpad.net/calibre/+bug/1879040)
This commit is contained in:
parent
6cecd089ee
commit
f6d1097ae2
1 changed files with 5 additions and 1 deletions
|
|
@ -486,7 +486,8 @@ def handle_escape(self):
|
|||
if self.closeable:
|
||||
self.overlay.hide_current_panel()
|
||||
else:
|
||||
ui_operations.quit()
|
||||
if self.overlay.handling_context_menu_event is None:
|
||||
ui_operations.quit()
|
||||
|
||||
def on_container_click(self, evt):
|
||||
pass # Dont allow panel to be closed by a click
|
||||
|
|
@ -516,6 +517,7 @@ class Overlay:
|
|||
|
||||
def __init__(self, view):
|
||||
self.view = view
|
||||
self.handling_context_menu_event = None
|
||||
c = self.clear_container()
|
||||
c.addEventListener('click', self.container_clicked)
|
||||
c.addEventListener('contextmenu', self.oncontextmenu, {'passive': False})
|
||||
|
|
@ -525,7 +527,9 @@ def oncontextmenu(self, evt):
|
|||
if evt.target and evt.target.tagName and evt.target.tagName.toLowerCase() in ('input', 'textarea'):
|
||||
return
|
||||
evt.preventDefault()
|
||||
self.handling_context_menu_event = evt
|
||||
self.handle_escape()
|
||||
self.handling_context_menu_event = None
|
||||
|
||||
def clear_container(self):
|
||||
c = self.container
|
||||
|
|
|
|||
Loading…
Reference in a new issue