@@ -212,6 +212,8 @@ def __init__(self, parent=None):
212212 def focusInEvent (self , event ):
213213 # This event seems to never get called on Linux, as CEF is
214214 # stealing all focus due to Issue #284.
215+ if cef .GetAppSetting ("debug" ):
216+ print ("[qt.py] CefWidget.focusInEvent" )
215217 if self .browser :
216218 if WINDOWS :
217219 WindowUtils .OnSetFocus (self .getHandle (), 0 , 0 , 0 )
@@ -220,6 +222,8 @@ def focusInEvent(self, event):
220222 def focusOutEvent (self , event ):
221223 # This event seems to never get called on Linux, as CEF is
222224 # stealing all focus due to Issue #284.
225+ if cef .GetAppSetting ("debug" ):
226+ print ("[qt.py] CefWidget.focusOutEvent" )
223227 if self .browser :
224228 self .browser .SetFocus (False )
225229
@@ -336,18 +340,20 @@ class FocusHandler(object):
336340 def __init__ (self , cef_widget ):
337341 self .cef_widget = cef_widget
338342
343+ def OnTakeFocus (self , ** _ ):
344+ if cef .GetAppSetting ("debug" ):
345+ print ("[qt.py] FocusHandler.OnTakeFocus" )
346+
339347 def OnSetFocus (self , ** _ ):
340- print ("[qt.py] FocusHandler.OnSetFocus" )
341- if LINUX :
342- return False
343- else :
344- return True
348+ if cef .GetAppSetting ("debug" ):
349+ print ("[qt.py] FocusHandler.OnSetFocus" )
345350
346351 def OnGotFocus (self , browser , ** _ ):
352+ if cef .GetAppSetting ("debug" ):
353+ print ("[qt.py] FocusHandler.OnGotFocus" )
354+ self .cef_widget .setFocus ()
347355 # Temporary fix no. 1 for focus issues on Linux (Issue #284)
348356 if LINUX :
349- print ("[qt.py] FocusHandler.OnGotFocus:"
350- " keyboard focus fix no. 1 (Issue #284)" )
351357 browser .SetFocus (True )
352358
353359
0 commit comments