Simulate Ctrl-click when hinting in new tab/win.
This works around the fact some pages (e.g. github) load their content via AJAX on a normal left click, so we'll never get acceptNavigationRequest and thus can't open them in a new tab. Fixes #488.
This commit is contained in:
parent
4b4bb3af88
commit
ddb39275eb
@ -386,6 +386,10 @@ class HintManager(QObject):
|
|||||||
action = "Hovering" if target == Target.hover else "Clicking"
|
action = "Hovering" if target == Target.hover else "Clicking"
|
||||||
log.hints.debug("{} on '{}' at {}/{}".format(
|
log.hints.debug("{} on '{}' at {}/{}".format(
|
||||||
action, elem, pos.x(), pos.y()))
|
action, elem, pos.x(), pos.y()))
|
||||||
|
if target in (Target.tab, Target.tab_bg, Target.window):
|
||||||
|
modifiers = Qt.ControlModifier
|
||||||
|
else:
|
||||||
|
modifiers = Qt.NoModifier
|
||||||
events = [
|
events = [
|
||||||
QMouseEvent(QEvent.MouseMove, pos, Qt.NoButton, Qt.NoButton,
|
QMouseEvent(QEvent.MouseMove, pos, Qt.NoButton, Qt.NoButton,
|
||||||
Qt.NoModifier),
|
Qt.NoModifier),
|
||||||
@ -394,9 +398,9 @@ class HintManager(QObject):
|
|||||||
self.set_open_target.emit(target.name)
|
self.set_open_target.emit(target.name)
|
||||||
events += [
|
events += [
|
||||||
QMouseEvent(QEvent.MouseButtonPress, pos, Qt.LeftButton,
|
QMouseEvent(QEvent.MouseButtonPress, pos, Qt.LeftButton,
|
||||||
Qt.NoButton, Qt.NoModifier),
|
Qt.NoButton, modifiers),
|
||||||
QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton,
|
QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton,
|
||||||
Qt.NoButton, Qt.NoModifier),
|
Qt.NoButton, modifiers),
|
||||||
]
|
]
|
||||||
for evt in events:
|
for evt in events:
|
||||||
self.mouse_event.emit(evt)
|
self.mouse_event.emit(evt)
|
||||||
|
Loading…
Reference in New Issue
Block a user