Author: ArcRiley
Date: 2007-07-06 01:04:27 -0400 (Fri, 06 Jul 2007)
New Revision: 375
Modified:
trunk/pysoy/src/_core-x11/Window.pxi
trunk/pysoy/src/_core-x11/glx.pxd
trunk/pysoy/src/_core-x11/soy._core.pxd
Log:
early work on icon, this is going to be more work than i can do before beta1
Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 00:37:34 UTC (rev
374)
+++ trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 05:04:27 UTC (rev
375)
@@ -26,8 +26,8 @@
Each instance of this class is a separate window.
'''
- def __new__(self, screen, title='', background=None, position=(0,0),
- size=(320,240), *args, **kw) :
+ def __new__(self, screen, title='', icon=None, background=None,
+ position=(0,0), size=(320,240), *args, **kw) :
cdef glx.Display *_display
cdef glx.Colormap _colormap
cdef glx.XSetWindowAttributes _winAttr
@@ -63,6 +63,8 @@
self._screen._xVisualInfo, NULL, gl.GL_TRUE)
_atom = glx.XInternAtom(_display, "WM_DELETE_WINDOW", True)
glx.XSetWMProtocols(_display, self._windowID, &_atom, 1)
+ #if icon :
+ # self.icon = icon
self._setProperties()
glx.XMapWindow(_display, self._windowID)
_sleep(10) # Let X11 finish before returning to Python
@@ -134,8 +136,8 @@
cdef glx.Display *_display
_display = glx.DisplayOfScreen(self._screen._screen)
glx.XSetStandardProperties(_display, self._windowID,
- self._title, self._title,
- 0, NULL, 0, NULL)
+ self._title, self._title, self._iconID,
+ NULL, 0, NULL)
glx.XFlush(_display)
@@ -157,6 +159,34 @@
self._setProperties()
_windows.unlock()
+
+ #property icon:
+ #'''Window's icon texture
+ #
+ #This property is the window's "icon", however the window manager uses it.
+ #Textures must be 1D or 2D (not 3D) and /should/ be square.
+ #
+ #Defaults to None.
+ #'''
+ #def __get__(self) :
+ # if self._iconID > 0 :
+ # return self._icon
+ # else :
+ # return None
+ #def __set__(self, value) :
+ #cdef glx.Display *_display
+ #_display = glx.DisplayOfScreen(self._screen._screen)
+ #if not isinstance(value, soy.textures.Texture) :
+ # raise TypeError('not a Texture')
+ #if (<soy.textures.Texture> value)._depth != 1 :
+ # raise TypeError('texture must not be 3 dimensional')
+ #self._icon = value
+ ## Need to load the Pixmap
+ #_windows.lock()
+ #self._setProperties()
+ #_windows.unlock()
+
+
property background:
'''Window's background color
Modified: trunk/pysoy/src/_core-x11/glx.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/glx.pxd 2007-07-06 00:37:34 UTC (rev 374)
+++ trunk/pysoy/src/_core-x11/glx.pxd 2007-07-06 05:04:27 UTC (rev 375)
@@ -264,7 +264,13 @@
Colormap colormap
Cursor cursor
- cdef int glXQueryVersion ( Display*, int *maj, int *min )
+ ctypedef struct XIconSize :
+ int min_width
+ int min_height
+ int max_width
+ int max_height
+ int width_inc
+ int height_inc
cdef Display *XOpenDisplay ( char* )
cdef int XCloseDisplay ( Display* )
@@ -283,6 +289,7 @@
cdef int WidthMMOfScreen ( Screen* )
cdef int HeightMMOfScreen ( Screen* )
cdef int PlanesOfScreen ( Screen* )
+ cdef int glXQueryVersion ( Display*, int *maj, int *min )
cdef XVisualInfo *glXChooseVisual ( Display*, int, int* )
cdef GLXContext glXCreateContext ( Display*, XVisualInfo*,
GLXContext, Bool )
@@ -290,6 +297,15 @@
cdef Bool glXMakeCurrent ( Display*, Window, GLXContext )
cdef void glXSwapBuffers ( Display*, Window )
cdef Colormap XCreateColormap ( Display*, Window, Visual*, int )
+ cdef Pixmap XCreatePixmap ( Display*, Window, unsigned int,
+ unsigned int, unsigned int )
+ cdef Pixmap XCreateBitmapFromData ( Display*, Window, char*,
+ unsigned int, unsigned int )
+ cdef Pixmap XCreatePixmapFromBitmapData(
+ Display*, Window, char*,
+ unsigned int, unsigned int,
+ unsigned long, unsigned long,
+ unsigned int)
cdef Window XCreateWindow ( Display*, Window, int, int,
unsigned int, unsigned int,
unsigned int, int,
@@ -297,6 +313,9 @@
unsigned long,
XSetWindowAttributes* )
cdef int XDestroyWindow ( Display*, Window )
+ cdef int XFreePixmap ( Display*, Pixmap )
+ cdef int XGetIconSizes ( Display*, Window,
+ XIconSize**, int* )
cdef Atom XInternAtom ( Display*, char*, Bool )
cdef int XSetWMProtocols ( Display*, Window, Atom*, int )
cdef int XSetStandardProperties ( Display*, Window, char*, char*,
Modified: trunk/pysoy/src/_core-x11/soy._core.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/soy._core.pxd 2007-07-06 00:37:34 UTC (rev
374)
+++ trunk/pysoy/src/_core-x11/soy._core.pxd 2007-07-06 05:04:27 UTC (rev
375)
@@ -25,6 +25,7 @@
cimport stdio
cimport soy._internals
cimport soy.colors
+cimport soy.textures
cdef class Scene :
cdef ode.dWorldID _worldID
@@ -52,6 +53,8 @@
cdef Screen _screen
cdef glx.Window _windowID
cdef object _title
+ cdef soy.textures.Texture _icon
+ cdef glx.Pixmap _iconID
cdef soy.colors.Color _background
cdef int _width
cdef int _height
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn