mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04: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
@ -486,6 +486,7 @@ class OpenBook: # {{{
|
|||||||
if self.closeable:
|
if self.closeable:
|
||||||
self.overlay.hide_current_panel()
|
self.overlay.hide_current_panel()
|
||||||
else:
|
else:
|
||||||
|
if self.overlay.handling_context_menu_event is None:
|
||||||
ui_operations.quit()
|
ui_operations.quit()
|
||||||
|
|
||||||
def on_container_click(self, evt):
|
def on_container_click(self, evt):
|
||||||
@ -516,6 +517,7 @@ class Overlay:
|
|||||||
|
|
||||||
def __init__(self, view):
|
def __init__(self, view):
|
||||||
self.view = view
|
self.view = view
|
||||||
|
self.handling_context_menu_event = None
|
||||||
c = self.clear_container()
|
c = self.clear_container()
|
||||||
c.addEventListener('click', self.container_clicked)
|
c.addEventListener('click', self.container_clicked)
|
||||||
c.addEventListener('contextmenu', self.oncontextmenu, {'passive': False})
|
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'):
|
if evt.target and evt.target.tagName and evt.target.tagName.toLowerCase() in ('input', 'textarea'):
|
||||||
return
|
return
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
|
self.handling_context_menu_event = evt
|
||||||
self.handle_escape()
|
self.handle_escape()
|
||||||
|
self.handling_context_menu_event = None
|
||||||
|
|
||||||
def clear_container(self):
|
def clear_container(self):
|
||||||
c = self.container
|
c = self.container
|
||||||
|
Loading…
x
Reference in New Issue
Block a user