diff -r 79d06c98c5c9 -r 60874802161b WebBrowser/WebBrowserWindow.py --- a/WebBrowser/WebBrowserWindow.py Sat Jul 01 19:14:01 2017 +0200 +++ b/WebBrowser/WebBrowserWindow.py Sun Jul 02 19:40:39 2017 +0200 @@ -110,6 +110,7 @@ _sessionManager = None _performingShutdown = False + _lastActiveWindow = None def __init__(self, home, path, parent, name, fromEric=False, initShortcutsOnly=False, searchWord=None, @@ -160,7 +161,6 @@ self.__mHistory = [] self.__lastConfigurationPageName = "" - self.__lastActiveWindow = None WebBrowserWindow._isPrivate = private @@ -4002,28 +4002,28 @@ """ return cls.BrowserWindows - def __appFocusChanged(self, old, now): + @pyqtSlot() + def __appFocusChanged(self): """ Private slot to handle a change of the focus. - - @param old reference to the widget, that lost focus (QWidget or None) - @param now reference to the widget having the focus (QWidget or None) - """ - if isinstance(now, WebBrowserWindow): - self.__lastActiveWindow = now + """ + focusWindow = e5App().activeWindow() + if isinstance(focusWindow, WebBrowserWindow): + WebBrowserWindow._lastActiveWindow = focusWindow - def getWindow(self): - """ - Public method to get a reference to the most recent active + @classmethod + def getWindow(cls): + """ + Class method to get a reference to the most recent active web browser window. @return reference to most recent web browser window @rtype WebBrowserWindow """ - if self.__lastActiveWindow: - return self.__lastActiveWindow - - return self.mainWindow() + if cls._lastActiveWindow: + return cls._lastActiveWindow + + return cls.mainWindow() def openSearchManager(self): """