Improved support for multiple OS platforms
[clg] / gdk / gdk.lisp
index 5e18e2e..48b2237 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: gdk.lisp,v 1.35 2007-04-06 14:25:20 espen Exp $
+;; $Id: gdk.lisp,v 1.38 2007-06-01 09:17:17 espen Exp $
 
 
 (in-package "GDK")
   (location pointer))
 
 (defmethod allocate-foreign ((region region) &key rectangle polygon fill-rule)
-  (declare (ignore initargs))
   (cond
    ((and rectangle polygon) 
     (error "Only one of the keyword arguments :RECTANGLE and :POLYGON can be specified"))
   (etypecase region 
     (region region)
     ((or rectangle vector) 
-     (make-instance 'region :rectangle (ensure-rectangle region)))))
+     (make-instance 'region :rectangle (ensure-rectangle region)))
+    (list
+     (make-instance 'region :polygon region))))
 
 (defbinding region-get-clipbox (region &optional (rectangle (make-instance 'rectangle))) nil
   (region region)
   "Obtains the area covered by the region as a list of rectangles."
   (multiple-value-bind (location length) (%region-get-rectangles region)
     (prog1
-       (map-c-vector 'list #'identity location 'point length :get)
+       (map-c-vector 'list #'identity location '(inlined rectangle) length :get)
       (deallocate-memory location))))
 
 (defbinding region-empty-p () boolean
   (dy int))
 
 (defbinding region-intersect (source1 source2) nil
-  (source1 region)
+  ((ensure-region source1) region :in/return)
   ((ensure-region source2) region))
 
 (defbinding region-union (source1 source2) nil
-  (source1 region)
+  ((ensure-region source1) region :in/return)
   ((ensure-region source2) region))
 
 (defbinding region-subtract (source1 source2) nil
-  (source1 region)
+  ((ensure-region source1) region :in/return)
   ((ensure-region source2) region))
 
 (defbinding region-xor (source1 source2) nil
-  (source1 region)
+  ((ensure-region source1) region :in/return)
   ((ensure-region source2) region))
 
 
   (dx int)
   (dy int))
 
+#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
+(defbinding window-move-region (window region dx dy) nil
+  (window window)
+  ((ensure-region region) region)
+  (dx int)
+  (dy int))
+
 (defbinding window-reparent () nil
   (window window)
   (new-parent window)
 
 (defun window-shape-combine (window shape offset-x offset-y)
   (etypecase shape
-    (nil (%window-shape-combine-region window nil 0 0)
+    (null (%window-shape-combine-region window nil 0 0))
     (region (%window-shape-combine-region window shape offset-x offset-y))
-    (bitmask (window-shape-combine-mask window shape offset-x offset-y)))))
+    (bitmap (window-shape-combine-mask window shape offset-x offset-y))))
 
 (defbinding window-set-child-shapes () nil
   (window window))
   
   (defun window-input-shape-combine (window shape x y)
     (etypecase shape
-      (nil (%window-input-shape-combine-region window nil 0 0)
-          (region (%window-input-shape-combine-region window shape x y))
-          (bitmask (%window-input-shape-combine-mask window shape x y)))))
+      (null (%window-input-shape-combine-region window nil 0 0))
+      (region (%window-input-shape-combine-region window shape x y))
+      (bitmap (%window-input-shape-combine-mask window shape x y))))
 
   (defbinding window-set-child-input-shapes () nil
     (window window))
 ;;     (cr cairo:context)
 ;;     (region region))
 
-  (defbinding (cairo-xlib-surface-get-window 
-              "clg_gdk_cairo_xlib_surface_get_window") () window
-  (surface cairo:xlib-surface))
+  (defbinding (cairo-surface-get-window "clg_gdk_cairo_surface_get_window") () window
+    (surface cairo:surface))
 )