On Sun, May 16, 2010 at 9:19 AM, Stéphane Ducasse <stephane.duca...@inria.fr
> wrote:

>
> On May 16, 2010, at 5:52 PM, Eliot Miranda wrote:
>
> >
> >
> > 2010/5/16 Mariano Martinez Peck <marianop...@gmail.com>
> >
> >
> > On Sun, May 16, 2010 at 4:42 PM, Lukas Renggli <reng...@gmail.com>
> wrote:
> > I asked the same question a few weeks back and the only working
> > solution I found was to patch the window size in the image file. The
> > actual implementation is from Max Leske:
> >
> >
> http://github.com/renggli/builder/blob/master/scripts/resize-window.sh
> >
> >
> > OMG. WHAT A HACK!!!!    but works hahahah. I cannot believe such thing
> could work...but in fact, it does!
> >
> > It is sad this cannot be done with Smalltalk, just evaluating something
> in the image.
> >
> > ? Why do you assume it can't be done in Smalltalk?
> >
> > shrinkDisplayInImageFile: imageFileName
> >
> >         | fs |
> >         fs := StandardFileStream fileNamed: imageFileName.
> >         fs binary.
> >         [fs position: 24.
> >          SmalltalkImage current isLittleEndian
> >                 ifTrue:
> >                         [fs nextLittleEndianNumber: 4 put: (1024
> bitShift: 16) + 768. "Display size"
> >                          fs nextLittleEndianNumber: 4 put: 0.
> "full-screen flag (off)"]
> >                 ifFalse:
> >                         [self error: 'not yet implemented']]
> >                 ensure: [fs close]! !
>
> What is fun with smalltalk is that now I understand that this information
> is encoded in the image format :)
> Now eliot do you think that the vm could expose an API of primitives so
> that we could script the size of the host window
> without having to restart the image. because I imagine that we have to.
>

I don't understand.  The VM has the relevant functionality.  It is easy to
construct a special save-as that resizes the screen (or puts it into full
screen mode), saves, and then restores the display to what it was.  The
above is useful when one wants to change an image file after the fact.  And
again it is easy to construct a special save-as that saves and then rewrites
the image header, which would allow one e.g. to save a large display image
file on a small display machine.  The KISS principle agues against modifying
the VM to take a series of variables that overrode the actual display size
on save.  If the iage header is well-defined (it hasn't changed in a loooong
time) ten the above is fine, no?

BTW, since Cog is using a number of other bits in the full-screen flag word
for other values (platform-dependent float order, whether process preemption
yields, etc) the above should read something like

seDisplayExtent: extent fullScreen: fullScreenFlag iInImageFile:
imageFileName

| fs flags |
fs := StandardFileStream fileNamed: imageFileName.
fs binary.
[fs position: 28.
 flags := fs nextLittleEndianNumber: 4.
 flags := fullScreenFlag ifTrue: [flags bitOr: 1] ifFalse: [flags bitClear:
1].
 fs position: 24.
 SmalltalkImage current isLittleEndian
ifTrue:
[fs nextLittleEndianNumber: 4 put: (extent x bitShift: 16) + extent y.
"Display size"
 fs nextLittleEndianNumber: 4 put: flags.]
ifFalse:
[self error: 'not yet implemented']]
ensure: [fs close]

Find attached on SmalltalkImage class.


> Stef
> >
> >
> > Thanks!
> >
> > Mariano
> >
> >
> >
> > Lukas
> >
> > 2010/5/16 Mariano Martinez Peck <marianop...@gmail.com>:
> > > I know I already asked this, but I didn't get a working solution. I
> want to
> > > change the default size of the host windows that runs on Pharo. Does
> someone
> > > know how to do that?
> > >
> > > I attach the 2 screenshots: what I have, and what I want.
> > >
> > > Thanks
> > >
> > > mariano
> > >
> > > _______________________________________________
> > > Pharo-project mailing list
> > > Pharo-project@lists.gforge.inria.fr
> > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> > >
> >
> >
> >
> > --
> > Lukas Renggli
> > www.lukas-renggli.ch
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project@lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project@lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project@lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

Attachment: SmalltalkImage class-seDisplayExtentfullScreeniInImageFile.st
Description: Binary data

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to