FFI: FFI-Unix-mt.6.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI: FFI-Unix-mt.6.mcz

commits-2
Marcel Taeumel uploaded a new version of FFI-Unix to project FFI:
http://source.squeak.org/FFI/FFI-Unix-mt.6.mcz

==================== Summary ====================

Name: FFI-Unix-mt.6
Author: mt
Time: 27 May 2021, 9:39:36.243843 am
UUID: fcaa7554-f959-dc45-a8d6-36edaec594f9
Ancestors: FFI-Unix-mt.5

Empty commit. Package superseded by "FFI-Libraries"

=============== Diff against FFI-Unix-mt.5 ===============

Item was removed:
- SystemOrganization addCategory: #'FFI-Unix-Examples'!

Item was removed:
- ExternalStructure subclass: #X11Display
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'FFI-Unix-Examples'!

Item was removed:
- ----- Method: X11Display class>>XOpenDisplay: (in category 'instance creation') -----
- XOpenDisplay: displayName
- "X11Display XOpenDisplay: nil"
- <cdecl: X11Display* 'XOpenDisplay' (char*) module:'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display class>>coloredEllipses (in category 'examples') -----
- coloredEllipses
- "X11Display coloredEllipses"
- | display window gc colors rnd w h pt1 pt2 r |
- display := X11Display XOpenDisplay: nil.
- window := display ourWindow.
- gc := X11GC on: window.
- colors := Color colorNames collect:[:n| (Color perform: n) pixelWordForDepth: 32].
- rnd := Random new.
- w := Display width.
- h := Display height.
- [Sensor anyButtonPressed] whileFalse:[
- pt1 := (rnd next * w) asInteger @ (rnd next * h) asInteger.
- pt2 := (rnd next * w) asInteger @ (rnd next * h) asInteger.
- r := Rectangle encompassing: (Array with: pt1 with: pt2).
- gc foreground: colors atRandom.
- gc fillOval: r.
- gc foreground: 0.
- gc drawOval: r.
- display sync.
- ].
- gc free.
- display closeDisplay.
- Display forceToScreen.!

Item was removed:
- ----- Method: X11Display class>>coloredRectangles (in category 'examples') -----
- coloredRectangles
- "X11Display coloredRectangles"
- | display window gc colors rnd w h pt1 pt2 r nPixels time n |
- display := X11Display XOpenDisplay: nil.
- window := display ourWindow.
- gc := X11GC on: window.
- colors := Color colorNames collect:[:cn| (Color perform: cn) pixelWordForDepth: 32].
- rnd := Random new.
- w := Display width.
- h := Display height.
- n := 0.
- nPixels := 0.
- time := Time millisecondClockValue.
- [Sensor anyButtonPressed] whileFalse:[
- pt1 := (rnd next * w) asInteger @ (rnd next * h) asInteger.
- pt2 := (rnd next * w) asInteger @ (rnd next * h) asInteger.
- r := Rectangle encompassing: (Array with: pt1 with: pt2).
- gc foreground: colors atRandom.
- gc fillRectangle: r.
- gc foreground: 0.
- gc drawRectangle: r.
- display sync.
- n := n + 1.
- nPixels := nPixels + ((r right - r left) * (r bottom - r top)).
- (n \\ 100) = 0 ifTrue:[
- 'Pixel fillRate: ', (nPixels * 1000 // (Time millisecondClockValue - time))
- asStringWithCommas displayAt: 0@0].
- ].
- gc free.
- display closeDisplay.
- Display forceToScreen.!

Item was removed:
- ----- Method: X11Display class>>fields (in category 'field definition') -----
- fields
- "X11Display defineFields"
- "Note: The structure of Display is internal and only pointers to X11Display are used"
- ^#()!

Item was removed:
- ----- Method: X11Display class>>new (in category 'instance creation') -----
- new
- ^ self on: nil!

Item was removed:
- ----- Method: X11Display class>>on: (in category 'instance creation') -----
- on: aStringOrNil
- ^ self XOpenDisplay: aStringOrNil!

Item was removed:
- ----- Method: X11Display class>>x11Draw (in category 'examples') -----
- x11Draw
- "X11Display x11Draw"
- | display window gc nextPt lastPt ptr |
- display := X11Display XOpenDisplay: nil.
- window = display ourWindow.
- gc := X11GC on: window.
- gc foreground: 0.
- lastPt := nil.
- [ptr := display queryPointer: window. "{root. child. root pos. win pos. mask}"
- ptr last anyMask: 256] whileFalse:[
- nextPt := ptr fourth.
- nextPt = lastPt ifFalse:[
- lastPt ifNotNil: [
- gc drawLineFrom: lastPt to: nextPt.
- display sync].
- lastPt := nextPt].
- ].
- gc free.
- display closeDisplay.
- Display forceToScreen.!

Item was removed:
- ----- Method: X11Display>>None (in category 'xlib calls') -----
- None
- ^ 0!

Item was removed:
- ----- Method: X11Display>>XCloseDisplay: (in category 'xlib calls') -----
- XCloseDisplay: aDisplay
- <cdecl: void 'XCloseDisplay' (X11Display*) module:'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XDisplayString: (in category 'xlib calls') -----
- XDisplayString: aDisplay
- <cdecl: char* 'XDisplayString' (X11Display*) module:'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XFlush: (in category 'xlib calls') -----
- XFlush: xDisplay
- <cdecl: void 'XFlush' (X11Display*) module:'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XGetInputFocus:with:with: (in category 'xlib calls') -----
- XGetInputFocus: display with: focus with: revert
- <cdecl: void 'XGetInputFocus' (X11Display* ulong* long*) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XQueryPointer:window:returnRoot:child:rootX:rootY:winX:winY:mask: (in category 'xlib calls') -----
- XQueryPointer: display window: w returnRoot: root child: child rootX: rootX rootY: rootY winX: winX winY: winY mask: mask
- <cdecl: bool 'XQueryPointer' (X11Display* ulong ulong* ulong* long* long* long* long* long*) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XSync: (in category 'xlib calls') -----
- XSync: xDisplay
- <cdecl: void 'XSync' (X11Display*) module:'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>XWarpPointer:sourceWindow:destWindow:sourceX:sourceY:sourceWidth:sourceHeight:destX:destY: (in category 'xlib calls') -----
- XWarpPointer: display sourceWindow: srcWindowID destWindow: destWindowID sourceX: srcX sourceY: srcY sourceWidth: srcWidth sourceHeight: srcHeight destX: destX destY: destY
- <cdecl: bool 'XWarpPointer' (X11Display* ulong ulong long long ulong ulong long long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11Display>>closeDisplay (in category 'initialize-release') -----
- closeDisplay
- handle == nil ifFalse:[
- self XCloseDisplay: self.
- handle := nil].!

Item was removed:
- ----- Method: X11Display>>displayString (in category 'accessing') -----
- displayString
- ^self XDisplayString: self!

Item was removed:
- ----- Method: X11Display>>flush (in category 'initialize-release') -----
- flush
- self XFlush: self!

Item was removed:
- ----- Method: X11Display>>getInputFocus (in category 'accessing') -----
- getInputFocus
- | focus revert |
- focus := WordArray new: 1.
- revert := WordArray new: 1.
- self XGetInputFocus: self with: focus with: revert.
- ^ X11Window new xid: focus first!

Item was removed:
- ----- Method: X11Display>>ourWindow (in category 'accessing') -----
- ourWindow
- "Guess the window to draw on."
- | window ptr child |
- window := self getInputFocus.
- ptr := self queryPointer: window. "{root. child. root pos. win pos. mask}"
- child := ptr second.
- child xid = 0 ifTrue: [^ window].
- ^ child!

Item was removed:
- ----- Method: X11Display>>queryPointer: (in category 'accessing') -----
- queryPointer: aX11Window
- | root child rootX rootY winX winY mask |
- root := WordArray new: 1.
- child := WordArray new: 1.
- rootX := WordArray new: 1.
- rootY := WordArray new: 1.
- winX := WordArray new: 1.
- winY := WordArray new: 1.
- mask := WordArray new: 1.
- self XQueryPointer: self window: aX11Window xid returnRoot: root child: child
- rootX: rootX rootY: rootY winX: winX winY: winY mask: mask.
- ^{
- X11Window new xid: root first.
- X11Window new xid: child first.
- rootX first @ rootY first.
- winX first @ winY first.
- mask first}!

Item was removed:
- ----- Method: X11Display>>sync (in category 'initialize-release') -----
- sync
- ^self XSync: self!

Item was removed:
- ----- Method: X11Display>>warpPointerBy: (in category 'accessing') -----
- warpPointerBy: aPoint
- "Moves the mouse pointer from its current location to its current location + aPoint. Generates a mouse move event if the squeak window is active"
-
- ^ self XWarpPointer: self
- sourceWindow: self None
- destWindow: self None
- sourceX: 0 sourceY: 0 sourceWidth: 0 sourceHeight: 0
- destX: aPoint x destY: aPoint y!

Item was removed:
- ----- Method: X11Display>>warpPointerFrom:in:To:in: (in category 'accessing') -----
- warpPointerFrom: aRectangle in: sourceWindow To: aPoint in: destWindow
- "Moves the mouse pointer to aPoint relative to the top-left corner of a window"
-
- ^ self XWarpPointer: self
- sourceWindow: sourceWindow xid
- destWindow: destWindow xid
- sourceX: aRectangle left sourceY: aRectangle top
- sourceWidth: aRectangle width sourceHeight: aRectangle height
- destX: aPoint x destY: aPoint y!

Item was removed:
- ----- Method: X11Display>>warpPointerTo:in: (in category 'accessing') -----
- warpPointerTo: aPoint in: aWindow
- "Moves the mouse pointer to aPoint relative to the top-left corner of a window"
-
- ^ self XWarpPointer: self
- sourceWindow: self None
- destWindow: aWindow xid
- sourceX: 0 sourceY: 0 sourceWidth: 0 sourceHeight: 0
- destX: aPoint x destY: aPoint y!

Item was removed:
- X11ID subclass: #X11Drawable
- instanceVariableNames: 'display xid'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'FFI-Unix-Examples'!

Item was removed:
- ----- Method: X11Drawable class>>display: (in category 'instance creation') -----
- display: aX11Display
- ^ self new display: aX11Display!

Item was removed:
- ----- Method: X11Drawable>>display (in category 'accessing') -----
- display
- ^display!

Item was removed:
- ----- Method: X11Drawable>>display: (in category 'accessing') -----
- display: aDisplay
- display := aDisplay!

Item was removed:
- ----- Method: X11Drawable>>printOn: (in category 'printing') -----
- printOn: aStream
- aStream
- nextPutAll: self class name;
- nextPut: $(;
- nextPutAll: self xid printStringHex;
- nextPut: $) !

Item was removed:
- ----- Method: X11Drawable>>xid (in category 'accessing') -----
- xid
- ^ xid!

Item was removed:
- ----- Method: X11Drawable>>xid: (in category 'accessing') -----
- xid: anUnsignedInteger
- xid := anUnsignedInteger!

Item was removed:
- ExternalStructure subclass: #X11GC
- instanceVariableNames: 'drawable'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'FFI-Unix-Examples'!

Item was removed:
- ----- Method: X11GC class>>XCreateGC:with:with:with: (in category 'xlib calls') -----
- XCreateGC: xDisplay with: aDrawable with: valueMask with: values
- <cdecl: X11GC 'XCreateGC' (X11Display* X11Drawable ulong long*) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC class>>fields (in category 'field definition') -----
- fields
- "X11GC defineFields"
- ^#( nil 'void*' )!

Item was removed:
- ----- Method: X11GC class>>on: (in category 'instance creation') -----
- on: aDrawable
- | xgc |
- xgc := self XCreateGC: aDrawable display with: aDrawable with: 0 with: nil.
- xgc drawable: aDrawable.
- ^xgc!

Item was removed:
- ----- Method: X11GC>>XDrawArc:with:with:with:with:with:with:with:with: (in category 'xlib calls') -----
- XDrawArc: xDisplay with: xDrawable with: xGC with: x with: y with: w with: h with: a1 with: a2
- <cdecl: void 'XDrawArc' (X11Display* X11Drawable X11GC long long ulong ulong long long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XDrawLine:with:with:with:with:with:with: (in category 'xlib calls') -----
- XDrawLine: xDisplay with: aDrawable with: xGC with: x0 with: y0 with: x1 with: y1
- <cdecl: long 'XDrawLine' (X11Display* X11Drawable X11GC long long long long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XDrawRectangle:with:with:with:with:with:with: (in category 'xlib calls') -----
- XDrawRectangle: xDisplay with: xDrawable with: xGC with: x with: y with: w with: h
- <cdecl: void 'XDrawRectangle' (X11Display* X11Drawable X11GC long long ulong ulong) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XFillArc:with:with:with:with:with:with:with:with: (in category 'xlib calls') -----
- XFillArc: xDisplay with: xDrawable with: xGC with: x with: y with: w with: h with: a1 with: a2
- <cdecl: void 'XFillArc' (X11Display* X11Drawable X11GC long long ulong ulong long long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XFillRectangle:with:with:with:with:with:with: (in category 'xlib calls') -----
- XFillRectangle: xDisplay with: xDrawable with: xGC with: x with: y with: w with: h
- <cdecl: void 'XFillRectangle' (X11Display* X11Drawable X11GC long long ulong ulong) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XFreeGC:with: (in category 'xlib calls') -----
- XFreeGC: xDisplay with: xGC
- <cdecl: long 'XFreeGC' (X11Display* X11GC) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XSetBackground:with:with: (in category 'xlib calls') -----
- XSetBackground: xDisplay with: xGC with: bg
- <cdecl: void 'XSetBackground' (X11Display* X11GC long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>XSetForeground:with:with: (in category 'xlib calls') -----
- XSetForeground: xDisplay with: xGC with: fg
- <cdecl: void 'XSetForeground' (X11Display* X11GC long) module: 'X11'>
- ^self externalCallFailed!

Item was removed:
- ----- Method: X11GC>>background: (in category 'drawing') -----
- background: pixelValue
- self XSetBackground: self display with: self with: pixelValue!

Item was removed:
- ----- Method: X11GC>>display (in category 'accessing') -----
- display
- ^drawable display!

Item was removed:
- ----- Method: X11GC>>drawLineFrom:to: (in category 'drawing') -----
- drawLineFrom: pt1 to: pt2
- self XDrawLine: self display
- with: drawable
- with: self
- with: pt1 x
- with: pt1 y
- with: pt2 x
- with: pt2 y!

Item was removed:
- ----- Method: X11GC>>drawOval: (in category 'drawing') -----
- drawOval: aRectangle
- self
- XDrawArc: self display
- with: drawable
- with: self
- with: aRectangle left
- with: aRectangle top
- with: aRectangle width
- with: aRectangle height
- with: 0
- with: 64*360!

Item was removed:
- ----- Method: X11GC>>drawRectangle: (in category 'drawing') -----
- drawRectangle: aRectangle
- self
- XDrawRectangle: self display
- with: drawable
- with: self
- with: aRectangle left
- with: aRectangle top
- with: aRectangle width
- with: aRectangle height!

Item was removed:
- ----- Method: X11GC>>drawable (in category 'accessing') -----
- drawable
- ^drawable!

Item was removed:
- ----- Method: X11GC>>drawable: (in category 'accessing') -----
- drawable: aDrawable
- drawable := aDrawable!

Item was removed:
- ----- Method: X11GC>>fillOval: (in category 'drawing') -----
- fillOval: aRectangle
- self
- XFillArc: self display
- with: drawable
- with: self
- with: aRectangle left
- with: aRectangle top
- with: aRectangle width
- with: aRectangle height
- with: 0
- with: 64*360!

Item was removed:
- ----- Method: X11GC>>fillRectangle: (in category 'drawing') -----
- fillRectangle: aRectangle
- self
- XFillRectangle: self display
- with: drawable
- with: self
- with: aRectangle left
- with: aRectangle top
- with: aRectangle width
- with: aRectangle height!

Item was removed:
- ----- Method: X11GC>>foreground: (in category 'drawing') -----
- foreground: pixelValue
- self XSetForeground: self display with: self with: pixelValue
- !

Item was removed:
- ----- Method: X11GC>>free (in category 'initialize-release') -----
- free
- handle == nil ifFalse:[
- self XFreeGC: self display with: self.
- handle := nil.
- ].!

Item was removed:
- ExternalTypeAlias subclass: #X11ID
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'FFI-Unix-Examples'!
-
- !X11ID commentStamp: 'mt 6/4/2020 19:16' prior: 0!
- I am an opaque handle in X11.!

Item was removed:
- ----- Method: X11ID class>>originalTypeName (in category 'field definition') -----
- originalTypeName
- "
- self defineFields
- "
- ^ 'size_t' "or always uint32_t ??"!

Item was removed:
- X11ID subclass: #X11Window
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'FFI-Unix-Examples'!