[gtk-cffi-cvs] CVS gtk-cffi/gdk

CVS User rklochkov rklochkov at common-lisp.net
Sun Aug 28 10:31:30 UTC 2011


Update of /project/gtk-cffi/cvsroot/gtk-cffi/gdk
In directory tiger.common-lisp.net:/tmp/cvs-serv22502/gdk

Modified Files:
	gdk-cffi.asd keys.lisp package.lisp rectangle.lisp 
Log Message:
Refactored GBoxed structs. Now they can be garbage collected


--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/gdk-cffi.asd	2011/08/26 17:16:14	1.2
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/gdk-cffi.asd	2011/08/28 10:31:30	1.3
@@ -29,4 +29,5 @@
    (:file gc :depends-on (loadlib generics))
    (:file visual :depends-on (loadlib generics))
    (:file image :depends-on (visual))
+   (:file atom :depends-on (loadlib))   
    (:file pixbuf :depends-on (image gc))))
--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/keys.lisp	2011/04/25 19:16:07	1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/keys.lisp	2011/08/28 10:31:30	1.2
@@ -1,1714 +1,1733 @@
 (in-package :gdk-cffi)
 
-(defun key (val)
-  (foreign-enum-value 'keys val))
+;(defun key (val)
+;  (foreign-enum-value 'keys val))
 
-(defcenum keys
-  (:VoidSymbol #xffffff)
-  (:BackSpace #xff08)
-  (:Tab #xff09)
-  (:Linefeed #xff0a)
-  (:Clear #xff0b)
-  (:Return #xff0d)
-  (:Pause #xff13)
-  (:Scroll-Lock #xff14)
-  (:Sys-Req #xff15)
-  (:Escape #xff1b)
-  (:Delete #xffff)
-  (:Multi-key #xff20)
-  (:Codeinput #xff37)
-  (:SingleCandidate #xff3c)
-  (:MultipleCandidate #xff3d)
-  (:PreviousCandidate #xff3e)
-  (:Kanji #xff21)
-  (:Muhenkan #xff22)
-  (:Henkan-Mode #xff23)
-  (:Henkan #xff23)
-  (:Romaji #xff24)
-  (:Hiragana #xff25)
-  (:Katakana #xff26)
-  (:Hiragana-Katakana #xff27)
-  (:Zenkaku #xff28)
-  (:Hankaku #xff29)
-  (:Zenkaku-Hankaku #xff2a)
-  (:Touroku #xff2b)
-  (:Massyo #xff2c)
-  (:Kana-Lock #xff2d)
-  (:Kana-Shift #xff2e)
-  (:Eisu-Shift #xff2f)
-  (:Eisu-toggle #xff30)
-  (:Kanji-Bangou #xff37)
-  (:Zen-Koho #xff3d)
-  (:Mae-Koho #xff3e)
-  (:Home #xff50)
-  (:Left #xff51)
-  (:Up #xff52)
-  (:Right #xff53)
-  (:Down #xff54)
-  (:Prior #xff55)
-  (:Page-Up #xff55)
-  (:Next #xff56)
-  (:Page-Down #xff56)
-  (:End #xff57)
-  (:Begin #xff58)
-  (:Select #xff60)
-  (:Print #xff61)
-  (:Execute #xff62)
-  (:Insert #xff63)
-  (:Undo #xff65)
-  (:Redo #xff66)
-  (:Menu #xff67)
-  (:Find #xff68)
-  (:Cancel #xff69)
-  (:Help #xff6a)
-  (:Break #xff6b)
-  (:Mode-switch #xff7e)
-  (:script-switch #xff7e)
-  (:Num-Lock #xff7f)
-  (:KP-Space #xff80)
-  (:KP-Tab #xff89)
-  (:KP-Enter #xff8d)
-  (:KP-F1 #xff91)
-  (:KP-F2 #xff92)
-  (:KP-F3 #xff93)
-  (:KP-F4 #xff94)
-  (:KP-Home #xff95)
-  (:KP-Left #xff96)
-  (:KP-Up #xff97)
-  (:KP-Right #xff98)
-  (:KP-Down #xff99)
-  (:KP-Prior #xff9a)
-  (:KP-Page-Up #xff9a)
-  (:KP-Next #xff9b)
-  (:KP-Page-Down #xff9b)
-  (:KP-End #xff9c)
-  (:KP-Begin #xff9d)
-  (:KP-Insert #xff9e)
-  (:KP-Delete #xff9f)
-  (:KP-Equal #xffbd)
-  (:KP-Multiply #xffaa)
-  (:KP-Add #xffab)
-  (:KP-Separator #xffac)
-  (:KP-Subtract #xffad)
-  (:KP-Decimal #xffae)
-  (:KP-Divide #xffaf)
-  (:KP-0 #xffb0)
-  (:KP-1 #xffb1)
-  (:KP-2 #xffb2)
-  (:KP-3 #xffb3)
-  (:KP-4 #xffb4)
-  (:KP-5 #xffb5)
-  (:KP-6 #xffb6)
-  (:KP-7 #xffb7)
-  (:KP-8 #xffb8)
-  (:KP-9 #xffb9)
-  (:F1 #xffbe)
-  (:F2 #xffbf)
-  (:F3 #xffc0)
-  (:F4 #xffc1)
-  (:F5 #xffc2)
-  (:F6 #xffc3)
-  (:F7 #xffc4)
-  (:F8 #xffc5)
-  (:F9 #xffc6)
-  (:F10 #xffc7)
-  (:F11 #xffc8)
-  (:L1 #xffc8)
-  (:F12 #xffc9)
-  (:L2 #xffc9)
-  (:F13 #xffca)
-  (:L3 #xffca)
-  (:F14 #xffcb)
-  (:L4 #xffcb)
-  (:F15 #xffcc)
-  (:L5 #xffcc)
-  (:F16 #xffcd)
-  (:L6 #xffcd)
-  (:F17 #xffce)
-  (:L7 #xffce)
-  (:F18 #xffcf)
-  (:L8 #xffcf)
-  (:F19 #xffd0)
-  (:L9 #xffd0)
-  (:F20 #xffd1)
-  (:L10 #xffd1)
-  (:F21 #xffd2)
-  (:R1 #xffd2)
-  (:F22 #xffd3)
-  (:R2 #xffd3)
-  (:F23 #xffd4)
-  (:R3 #xffd4)
-  (:F24 #xffd5)
-  (:R4 #xffd5)
-  (:F25 #xffd6)
-  (:R5 #xffd6)
-  (:F26 #xffd7)
-  (:R6 #xffd7)
-  (:F27 #xffd8)
-  (:R7 #xffd8)
-  (:F28 #xffd9)
-  (:R8 #xffd9)
-  (:F29 #xffda)
-  (:R9 #xffda)
-  (:F30 #xffdb)
-  (:R10 #xffdb)
-  (:F31 #xffdc)
-  (:R11 #xffdc)
-  (:F32 #xffdd)
-  (:R12 #xffdd)
-  (:F33 #xffde)
-  (:R13 #xffde)
-  (:F34 #xffdf)
-  (:R14 #xffdf)
-  (:F35 #xffe0)
-  (:R15 #xffe0)
-  (:Shift-L #xffe1)
-  (:Shift-R #xffe2)
-  (:Control-L #xffe3)
-  (:Control-R #xffe4)
-  (:Caps-Lock #xffe5)
-  (:Shift-Lock #xffe6)
-  (:Meta-L #xffe7)
-  (:Meta-R #xffe8)
-  (:Alt-L #xffe9)
-  (:Alt-R #xffea)
-  (:Super-L #xffeb)
-  (:Super-R #xffec)
-  (:Hyper-L #xffed)
-  (:Hyper-R #xffee)
-  (:ISO-Lock #xfe01)
-  (:ISO-Level2-Latch #xfe02)
-  (:ISO-Level3-Shift #xfe03)
-  (:ISO-Level3-Latch #xfe04)
-  (:ISO-Level3-Lock #xfe05)
-  (:ISO-Group-Shift #xff7e)
-  (:ISO-Group-Latch #xfe06)
-  (:ISO-Group-Lock #xfe07)
-  (:ISO-Next-Group #xfe08)
-  (:ISO-Next-Group-Lock #xfe09)
-  (:ISO-Prev-Group #xfe0a)
-  (:ISO-Prev-Group-Lock #xfe0b)
-  (:ISO-First-Group #xfe0c)
-  (:ISO-First-Group-Lock #xfe0d)
-  (:ISO-Last-Group #xfe0e)
-  (:ISO-Last-Group-Lock #xfe0f)
-  (:ISO-Left-Tab #xfe20)
-  (:ISO-Move-Line-Up #xfe21)
-  (:ISO-Move-Line-Down #xfe22)
-  (:ISO-Partial-Line-Up #xfe23)
-  (:ISO-Partial-Line-Down #xfe24)
-  (:ISO-Partial-Space-Left #xfe25)
-  (:ISO-Partial-Space-Right #xfe26)
-  (:ISO-Set-Margin-Left #xfe27)
-  (:ISO-Set-Margin-Right #xfe28)
-  (:ISO-Release-Margin-Left #xfe29)
-  (:ISO-Release-Margin-Right #xfe2a)
-  (:ISO-Release-Both-Margins #xfe2b)
-  (:ISO-Fast-Cursor-Left #xfe2c)
-  (:ISO-Fast-Cursor-Right #xfe2d)
-  (:ISO-Fast-Cursor-Up #xfe2e)
-  (:ISO-Fast-Cursor-Down #xfe2f)
-  (:ISO-Continuous-Underline #xfe30)
-  (:ISO-Discontinuous-Underline #xfe31)
-  (:ISO-Emphasize #xfe32)
-  (:ISO-Center-Object #xfe33)
-  (:ISO-Enter #xfe34)
-  (:dead-grave #xfe50)
-  (:dead-acute #xfe51)
-  (:dead-circumflex #xfe52)
-  (:dead-tilde #xfe53)
-  (:dead-macron #xfe54)
-  (:dead-breve #xfe55)
-  (:dead-abovedot #xfe56)
-  (:dead-diaeresis #xfe57)
-  (:dead-abovering #xfe58)
-  (:dead-doubleacute #xfe59)
-  (:dead-caron #xfe5a)
-  (:dead-cedilla #xfe5b)
-  (:dead-ogonek #xfe5c)
-  (:dead-iota #xfe5d)
-  (:dead-voiced-sound #xfe5e)
-  (:dead-semivoiced-sound #xfe5f)
-  (:dead-belowdot #xfe60)
-  (:dead-hook #xfe61)
-  (:dead-horn #xfe62)
-  (:First-Virtual-Screen #xfed0)
-  (:Prev-Virtual-Screen #xfed1)
-  (:Next-Virtual-Screen #xfed2)
-  (:Last-Virtual-Screen #xfed4)
-  (:Terminate-Server #xfed5)
-  (:AccessX-Enable #xfe70)
-  (:AccessX-Feedback-Enable #xfe71)
-  (:RepeatKeys-Enable #xfe72)
-  (:SlowKeys-Enable #xfe73)
-  (:BounceKeys-Enable #xfe74)
-  (:StickyKeys-Enable #xfe75)
-  (:MouseKeys-Enable #xfe76)
-  (:MouseKeys-Accel-Enable #xfe77)
-  (:Overlay1-Enable #xfe78)
-  (:Overlay2-Enable #xfe79)
-  (:AudibleBell-Enable #xfe7a)
-  (:Pointer-Left #xfee0)
-  (:Pointer-Right #xfee1)
-  (:Pointer-Up #xfee2)
-  (:Pointer-Down #xfee3)
-  (:Pointer-UpLeft #xfee4)
-  (:Pointer-UpRight #xfee5)
-  (:Pointer-DownLeft #xfee6)
-  (:Pointer-DownRight #xfee7)
-  (:Pointer-Button-Dflt #xfee8)
-  (:Pointer-Button1 #xfee9)
-  (:Pointer-Button2 #xfeea)
-  (:Pointer-Button3 #xfeeb)
-  (:Pointer-Button4 #xfeec)
-  (:Pointer-Button5 #xfeed)
-  (:Pointer-DblClick-Dflt #xfeee)
-  (:Pointer-DblClick1 #xfeef)
-  (:Pointer-DblClick2 #xfef0)
-  (:Pointer-DblClick3 #xfef1)
-  (:Pointer-DblClick4 #xfef2)
-  (:Pointer-DblClick5 #xfef3)
-  (:Pointer-Drag-Dflt #xfef4)
-  (:Pointer-Drag1 #xfef5)
-  (:Pointer-Drag2 #xfef6)
-  (:Pointer-Drag3 #xfef7)
-  (:Pointer-Drag4 #xfef8)
-  (:Pointer-Drag5 #xfefd)
-  (:Pointer-EnableKeys #xfef9)
-  (:Pointer-Accelerate #xfefa)
-  (:Pointer-DfltBtnNext #xfefb)
-  (:Pointer-DfltBtnPrev #xfefc)
-  (:3270-Duplicate #xfd01)
-  (:3270-FieldMark #xfd02)
-  (:3270-Right2 #xfd03)
-  (:3270-Left2 #xfd04)
-  (:3270-BackTab #xfd05)
-  (:3270-EraseEOF #xfd06)
-  (:3270-EraseInput #xfd07)
-  (:3270-Reset #xfd08)
-  (:3270-Quit #xfd09)
-  (:3270-PA1 #xfd0a)
-  (:3270-PA2 #xfd0b)
-  (:3270-PA3 #xfd0c)
-  (:3270-Test #xfd0d)
-  (:3270-Attn #xfd0e)
-  (:3270-CursorBlink #xfd0f)
-  (:3270-AltCursor #xfd10)
-  (:3270-KeyClick #xfd11)
-  (:3270-Jump #xfd12)
-  (:3270-Ident #xfd13)
-  (:3270-Rule #xfd14)
-  (:3270-Copy #xfd15)
-  (:3270-Play #xfd16)
-  (:3270-Setup #xfd17)
-  (:3270-Record #xfd18)
-  (:3270-ChangeScreen #xfd19)
-  (:3270-DeleteWord #xfd1a)
-  (:3270-ExSelect #xfd1b)
-  (:3270-CursorSelect #xfd1c)
-  (:3270-PrintScreen #xfd1d)
-  (:3270-Enter #xfd1e)
-  (:space #x020)
-  (:exclam #x021)
-  (:quotedbl #x022)
-  (:numbersign #x023)
-  (:dollar #x024)
-  (:percent #x025)
-  (:ampersand #x026)
-  (:apostrophe #x027)
-  (:quoteright #x027)
-  (:parenleft #x028)
-  (:parenright #x029)
-  (:asterisk #x02a)
-  (:plus #x02b)
-  (:comma #x02c)
-  (:minus #x02d)
-  (:period #x02e)
-  (:slash #x02f)
-  (:0 #x030)
-  (:1 #x031)
-  (:2 #x032)
-  (:3 #x033)
-  (:4 #x034)
-  (:5 #x035)
-  (:6 #x036)
-  (:7 #x037)
-  (:8 #x038)
-  (:9 #x039)
-  (:colon #x03a)
-  (:semicolon #x03b)
-  (:less #x03c)
-  (:equal #x03d)
-  (:greater #x03e)
-  (:question #x03f)
-  (:at #x040)
-  (:caps-A #x041)
-  (:caps-B #x042)
-  (:caps-C #x043)
-  (:caps-D #x044)
-  (:caps-E #x045)
-  (:caps-F #x046)
-  (:caps-G #x047)
-  (:caps-H #x048)
-  (:caps-I #x049)
-  (:caps-J #x04a)
-  (:caps-K #x04b)
-  (:caps-L #x04c)
-  (:caps-M #x04d)
-  (:caps-N #x04e)
-  (:caps-O #x04f)
-  (:caps-P #x050)
-  (:caps-Q #x051)
-  (:caps-R #x052)
-  (:caps-S #x053)
-  (:caps-T #x054)
-  (:caps-U #x055)
-  (:caps-V #x056)
-  (:caps-W #x057)
-  (:caps-X #x058)
-  (:caps-Y #x059)
-  (:caps-Z #x05a)
-  (:bracketleft #x05b)
-  (:backslash #x05c)
-  (:bracketright #x05d)
-  (:asciicircum #x05e)
-  (:underscore #x05f)
-  (:grave #x060)
-  (:quoteleft #x060)
-  (:a #x061)
-  (:b #x062)
-  (:c #x063)
-  (:d #x064)
-  (:e #x065)
-  (:f #x066)
-  (:g #x067)
-  (:h #x068)
-  (:i #x069)
-  (:j #x06a)
-  (:k #x06b)
-  (:l #x06c)
-  (:m #x06d)
-  (:n #x06e)
-  (:o #x06f)
-  (:p #x070)
-  (:q #x071)
-  (:r #x072)

[3047 lines skipped]
--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/package.lisp	2011/08/26 17:16:14	1.2
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/package.lisp	2011/08/28 10:31:30	1.3
@@ -8,7 +8,7 @@
 (in-package #:cl-user)
 
 (defpackage #:gdk-cffi
-  (:use #:common-lisp
+  (:use #:common-lisp #:alexandria
         #:cffi #:cffi-object #:g-lib-cffi #:g-object-cffi)
   (:import-from #:cl-cairo2 #:x #:y #:width #:height #:cairo_rectangle_t)
   (:export
@@ -48,6 +48,8 @@
    #:with-threads
 
    #:key
+
+   #:gatom
    ))
 
 (in-package #:gdk-cffi)
--- /project/gtk-cffi/cvsroot/gtk-cffi/gdk/rectangle.lisp	2011/08/26 17:16:14	1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gdk/rectangle.lisp	2011/08/28 10:31:30	1.2
@@ -3,32 +3,27 @@
 (defclass rectangle (object)
   ())
 
-(defmacro with-rectangle (rect &body body)
-  `(with-object (,rect) (make-instance 'rectangle) , at body))
-
-(defmethod gconstructor ((rectangle rectangle) &key &allow-other-keys)
+(defmethod new-struct ((class (eql 'rectangle)))
   (foreign-alloc 'cairo_rectangle_t))
 
-(defmethod free :before ((rectangle rectangle))
-  (foreign-free (pointer rectangle)))
-
-(defcstruct-accessors (rectangle . cairo_rectangle_t)
-    x y height width)
+(defcstruct-accessors (rectangle . cairo_rectangle_t))
 
 (defcfun  gdk-rectangle-intersect :boolean
-  (src1 pobject) (src2 pobject) (dest pobject))
+  (src1 (struct rectangle)) (src2 (struct rectangle)) 
+  (dest (struct rectangle :out t)))
 
 (defmethod intersect ((rect1 rectangle) (rect2 rectangle))
-   (let ((dest (make-instance 'rectangle)))
-     (if (gdk-rectangle-intersect rect1 rect2 dest)
-         dest
-         (progn (free dest) nil))))
+  "Returns new GdkRectangle: intersection of rect1 and rect2"
+  (let ((dest (make-instance 'rectangle)))
+    (when (gdk-rectangle-intersect rect1 rect2 dest)
+      dest)))
 
 (defcfun gdk-rectangle-union :void
-  (src1 pobject) (src2 pobject) (dest pobject))
+  (src1 (struct rectangle)) (src2 (struct rectangle)) 
+  (dest (struct rectangle :out t)))
 
 (defmethod rectangle-union ((rect1 rectangle) (rect2 rectangle))
-   (let ((dest (make-instance 'rectangle)))
-     (gdk-rectangle-union rect1 rect2 dest)))
+  (let ((dest (make-instance 'rectangle)))
+    (gdk-rectangle-union rect1 rect2 dest)))
 
 (defcfun gdk-rectangle-get-type g-type)





More information about the gtk-cffi-cvs mailing list