Win32Window how to get Squeak's window Handle? VM?

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

Re: Changing window size (was Re: How to coece a HWND*?)

timrowledge

On 12-Jul-07, at 12:45 PM, Bert Freudenberg wrote:

> It actually should switch the screen resolution only if the  
> fullscreen flag is true. Has been a bug for a long time. But since  
> the prim wasn't implemented anywhere else, nobody used it anyway.
It was most definitely implemented on Windows some years ago; there  
were log and sometimes (to me) confusing discussions about what it  
was supposed to do. See http://wiki.squeak.org/squeak/3148 for an  
example. I've no idea if it got removed or disconnected or whatever.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
MIPS:  Meaningless Indicator of Processor Speed.



Reply | Threaded
Open this post in threaded view
|

RE: Changing window size (was Re: How to coece a HWND*?)

Gary Chambers-4
In reply to this post by Bert Freudenberg
If you are looking to deploy an application "as if it were a host window"
then it is possible to have Squeak fill the area with your Morph.

On windows you can adjust the Squeak.ini to have the title of your choosing.
On Linux it is a bit more convoluted!

Depends what you want to achieve.

Regards.


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Bert
Freudenberg
Sent: 12 July 2007 8:18 pm
To: Herbert König; The general-purpose Squeak developers list
Subject: Changing window size (was Re: How to coece a HWND*?)



On Jul 12, 2007, at 19:39 , Herbert König wrote:

> Hello,
>
> finally I managed to build a kind of working plugin.
>
> Working in that I retrieve the window handle of the Squeak OS window
> from the VM and I can use this handle (still inside the plugin) to
> close the Squeak window.
>
> How do I get this HWND* back to Squeak so that it returns the same as
> Win32Window class getFocus?
>
> I can send something back to Squeak (if I'm not closing the Squeak
> window) but whatever I try gives a different result from what
> Win32Window class getFocus returns.
>
> I could stay within the plugin to do all I want but would prefer to
> store the handle in Squeak and in subsequent calls use the plugin to
> e.g. resize the window.

If resizing the Squeak window is actually what you want - why don't  
you implement primitive 92 which is meant for that purpose? It is  
only actually implemented on the Mac AFAIK but that would be actually  
useful to have on all platforms. See DisplayScreen  
class>>depth:width:height:fullscreen:

- Bert -




Reply | Threaded
Open this post in threaded view
|

RE: Changing window size (was Re: How to coece a HWND*?)

Gary Chambers-4
In reply to this post by timrowledge
Seems like a good idea if this was pulled together and made standard across
VMs.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of tim
Rowledge
Sent: 12 July 2007 9:33 pm
To: The general-purpose Squeak developers list
Subject: Re: Changing window size (was Re: How to coece a HWND*?)



On 12-Jul-07, at 12:45 PM, Bert Freudenberg wrote:

> It actually should switch the screen resolution only if the
> fullscreen flag is true. Has been a bug for a long time. But since  
> the prim wasn't implemented anywhere else, nobody used it anyway.
It was most definitely implemented on Windows some years ago; there  
were log and sometimes (to me) confusing discussions about what it  
was supposed to do. See http://wiki.squeak.org/squeak/3148 for an  
example. I've no idea if it got removed or disconnected or whatever.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
MIPS:  Meaningless Indicator of Processor Speed.




Reply | Threaded
Open this post in threaded view
|

Re: Changing window size (was Re: How to coece a HWND*?)

timrowledge
In reply to this post by Herbert König

On 12-Jul-07, at 1:29 PM, Herbert König wrote:


>
> Moving to HostWindowPlugin has the problem of getting my changes
> accepted. And to find out what has to go into cross and what into the
> Windows part of the tree.
If you explained what your changes are supposed to do, why they are  
needed, etc you might find that there is less to worry about than you  
might think. Ffenestri does all the window manipulation we could  
think of at the time. If there is more needed, tell us.

What is needed in this arena is the *image* work to make use of  
Ffenestri. You guys (using the general third person plural)  
complained for *years* about how utterly essential  host windows are  
and yet in the nearly three years since we wrote Ffenestri there has  
been..... <crickets>....

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: SDJ: Send all Data to Japan



Reply | Threaded
Open this post in threaded view
|

Re: Changing window size (was Re: How to coece a HWND*?)

Bert Freudenberg
In reply to this post by timrowledge

On Jul 12, 2007, at 22:33 , tim Rowledge wrote:

>
> On 12-Jul-07, at 12:45 PM, Bert Freudenberg wrote:
>
>> It actually should switch the screen resolution only if the  
>> fullscreen flag is true. Has been a bug for a long time. But since  
>> the prim wasn't implemented anywhere else, nobody used it anyway.
> It was most definitely implemented on Windows some years ago; there  
> were log and sometimes (to me) confusing discussions about what it  
> was supposed to do. See http://wiki.squeak.org/squeak/3148 for an  
> example. I've no idea if it got removed or disconnected or whatever.

Maybe my memory fails me and it actually works on Windows. I wouldn't  
really know, haven't used Windows seriously in this millenium.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Igor Stasenko
In reply to this post by Herbert König
in plugin you might write:
| handle |
handle := blablabla.
^ self pop: 1 thenPush:(self positive32BitIntegerFor: handle)

where the handle , is that unsigned32 window handle.

On 12/07/07, Herbert König <[hidden email]> wrote:

> Hello,
>
> finally I managed to build a kind of working plugin.
>
> Working in that I retrieve the window handle of the Squeak OS window
> from the VM and I can use this handle (still inside the plugin) to
> close the Squeak window.
>
> How do I get this HWND* back to Squeak so that it returns the same as
> Win32Window class getFocus?
>
> I can send something back to Squeak (if I'm not closing the Squeak
> window) but whatever I try gives a different result from what
> Win32Window class getFocus returns.
>
> I could stay within the plugin to do all I want but would prefer to
> store the handle in Squeak and in subsequent calls use the plugin to
> e.g. resize the window.
>
>
>
> Thanks
>
> Herbert                            mailto:[hidden email]
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Herbert König
Hello Sig,

s> in plugin you might write:
s> | handle |
s> handle := blablabla.
s> ^ self pop: 1 thenPush:(self positive32BitIntegerFor: handle)

s> where the handle , is that unsigned32 window handle.

it compiles if I change self to interpreterProy but it still returns
the wrong number. Maybe it's a Matter of byte order. But hex doesn't
give a clue on that. So maybe it's a matter of further dereferencing.

If I only knew C :-))

In C I declare a
static HWND *theStWindow

and I push a positive32BitIntegerFor(*theStWindow) being not better
than pushing ..(theStWindow)

Now I have to hurry to work for money :-))
       
Thanks,


Herbert                            mailto:[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Changing window size (was Re: How to coece a HWND*?)

Herbert König
In reply to this post by timrowledge
Hello Tim,

tR> If you explained what your changes are supposed to do, why they are
tR> needed, etc you might find that there is less to worry about than you
tR> might think. Ffenestri does all the window manipulation we could  
tR> think of at the time. If there is more needed, tell us.

My main problems with Ffenestri is my close to nothing C, winapi and
plugin knowlwdge. I'm working on it.

What I plan to do further is to change the windows decorations
(minimize, maximize..) make it unresizable ... which in delphi(2)
times was hidden in borderstyle. Maybe set context menus.



tR> What is needed in this arena is the *image* work to make use of  
tR> Ffenestri. You guys (using the general third person plural)

no offense taken :-)

As it looks now (and my view is rapidly changing here):

Maybe I'll use the main squeak window like a dialog, where I do lots
of Morphic graphics and create HostWindows for the boring parts of the
UI.

I plan to start Squeak from AutoCAD so maybe I won't need any host
windows as the boring UI is done in ACAD.

But I'll use HostWindows for the above modifications. And will publish
everything I consider useful.

tR> complained for *years* about how utterly essential  host windows are
tR> and yet in the nearly three years since we wrote Ffenestri there has
tR> been..... <crickets>....

It seems some of those "You guys" will have to change the whole morphic
drawing, BitBlt whatever to paint on a HostWindow. Which looks like an
awful lot of work. So I guess people having a need will do a bit in
this area and maybe it sums up one day.

I'm happy to see that more and more people are on the way to use
Squeak commercially and not only Seaside.

Cheers

Herbert                            mailto:[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Igor Stasenko
In reply to this post by Herbert König
can you send a function which generates VMMaker for your primitive?
You dont need to declare variable as HWND*.
You can declare its as HWND, and then put address of variable to win calls

On 13/07/07, Herbert König <[hidden email]> wrote:

> Hello Sig,
>
> s> in plugin you might write:
> s> | handle |
> s> handle := blablabla.
> s> ^ self pop: 1 thenPush:(self positive32BitIntegerFor: handle)
>
> s> where the handle , is that unsigned32 window handle.
>
> it compiles if I change self to interpreterProy but it still returns
> the wrong number. Maybe it's a Matter of byte order. But hex doesn't
> give a clue on that. So maybe it's a matter of further dereferencing.
>
> If I only knew C :-))
>
> In C I declare a
> static HWND *theStWindow
>
> and I push a positive32BitIntegerFor(*theStWindow) being not better
> than pushing ..(theStWindow)
>
> Now I have to hurry to work for money :-))
>
> Thanks,
>
>
> Herbert                            mailto:[hidden email]
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Herbert König
Hello Sig,

you involve yourself deeply into my problems.  If we ever meet in
person, I owe you a beer!

s> can you send a function which generates VMMaker for your primitive?
s> You dont need to declare variable as HWND*.
s> You can declare its as HWND, and then put address of variable to win calls

As it's all very tiny I've filed out the plugin class and the class
using the plugin (each one method)

VMMaker generates SqueakWindowPlugin.c which I modify to
SqueakWindowPluginHko.c.

In Line 11 I include windows.h, in line 89 i make a test function to
see if I can do something with the window.

In Line 102 you find my changed primitive. Later I'll learn to use
cCode in Squeak and code it all in Squeak.

The test is, that if you uncomment the closeWindow call in line 107 it
closes the Squeak window.

Beware, it closes Squeak but leaves all files open, as I don't observe
the niceties before closing a window. It kind of slams the window and
breaks a few window panes :-))

Thanks,

Herbert                            mailto:[hidden email]


SqueakWindowPlugin.st (894 bytes) Download Attachment
SqueakWindow.st (980 bytes) Download Attachment
SqueakWindowPluginHko.c (4K) Download Attachment
SqueakWindowPlugin.c (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Igor Stasenko
On 13/07/07, Herbert König <[hidden email]> wrote:
> Hello Sig,
>
> you involve yourself deeply into my problems.  If we ever meet in
> person, I owe you a beer!
>
be my guest! :)

> s> can you send a function which generates VMMaker for your primitive?
> s> You dont need to declare variable as HWND*.
> s> You can declare its as HWND, and then put address of variable to win calls
>
> As it's all very tiny I've filed out the plugin class and the class
> using the plugin (each one method)
>
> VMMaker generates SqueakWindowPlugin.c which I modify to
> SqueakWindowPluginHko.c.
>
> In Line 11 I include windows.h, in line 89 i make a test function to
> see if I can do something with the window.
>
> In Line 102 you find my changed primitive. Later I'll learn to use
> cCode in Squeak and code it all in Squeak.
>
> The test is, that if you uncomment the closeWindow call in line 107 it
> closes the Squeak window.
>
> Beware, it closes Squeak but leaves all files open, as I don't observe
> the niceties before closing a window. It kind of slams the window and
> breaks a few window panes :-))
>
> Thanks,
>
> Herbert                            mailto:[hidden email]
>
>
>
>



SqueakWindow.st (2K) Download Attachment
SqueakWindowPlugin.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing window size (was Re: How to coece a HWND*?)

johnmci
In reply to this post by Herbert König

On Jul 13, 2007, at 2:13 AM, Herbert König wrote:

> It seems some of those "You guys" will have to change the whole  
> morphic
> drawing, BitBlt whatever to paint on a HostWindow. Which looks like an
> awful lot of work. So I guess people having a need will do a bit in
> this area and maybe it sums up one day.

I had a change set somewhere that would swap out the Display for the  
host window that was part of the Project's information.

Thus you could create a host window for a project, when you jumped to  
the project then everything was drawn to that project's window.
At the time, and I think today, when you switch between projects, the  
existing project is "hibernated" and morphics aren't stepped.
Switching between projects invokes lots of things.

This was deemed clever, but not what should happen. At the time we  
did setup Tweak projects which has Display as a instance variable to  
work
with host windows, but there was a lack of interest.

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



Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

johnmci
In reply to this post by Herbert König

On Jul 13, 2007, at 9:07 AM, Herbert König wrote:

> The test is, that if you uncomment the closeWindow call in line 107 it
> closes the Squeak window.

I'll note the mac carbon squeak vm was changed a few months back to  
let you close the squeak main window. Earlier work last year made it  
so it could run headless, or as a headless background task. In fact  
for the safari/firebox os-x browser plugin we run it as a headless  
non-background task and when you flip to full screen we switch to the  
squeak process and open the window. On revert back to non-full screen  
we close the squeak window and switch back to the browser.


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



Reply | Threaded
Open this post in threaded view
|

Re: How to coece a HWND* was: Win32Window how to get Squeak's window Handle? VM?

Herbert König
In reply to this post by Igor Stasenko
Hello Sig,

thanks a lot, it works and is instructive.


Cheers,

Herbert                            mailto:[hidden email]


12