From: <Blu...@us...> - 2010-08-31 18:19:48
|
Revision: 381 http://virtplayground.svn.sourceforge.net/virtplayground/?rev=381&view=rev Author: BlueWolf_ Date: 2010-08-31 18:19:41 +0000 (Tue, 31 Aug 2010) Log Message: ----------- Removed has_focus and has_hover from sh as it's practically a duplicate from key.get_focused() and mouse.get_focused() Modified Paths: -------------- trunk/client/VP.py trunk/client/gui.py trunk/client/layout.py Modified: trunk/client/VP.py =================================================================== --- trunk/client/VP.py 2010-08-31 18:13:16 UTC (rev 380) +++ trunk/client/VP.py 2010-08-31 18:19:41 UTC (rev 381) @@ -29,8 +29,6 @@ class Main(): def __init__(self): - sh['has_focus'] = True - sh['has_hover'] = True sh['filetable'] = {} sh['timer'] = Timer() sh['downloader'] = Downloader() @@ -92,17 +90,7 @@ ev = pygame.event.Event(MOUSEMOTION, buttons = ev.buttons, pos = pos) - - # As (sometimes) the mouse focus doesn't get through when - # switching workspaces (Linux), this should "fix" it - sh['has_hover'] = True - elif ev.type == ACTIVEEVENT: - if ev.state == 1: # Mouse focus - sh['has_hover'] = (ev.gain == 1) - elif ev.state == 2: # Window focus - sh['has_focus'] = (ev.gain == 1) - # Send through all the layers if sh['windows'].event(ev): continue if sh['layout'].event(ev): continue Modified: trunk/client/gui.py =================================================================== --- trunk/client/gui.py 2010-08-31 18:13:16 UTC (rev 380) +++ trunk/client/gui.py 2010-08-31 18:19:41 UTC (rev 381) @@ -111,7 +111,7 @@ if pos == None: pos = pygame.mouse.get_pos() - if sh['has_hover']: + if pygame.mouse.get_focused(): # Get the current hovered object rect, hover = self.this_pos(pos) Modified: trunk/client/layout.py =================================================================== --- trunk/client/layout.py 2010-08-31 18:13:16 UTC (rev 380) +++ trunk/client/layout.py 2010-08-31 18:19:41 UTC (rev 381) @@ -92,7 +92,10 @@ self.topbar = load_image(True, "images", "topbar.png") self.selected = None - self.hover = self.topbarcursor(pygame.mouse.get_pos()) + if pygame.mouse.get_focused(): + self.hover = self.topbarcursor(pygame.mouse.get_pos()) + else: + self.hover = None self.toppos = 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |