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:
Kovid Goyal 2020-05-16 15:18:53 +05:30
parent 6cecd089ee
commit f6d1097ae2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -486,6 +486,7 @@ class OpenBook: # {{{
if self.closeable:
self.overlay.hide_current_panel()
else:
if self.overlay.handling_context_menu_event is None:
ui_operations.quit()
def on_container_click(self, evt):
@ -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 @@ class Overlay:
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