Revert changes to WebEngineView.createWindow
We still need those to open tabs in the background when middle-clicked.
This was a regression introduced in 545539f28d
.
Fixes #2276.
This commit is contained in:
parent
6cd4105ea1
commit
987cb236e8
@ -73,8 +73,10 @@ class WebEngineView(QWebEngineView):
|
|||||||
The new QWebEngineView object.
|
The new QWebEngineView object.
|
||||||
"""
|
"""
|
||||||
debug_type = debug.qenum_key(QWebEnginePage, wintype)
|
debug_type = debug.qenum_key(QWebEnginePage, wintype)
|
||||||
|
background_tabs = config.get('tabs', 'background-tabs')
|
||||||
|
|
||||||
log.webview.debug("createWindow with type {}".format(debug_type))
|
log.webview.debug("createWindow with type {}, background_tabs "
|
||||||
|
"{}".format(debug_type, background_tabs))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
background_tab_wintype = QWebEnginePage.WebBrowserBackgroundTab
|
background_tab_wintype = QWebEnginePage.WebBrowserBackgroundTab
|
||||||
@ -83,22 +85,30 @@ class WebEngineView(QWebEngineView):
|
|||||||
# this with a newer Qt...
|
# this with a newer Qt...
|
||||||
background_tab_wintype = 0x0003
|
background_tab_wintype = 0x0003
|
||||||
|
|
||||||
click_target = {
|
if wintype == QWebEnginePage.WebBrowserWindow:
|
||||||
# Shift-Alt-Click
|
# Shift-Alt-Click
|
||||||
QWebEnginePage.WebBrowserWindow: usertypes.ClickTarget.window,
|
target = usertypes.ClickTarget.window
|
||||||
# ?
|
elif wintype == QWebEnginePage.WebDialog:
|
||||||
QWebEnginePage.WebDialog: usertypes.ClickTarget.tab,
|
|
||||||
# Middle-click / Ctrl-Click with Shift
|
|
||||||
QWebEnginePage.WebBrowserTab: usertypes.ClickTarget.tab_bg,
|
|
||||||
# Middle-click / Ctrl-Click
|
|
||||||
background_tab_wintype: usertypes.ClickTarget.tab,
|
|
||||||
}
|
|
||||||
|
|
||||||
if wintype == QWebEnginePage.WebDialog:
|
|
||||||
log.webview.warning("{} requested, but we don't support "
|
log.webview.warning("{} requested, but we don't support "
|
||||||
"that!".format(debug_type))
|
"that!".format(debug_type))
|
||||||
|
target = usertypes.ClickTarget.tab
|
||||||
|
elif wintype == QWebEnginePage.WebBrowserTab:
|
||||||
|
# Middle-click / Ctrl-Click with Shift
|
||||||
|
# FIXME:qtwebengine this also affects target=_blank links...
|
||||||
|
if background_tabs:
|
||||||
|
target = usertypes.ClickTarget.tab
|
||||||
|
else:
|
||||||
|
target = usertypes.ClickTarget.tab_bg
|
||||||
|
elif wintype == background_tab_wintype:
|
||||||
|
# Middle-click / Ctrl-Click
|
||||||
|
if background_tabs:
|
||||||
|
target = usertypes.ClickTarget.tab_bg
|
||||||
|
else:
|
||||||
|
target = usertypes.ClickTarget.tab
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid wintype {}".format(debug_type))
|
||||||
|
|
||||||
tab = shared.get_tab(self._win_id, click_target[wintype])
|
tab = shared.get_tab(self._win_id, target)
|
||||||
|
|
||||||
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-54419
|
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-54419
|
||||||
vercheck = qtutils.version_check
|
vercheck = qtutils.version_check
|
||||||
|
Loading…
Reference in New Issue
Block a user