File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,7 @@ class WindowBase(EventDispatcher):
295
295
_modifiers = ListProperty ([])
296
296
_rotation = NumericProperty (0 )
297
297
_clearcolor = ObjectProperty ([0 , 0 , 0 , 1 ])
298
+ _focus = BooleanProperty (True )
298
299
299
300
children = ListProperty ([])
300
301
'''List of the children of this window.
@@ -599,12 +600,15 @@ def _get_effective_size(self):
599
600
defaults to True.
600
601
'''
601
602
602
- focus = BooleanProperty ( True )
603
- '''Set whether or not the window currently has focus.
603
+ def _get_focus ( self ):
604
+ return self . _focus
604
605
605
- .. versionadded::1.9.1
606
+ focus = AliasProperty (_get_focus , None , bind = ('_focus' ,))
607
+ '''Check whether or not the window currently has focus.
606
608
607
- :attr:`focus` is a :class:`~kivy.properties.BooleanProperty and
609
+ .. versionadded:: 1.9.1
610
+
611
+ :attr:`focus` is a read-only :class:`~kivy.properties.AliasProperty and
608
612
defaults to True.
609
613
'''
610
614
Original file line number Diff line number Diff line change @@ -472,6 +472,12 @@ def _mainloop(self):
472
472
if Config .getboolean ('kivy' , 'pause_on_minimize' ):
473
473
self .do_pause ()
474
474
475
+ elif action == 'windowfocusgained' :
476
+ self ._focus = True
477
+
478
+ elif action == 'windowfocuslost' :
479
+ self ._focus = False
480
+
475
481
elif action == 'windowenter' :
476
482
self .dispatch ('on_cursor_enter' )
477
483
@@ -559,12 +565,6 @@ def _mainloop(self):
559
565
text = args [0 ]
560
566
self .dispatch ('on_textinput' , text )
561
567
562
- elif action == 'windowfocusgained' :
563
- self .focus = True
564
-
565
- elif action == 'windowfocuslost' :
566
- self .focus = False
567
-
568
568
# unhandled event !
569
569
else :
570
570
Logger .trace ('WindowSDL: Unhandled event %s' % str (event ))
You can’t perform that action at this time.
0 commit comments