[pyatspi2] Avoid calling atspi_state_set_get_states



commit 62c9dae6174fd2a837643af14e32a716fa8c0017
Author: Mike Gorse <mgorse novell com>
Date:   Mon Apr 25 18:32:05 2011 -0500

    Avoid calling atspi_state_set_get_states
    
    Pygobject 2.28.3 and earlier had a bug that sometimes made fetching arrays of
    untyped enums fail on 64-bit systems, so added a work-around for now.
    Will probably revert this commit eventually, as it is a bit of a hack.

 pyatspi/state.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/pyatspi/state.py b/pyatspi/state.py
index 33f3256..b90afc9 100644
--- a/pyatspi/state.py
+++ b/pyatspi/state.py
@@ -162,8 +162,16 @@ def stateset_init(self, *states):
 	GObject.GObject.__init__(self)
 	map(self.add, states)
 
+# TODO: Probably remove this hack for 2.2, since BGO#646581 is fixed
+def StateSet_getStates(self):
+        ret = []
+        for i in range(0, 64):
+                if (self.states & (1 << i)):
+                        ret.append(Atspi.StateType(i))
+        return ret
+
 StateSet = Atspi.StateSet
-StateSet.getStates = StateSet.get_states
+StateSet.getStates = StateSet_getStates
 StateSet.isEmpty = StateSet.is_empty
 StateSet.raw = lambda x: x
 StateSet.unref = lambda x: None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]