From 24519ad23309de511a4bb57fa5073d7f0b730e76 Mon Sep 17 00:00:00 2001 From: hordepfo Date: Wed, 22 Jan 2014 02:30:26 +0000 Subject: [PATCH 1/2] Solves app and category buttons focus issues The buttons were grabbing the focus out of the search entry on hover, inducing strange behaviour. Fixes #23 --- usr/lib/linuxmint/mintMenu/plugins/applications.py | 4 ---- usr/lib/linuxmint/mintMenu/plugins/easybuttons.py | 4 ---- 2 files changed, 8 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index c41ebcf..6191780 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -878,9 +878,6 @@ class pluginclass( object ): i.released() i.set_relief( Gtk.ReliefStyle.NONE ) widget.set_relief( Gtk.ReliefStyle.HALF ) - widget.grab_focus() - - self.searchEntry.set_text( "" ) self.applicationsScrolledWindow.get_vadjustment().set_value( 0 ) @@ -1121,7 +1118,6 @@ class pluginclass( object ): #menu.reposition() #self.mintMenuWin.grab() menu.connect( 'deactivate', self.onMenuPopupDeactivate) - self.focusSearchEntry() return True def pos_func(self, menu=None): diff --git a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py index 2d0d90d..1f1d799 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py +++ b/usr/lib/linuxmint/mintMenu/plugins/easybuttons.py @@ -283,7 +283,6 @@ class ApplicationLauncher( easyButton ): self.connectSelf( "focus-in-event", self.onFocusIn ) self.connectSelf( "focus-out-event", self.onFocusOut ) - self.connectSelf( "enter-notify-event", self.onEnterNotify ) self.connectSelf( "clicked", self.execute ) @@ -332,9 +331,6 @@ class ApplicationLauncher( easyButton ): def onFocusOut( self, widget, event ): self.set_relief( Gtk.ReliefStyle.NONE ) - def onEnterNotify( self, widget, event ): - self.grab_focus() - def setupLabels( self ): self.addLabel( self.appName ) From 2353f958d39077dbd2f22795ee56bca79e52f846 Mon Sep 17 00:00:00 2001 From: hordepfo Date: Wed, 22 Jan 2014 03:15:15 +0000 Subject: [PATCH 2/2] Correction of previous commit - clear when clicked Now category buttons only clear text when clicked, not when hovered. It seems more natural, because a now the mouse position is irrelevant when trying to type on the search entry. --- usr/lib/linuxmint/mintMenu/plugins/applications.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 6191780..272f852 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -880,6 +880,10 @@ class pluginclass( object ): widget.set_relief( Gtk.ReliefStyle.HALF ) self.applicationsScrolledWindow.get_vadjustment().set_value( 0 ) + + def FilterAndClear( self, widget, category = None ): + self.searchEntry.set_text( "" ) + self.Filter( widget, category ) # Forward all text to the search box def keyPress( self, widget, event ): @@ -1673,7 +1677,7 @@ class pluginclass( object ): else: item["button"].mouseOverHandlerIds = None - item["button"].connect( "clicked", self.Filter, item["filter"] ) + item["button"].connect( "clicked", self.FilterAndClear, item["filter"] ) item["button"].connect( "focus-in-event", self.categoryBtnFocus, item["filter"] ) item["button"].show()