summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2014-05-14 07:01:57 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2014-05-14 07:01:57 +0300
commitb6f2a6822f36be6ddc017e4d78bc3d29c8cbe1ee (patch)
treea4574a64e0fbcb8c4f1afb3b11a60de7b2ee6ee7
parent5903c8a936181ce9afd8ee858bfcef61c334f624 (diff)
efl.ecore.x: Unicode handling
-rw-r--r--efl/ecore/x.pyx9
-rw-r--r--efl/ecore/x_events.pxi11
2 files changed, 9 insertions, 11 deletions
diff --git a/efl/ecore/x.pyx b/efl/ecore/x.pyx
index ef1bd66..d75c587 100644
--- a/efl/ecore/x.pyx
+++ b/efl/ecore/x.pyx
@@ -17,6 +17,7 @@
17 17
18#from cpython cimport PyObject, Py_INCREF, Py_DECREF 18#from cpython cimport PyObject, Py_INCREF, Py_DECREF
19from cpython cimport PyMem_Malloc, PyMem_Free 19from cpython cimport PyMem_Malloc, PyMem_Free
20from libc.string cimport PyUnicode_AsUTF8String
20 21
21 22
22def init(name=None): 23def init(name=None):
@@ -25,13 +26,9 @@ def init(name=None):
25 :param name: display target name, if None, default will be used. 26 :param name: display target name, if None, default will be used.
26 :rtype: int 27 :rtype: int
27 """ 28 """
28 cdef char *s
29 cdef int i 29 cdef int i
30 if name is None: 30 if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
31 s = NULL 31 i = ecore_x_init(s if name is not None else NULL)
32 else:
33 s = name
34 i = ecore_x_init(s)
35 x_events_register() 32 x_events_register()
36 return i 33 return i
37 34
diff --git a/efl/ecore/x_events.pxi b/efl/ecore/x_events.pxi
index 680239e..b605899 100644
--- a/efl/ecore/x_events.pxi
+++ b/efl/ecore/x_events.pxi
@@ -16,12 +16,13 @@
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from efl.ecore cimport EventHandler 18from efl.ecore cimport EventHandler
19from efl.utils.conversions cimport _ctouni as _charp_to_str
19 20
20cdef object _charp_to_str(const char *p): 21# cdef object _charp_to_str(const char *p):
21 if p != NULL: 22# if p != NULL:
22 return p 23# return p
23 else: 24# else:
24 return None 25# return None
25 26
26 27
27cdef class EventKey(Event): 28cdef class EventKey(Event):