Rootless Squeak on OS X?

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

Rootless Squeak on OS X?

Aaron Reichow
John and the list-

I'm wondering if we can get a rootless Squeak VM for Mac OS X  
created.  I'm of the mind we could do it quite quickly and relatively  
easily.

For a photo of what this looks like on Windows, see:
http://www.d.umn.edu/~areichow/squeak/rootless/rootless-squeak.gif

I was digging through some old Squeak files, and I happened upon a  
little gem that I've not seen many people use, which is a shame.  
That little gem of a goodie is Win32 Rootless! Basically, it sets the  
background color of Squeak to something with full transparency and  
then goes full-screen.  It gives the working illusion that all your  
Squeak windows and naked morphs are just floating there, not encased  
in an inner world.  It isn't perfect, and it is far from the power  
you'd get with real OS windows or that project ... But, it still is  
awesome and with a small bit of code does a lot of good toward  
bringing Squeak more into the fold of the host OS environment, but  
without having to make the sacrifices of other more OS-specific  
Smalltalks (e.g. Smalltalk MT).

Like I said, it's basically making Squeak full screen and makings  
Squeak's background transparent and having the OS realize that.  
Which means all Squeak windows are on one layer, just like if you had  
a maximized Squeak window, in relation to other OS windows. You can't  
have a Squeak workspace and class browser with a Firefox window  
sandwiched between, or see various Squeak windows from the Windows  
taskbar That said, it really doesn't make a difference. The biggest  
thing I used rootless Squeak for was for widgets, just like with OS  
X's Dashboard.  I generally did my main development in a regular  
image for various reasons, but I always had Squeak running with a few  
widgets of my own devising- a clock/weather thing, a program  
launcher, a menu of scripts I ran a lot, some things like that.  As a  
Squeaker, I was able to implement this in Squeak 10x quicker than I  
could've writing HTML/JavaScript/CSS to create an OS X or Yahoo! widget.

There has to be a way to do this on OS X!  I'm hoping that John or  
someone else on the list might be willing to tackle it or be willing  
to tell me where to look myself.  I'm quite handy with anything in  
Smalltalk, but when it comes to the workings of the VM or FFI calls  
into C I'm lost.

It seems that this should be pretty easy to implement, if only  
because a) Mac OS X can do transparency too and b) the Windows  
version manages to be implemented in a measly ~5 pages of code,  
looking at the fileout.  When you actually file it in, it's a tiny  
bit of code, relatively.  It uses FFI to work its magic and doesn't  
require a plugin.  As you see if you download the zip below, it was  
created for Squeak 3.0, however I've used it on newer Squeaks (at  
least up to 3.6, possibly 3.7 IIRC) with no problems or patches.

For anyone interested in trying it, get it here:
http://www.d.umn.edu/~areichow/squeak/Win32-Rootless.zip

It only works with Windows 2000 and up, though I've never tried it on  
Vista. Anything older than Win2k doesn't support alpha channels. You  
just need to load in those two file-ins, and there is a class comment  
telling you what to evaluate.  I used it on Windows XP quite a bit  
and never noticed any flakiness as a result.

Regards,
Aaron

Reply | Threaded
Open this post in threaded view
|

Re: Rootless Squeak on OS X?

johnmci

On Feb 22, 2007, at 10:35 PM, Aaron Reichow wrote:

> John and the list-
>
> There has to be a way to do this on OS X!  I'm hoping that John or  
> someone else on the list might be willing to tackle it or be  
> willing to tell me where to look myself.  I'm quite handy with  
> anything in Smalltalk, but when it comes to the workings of the VM  
> or FFI calls into C I'm lost.
>
> It seems that this should be pretty easy to implement, if only  
> because a) Mac OS X can do transparency too and b) the Windows  
> version manages to be implemented in a measly ~5 pages of code,  
> looking at the fileout.  When you actually file it in, it's a tiny  
> bit of code, relatively.  It uses FFI to work its magic and doesn't  
> require a plugin.  As you see if you download the zip below, it was  
> created for Squeak 3.0, however I've used it on newer Squeaks (at  
> least up to 3.6, possibly 3.7 IIRC) with no problems or patches.

Have you fiddled with
http://www.smalltalkconsulting.com/html/squeakinfoplist.html

SqueakWindowHasTitle
SqueakWindowType
SqueakWindowAttribute



kOverlayWindowClass

     Identifies an overlay window, which is a completely transparent  
window positioned above all other windows. Overlay windows are  
intended as a replacement for the pre-Carbon practice of drawing  
directly into the Window Manager port. By creating a full-screen  
overlay window and drawing into it, you can draw over any window in  
any application without disturbing the contents of the windows  
beneath your drawing. Overlay windows have a default handler for  
kEventWindowPaint that uses CGContextClearRect to clear the overlay  
window's alpha channel to zero. This ensures the initial transparency  
of the window.


If you don't set
SqueakWindowAttribute
to all zeros, then you'll crash because I don't check for window  
failure open,and by setting kOverlayWindowClass to 14 you must have  
the right attributes.
Likely you should code a FFI call to

WindowAttributes GetAvailableWindowAttributes (
    WindowClass inClass
);

likely you could also code a FFI call to
OSStatus SetWindowClass (
    WindowRef window,
    WindowClass inClass
);

and

OSStatus ChangeWindowAttributes (
    WindowRef window,
    WindowAttributes setTheseAttributes,
    WindowAttributes clearTheseAttributes
);

Both Sophie and Croquet have lots of FFI calls you can look at for  
examples.


Lastly I believe I drag the data out of the squeak display buffer  
using kCGImageAlphaNoneSkipFirst
in sqMacWindowUniversal.c

I guess I could make this a info.plist and let people figure out what  
they want.
I suspect you'll need a new vm and set thing to kCGImageAlphaFirst or  
kCGImageAlphaPremultipliedFirst
Oh and likely it might different for macIntel.

Anyway you'll need to test some things before a vm change, then let  
me know


kCGImageAlphaFirst
The alpha component is stored in the most significant bits of each  
pixel. For example, non-premultiplied ARGB.

kCGImageAlphaLast
The alpha component is stored in the least significant bits of each  
pixel. For example, non-premultiplied RGBA.

kCGImageAlphaNone
There is no alpha channel. If the total size of the pixel is greater  
than the space required for the number of color components in the  
color space, the least significant bits are ignored. This value is  
equivalent to kCGImageAlphaNoneSkipLast.

kCGImageAlphaNoneSkipFirst
There is no alpha channel. If the total size of the pixel is greater  
than the space required for the number of color components in the  
color space, the most significant bits are ignored.

kCGImageAlphaOnly
There is no color data, only an alpha channel.

kCGImageAlphaNoneSkipLast
There is no alpha channel. If the total size of the pixel is greater  
than the space required for the number of color components in the  
color space, the least significant bits are ignored. This value is  
equivalent to kCGImageAlphaNone.

kCGImageAlphaPremultipliedFirst
The alpha component is stored in the most significant bits of each  
pixel and the color components have already been multiplied by this  
alpha value. For example, premultiplied ARGB.

kCGImageAlphaPremultipliedLast
The alpha component is stored in the least significant bits of each  
pixel and the color components have already been multiplied by this  
alpha value. For example, premultiplied RGBA.






--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: Rootless Squeak on OS X?

johnmci
In reply to this post by Aaron Reichow

On Feb 22, 2007, at 10:35 PM, Aaron Reichow wrote:
> . The biggest thing I used rootless Squeak for was for widgets,  
> just like with OS X's Dashboard.

Well you can run the plugin squeak vm as a dashboard widget, however  
no one has ever expressed interest.

see http://www.smalltalkconsulting.com/squeak.html

In the experimental directory

  Squeak.wdgt.zip

You'll need to load and install the squeakland stuff to get the other  
stuff you'd need.

Or try the new version of the plugin interface at

SqueakBrowserPlugin.plugin.3.8.14b2.zip


 From an note to Ned last fall, assuming you've the old squeakland  
setup installed.


----------------------------------------

You need the new plugin and the latest VM. I'll note I'm in the  
middle of making a 3.8.14beta5U VM to fix issues with modifiers and
key strokes.

see my idisk and the experimental folder. you need the

Squeak 3.8.14beta3U.app.zip  (actually the b5u vm)  { NO USE THE MOST  
CURRENT VM}


SqueakBrowserPlugin.plugin.3.8.14b2.zip

You need to remove the

NPSqueakStubCFM and the
NPSqueak.bundle
from your "Internet Plug-Ins" folder.
stick the
SqueakBrowserPlugin.plugin in the "Internet Plug-Ins" folder.

Stick the Squeak 3.8.14beta3U.app  {Latest VM| in the /Application/
squeakland/squeak/internet folder

Adjust the info.plist information in the SqueakBrowserPlugin.plugin  
to ensure the image name and path to the image in the
  /Application/squeakland/squeak/internet  is what you want it to be.

You can delete the
  /Application/squeakland/squeak/Plugins folder

and delete the
LocalePlugin.bundle
NPSqueakStubCFM
KedamaPlugin.bundle
NPSqueak.bundle
PrintJobPlugin.bundle
Squeak 3.0.app
mpeg3Plugin.bundle

from the
/Application/squeakland/squeak/internet folder.


--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===