From 262cea8e7513edbeb3e6ce6d6f24b41414acb723 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 9 May 2018 11:02:42 -0700 Subject: [PATCH 01/10] Restore focus to webview after clicking tab-bg --- qutebrowser/browser/hints.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 715a4a4db..147bf23af 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -210,10 +210,10 @@ class HintActions: else: target_mapping[Target.tab] = usertypes.ClickTarget.tab + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=self._win_id) if context.target in [Target.normal, Target.current]: # Set the pre-jump mark ', so we can jump back here after following - tabbed_browser = objreg.get('tabbed-browser', scope='window', - window=self._win_id) tabbed_browser.set_mark("'") try: @@ -227,6 +227,10 @@ class HintActions: except webelem.Error as e: raise HintingError(str(e)) + if context.target == Target.tab_bg: + # We lost focus when clicking in the background, get it back. + tabbed_browser.widget.currentWidget().setFocus() + def yank(self, url, context): """Yank an element to the clipboard or primary selection. From bc9f178a080688df93293b26a7bcab596ce08289 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 9 May 2018 15:34:01 -0700 Subject: [PATCH 02/10] Add test for tab-bg focus --- tests/end2end/data/hints/link_input.html | 25 ++++++++++++++++++++++++ tests/end2end/features/hints.feature | 11 +++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/end2end/data/hints/link_input.html diff --git a/tests/end2end/data/hints/link_input.html b/tests/end2end/data/hints/link_input.html new file mode 100644 index 000000000..56d02433c --- /dev/null +++ b/tests/end2end/data/hints/link_input.html @@ -0,0 +1,25 @@ + + + + + + Simple link and input + + + + Follow me! +
+ With padding: +
+ With existing text (logs to JS):: +
+ + diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index c3b857bc4..7805082ad 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -203,6 +203,17 @@ Feature: Using hints And I run :fake-key new Then the javascript message "contents: existingnew" should be logged + Scenario: Typing input with existing text after opening a bg tab + When I open data/hints/link_input.html + And I run :click-element id qute-input-existing + And I wait for "Entering mode KeyMode.insert *" in the log + And I run :leave-mode + And I hint with args "all tab-bg" and follow a + And I wait until data/hello.txt is loaded + And I run :enter-mode insert + And I run :fake-key -g new + Then the javascript message "contents: existingnew" should be logged + ### iframes Scenario: Using :follow-hint inside an iframe When I open data/hints/iframe.html From 538b4fafdb2f3af6dbc7790a90542c7db2ec8856 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 10 May 2018 09:30:28 -0700 Subject: [PATCH 03/10] Revert "Restore focus to webview after clicking tab-bg" This reverts commit 262cea8e7513edbeb3e6ce6d6f24b41414acb723. --- qutebrowser/browser/hints.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 147bf23af..715a4a4db 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -210,10 +210,10 @@ class HintActions: else: target_mapping[Target.tab] = usertypes.ClickTarget.tab - tabbed_browser = objreg.get('tabbed-browser', scope='window', - window=self._win_id) if context.target in [Target.normal, Target.current]: # Set the pre-jump mark ', so we can jump back here after following + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=self._win_id) tabbed_browser.set_mark("'") try: @@ -227,10 +227,6 @@ class HintActions: except webelem.Error as e: raise HintingError(str(e)) - if context.target == Target.tab_bg: - # We lost focus when clicking in the background, get it back. - tabbed_browser.widget.currentWidget().setFocus() - def yank(self, url, context): """Yank an element to the clipboard or primary selection. From 95093b82c9d7dfe1342e7db4b5fd2df3d3b8d8c5 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 10 May 2018 09:34:38 -0700 Subject: [PATCH 04/10] Refocus webview after spawning a background tab --- qutebrowser/mainwindow/tabbedbrowser.py | 2 ++ tests/end2end/features/hints.feature | 11 ----------- tests/end2end/features/tabs.feature | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 2d674e280..28c754a97 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -487,6 +487,8 @@ class TabbedBrowser(QWidget): tab.resize(self.widget.currentWidget().size()) self.widget.tab_index_changed.emit(self.widget.currentIndex(), self.widget.count()) + # Refocus webview in case we lost it by spawning a bg tab + self.widget.currentWidget().setFocus() else: self.widget.setCurrentWidget(tab) # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 7805082ad..c3b857bc4 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -203,17 +203,6 @@ Feature: Using hints And I run :fake-key new Then the javascript message "contents: existingnew" should be logged - Scenario: Typing input with existing text after opening a bg tab - When I open data/hints/link_input.html - And I run :click-element id qute-input-existing - And I wait for "Entering mode KeyMode.insert *" in the log - And I run :leave-mode - And I hint with args "all tab-bg" and follow a - And I wait until data/hello.txt is loaded - And I run :enter-mode insert - And I run :fake-key -g new - Then the javascript message "contents: existingnew" should be logged - ### iframes Scenario: Using :follow-hint inside an iframe When I open data/hints/iframe.html diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 1841ef9c9..a19bc7a97 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1250,3 +1250,25 @@ Feature: Tab management Then the following tabs should be open: - data/numbers/1.txt - data/numbers/2.txt (pinned) (active) + + + Scenario: Focused webview after clicking link in bg + When I open data/hints/link_input.html + And I run :click-element id qute-input-existing + And I wait for "Entering mode KeyMode.insert *" in the log + And I run :leave-mode + And I hint with args "all tab-bg" and follow a + And I wait until data/hello.txt is loaded + And I run :enter-mode insert + And I run :fake-key -g new + Then the javascript message "contents: existingnew" should be logged + + Scenario: Focused webview after opening link in bg + When I open data/hints/link_input.html + And I run :click-element id qute-input-existing + And I wait for "Entering mode KeyMode.insert *" in the log + And I run :leave-mode + And I open data/hello.txt in a new background tab + And I run :enter-mode insert + And I run :fake-key -g new + Then the javascript message "contents: existingnew" should be logged From 71d55e92135aba9f11db3691028dab5e59b4e529 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Fri, 11 May 2018 08:45:43 -0700 Subject: [PATCH 05/10] Refocus command prompt after a new tab is opened when in command mode --- qutebrowser/mainwindow/tabbedbrowser.py | 11 ++++++++++- tests/end2end/features/tabs.feature | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 28c754a97..c473f914d 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -22,7 +22,7 @@ import functools import attr -from PyQt5.QtWidgets import QSizePolicy, QWidget +from PyQt5.QtWidgets import QSizePolicy, QWidget, QApplication from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl from PyQt5.QtGui import QIcon @@ -458,6 +458,8 @@ class TabbedBrowser(QWidget): "related {}, idx {}".format( url, background, related, idx)) + prev_focus = QApplication.focusWidget() + if (config.val.tabs.tabs_are_windows and self.widget.count() > 0 and not ignore_tabs_are_windows): window = mainwindow.MainWindow(private=self.private) @@ -494,6 +496,13 @@ class TabbedBrowser(QWidget): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 tab.setFocus() + mode = modeman.instance(self._win_id).mode + if mode in [usertypes.KeyMode.command, usertypes.KeyMode.prompt, + usertypes.KeyMode.yesno]: + # If we were in a command prompt, restore old focus + # The above commands need to be run to switch tabs + prev_focus.setFocus() + tab.show() self.new_tab.emit(tab, idx) return tab diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index a19bc7a97..5f5ae5d29 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1272,3 +1272,19 @@ Feature: Tab management And I run :enter-mode insert And I run :fake-key -g new Then the javascript message "contents: existingnew" should be logged + + Scenario: Focused prompt after opening link in bg + When I open data/hints/link_input.html + When I run :set-cmd-text -s :message-info + And I open data/hello.txt in a new background tab + And I run :fake-key -g hello-world + And I run :command-accept + Then the message "hello-world" should be shown + + Scenario: Focused prompt after opening link in fg + When I open data/hints/link_input.html + When I run :set-cmd-text -s :message-info + And I open data/hello.txt in a new tab + And I run :fake-key -g hello-world + And I run :command-accept + Then the message "hello-world" should be shown From 77c8575a882d9b35054164654ba03021fe3b6ba0 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 16 May 2018 12:45:01 -0700 Subject: [PATCH 06/10] Only apply workaround for QTBUG-68076 on non-background tabs Previously, we would focus webviews even if they were in the background to work around https://bugreports.qt.io/browse/QTBUG-68076. This adjusts that to only occur when needed. --- qutebrowser/browser/browsertab.py | 9 ++++++++- qutebrowser/browser/webengine/webenginetab.py | 11 +++-------- qutebrowser/browser/webkit/webkittab.py | 4 +++- qutebrowser/mainwindow/tabbedbrowser.py | 7 ++++--- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 2a9662eef..4d4f6380a 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -847,7 +847,14 @@ class AbstractTab(QWidget): if predict: self.predicted_navigation.emit(url) - def openurl(self, url, *, predict=True): + def openurl(self, url, *, predict=True, background=False): + """Open the given URL in this tab. + + Arguments: + url: The QUrl to open. + predict: If set to False, predicted_navigation is not emitted. + background: Whether the tab is being opened in the background. + """ raise NotImplementedError def reload(self, *, force=False): diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index fb04dc120..f0e2b85b6 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -782,15 +782,10 @@ class WebEngineTab(browsertab.AbstractTab): self.zoom.set_factor(self._saved_zoom) self._saved_zoom = None - def openurl(self, url, *, predict=True): - """Open the given URL in this tab. - - Arguments: - url: The QUrl to open. - predict: If set to False, predicted_navigation is not emitted. - """ + def openurl(self, url, *, predict=True, background=False): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - self._widget.setFocus() + if not background: + self._widget.setFocus() self._saved_zoom = self.zoom.factor() self._openurl_prepare(url, predict=predict) self._widget.load(url) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 9d5305f10..352372ba4 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -673,9 +673,11 @@ class WebKitTab(browsertab.AbstractTab): settings = widget.settings() settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) - def openurl(self, url, *, predict=True): + # pylint: disable=unused-argument + def openurl(self, url, *, predict=True, background=False): self._openurl_prepare(url, predict=predict) self._widget.openurl(url) + # pylint: enable=unused-argument def url(self, requested=False): frame = self._widget.page().mainFrame() diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index c473f914d..0f9efc014 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -477,11 +477,12 @@ class TabbedBrowser(QWidget): idx = self._get_new_tab_idx(related) self.widget.insertTab(idx, tab, "") - if url is not None: - tab.openurl(url) - if background is None: background = config.val.tabs.background + + if url is not None: + tab.openurl(url, background=background) + if background: # Make sure the background tab has the correct initial size. # With a foreground tab, it's going to be resized correctly by the From 2f76ef1e53d609f14e5b57d548711fb286f3b487 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Tue, 22 May 2018 23:17:43 -0700 Subject: [PATCH 07/10] Revert "Only apply workaround for QTBUG-68076 on non-background tabs" This reverts commit 77c8575a882d9b35054164654ba03021fe3b6ba0. --- qutebrowser/browser/browsertab.py | 9 +-------- qutebrowser/browser/webengine/webenginetab.py | 11 ++++++++--- qutebrowser/browser/webkit/webkittab.py | 4 +--- qutebrowser/mainwindow/tabbedbrowser.py | 7 +++---- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 4d4f6380a..2a9662eef 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -847,14 +847,7 @@ class AbstractTab(QWidget): if predict: self.predicted_navigation.emit(url) - def openurl(self, url, *, predict=True, background=False): - """Open the given URL in this tab. - - Arguments: - url: The QUrl to open. - predict: If set to False, predicted_navigation is not emitted. - background: Whether the tab is being opened in the background. - """ + def openurl(self, url, *, predict=True): raise NotImplementedError def reload(self, *, force=False): diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index f0e2b85b6..fb04dc120 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -782,10 +782,15 @@ class WebEngineTab(browsertab.AbstractTab): self.zoom.set_factor(self._saved_zoom) self._saved_zoom = None - def openurl(self, url, *, predict=True, background=False): + def openurl(self, url, *, predict=True): + """Open the given URL in this tab. + + Arguments: + url: The QUrl to open. + predict: If set to False, predicted_navigation is not emitted. + """ # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - if not background: - self._widget.setFocus() + self._widget.setFocus() self._saved_zoom = self.zoom.factor() self._openurl_prepare(url, predict=predict) self._widget.load(url) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 352372ba4..9d5305f10 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -673,11 +673,9 @@ class WebKitTab(browsertab.AbstractTab): settings = widget.settings() settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, True) - # pylint: disable=unused-argument - def openurl(self, url, *, predict=True, background=False): + def openurl(self, url, *, predict=True): self._openurl_prepare(url, predict=predict) self._widget.openurl(url) - # pylint: enable=unused-argument def url(self, requested=False): frame = self._widget.page().mainFrame() diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 0f9efc014..c473f914d 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -477,12 +477,11 @@ class TabbedBrowser(QWidget): idx = self._get_new_tab_idx(related) self.widget.insertTab(idx, tab, "") + if url is not None: + tab.openurl(url) + if background is None: background = config.val.tabs.background - - if url is not None: - tab.openurl(url, background=background) - if background: # Make sure the background tab has the correct initial size. # With a foreground tab, it's going to be resized correctly by the From 28fce9a7cb6b0e772b67a6227e3f61fc11ac8e31 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sat, 26 May 2018 13:52:57 -0700 Subject: [PATCH 08/10] Add support for opening background tabs in 5.11 Adding more workarounds to 442bdd4a4f153c9c5b728, *sigh* --- qutebrowser/browser/mouse.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/mouse.py b/qutebrowser/browser/mouse.py index 5320bfa6b..a59901e62 100644 --- a/qutebrowser/browser/mouse.py +++ b/qutebrowser/browser/mouse.py @@ -22,7 +22,7 @@ from PyQt5.QtCore import QObject, QEvent, Qt, QTimer from qutebrowser.config import config -from qutebrowser.utils import message, log, usertypes, qtutils +from qutebrowser.utils import message, log, usertypes, qtutils, objreg from qutebrowser.keyinput import modeman @@ -57,7 +57,22 @@ class ChildEventFilter(QObject): if qtutils.version_check('5.11', compiled=False, exact=True): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - QTimer.singleShot(0, self._widget.setFocus) + try: + win_id = self._widget._win_id + PASSTHROUGH_MODES = [usertypes.KeyMode.command, + usertypes.KeyMode.prompt, + usertypes.KeyMode.yesno] + if modeman.instance(win_id).mode not in PASSTHROUGH_MODES: + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=win_id) + current_index = tabbed_browser.widget.currentIndex() + widget_index = self._widget.parent().tab_id + if current_index == widget_index: + QTimer.singleShot(0, self._widget.setFocus) + except: + # Something failed, let's just setFocus + QTimer.singleShot(0, self._widget.setFocus) + elif event.type() == QEvent.ChildRemoved: child = event.child() log.mouse.debug("{}: removed child {}".format(obj, child)) From 5d38d28feeb4597db8844e36ea5784505b2655ca Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sun, 27 May 2018 17:09:18 -0700 Subject: [PATCH 09/10] Fix incorrect usage of tab_id --- qutebrowser/browser/mouse.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/mouse.py b/qutebrowser/browser/mouse.py index a59901e62..d7c2e2dc2 100644 --- a/qutebrowser/browser/mouse.py +++ b/qutebrowser/browser/mouse.py @@ -58,15 +58,22 @@ class ChildEventFilter(QObject): if qtutils.version_check('5.11', compiled=False, exact=True): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 try: + # pylint: disable=protected-access win_id = self._widget._win_id - PASSTHROUGH_MODES = [usertypes.KeyMode.command, - usertypes.KeyMode.prompt, - usertypes.KeyMode.yesno] - if modeman.instance(win_id).mode not in PASSTHROUGH_MODES: - tabbed_browser = objreg.get('tabbed-browser', scope='window', + # pylint: enable=protected-access + passthrough_modes = [usertypes.KeyMode.command, + usertypes.KeyMode.prompt, + usertypes.KeyMode.yesno] + if modeman.instance(win_id).mode not in passthrough_modes: + tabbed_browser = objreg.get('tabbed-browser', + scope='window', window=win_id) current_index = tabbed_browser.widget.currentIndex() - widget_index = self._widget.parent().tab_id + try: + widget_index = tabbed_browser.widget.indexOf( + self._widget.parent()) + except RuntimeError: + widget_index = -1 if current_index == widget_index: QTimer.singleShot(0, self._widget.setFocus) except: From e5b655256821dff1f3f67c974c3922b21eebf563 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Wed, 13 Jun 2018 15:37:32 -0700 Subject: [PATCH 10/10] Clean up and simplify some logic --- qutebrowser/browser/mouse.py | 40 ++++++++----------- qutebrowser/browser/webengine/webenginetab.py | 2 +- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/qutebrowser/browser/mouse.py b/qutebrowser/browser/mouse.py index d7c2e2dc2..24ced7d47 100644 --- a/qutebrowser/browser/mouse.py +++ b/qutebrowser/browser/mouse.py @@ -40,11 +40,12 @@ class ChildEventFilter(QObject): _widget: The widget expected to send out childEvents. """ - def __init__(self, eventfilter, widget, parent=None): + def __init__(self, eventfilter, widget, win_id, parent=None): super().__init__(parent) self._filter = eventfilter assert widget is not None self._widget = widget + self._win_id = win_id def eventFilter(self, obj, event): """Act on ChildAdded events.""" @@ -57,28 +58,21 @@ class ChildEventFilter(QObject): if qtutils.version_check('5.11', compiled=False, exact=True): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076 - try: - # pylint: disable=protected-access - win_id = self._widget._win_id - # pylint: enable=protected-access - passthrough_modes = [usertypes.KeyMode.command, - usertypes.KeyMode.prompt, - usertypes.KeyMode.yesno] - if modeman.instance(win_id).mode not in passthrough_modes: - tabbed_browser = objreg.get('tabbed-browser', - scope='window', - window=win_id) - current_index = tabbed_browser.widget.currentIndex() - try: - widget_index = tabbed_browser.widget.indexOf( - self._widget.parent()) - except RuntimeError: - widget_index = -1 - if current_index == widget_index: - QTimer.singleShot(0, self._widget.setFocus) - except: - # Something failed, let's just setFocus - QTimer.singleShot(0, self._widget.setFocus) + pass_modes = [usertypes.KeyMode.command, + usertypes.KeyMode.prompt, + usertypes.KeyMode.yesno] + if modeman.instance(self._win_id).mode not in pass_modes: + tabbed_browser = objreg.get('tabbed-browser', + scope='window', + window=self._win_id) + current_index = tabbed_browser.widget.currentIndex() + try: + widget_index = tabbed_browser.widget.indexOf( + self._widget.parent()) + except RuntimeError: + widget_index = -1 + if current_index == widget_index: + QTimer.singleShot(0, self._widget.setFocus) elif event.type() == QEvent.ChildRemoved: child = event.child() diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 4ce8b8bdd..d8ccd857c 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -769,7 +769,7 @@ class WebEngineTab(browsertab.AbstractTab): fp.installEventFilter(self._mouse_event_filter) self._child_event_filter = mouse.ChildEventFilter( eventfilter=self._mouse_event_filter, widget=self._widget, - parent=self) + win_id=self.win_id, parent=self) self._widget.installEventFilter(self._child_event_filter) @pyqtSlot()