efl.ecore.x: Unicode handling
This commit is contained in:
parent
5903c8a936
commit
b6f2a6822f
|
@ -17,6 +17,7 @@
|
|||
|
||||
#from cpython cimport PyObject, Py_INCREF, Py_DECREF
|
||||
from cpython cimport PyMem_Malloc, PyMem_Free
|
||||
from libc.string cimport PyUnicode_AsUTF8String
|
||||
|
||||
|
||||
def init(name=None):
|
||||
|
@ -25,13 +26,9 @@ def init(name=None):
|
|||
:param name: display target name, if None, default will be used.
|
||||
:rtype: int
|
||||
"""
|
||||
cdef char *s
|
||||
cdef int i
|
||||
if name is None:
|
||||
s = NULL
|
||||
else:
|
||||
s = name
|
||||
i = ecore_x_init(s)
|
||||
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
|
||||
i = ecore_x_init(s if name is not None else NULL)
|
||||
x_events_register()
|
||||
return i
|
||||
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from efl.ecore cimport EventHandler
|
||||
from efl.utils.conversions cimport _ctouni as _charp_to_str
|
||||
|
||||
cdef object _charp_to_str(const char *p):
|
||||
if p != NULL:
|
||||
return p
|
||||
else:
|
||||
return None
|
||||
# cdef object _charp_to_str(const char *p):
|
||||
# if p != NULL:
|
||||
# return p
|
||||
# else:
|
||||
# return None
|
||||
|
||||
|
||||
cdef class EventKey(Event):
|
||||
|
|
Loading…
Reference in New Issue