Better logic in focus-out-event blocking/unblocking, will not crash in Mint 13
This commit is contained in:
parent
8c2ef69ca9
commit
7ef248fa8e
@ -91,6 +91,7 @@ class MainWindow( object ):
|
|||||||
self.window.connect( "key-press-event", self.onKeyPress )
|
self.window.connect( "key-press-event", self.onKeyPress )
|
||||||
self.window.connect( "focus-in-event", self.onFocusIn )
|
self.window.connect( "focus-in-event", self.onFocusIn )
|
||||||
self.loseFocusId = self.window.connect( "focus-out-event", self.onFocusOut )
|
self.loseFocusId = self.window.connect( "focus-out-event", self.onFocusOut )
|
||||||
|
self.loseFocusBlocked = False
|
||||||
|
|
||||||
self.window.stick()
|
self.window.stick()
|
||||||
|
|
||||||
@ -465,18 +466,10 @@ class MainWindow( object ):
|
|||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
def onFocusIn( self, *args ):
|
def onFocusIn( self, *args ):
|
||||||
def dummy( *args ): pass
|
if self.loseFocusBlocked:
|
||||||
|
self.window.handler_unblock( self.loseFocusId )
|
||||||
signalId = GObject.signal_lookup( "focus-out-event", self.window )
|
self.loseFocusBlocked = False
|
||||||
while True:
|
|
||||||
result = GObject.signal_handler_find( self.window,
|
|
||||||
GObject.SignalMatchType.ID | GObject.SignalMatchType.UNBLOCKED,
|
|
||||||
signalId, 0, None, dummy, dummy )
|
|
||||||
if result == 0:
|
|
||||||
self.window.handler_unblock( self.loseFocusId )
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def onFocusOut( self, *args):
|
def onFocusOut( self, *args):
|
||||||
@ -485,7 +478,9 @@ class MainWindow( object ):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def stopHiding( self ):
|
def stopHiding( self ):
|
||||||
self.window.handler_block( self.loseFocusId )
|
if not self.loseFocusBlocked:
|
||||||
|
self.window.handler_block( self.loseFocusId )
|
||||||
|
self.loseFocusBlocked = True
|
||||||
|
|
||||||
class MenuWin( object ):
|
class MenuWin( object ):
|
||||||
def __init__( self, applet, iid ):
|
def __init__( self, applet, iid ):
|
||||||
|
Loading…
Reference in New Issue
Block a user