[Pharo-project] Question about HostMenuSystem
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem. Look to InputEventSensor >> processMenuEvent: evt | handler localCopyOfEvt | localCopyOfEvt := evt shallowCopy. handler := (HostSystemMenus defaultMenuBarForWindowIndex: (localCopyOfEvt at: 8)) getHandlerForMenu: (localCopyOfEvt at: 3) item: (localCopyOfEvt at: 4). handler handler value: localCopyOfEvt There is the only place where HostSystemMenus is used. Now I am trying to see the best way to remove this. The first approach that came to my mind, which may not be the best to implement this method as follows: processMenuEvent: evt "By default the menu events are not handled. In case you want to handle them you should override this method" And of course, in the package HostSystemMenus we override that method with the original code. Then I though some kind of notification or oberser pattern, where someone can register as an "observer" and then, then this menu events occurs, these guys are notified. Maybe using Announcments? My skills here are quite limited. What do you think ? Can you help me ? Cheers Mariano
On 3/18/10 3:38 PM, Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
You could also remove this code completely, including the call to processMenuEvent: and then the HostMenuSystem could register its own input event listener upon installation. See UserInterruptHandler for an example how to do this. Michael
On Thu, Mar 18, 2010 at 11:55 PM, Michael Rueger <m.rueger@acm.org> wrote:
On 3/18/10 3:38 PM, Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
You could also remove this code completely, including the call to processMenuEvent: and then the HostMenuSystem could register its own input event listener upon installation. See UserInterruptHandler for an example how to do this.
Hi Michael. Let me see if I understood. - In PharoCore I remove InputEventSensor >> processMenuEvent: and the invocation from ImputEventSensor >> processEvent: evt - In the package HostMenuSystem, I create a subclass of InputEventHandler (Suppose called HostMenuEventHandler). It is correct to subclass from this class ? - In HostMenuEventHandler I create the method handleEvent: that does the if type = EventTypeMenu and do everything - In a class side method initialize or similar, I put: HostMenuEventHandler new registerIn: InputEventFetcher default. Is that correct? I mean, it is correct to register in InputEventFetcher or I should use another class ? Thanks a lot. Mariano
Michael
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On 3/21/10 4:07 PM, Mariano Martinez Peck wrote:
Hi Michael. Let me see if I understood.
- In PharoCore I remove InputEventSensor >> processMenuEvent: and the invocation from ImputEventSensor >> processEvent: evt
correct And make sure to do it in the right order and have backups of your image ;-)
- In the package HostMenuSystem, I create a subclass of InputEventHandler (Suppose called HostMenuEventHandler). It is correct to subclass from this class ?
Yes
- In HostMenuEventHandler I create the method handleEvent: that does the if type = EventTypeMenu and do everything
Yes
- In a class side method initialize or similar, I put:
HostMenuEventHandler new registerIn: InputEventFetcher default.
Is that correct? I mean, it is correct to register in InputEventFetcher or I should use another class ?
You understood perfectly :-) Now I'm curious if it actually works... Will hopefully be a good example of how the new event handling setup allows us to do these things without system overrides. Michael
Thanks Michael. Now I have another question. In the latests PharoCore 1.1 I cannot see the VM menu. I only see the options "Squeak VM" and "Edit". But the HostMenuSystem was only removed in Pharo 1.0 with the ifPresent: in processMenuEvent: In 1.1 that method is correct. Then....I don't understand why I don't see the VM menus like Tools, Debug, etc. Should I see them ? Adrian any idea ? Maybe there is a problem with the Smalltalk startUpList ? I know it has been changed in previous updates. Cheers Mariano On Mon, Mar 22, 2010 at 12:19 AM, Michael Rueger <m.rueger@acm.org> wrote:
On 3/21/10 4:07 PM, Mariano Martinez Peck wrote:
Hi Michael. Let me see if I understood.
- In PharoCore I remove InputEventSensor >> processMenuEvent: and the invocation from ImputEventSensor >> processEvent: evt
correct And make sure to do it in the right order and have backups of your image ;-)
- In the package HostMenuSystem, I create a subclass of InputEventHandler (Suppose called HostMenuEventHandler). It is correct to subclass from this class ?
Yes
- In HostMenuEventHandler I create the method handleEvent: that does
the if type = EventTypeMenu and do everything
Yes
- In a class side method initialize or similar, I put:
HostMenuEventHandler new registerIn: InputEventFetcher default.
Is that correct? I mean, it is correct to register in InputEventFetcher or I should use another class ?
You understood perfectly :-)
Now I'm curious if it actually works...
Will hopefully be a good example of how the new event handling setup allows us to do these things without system overrides.
Michael
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Mar 22, 2010, at 12:32 AM, Mariano Martinez Peck wrote:
Thanks Michael. Now I have another question. In the latests PharoCore 1.1 I cannot see the VM menu. I only see the options "Squeak VM" and "Edit".
But the HostMenuSystem was only removed in Pharo 1.0 with the ifPresent: in processMenuEvent: In 1.1 that method is correct.
Then....I don't understand why I don't see the VM menus like Tools, Debug, etc. Should I see them ?
Adrian any idea ?
I removed them when they where broken. We should enable them again: http://code.google.com/p/pharo/issues/detail?id=1876
Maybe there is a problem with the Smalltalk startUpList ? I know it has been changed in previous updates.
so if you remove this strange all=error swallowing wrappter in HostSystemMenus>>#startUp: [self setDefaultMenuProxyClass] ifError: [:err :rcvr | ]. you will get a DNU at image startup that shows that we need to fix the menu building code as it used the world menu. It should build it's menu using the menu builder framework. Marcus -- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD.
Adrian any idea ?
I removed them when they where broken. We should enable them again:
Ahh okok. Yes, please, we need to enable it :)
Maybe there is a problem with the Smalltalk startUpList ? I know it has been changed in previous updates.
so if you remove this strange all=error swallowing wrappter in HostSystemMenus>>#startUp:
[self setDefaultMenuProxyClass] ifError: [:err :rcvr | ].
you will get a DNU at image startup that shows that we need to fix the menu building code as it used the world menu. It should build it's menu using the menu builder framework.
Ok....I don't have too much time now (and I don't know anything about the WorldMenu). But when this is working I can continue to make it loadable in a clean way. Thanks Mariano
Marcus
-- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
This is cool to see a bold guy like that pushing that :) Keep pushing mariano. Stef On Mar 22, 2010, at 12:19 AM, Michael Rueger wrote:
On 3/21/10 4:07 PM, Mariano Martinez Peck wrote:
Hi Michael. Let me see if I understood.
- In PharoCore I remove InputEventSensor >> processMenuEvent: and the invocation from ImputEventSensor >> processEvent: evt
correct And make sure to do it in the right order and have backups of your image ;-)
- In the package HostMenuSystem, I create a subclass of InputEventHandler (Suppose called HostMenuEventHandler). It is correct to subclass from this class ?
Yes
- In HostMenuEventHandler I create the method handleEvent: that does the if type = EventTypeMenu and do everything
Yes
- In a class side method initialize or similar, I put:
HostMenuEventHandler new registerIn: InputEventFetcher default.
Is that correct? I mean, it is correct to register in InputEventFetcher or I should use another class ?
You understood perfectly :-)
Now I'm curious if it actually works...
Will hopefully be a good example of how the new event handling setup allows us to do these things without system overrides.
Michael
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hi Mariano, As you may remember, I have removed HostSystemMenus from PharoCore 1.0 some time ago. What I did in this case was "Smalltalk at: #HostSystemMenus ifPresent:...", which is not very nice but easily solves the problem. Thanks for removing it in 1.1. Until the duplication of events due to this package/plugin is solved, we should not have it in PharoCore. Or maybe even better we should not have it in PharoCore at all and load it only in Pharo (when it works). Cheers, Adrian On Mar 18, 2010, at 23:38 , Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
| handler localCopyOfEvt |
localCopyOfEvt := evt shallowCopy. handler := (HostSystemMenus defaultMenuBarForWindowIndex: (localCopyOfEvt at: 8)) getHandlerForMenu: (localCopyOfEvt at: 3) item: (localCopyOfEvt at: 4).
handler handler value: localCopyOfEvt
There is the only place where HostSystemMenus is used. Now I am trying to see the best way to remove this. The first approach that came to my mind, which may not be the best to implement this method as follows:
processMenuEvent: evt "By default the menu events are not handled. In case you want to handle them you should override this method"
And of course, in the package HostSystemMenus we override that method with the original code.
Then I though some kind of notification or oberser pattern, where someone can register as an "observer" and then, then this menu events occurs, these guys are notified. Maybe using Announcments? My skills here are quite limited. What do you think ? Can you help me ?
Cheers
Mariano _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
I believe the duplicate events issue was solved or do you have an example of it occuring again? On 3/19/10, Adrian Lienhard <adi@netstyle.ch> wrote:
Hi Mariano,
As you may remember, I have removed HostSystemMenus from PharoCore 1.0 some time ago.
What I did in this case was "Smalltalk at: #HostSystemMenus ifPresent:...", which is not very nice but easily solves the problem.
Thanks for removing it in 1.1. Until the duplication of events due to this package/plugin is solved, we should not have it in PharoCore. Or maybe even better we should not have it in PharoCore at all and load it only in Pharo (when it works).
Cheers, Adrian
On Mar 18, 2010, at 23:38 , Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
| handler localCopyOfEvt |
localCopyOfEvt := evt shallowCopy. handler := (HostSystemMenus defaultMenuBarForWindowIndex: (localCopyOfEvt at: 8)) getHandlerForMenu: (localCopyOfEvt at: 3) item: (localCopyOfEvt at: 4).
handler handler value: localCopyOfEvt
There is the only place where HostSystemMenus is used. Now I am trying to see the best way to remove this. The first approach that came to my mind, which may not be the best to implement this method as follows:
processMenuEvent: evt "By default the menu events are not handled. In case you want to handle them you should override this method"
And of course, in the package HostSystemMenus we override that method with the original code.
Then I though some kind of notification or oberser pattern, where someone can register as an "observer" and then, then this menu events occurs, these guys are notified. Maybe using Announcments? My skills here are quite limited. What do you think ? Can you help me ?
Cheers
Mariano _______________________________________________ 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
-- =========================================================================== John M. McIntosh <johnmci@smalltalkconsulting.com> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ===========================================================================
Ah, I didn't know this was solved. I don't know about it occurring again because I mostly work in Pharo 1.0, which has the Host System Menu code removed. Is this a fix in the VM? Cheers, Adrian On Mar 19, 2010, at 08:50 , John McIntosh wrote:
I believe the duplicate events issue was solved or do you have an example of it occuring again?
On 3/19/10, Adrian Lienhard <adi@netstyle.ch> wrote:
Hi Mariano,
As you may remember, I have removed HostSystemMenus from PharoCore 1.0 some time ago.
What I did in this case was "Smalltalk at: #HostSystemMenus ifPresent:...", which is not very nice but easily solves the problem.
Thanks for removing it in 1.1. Until the duplication of events due to this package/plugin is solved, we should not have it in PharoCore. Or maybe even better we should not have it in PharoCore at all and load it only in Pharo (when it works).
Cheers, Adrian
On Mar 18, 2010, at 23:38 , Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
| handler localCopyOfEvt |
localCopyOfEvt := evt shallowCopy. handler := (HostSystemMenus defaultMenuBarForWindowIndex: (localCopyOfEvt at: 8)) getHandlerForMenu: (localCopyOfEvt at: 3) item: (localCopyOfEvt at: 4).
handler handler value: localCopyOfEvt
There is the only place where HostSystemMenus is used. Now I am trying to see the best way to remove this. The first approach that came to my mind, which may not be the best to implement this method as follows:
processMenuEvent: evt "By default the menu events are not handled. In case you want to handle them you should override this method"
And of course, in the package HostSystemMenus we override that method with the original code.
Then I though some kind of notification or oberser pattern, where someone can register as an "observer" and then, then this menu events occurs, these guys are notified. Maybe using Announcments? My skills here are quite limited. What do you think ? Can you help me ?
Cheers
Mariano _______________________________________________ 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
-- =========================================================================== John M. McIntosh <johnmci@smalltalkconsulting.com> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ===========================================================================
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Begin forwarded message:
From: John M McIntosh <johnmci@smalltalkconsulting.com> Date: March 16, 2010 7:29:12 PM GMT+01:00 To: stephane ducasse <stephane.ducasse@free.fr> Subject: Re: do you remember the fix for the hostMenu Reply-To: johnmci@smalltalkconsulting.com
The fix seems to be in
PharoCore1.1ALPHA Latest update: #11254
peekEvent "Look ahead at the next event." | nextEvent | nextEvent := eventQueue peek. ^((nextEvent notNil) and: [(nextEvent at: 1) ~= EventTypeMenu]) ifTrue: [self processEvent: nextEvent]
On 2010-03-15, at 12:58 PM, stephane ducasse wrote:
Hi john
I would like to add the HostMenus back to 1.1 and get the tests green. Do you have the fix for the menus somewhere?
Stef
-- =========================================================================== John M. McIntosh <johnmci@smalltalkconsulting.com> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ===========================================================================
The double copy was fixed in the image side, with the code Stef has just pasted. No need of VM. Now, for 1.1 I want the HostMenuSystem not to be in Core as I think it is not a CORE package, but be loadable. And even more, load it by default in PharoDev 1.1. Adrian: I saw the ifPresent: I think it was perfect for 1.0 as we were hurry and we needed to really fix that stuff. Now that we have time, I was thinking if there was a possibility of making that a bit better. Michael: Thanks for the hints. It will try to look at it when I find some minutes. Cheers Mariano On Fri, Mar 19, 2010 at 9:07 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Begin forwarded message:
From: John M McIntosh <johnmci@smalltalkconsulting.com> Date: March 16, 2010 7:29:12 PM GMT+01:00 To: stephane ducasse <stephane.ducasse@free.fr> Subject: Re: do you remember the fix for the hostMenu Reply-To: johnmci@smalltalkconsulting.com
The fix seems to be in
PharoCore1.1ALPHA Latest update: #11254
peekEvent "Look ahead at the next event." | nextEvent | nextEvent := eventQueue peek. ^((nextEvent notNil) and: [(nextEvent at: 1) ~= EventTypeMenu]) ifTrue: [self processEvent: nextEvent]
On 2010-03-15, at 12:58 PM, stephane ducasse wrote:
Hi john
I would like to add the HostMenus back to 1.1 and get the tests green. Do you have the fix for the menus somewhere?
Stef
--
===========================================================================
John M. McIntosh <johnmci@smalltalkconsulting.com> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Mar 19, 2010, at 09:50 , Mariano Martinez Peck wrote:
The double copy was fixed in the image side, with the code Stef has just pasted. No need of VM.
Great! I must have missed the mail or bug report about this being fixed.
Now, for 1.1 I want the HostMenuSystem not to be in Core as I think it is not a CORE package, but be loadable. And even more, load it by default in PharoDev 1.1.
yep, that would be good.
Adrian: I saw the ifPresent: I think it was perfect for 1.0 as we were hurry and we needed to really fix that stuff. Now that we have time, I was thinking if there was a possibility of making that a bit better.
exactly Cheers, Adrian
Michael: Thanks for the hints. It will try to look at it when I find some minutes.
Cheers
Mariano
On Fri, Mar 19, 2010 at 9:07 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Begin forwarded message:
From: John M McIntosh <johnmci@smalltalkconsulting.com> Date: March 16, 2010 7:29:12 PM GMT+01:00 To: stephane ducasse <stephane.ducasse@free.fr> Subject: Re: do you remember the fix for the hostMenu Reply-To: johnmci@smalltalkconsulting.com
The fix seems to be in
PharoCore1.1ALPHA Latest update: #11254
peekEvent "Look ahead at the next event." | nextEvent | nextEvent := eventQueue peek. ^((nextEvent notNil) and: [(nextEvent at: 1) ~= EventTypeMenu]) ifTrue: [self processEvent: nextEvent]
On 2010-03-15, at 12:58 PM, stephane ducasse wrote:
Hi john
I would like to add the HostMenus back to 1.1 and get the tests green. Do you have the fix for the menus somewhere?
Stef
--
===========================================================================
John M. McIntosh <johnmci@smalltalkconsulting.com> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
===========================================================================
_______________________________________________ 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
adrian the duplication was solved :) Now what mariano is aiming at is can be get minicore in place and from minicore reload core :) if you see what I mean. Stef On Mar 19, 2010, at 8:43 AM, Adrian Lienhard wrote:
Hi Mariano,
As you may remember, I have removed HostSystemMenus from PharoCore 1.0 some time ago.
What I did in this case was "Smalltalk at: #HostSystemMenus ifPresent:...", which is not very nice but easily solves the problem.
Thanks for removing it in 1.1. Until the duplication of events due to this package/plugin is solved, we should not have it in PharoCore. Or maybe even better we should not have it in PharoCore at all and load it only in Pharo (when it works).
Cheers, Adrian
On Mar 18, 2010, at 23:38 , Mariano Martinez Peck wrote:
Hi folks. I want to remove HostMenuSystem from PharoCore image. Probably, I can put it on PharoDev image but of course, it will be accesible also from squeaksource to download it. I don't this is a "core" package. In order to do that, I found the following problem.
Look to InputEventSensor >> processMenuEvent: evt
| handler localCopyOfEvt |
localCopyOfEvt := evt shallowCopy. handler := (HostSystemMenus defaultMenuBarForWindowIndex: (localCopyOfEvt at: 8)) getHandlerForMenu: (localCopyOfEvt at: 3) item: (localCopyOfEvt at: 4).
handler handler value: localCopyOfEvt
There is the only place where HostSystemMenus is used. Now I am trying to see the best way to remove this. The first approach that came to my mind, which may not be the best to implement this method as follows:
processMenuEvent: evt "By default the menu events are not handled. In case you want to handle them you should override this method"
And of course, in the package HostSystemMenus we override that method with the original code.
Then I though some kind of notification or oberser pattern, where someone can register as an "observer" and then, then this menu events occurs, these guys are notified. Maybe using Announcments? My skills here are quite limited. What do you think ? Can you help me ?
Cheers
Mariano _______________________________________________ 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
participants (6)
-
Adrian Lienhard -
John McIntosh -
Marcus Denker -
Mariano Martinez Peck -
Michael Rueger -
Stéphane Ducasse