Author: ArcRiley
Date: 2007-07-06 02:29:32 -0400 (Fri, 06 Jul 2007)
New Revision: 376
Modified:
trunk/pysoy/src/_core-common/_coreLoop.pxi
trunk/pysoy/src/_core-x11/Screen.pxi
trunk/pysoy/src/_core-x11/Window.pxi
trunk/pysoy/src/_core-x11/glx.pxd
trunk/pysoy/src/_core-x11/soy._core.pxd
Log:
soy.Window.size is now updated dynamically (fix for ticket #248)
Modified: trunk/pysoy/src/_core-common/_coreLoop.pxi
===================================================================
--- trunk/pysoy/src/_core-common/_coreLoop.pxi 2007-07-06 05:04:27 UTC (rev
375)
+++ trunk/pysoy/src/_core-common/_coreLoop.pxi 2007-07-06 06:29:32 UTC (rev
376)
@@ -50,6 +50,10 @@
for i from 0 <= i < _transports.current :
(<soy.transports.Transport> _transports.list[i])._process()
_transports.unlock()
+ _screens.lock()
+ for i from 0 <= i < _screens.current :
+ (<Screen> _screens.list[i])._events()
+ _screens.unlock()
_windows.lock()
for i from 0 <= i < _windows.current :
(<Window> _windows.list[i])._render()
Modified: trunk/pysoy/src/_core-x11/Screen.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Screen.pxi 2007-07-06 05:04:27 UTC (rev
375)
+++ trunk/pysoy/src/_core-x11/Screen.pxi 2007-07-06 06:29:32 UTC (rev
376)
@@ -17,9 +17,7 @@
#
# $Id$
-cdef glx.Display *_display
cdef soy._internals.Children _screens
-_display = glx.XOpenDisplay(NULL)
_screens = soy._internals.Children()
cdef class Screen :
@@ -33,6 +31,8 @@
def __new__(self, sId=-1) :
cdef int i
cdef int _glxAttrs[16]
+ cdef glx.Display *_display
+ _display = glx.XOpenDisplay(NULL)
if _display==NULL :
raise('Could not open display\n')
if type(sId)==int and sId<0 :
@@ -105,3 +105,20 @@
self._glVersion = 2
elif gl.glewIsSupported("GL_VERSION_1_1") :
self._glVersion = 1
+
+ cdef void _events(self) :
+ cdef int i
+ cdef glx.XEvent _event
+ cdef glx.Display *_display
+ _display = glx.DisplayOfScreen(self._screen)
+ while glx.XPending(_display) > 0 :
+ glx.XNextEvent(_display, &_event)
+ if _event.type == glx.ConfigureNotify :
+ _windows.lock()
+ for i from 0 <= i < _windows.current :
+ if (<Window> _windows.list[i])._windowID==_event.xconfigure.window :
+ (<Window> _windows.list[i])._width = _event.xconfigure.width
+ (<Window> _windows.list[i])._height = _event.xconfigure.height
+ break
+ _windows.unlock()
+
Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 05:04:27 UTC (rev
375)
+++ trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 06:29:32 UTC (rev
376)
@@ -49,8 +49,10 @@
self._screen._xVisualInfo.visual, glx.AllocNone)
_winAttr.colormap = _colormap
_winAttr.border_pixel = 0
- _winAttr.event_mask = glx.ExposureMask | glx.KeyPressMask | \
- glx.ButtonPressMask | glx.StructureNotifyMask
+ _winAttr.event_mask = glx.KeyPressMask | glx.KeyReleaseMask | \
+ glx.ButtonPressMask | glx.ButtonReleaseMask | \
+ glx.EnterWindowMask | glx.LeaveWindowMask | \
+ glx.PointerMotionMask | glx.StructureNotifyMask
self._windowID = glx.XCreateWindow(
_display,
glx.RootWindowOfScreen(self._screen._screen),
Modified: trunk/pysoy/src/_core-x11/glx.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/glx.pxd 2007-07-06 05:04:27 UTC (rev 375)
+++ trunk/pysoy/src/_core-x11/glx.pxd 2007-07-06 06:29:32 UTC (rev 376)
@@ -136,9 +136,11 @@
CWDontPropagate
CWColormap
CWCursor
+ #
# Xlib CreateColormap
AllocNone
AllocAll
+ #
# Xlib Event Input Masks
NoEventMask
KeyPressMask
@@ -166,6 +168,127 @@
PropertyChangeMask
ColormapChangeMask
OwnerGrabButtonMask
+ #
+ # Event names
+ KeyPress
+ KeyRelease
+ ButtonPress
+ ButtonRelease
+ MotionNotify
+ EnterNotify
+ LeaveNotify
+ FocusIn
+ FocusOut
+ KeymapNotify
+ Expose
+ GraphicsExpose
+ NoExpose
+ VisibilityNotify
+ CreateNotify
+ DestroyNotify
+ UnmapNotify
+ MapNotify
+ MapRequest
+ ReparentNotify
+ ConfigureNotify
+ ConfigureRequest
+ GravityNotify
+ ResizeRequest
+ CirculateNotify
+ CirculateRequest
+ PropertyNotify
+ SelectionClear
+ SelectionRequest
+ SelectionNotify
+ ColormapNotify
+ ClientMessage
+ MappingNotify
+ LASTEvent
+ #
+ # Key masks
+ ShiftMask
+ LockMask
+ ControlMask
+ Mod1Mask
+ Mod2Mask
+ Mod3Mask
+ Mod4Mask
+ Mod5Mask
+ #
+ # Modifier names
+ ShiftMapIndex
+ LockMapIndex
+ ControlMapIndex
+ Mod1MapIndex
+ Mod2MapIndex
+ Mod3MapIndex
+ Mod4MapIndex
+ Mod5MapIndex
+ #
+ # Button masks
+ Button1Mask
+ Button2Mask
+ Button3Mask
+ Button4Mask
+ Button5Mask
+ AnyModifier
+ #
+ # Button names
+ Button1
+ Button2
+ Button3
+ Button4
+ Button5
+ #
+ # Notify modes
+ NotifyNormal
+ NotifyGrab
+ NotifyUngrab
+ NotifyWhileGrabbed
+ #
+ # Notify hint
+ NotifyHint
+ #
+ # Notify details
+ NotifyAncestor
+ NotifyVirtual
+ NotifyInferior
+ NotifyNonlinear
+ NotifyNonlinearVirtual
+ NotifyPointer
+ NotifyPointerRoot
+ NotifyDetailNone
+ #
+ # Visibility notify
+ VisibilityUnobscured
+ VisibilityPartiallyObscured
+ VisibilityFullyObscured
+ #
+ # Circulation request
+ PlaceOnTop
+ PlaceOnBottom
+ #
+ # Error Names
+ Success
+ BadRequest
+ BadValue
+ BadWindow
+ BadPixmap
+ BadAtom
+ BadCursor
+ BadFont
+ BadMatch
+ BadDrawable
+ BadAccess
+ BadAlloc
+ BadColor
+ BadGC
+ BadIDChoice
+ BadName
+ BadLength
+ BadImplementation
+ FirstExtensionError
+ LastExtensionError
ctypedef int Bool
@@ -175,15 +298,12 @@
ctypedef unsigned long Cursor
ctypedef unsigned long Colormap
ctypedef unsigned long GContext
+ ctypedef unsigned long Atom
ctypedef unsigned long VisualID
- ctypedef unsigned long Atom
-
+ ctypedef unsigned long Time
ctypedef void *GLXContext
-
ctypedef void *GC
-
ctypedef void Display
-
ctypedef void Visual
ctypedef struct Depth :
@@ -264,14 +384,88 @@
Colormap colormap
Cursor cursor
- ctypedef struct XIconSize :
- int min_width
- int min_height
- int max_width
- int max_height
- int width_inc
- int height_inc
+ ctypedef struct XAnyEvent :
+ int type
+ unsigned long serial
+ Bool send_event
+ Display *display
+ Window window
+ ctypedef struct XKeyEvent :
+ int type
+ unsigned long serial
+ Bool send_event
+ Display *display
+ Window window
+ Window root
+ Window subwindow
+ Time time
+ int x
+ int y
+ int x_root
+ int y_root
+ unsigned int state
+ unsigned int keycode
+ Bool same_screen
+
+ ctypedef struct XButtonEvent :
+ int type
+ unsigned long serial
+ Bool send_event
+ Display *display
+ Window window
+ Window root
+ Window subwindow
+ Time time
+ int x
+ int y
+ int x_root
+ int y_root
+ unsigned int state
+ unsigned int button
+ Bool same_screen
+
+ ctypedef struct XMotionEvent :
+ int type
+ unsigned long serial
+ Bool send_event
+ Display *display
+ Window window
+ Window root
+ Window subwindow
+ Time time
+ int x
+ int y
+ int x_root
+ int y_root
+ unsigned int state
+ char is_hint
+ Bool same_screen
+
+ ctypedef struct XConfigureEvent :
+ int type
+ unsigned long serial
+ Bool send_event
+ Display *display
+ Window event
+ Window window
+ int x
+ int y
+ int width
+ int height
+ int border_width
+ Window above
+ Bool override_redirect
+
+ ctypedef union XEvent :
+ int type
+ XAnyEvent xany
+ XKeyEvent xkey
+ XButtonEvent xbutton
+ XMotionEvent xmotion
+ XConfigureEvent xconfigure
+
+
cdef Display *XOpenDisplay ( char* )
cdef int XCloseDisplay ( Display* )
cdef char *DisplayString ( Display* )
@@ -313,25 +507,25 @@
unsigned long,
XSetWindowAttributes* )
cdef int XDestroyWindow ( Display*, Window )
+ cdef int XFlush ( Display* )
cdef int XFreePixmap ( Display*, Pixmap )
- cdef int XGetIconSizes ( Display*, Window,
- XIconSize**, int* )
+ cdef int XGetGeometry ( Display*, Window, Window*,
+ int*, int*,
+ unsigned int*, unsigned int*,
+ unsigned int*, unsigned int* )
cdef Atom XInternAtom ( Display*, char*, Bool )
- cdef int XSetWMProtocols ( Display*, Window, Atom*, int )
- cdef int XSetStandardProperties ( Display*, Window, char*, char*,
- Pixmap, char**, int, XSizeHints* )
- cdef int XFlush ( Display* )
cdef int XMapWindow ( Display*, Window )
cdef int XMapRaised ( Display*, Window )
- cdef int XUnmapWindow ( Display*, Window )
cdef int XMoveWindow ( Display*, Window, int, int )
- cdef int XResizeWindow ( Display*, Window, int, int )
- cdef int XGetGeometry ( Display*, Window, Window*,
- int*, int*,
- unsigned int*, unsigned int*,
- unsigned int*, unsigned int* )
+ cdef int XNextEvent ( Display*, XEvent* )
+ cdef int XPending ( Display* )
cdef int XQueryTree ( Display*, Window, Window*,
Window*, Window**, unsigned int* )
+ cdef int XResizeWindow ( Display*, Window, int, int )
+ cdef int XSetWMProtocols ( Display*, Window, Atom*, int )
+ cdef int XSetStandardProperties ( Display*, Window, char*, char*,
+ Pixmap, char**, int, XSizeHints* )
+ cdef int XUnmapWindow ( Display*, Window )
Modified: trunk/pysoy/src/_core-x11/soy._core.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/soy._core.pxd 2007-07-06 05:04:27 UTC (rev
375)
+++ trunk/pysoy/src/_core-x11/soy._core.pxd 2007-07-06 06:29:32 UTC (rev
376)
@@ -47,6 +47,7 @@
# OpenGL Support
cdef int _glVersion
cdef void _glewInit(self)
+ cdef void _events(self)
cdef class Window :
cdef soy._internals.Children _widgets
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn