changes to Cross headers files

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

changes to Cross headers files

Ian Piumarta
 
Hi,

I'm about to commit a few changes to the Cross sources to support the  
OLPC VM and its virtual image.  If anyone has any objections, now is  
the time to raise them.

Cheers,
Ian

Index: plugins/DropPlugin/DropPlugin.h
===================================================================
--- plugins/DropPlugin/DropPlugin.h (revision 1742)
+++ plugins/DropPlugin/DropPlugin.h (working copy)
@@ -9,4 +9,5 @@
int dropRequestFileHandle(int dropIndex); /* return READ-ONLY file  
handle OOP or nilObject if error */
int sqSecFileAccessCallback(void *);
void sqSetNumberOfDropFiles(int numberOfFiles);
-void sqSetFileInformation(int dropIndex, void *dropFile);
\ No newline at end of file
+void sqSetFileInformation(int dropIndex, void *dropFile);
+void sqDragTriggerData(char *aByteArray, int dataLength, char  
*aFormat, int formatLength);
Index: plugins/SoundPlugin/SoundPlugin.h
===================================================================
--- plugins/SoundPlugin/SoundPlugin.h (revision 1742)
+++ plugins/SoundPlugin/SoundPlugin.h (working copy)
@@ -18,5 +18,10 @@
int snd_StopRecording(void);
double snd_GetRecordingSampleRate(void);
int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int  
bufferSizeInBytes);
-void snd_Volume(double *left, double *right); //
[hidden email] Nov 6th 2000
-void snd_SetVolume(double left, double right);//
[hidden email] Nov 6th 2000
+void snd_Volume(double *left, double *right);  /*  
[hidden email] Nov 6th 2000 */
+void snd_SetVolume(double left, double right); /*  
[hidden email] Nov 6th 2000 */
+
+/* mixer interface */
+int snd_GetSwitch(int id, int captureFlag, int channel);
+int snd_SetSwitch(int id, int captureFlag, int parameter);
+int snd_SetDevice(int id, char *name);
Index: vm/sq.h
===================================================================
--- vm/sq.h (revision 1742)
+++ vm/sq.h (working copy)
@@ -284,10 +284,11 @@
    int windowIndex; /* host window structure */
} sqDragDropFilesEvent;
-#define DragEnter 1 /* drag operation from OS entered Squeak window */
+#define DragEnter 1 /* drag operation from OS entered Squeak window */
#define DragMove 2 /* drag operation from OS moved within Squeak  
window */
-#define DragLeave 3 /* drag operation from OS left Squeak window */
-#define DragDrop 4 /* drag operation dropped contents onto  
Squeak.      */
+#define DragLeave 3 /* drag operation from OS left Squeak window */
+#define DragDrop 4 /* drag operation dropped contents onto Squeak. */
+#define DragRequest 5 /* data request from other app. */
/* menu event */
typedef struct sqMenuEvent

Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Andreas.Raab
 
Looks good to me. Can you say something about the intended use case for
the dnd changes? Looks like you're trying to support drags out of
Squeak? How would the image utilize this?

Cheers,
   - Andreas

Ian Piumarta wrote:

>
> Hi,
>
> I'm about to commit a few changes to the Cross sources to support the
> OLPC VM and its virtual image.  If anyone has any objections, now is the
> time to raise them.
>
> Cheers,
> Ian
>
> Index: plugins/DropPlugin/DropPlugin.h
> ===================================================================
> --- plugins/DropPlugin/DropPlugin.h    (revision 1742)
> +++ plugins/DropPlugin/DropPlugin.h    (working copy)
> @@ -9,4 +9,5 @@
> int dropRequestFileHandle(int dropIndex); /* return READ-ONLY file
> handle OOP or nilObject if error */
> int sqSecFileAccessCallback(void *);
> void sqSetNumberOfDropFiles(int numberOfFiles);
> -void sqSetFileInformation(int dropIndex, void *dropFile);
> \ No newline at end of file
> +void sqSetFileInformation(int dropIndex, void *dropFile);
> +void sqDragTriggerData(char *aByteArray, int dataLength, char *aFormat,
> int formatLength);
> Index: plugins/SoundPlugin/SoundPlugin.h
> ===================================================================
> --- plugins/SoundPlugin/SoundPlugin.h    (revision 1742)
> +++ plugins/SoundPlugin/SoundPlugin.h    (working copy)
> @@ -18,5 +18,10 @@
> int snd_StopRecording(void);
> double snd_GetRecordingSampleRate(void);
> int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int
> bufferSizeInBytes);
> -void snd_Volume(double *left, double *right);
> //[hidden email] Nov 6th 2000
> -void snd_SetVolume(double left, double
> right);//[hidden email] Nov 6th 2000
> +void snd_Volume(double *left, double *right);  /*
> [hidden email] Nov 6th 2000 */
> +void snd_SetVolume(double left, double right); /*
> [hidden email] Nov 6th 2000 */
> +
> +/* mixer interface */
> +int snd_GetSwitch(int id, int captureFlag, int channel);
> +int snd_SetSwitch(int id, int captureFlag, int parameter);
> +int snd_SetDevice(int id, char *name);
> Index: vm/sq.h
> ===================================================================
> --- vm/sq.h    (revision 1742)
> +++ vm/sq.h    (working copy)
> @@ -284,10 +284,11 @@
>    int windowIndex;        /* host window structure */
> } sqDragDropFilesEvent;
> -#define DragEnter    1 /* drag operation from OS entered Squeak
> window     */
> +#define DragEnter    1 /* drag operation from OS entered Squeak window */
> #define DragMove    2 /* drag operation from OS moved within Squeak
> window */
> -#define DragLeave    3 /* drag operation from OS left Squeak window     */
> -#define DragDrop    4 /* drag operation dropped contents onto
> Squeak.      */
> +#define DragLeave    3 /* drag operation from OS left Squeak window */
> +#define DragDrop    4 /* drag operation dropped contents onto Squeak. */
> +#define DragRequest    5 /* data request from other app. */
> /* menu event */
> typedef struct sqMenuEvent
>
Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Takashi Yamamiya
 
Hi Andreas,

On Mon, Apr 21, 2008 at 1:22 PM, Andreas Raab <[hidden email]> wrote:
>
>  Looks good to me. Can you say something about the intended use case for the
> dnd changes? Looks like you're trying to support drags out of Squeak? How
> would the image utilize this?

I added one event type (DragRequest = 5) and three primitives in
DropPlugin for OLPC etoys image.

HandMorph>>primitiveDndOutStart: aByteArray (DropPlugin>>primitiveDndOutStart:)
- Initialize drag out session and tell types (null separated strings) to VM.

HandMorph>>primitiveDndOutAcceptedType (DropPlutin>>primitiveDndOutAcceptedType)
- Answer a type which receiver program accepted.

HandMorph>>primitiveDndOutSend: aByteArray (DropPlugin>>primitiveDndOutSend:)
- Transfar actual data to the receiver.

1) For example, if you are about to drag a morph,
#primitiveDndOutStart: is called with types like
"image/png\0image/gif\0image/bmp". And VM starts drag out session.

2) If some application accepts it, DragRequest event is send to the
image. The image knows accepted type e.g. "img/png" through
#primitiveDndOutAcceptedType then send actual png data with
#primitiveDndOutSend:.

All other internal messy things like canceling the session are handled
inside VM and image don't care about them.

additional code for DropPlugin is:
- http://etoys.laptop.org/svn/trunk/vmm/additionalPlugins.cs
and support codes for unix vm are:
- http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
- http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/vm-display-X11/sqUnixXdnd.c

Cheers,
- Takashi
Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

timrowledge
 

> All other internal messy things like canceling the session are handled
> inside VM and image don't care about them.
Everything sounds fine to me apart from this - I get a touch nervous  
when there is  chance that too much is being put into the VM. Are you  
really sure that it isn't better to let the image handle the messy  
stuff? Remember that it is easier to fix bugs in the image than in the  
VM....

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: LB: connect Line-voltage to BITNET


Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Andreas.Raab
In reply to this post by Takashi Yamamiya
 
Sounds good. Can you by any chance email me enough of the support code
(or point me to an image that has it) so that I can try this out on Windows?

Cheers,
   - Andreas

Takashi Yamamiya wrote:

>  
> Hi Andreas,
>
> On Mon, Apr 21, 2008 at 1:22 PM, Andreas Raab <[hidden email]> wrote:
>>  Looks good to me. Can you say something about the intended use case for the
>> dnd changes? Looks like you're trying to support drags out of Squeak? How
>> would the image utilize this?
>
> I added one event type (DragRequest = 5) and three primitives in
> DropPlugin for OLPC etoys image.
>
> HandMorph>>primitiveDndOutStart: aByteArray (DropPlugin>>primitiveDndOutStart:)
> - Initialize drag out session and tell types (null separated strings) to VM.
>
> HandMorph>>primitiveDndOutAcceptedType (DropPlutin>>primitiveDndOutAcceptedType)
> - Answer a type which receiver program accepted.
>
> HandMorph>>primitiveDndOutSend: aByteArray (DropPlugin>>primitiveDndOutSend:)
> - Transfar actual data to the receiver.
>
> 1) For example, if you are about to drag a morph,
> #primitiveDndOutStart: is called with types like
> "image/png\0image/gif\0image/bmp". And VM starts drag out session.
>
> 2) If some application accepts it, DragRequest event is send to the
> image. The image knows accepted type e.g. "img/png" through
> #primitiveDndOutAcceptedType then send actual png data with
> #primitiveDndOutSend:.
>
> All other internal messy things like canceling the session are handled
> inside VM and image don't care about them.
>
> additional code for DropPlugin is:
> - http://etoys.laptop.org/svn/trunk/vmm/additionalPlugins.cs
> and support codes for unix vm are:
> - http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
> - http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/vm-display-X11/sqUnixXdnd.c
>
> Cheers,
> - Takashi
>
Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Takashi Yamamiya
In reply to this post by Takashi Yamamiya
 
On Mon, Apr 21, 2008 at 4:21 PM, tim Rowledge <[hidden email]> wrote:
>
> > All other internal messy things like canceling the session are handled
> > inside VM and image don't care about them.
> >
>  Everything sounds fine to me apart from this - I get a touch nervous when
> there is  chance that too much is being put into the VM. Are you really sure
> that it isn't better to let the image handle the messy stuff? Remember that
> it is easier to fix bugs in the image than in the VM....

I'm not sure which is better. But drag and drop is too platform specific, so
I couldn't decide what kind of low level API is needed to control by
image. And I just
provided small interface as well as possible. Maybe it will be clear
when someone
writes drag out for other platform.

Cheers,
- Takashi
Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Takashi Yamamiya
In reply to this post by Andreas.Raab
 
An image with VMMaker is http://etoys.laptop.org/svn/trunk/vmm/
(olpc-vmm.image and olpc-vmm.changes)

Image side code is http://etoys.laptop.org/svn/trunk/etoys/
(etoys-dev.image and etoys.changes, you might need to update)

But I don't have any code running on Windows...

Cheers,
- Takashi

On Mon, Apr 21, 2008 at 4:41 PM, Andreas Raab <[hidden email]> wrote:

>
>  Sounds good. Can you by any chance email me enough of the support code (or
> point me to an image that has it) so that I can try this out on Windows?
>
>  Cheers,
>   - Andreas
>
>  Takashi Yamamiya wrote:
>
> >  Hi Andreas,
> >
> > On Mon, Apr 21, 2008 at 1:22 PM, Andreas Raab <[hidden email]> wrote:
> >
> > >  Looks good to me. Can you say something about the intended use case for
> the
> > > dnd changes? Looks like you're trying to support drags out of Squeak?
> How
> > > would the image utilize this?
> > >
> >
> > I added one event type (DragRequest = 5) and three primitives in
> > DropPlugin for OLPC etoys image.
> >
> > HandMorph>>primitiveDndOutStart: aByteArray
> (DropPlugin>>primitiveDndOutStart:)
> > - Initialize drag out session and tell types (null separated strings) to
> VM.
> >
> > HandMorph>>primitiveDndOutAcceptedType
> (DropPlutin>>primitiveDndOutAcceptedType)
> > - Answer a type which receiver program accepted.
> >
> > HandMorph>>primitiveDndOutSend: aByteArray
> (DropPlugin>>primitiveDndOutSend:)
> > - Transfar actual data to the receiver.
> >
> > 1) For example, if you are about to drag a morph,
> > #primitiveDndOutStart: is called with types like
> > "image/png\0image/gif\0image/bmp". And VM starts drag out session.
> >
> > 2) If some application accepts it, DragRequest event is send to the
> > image. The image knows accepted type e.g. "img/png" through
> > #primitiveDndOutAcceptedType then send actual png data with
> > #primitiveDndOutSend:.
> >
> > All other internal messy things like canceling the session are handled
> > inside VM and image don't care about them.
> >
> > additional code for DropPlugin is:
> > - http://etoys.laptop.org/svn/trunk/vmm/additionalPlugins.cs
> > and support codes for unix vm are:
> > -
> http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/plugins/DropPlugin/sqUnixDragDrop.c
> > -
> http://squeakvm.org/svn/squeak/branches/olpc/platforms/unix/vm-display-X11/sqUnixXdnd.c
> >
Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

johnmci
In reply to this post by Takashi Yamamiya
 

On Apr 21, 2008, at 3:41 PM, Takashi Yamamiya wrote:

> 1) For example, if you are about to drag a morph,
> #primitiveDndOutStart: is called with types like
> "image/png\0image/gif\0image/bmp". And VM starts drag out session.
>
> 2) If some application accepts it, DragRequest event is send to the
> image. The image knows accepted type e.g. "img/png" through
> #primitiveDndOutAcceptedType then send actual png data with
> #primitiveDndOutSend:.


Ok I assume these are just mime type strings we supply or get from the  
VM api?
So are these then cross platform, or very specific to the operating  
system?

image/png seems rather mimetype generic where as image/png555 would  
not be friendly...
and I assume your "img/png" was a typo?

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


Reply | Threaded
Open this post in threaded view
|

Re: changes to Cross headers files

Takashi Yamamiya
 
On Mon, Apr 21, 2008 at 5:20 PM, John M McIntosh
<[hidden email]> wrote:

>
>  On Apr 21, 2008, at 3:41 PM, Takashi Yamamiya wrote:
>
> > 1) For example, if you are about to drag a morph,
> > #primitiveDndOutStart: is called with types like
> > "image/png\0image/gif\0image/bmp". And VM starts drag out session.
> >
> > 2) If some application accepts it, DragRequest event is send to the
> > image. The image knows accepted type e.g. "img/png" through
> > #primitiveDndOutAcceptedType then send actual png data with
> > #primitiveDndOutSend:.
>
>  Ok I assume these are just mime type strings we supply or get from the VM
> api?
>  So are these then cross platform, or very specific to the operating system?

Types are just mime type strings. In unix (XDnD), many applications
use mime types in
drag and drop by chance. I guess mime types can be used in other platforms, too.

>  image/png seems rather mimetype generic where as image/png555 would not be
> friendly...
>  and I assume your "img/png" was a typo?

Ah, yes. It was a typo.

Cheers,
- Takashi