Hello, Please let me know if this is a very VM question, and I will make sure to post it on the Beginners list instead...
Anyway...I would like to use Squeak as a background tray application in Windows with a dynamic right-click menu depending on the state of my application. I have successfully modified and compiled a "SqueakVM-Win32-3.10.6" package to include an "options menu" for the taskbar icon.
Keeping the menus in sync could be done using an INI file the same way as the preference menu functionality in sqWin32Prefs.c, but with custom message ID's listed there as well. However, having never poked around in the VM before (and being years since I did anything in C), I was wondering if someone could point me in the right direction to post a message from within the Windows message loop that the interpreted image would see.
This is obviously being done to pass keyboard and mouse events back and forth...I was just hoping someone could help me narrow down my search to find the correct functions to call on the C-side, and the correct way to listen for the message on the Smalltalk side! Thanks, Rob Rothwell -- The foolish reject what they see, not what they think; the wise reject what they think, not what they see. -- Huang Po |
Well not being a windows expert or even novice I can say if you are looking at the windows VM source code. see usage of /* and lastly, fill in the event itself */ event = (sqMouseEvent*) sqNextEventPut(); *event = proto; This is used to help you give a structure of data to the VM InputSensor event queue. /* generic input event */ typedef struct sqInputEvent { int type; /* type of event; either one of EventTypeXXX */ unsigned int timeStamp; /* time stamp */ /* the interpretation of the following fields depend on the type of the event */ int unused1; int unused2; int unused3; int unused4; int unused5; int windowIndex; /* SmallInteger used in image to identify a host window structure */ } sqInputEvent; What values are in the unused1-unused5 integers are up to the VM and the image to decide and agree upon. Setting up the data, then invoking sqNextEventPut and doing the *event := whatever places your event on the queue. EventSensor>>fetchMoreEvents Is where the smalltalk image tirelessly remove events from the FIFO queue and processes them. Obviously you then need a VM and image to agree on your protocol. There maybe a different solution, Smalltalk code callbacks from C code are allowed in some variations of the VM> On Mar 1, 2008, at 5:39 PM, Rob Rothwell wrote: > Hello, > > Please let me know if this is a very VM question, and I will make > sure to post it on the Beginners list instead... > > Anyway...I would like to use Squeak as a background tray application > in Windows with a dynamic right-click menu depending on the state of > my application. I have successfully modified and compiled a > "SqueakVM-Win32-3.10.6" package to include an "options menu" for the > taskbar icon. > > Keeping the menus in sync could be done using an INI file the same > way as the preference menu functionality in sqWin32Prefs.c, but with > custom message ID's listed there as well. However, having never > poked around in the VM before (and being years since I did anything > in C), I was wondering if someone could point me in the right > direction to post a message from within the Windows message loop > that the interpreted image would see. > > This is obviously being done to pass keyboard and mouse events back > and forth...I was just hoping someone could help me narrow down my > search to find the correct functions to call on the C-side, and the > correct way to listen for the message on the Smalltalk side! > > Thanks, > > Rob Rothwell > > > -- > The foolish reject what they see, not what they think; the wise > reject what they think, not what they see. -- Huang Po -- = = = ======================================================================== John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ======================================================================== |
In reply to this post by Rob Rothwell
On 02/03/2008, Rob Rothwell <[hidden email]> wrote: > > Hello, > > Please let me know if this is a very VM question, and I will make sure to > post it on the Beginners list instead... > > Anyway...I would like to use Squeak as a background tray application in > Windows with a dynamic right-click menu depending on the state of my > application. I have successfully modified and compiled a > "SqueakVM-Win32-3.10.6" package to include an "options menu" for the taskbar > icon. > > Keeping the menus in sync could be done using an INI file the same way as > the preference menu functionality in sqWin32Prefs.c, but with custom message > ID's listed there as well. However, having never poked around in the VM > before (and being years since I did anything in C), I was wondering if > someone could point me in the right direction to post a message from within > the Windows message loop that the interpreted image would see. > > This is obviously being done to pass keyboard and mouse events back and > forth...I was just hoping someone could help me narrow down my search to > find the correct functions to call on the C-side, and the correct way to > listen for the message on the Smalltalk side! > Well, you can do in similar way how VM does for transferring user input to Smalltalk side. In VM: - add some variable(s) to hold your event parameters - on some event, handled by windowProc(), set these parameters, and signal semaphore. - add primitive which when called, transforms event parameters to objects. - add primitive to register given semaphore , which will be signaled when event occurs In smalltalk: - call primitive to register semaphore - create process, waiting on given semapore, once it signaled, call primitive to read event details. > Thanks, > > Rob Rothwell > > > -- > The foolish reject what they see, not what they think; the wise reject what > they think, not what they see. -- Huang Po > -- Best regards, Igor Stasenko AKA sig. |
I'll note this way is the approved method of doing it since it doesn't require changing EventSensor. Requires a bit more code and complexity On Mar 1, 2008, at 6:25 PM, Igor Stasenko wrote: > Well, you can do in similar way how VM does for transferring user > input to Smalltalk side. > > In VM: > - add some variable(s) to hold your event parameters > - on some event, handled by windowProc(), set these parameters, and > signal semaphore. > - add primitive which when called, transforms event parameters to > objects. > - add primitive to register given semaphore , which will be signaled > when event occurs > > In smalltalk: > - call primitive to register semaphore > - create process, waiting on given semapore, once it signaled, call > primitive to read event details. -- = = = ======================================================================== John M. McIntosh <[hidden email]> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ======================================================================== |
Thank you both...I bet I can actually figure out the EventSensor way; doing it by using the approved method is a little beyond me at this time. I've never even used primitives yet--let alone written any in the VM! Thanks for your time, Rob
On Sat, Mar 1, 2008 at 9:31 PM, John M McIntosh <[hidden email]> wrote: I'll note this way is the approved method of doing it since it doesn't -- The foolish reject what they see, not what they think; the wise reject what they think, not what they see. -- Huang Po |
In reply to this post by johnmci
On 02/03/2008, John M McIntosh <[hidden email]> wrote: > > I'll note this way is the approved method of doing it since it doesn't > require changing EventSensor. > Requires a bit more code and complexity > Btw, i thought a bit on this and have an idea how to connect any kind of external events with language side in HydraVM without need of too much coding in C. Since HydraVM inherently proposing events and channels, then all we need is to provide a little framework for connecting external event source generator with channels. This can be a couple of methods in VM core to connect any external events source with language side. So, in future, an EventSensor can be refactored to use channel for fetching user input events. And other kinds of external events can be handled in similar way. -- Best regards, Igor Stasenko AKA sig. |
Free forum by Nabble | Edit this page |