Fix mouse focus bug with favorites menu

If you click on favorites and click on any area outside menu -> nothing happens
This is because the mouse is grabed by window.
Fix this by registering a callback instead of immediately grabbing(not sure why this was added by Michael)
Frankly this code can use some DRY love
This commit is contained in:
Karthik T 2013-10-24 00:51:19 +08:00
parent 2956eb2060
commit 285376b049

View File

@ -949,7 +949,8 @@ class pluginclass( object ):
mTree.show_all() mTree.show_all()
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, ev.button, ev.time) gtk.gtk_menu_popup(hash(mTree), None, None, None, None, ev.button, ev.time)
self.mintMenuWin.grab() #self.mintMenuWin.grab()
mTree.connect( 'deactivate', self.onMenuPopupDeactivate)
else: else:
mTree = Gtk.Menu() mTree = Gtk.Menu()
@ -969,7 +970,8 @@ class pluginclass( object ):
insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore ) insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore )
insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore ) insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore )
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, ev.button, ev.time) gtk.gtk_menu_popup(hash(mTree), None, None, None, None, ev.button, ev.time)
self.mintMenuWin.grab() #self.mintMenuWin.grab()
mTree.connect( 'deactivate', self.onMenuPopupDeactivate)
def menuPopup( self, widget, event ): def menuPopup( self, widget, event ):
if event.button == 3: if event.button == 3: