popups and focus working now

This commit is contained in:
Michael Webster 2013-03-07 19:25:41 -05:00
parent 614764a7e8
commit 8812475eac
3 changed files with 10 additions and 13 deletions

View File

@ -460,16 +460,15 @@ class MainWindow( object ):
def grab( self ): def grab( self ):
gdk.gdk_pointer_grab (hash(self.window.window), True, Gdk.EventMask.BUTTON_PRESS_MASK, None, None, 0) 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 ) Gdk.keyboard_grab( self.window.window, False, Gdk.CURRENT_TIME )
# Gtk.grab_add(self.window) Gtk.grab_add(self.window)
def ungrab( self ): def ungrab( self ):
# Gtk.grab_remove(self.window) Gtk.grab_remove(self.window)
self.window.hide() self.window.hide()
Gdk.pointer_ungrab(Gdk.CURRENT_TIME) Gdk.pointer_ungrab(Gdk.CURRENT_TIME)
Gdk.keyboard_ungrab(Gdk.CURRENT_TIME) Gdk.keyboard_ungrab(Gdk.CURRENT_TIME)
def onMap( self, widget, event ): def onMap( self, widget, event ):
return
self.grab() self.grab()
def onShow( self, widget ): def onShow( self, widget ):
@ -506,11 +505,13 @@ class MainWindow( object ):
return True return True
def onGrabBroken( self, widget, event ): def onGrabBroken( self, widget, event ):
return
if event.grab_broken.grab_window: if event.grab_broken.grab_window:
try: try:
theft = event.grab_broken.grab_window.get_user_data() theft = event.grab_broken.grab_window.get_user_data()
theft.connect( "event", self.onGrabTheftEvent ) theft.connect( "event", self.onGrabTheftEvent )
except: except Exception, detail:
print detail
self.window.hide( True ) self.window.hide( True )
def onGrabTheftEvent( self, widget, event ): def onGrabTheftEvent( self, widget, event ):

View File

@ -922,7 +922,7 @@ class pluginclass( object ):
mTree.show_all() mTree.show_all()
gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
# self.mintMenuWin.grab() self.mintMenuWin.grab()
else: else:
mTree = Gtk.Menu() mTree = Gtk.Menu()
@ -942,8 +942,7 @@ 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, ev.button, ev.time) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
# self.mintMenuWin.grab() self.mintMenuWin.grab()
return True
def menuPopup( self, widget, event ): def menuPopup( self, widget, event ):
if event.button == 3: if event.button == 3:
@ -1008,8 +1007,7 @@ class pluginclass( object ):
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, 0, 0) gtk.gtk_menu_popup(hash(mTree), None, None, None, None, 0, 0)
def onMenuPopupDeactivate( self, widget): def onMenuPopupDeactivate( self, widget):
pass self.mintMenuWin.grab()
#self.mintMenuWin.grab()
def searchPopup( self, widget=None, event=None ): def searchPopup( self, widget=None, event=None ):
menu = Gtk.Menu() menu = Gtk.Menu()
@ -1090,7 +1088,7 @@ class pluginclass( object ):
#menu.attach_to_widget(self.searchButton, None) #menu.attach_to_widget(self.searchButton, None)
#menu.reposition() #menu.reposition()
#menu.reposition() #menu.reposition()
# self.mintMenuWin.grab() self.mintMenuWin.grab()
self.focusSearchEntry() self.focusSearchEntry()
return True return True

View File

@ -259,9 +259,7 @@ class pluginclass( object ):
trashMenu.show_all() trashMenu.show_all()
emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget ) emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget )
gtk.gtk_menu_popup(hash(trashMenu), None, None, None, None, 3, 0) gtk.gtk_menu_popup(hash(trashMenu), None, None, None, None, 3, 0)
#self.mintMenuWin.grab() self.mintMenuWin.grab()
return True
def emptyTrash( self, menu, widget): def emptyTrash( self, menu, widget):
os.system("rm -rf " + home + "/.local/share/Trash/info/*") os.system("rm -rf " + home + "/.local/share/Trash/info/*")