From 8812475eac9b267ecead6a92cc1708035c88d086 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Thu, 7 Mar 2013 19:25:41 -0500 Subject: [PATCH] popups and focus working now --- usr/lib/linuxmint/mintMenu/mintMenu.py | 9 +++++---- usr/lib/linuxmint/mintMenu/plugins/applications.py | 10 ++++------ usr/lib/linuxmint/mintMenu/plugins/places.py | 4 +--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 8379a64..8df2a56 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -460,16 +460,15 @@ class MainWindow( object ): def grab( self ): gdk.gdk_pointer_grab (hash(self.window.window), True, Gdk.EventMask.BUTTON_PRESS_MASK, None, None, 0) Gdk.keyboard_grab( self.window.window, False, Gdk.CURRENT_TIME ) - # Gtk.grab_add(self.window) + Gtk.grab_add(self.window) def ungrab( self ): - # Gtk.grab_remove(self.window) + Gtk.grab_remove(self.window) self.window.hide() Gdk.pointer_ungrab(Gdk.CURRENT_TIME) Gdk.keyboard_ungrab(Gdk.CURRENT_TIME) def onMap( self, widget, event ): - return self.grab() def onShow( self, widget ): @@ -506,11 +505,13 @@ class MainWindow( object ): return True def onGrabBroken( self, widget, event ): + return if event.grab_broken.grab_window: try: theft = event.grab_broken.grab_window.get_user_data() theft.connect( "event", self.onGrabTheftEvent ) - except: + except Exception, detail: + print detail self.window.hide( True ) def onGrabTheftEvent( self, widget, event ): diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 7c846a0..d388dae 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -922,7 +922,7 @@ class pluginclass( object ): mTree.show_all() gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time) - # self.mintMenuWin.grab() + self.mintMenuWin.grab() else: mTree = Gtk.Menu() @@ -942,8 +942,7 @@ class pluginclass( object ): insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore ) insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore ) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time) - # self.mintMenuWin.grab() - return True + self.mintMenuWin.grab() def menuPopup( self, widget, event ): if event.button == 3: @@ -1008,8 +1007,7 @@ class pluginclass( object ): gtk.gtk_menu_popup(hash(mTree), None, None, None, None, 0, 0) def onMenuPopupDeactivate( self, widget): - pass - #self.mintMenuWin.grab() + self.mintMenuWin.grab() def searchPopup( self, widget=None, event=None ): menu = Gtk.Menu() @@ -1090,7 +1088,7 @@ class pluginclass( object ): #menu.attach_to_widget(self.searchButton, None) #menu.reposition() #menu.reposition() - # self.mintMenuWin.grab() + self.mintMenuWin.grab() self.focusSearchEntry() return True diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 9f01b69..272b17a 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -259,9 +259,7 @@ class pluginclass( object ): trashMenu.show_all() emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget ) gtk.gtk_menu_popup(hash(trashMenu), None, None, None, None, 3, 0) - #self.mintMenuWin.grab() - return True - + self.mintMenuWin.grab() def emptyTrash( self, menu, widget): os.system("rm -rf " + home + "/.local/share/Trash/info/*")