Author: JonNeal
Date: 2008-01-30 01:24:05 +0000 (Wed, 30 Jan 2008)
New Revision: 806
Modified:
trunk/pysoy/src/_core-x11/Window.pxi
trunk/pysoy/src/_core-x11/glx.pxd
trunk/pysoy/src/textures/Texture.pxi
Log:
More icon fixes, almost there
Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi 2008-01-29 00:29:10 UTC (rev
805)
+++ trunk/pysoy/src/_core-x11/Window.pxi 2008-01-30 01:24:05 UTC (rev
806)
@@ -37,8 +37,7 @@
self._controllers = soy._internals.Children()
self._widgets = soy._internals.Children()
self._title = str(title)
- if icon:
- self.icon = icon
+ self._icon = icon
if background :
self._background = background
else :
@@ -90,8 +89,8 @@
if self._screen._fullScreen != self and self._splash == 0 :
_atom = glx.XInternAtom(_display, "WM_DELETE_WINDOW", True)
glx.XSetWMProtocols(_display, self._windowID, &_atom, 1)
- #if icon :
- # self.icon = icon
+ if self._icon :
+ self.icon = self._icon
self._setProperties()
glx.XMapWindow(_display, self._windowID)
glx.XFlush(_display)
@@ -176,7 +175,7 @@
cdef void _setProperties(self) :
glx.XSetStandardProperties(_display, self._windowID,
- self._title, self._title, self._iconID,
+ self._title, self._title, self.icon,
NULL, 0, NULL)
glx.XFlush(_display)
@@ -248,13 +247,15 @@
Defaults to None.
'''
def __get__(self) :
- if self._iconID > 0 :
- return self._icon
+ if self._icon :
+ return self._iconID
else :
return None
def __set__(self, value) :
cdef glx.Display *_display
cdef glx.XImage *ximage_buffer
+ cdef glx.GC gc_cache
+ cdef glx.XGCValues gcv
_display = glx.DisplayOfScreen(self._screen._screen)
if not isinstance(value, soy.textures.Texture) :
raise TypeError('not a Texture')
@@ -262,18 +263,17 @@
raise TypeError('texture must not be 3 dimensional')
if value.channels != 3 :
raise TypeError('texture must be RGB format')
- self._icon = value
ximage_buffer = glx.XCreateImage(_display,
self._screen._xVisualInfo.visual,
- self._screen._xVisualInfo.depth,
- 2, 0, value.pixels,
+ value.depth, 2, 0, value.pixels,
value.width, value.height, 32, 32)
- self._iconID = glx.XCreatePixmap(_display, self._screen, value.width,
- value.height,
- self._screen._xVisualInfo.depth)
- stdlib.memcpy(&self._iconID, ximage_buffer,
value.width*value.height*value.chan)
- _windows.lock()
- self._setProperties()
- _windows.unlock()
+ self._iconID = glx.XCreatePixmap(_display,self._windowID,
+ value.width,value.height, value.depth)
+ gcv.function = glx.GXcopy
+ gc_cache = glx.XCreateGC(_display, self._iconID, glx.GCFunction, &gcv)
+ glx.XPutImage(_display, self._iconID, gc_cache, ximage_buffer, 0, 0, 0,
0, value.width, value.height)
+ #_windows.lock()
+ #self._setProperties()
+ #_windows.unlock()
property background:
Modified: trunk/pysoy/src/_core-x11/glx.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/glx.pxd 2008-01-29 00:29:10 UTC (rev 805)
+++ trunk/pysoy/src/_core-x11/glx.pxd 2008-01-30 01:24:05 UTC (rev 806)
@@ -594,6 +594,13 @@
+cdef extern from "X11/X.h" :
+ cdef enum :
+ GXcopy
+ GCFunction
+
+
+
cdef extern from "X11/Xlib.h" :
ctypedef char *XPointer
ctypedef void _XDisplay
@@ -614,7 +621,44 @@
unsigned long green_mask
unsigned long blue_mask
XPointer obdata
+
+ #ctypedef struct XExtData :
+ # int number
+ # XPointer private_data
+
+ ctypedef struct XGCValues :
+ int function
+ unsigned long plane_mask
+ unsigned long foreground
+ unsigned long background
+ int line_width
+ int line_style
+ int cap_style
+ int join_style
+ int fill_style
+ int fill_rule
+ int arc_mode
+ Pixmap tile
+ Pixmap stipple
+ int ts_x_origin
+ int ts_y_origin
+ int subwindow_mode
+ Bool graphics_exposures
+ int clip_x_origin
+ int clip_y_origin
+ Pixmap clip_mask
+ int dash_offset
+ char dashes
+
+ #ctypedef struct GC :
+ # GContext gid
+ # XExtData *ext_data
cdef XImage *XCreateImage( Display*, Visual*, unsigned int,
int, int, char*, unsigned int,
- unsigned int, int, int )
+ unsigned int, int, int )
+ cdef int XPutImage( Display*, Drawable, GC, XImage*,
+ int, int, int, int, unsigned int,
+ unsigned int )
+ cdef GC XCreateGC( Display*, Drawable, unsigned long, XGCValues* )
+
Modified: trunk/pysoy/src/textures/Texture.pxi
===================================================================
--- trunk/pysoy/src/textures/Texture.pxi 2008-01-29 00:29:10 UTC (rev
805)
+++ trunk/pysoy/src/textures/Texture.pxi 2008-01-30 01:24:05 UTC (rev
806)
@@ -91,7 +91,6 @@
property depth :
def __get__(self) :
- print self._depth
return self._depth
property size :
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn