Update of /cvsroot/freevo/kaa/display/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11055
Modified Files:
__init__.py display.c x11display.c x11window.c
Log Message:
Update to use new WeakOneShotTimer; add X11 display to evas.dependencies to
prevent display from getting dealloc'd before evas.
Index: x11display.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/x11display.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** x11display.c 11 Jul 2005 13:54:45 -0000 1.6
--- x11display.c 13 Jul 2005 18:07:25 -0000 1.7
***************
*** 74,77 ****
--- 74,78 ----
X11Display_PyObject__dealloc(X11Display_PyObject * self)
{
+ //printf("X11Display dealloc\n");
if (self->display) {
XCloseDisplay(self->display);
Index: display.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/display.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** display.c 11 Jul 2005 13:54:44 -0000 1.7
--- display.c 13 Jul 2005 18:07:25 -0000 1.8
***************
*** 41,51 ****
PyMethodDef display_methods[] = {
! { "image_to_surface", image_to_surface, METH_VARARGS },
! { "render_imlib2_image", render_imlib2_image, METH_VARARGS },
#ifdef USE_EVAS
! { "new_evas_software_x11", new_evas_software_x11, METH_VARARGS |
! METH_KEYWORDS },
#ifdef ENABLE_ENGINE_GL_X11
! { "new_evas_gl_x11", new_evas_gl_x11, METH_VARARGS | METH_KEYWORDS },
#endif
#endif
--- 41,50 ----
PyMethodDef display_methods[] = {
! { "image_to_surface", (PyCFunction) image_to_surface, METH_VARARGS },
! { "render_imlib2_image", (PyCFunction) render_imlib2_image, METH_VARARGS
},
#ifdef USE_EVAS
! { "new_evas_software_x11", (PyCFunction) new_evas_software_x11,
METH_VARARGS | METH_KEYWORDS },
#ifdef ENABLE_ENGINE_GL_X11
! { "new_evas_gl_x11", (PyCFunction) new_evas_gl_x11, METH_VARARGS |
METH_KEYWORDS },
#endif
#endif
Index: x11window.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/x11window.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** x11window.c 11 Jul 2005 13:54:45 -0000 1.6
--- x11window.c 13 Jul 2005 18:07:25 -0000 1.7
***************
*** 107,110 ****
--- 107,111 ----
{
if (self->window) {
+ //printf("X11Window destroy\n");
XDestroyWindow(self->display, self->window);
Py_XDECREF(self->ptr);
Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/__init__.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** __init__.py 11 Jul 2005 13:54:44 -0000 1.11
--- __init__.py 13 Jul 2005 18:07:24 -0000 1.12
***************
*** 61,66 ****
self._display = _Display.X11Display(dispname)
self._windows = {}
! cb = kaa.notifier.Function(self.handle_events)
! kaa.notifier.addSocket(self.socket, cb)
def handle_events(self):
--- 61,66 ----
self._display = _Display.X11Display(dispname)
self._windows = {}
! dispatcher = kaa.notifier.SocketDispatcher(self.handle_events)
! dispatcher.register(self.socket)
def handle_events(self):
***************
*** 78,82 ****
assert(wid in self._windows)
window = self._windows[wid]()
! window.handle_events(events)
# call the socket again
--- 78,86 ----
assert(wid in self._windows)
window = self._windows[wid]()
! if not window:
! # Window no longer exists.
! del self._windows[wid]
! else:
! window.handle_events(events)
# call the socket again
***************
*** 119,123 ****
display._windows[self._window.ptr] = weakref.ref(self)
self._cursor_hide_timeout = -1
! self._cursor_hide_timer_id = -1
self.signals = {
--- 123,128 ----
display._windows[self._window.ptr] = weakref.ref(self)
self._cursor_hide_timeout = -1
! self._cursor_hide_timer = kaa.notifier.WeakOneShotTimer(lambda o:
o.set_cursor_visible(False), self)
! self._cursor_visible = True
self.signals = {
***************
*** 147,157 ****
if event == X11Display.XEVENT_MOTION_NOTIFY:
# Mouse moved, so show cursor.
! if self._cursor_hide_timeout != 0:
self.set_cursor_visible(True)
! # Remove any pending timer
! if self._cursor_hide_timer_id != -1:
! kaa.notifier.removeTimer(self._cursor_hide_timer_id)
! self._cursor_hide_timer_id = -1
! self._cursor_hide_add_timer()
elif event == X11Display.XEVENT_KEY_PRESS:
--- 152,159 ----
if event == X11Display.XEVENT_MOTION_NOTIFY:
# Mouse moved, so show cursor.
! if self._cursor_hide_timeout != 0 and not
self._cursor_visible:
self.set_cursor_visible(True)
!
! self._cursor_hide_timer.start(self._cursor_hide_timeout)
elif event == X11Display.XEVENT_KEY_PRESS:
***************
*** 166,184 ****
- def _cursor_hide_add_timer(self):
- # Add a new timer to hide the cursor at the current interval.
- if self._cursor_hide_timeout > 0:
- interval = self._cursor_hide_timeout * 1000
- id = kaa.notifier.addTimer(interval, self._cursor_hide_cb)
- self._cursor_hide_timer_id = id
- elif self._cursor_hide_timeout == 0:
- self._cursor_hide_cb()
-
- def _cursor_hide_cb(self):
- self.set_cursor_visible(False)
- self._cursor_hide_timer_id = -1
- self._display.handle_events()
- return False
-
def move(self, pos):
self.set_geometry(pos, (-1, -1))
--- 168,171 ----
***************
*** 196,204 ****
def set_cursor_visible(self, visible):
self._window.set_cursor_visible(visible)
self._display.handle_events()
def set_cursor_hide_timeout(self, timeout):
! self._cursor_hide_timeout = timeout
! self._cursor_hide_add_timer()
--- 183,192 ----
def set_cursor_visible(self, visible):
self._window.set_cursor_visible(visible)
+ self._cursor_visible = visible
self._display.handle_events()
def set_cursor_hide_timeout(self, timeout):
! self._cursor_hide_timeout = timeout * 1000
! self._cursor_hide_timer.start(self._cursor_hide_timeout)
***************
*** 221,224 ****
--- 209,215 ----
self._evas.output_size_set(size)
self._evas.viewport_set((0, 0), size)
+ # Ensures the display remains alive until after Evas gets deallocated
+ # during garbage collection.
+ self._evas._dependencies.append(display._display)
super(EvasX11Window, self).__init__(display, window)
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog