Haiku - FreeDesktop.org cooperation proposal (fwd)
François Revol
revol at free.fr
Thu May 8 05:43:17 PDT 2008
Hi,
> As a teenager, I read about BeOS in a Finnish computer magazine. It
> sounded really cool, so when my parents told me they were going to
> buy a
> new family computer, I asked the computer store for a PC that could
> run
> BeOS. The new computer had Windows on it, but I was able to run BeOS
> with the Windows installer. I never really became a BeOS user, but
> there
> was something attractive in it and thus I've been secretly following
> Haiku development from the shadows. I'm happy to see you on this list
> and I hope fruitful co-operation will arise.
As for me I heard about BeOS in magazines and once managed to install
an R4 demo CD (which wasn't meant to but eh) on my K6-2... then after a
failed linux upgrade (a redhat that screwed up my slackware alongside
or something alike) and being frustrated by a kernel lockup when
testing a driver I wrote (linux wasn't preemptible at that time) I went
on trying BeOS and staid with it since then. I worked at yellowTAB GmbH
for some time, trying to revive the original one while working on
Haiku, but it eventually failed.
It's nice to see ppl interested.
> > * Haiku can certainly adhere to some freedesktop.org standards
> > where it
> > is relevant.
>
> Today I'm using mainly Ubuntu and I have been working on the
> freedesktop.org clipboard specification. The current version should
> be
> more general than some older editions. Iirc the clipboard management
> in
> BeOS was fairly simple, so it might be possible for Haiku to respect
> the
> specification (at least to some degree). Please give me your opinion
> on
> the matter. The current version is available from
> http://lists.freedesktop.org/archives/xdg/2007-November/008985.html
While we cannot use X11 protocols, maybe we can agree on common
mimetypes and encoding.
BeOS (and thus Haiku) has been using UTF-8 for a decade already, and I
welcome the decision of most Linux projects and devs to finally join
the club (except some ISO fanatic IRC ops I know :D).
BeOS (and Haiku) also adopted mime types very early for its many
internal uses, including application to file types mapping, and
clipboard and DnD handling.
Applications each have their own mime signature, the usual format
being:
application/x-vnd.VendorName-AppName
I'll have a look at the specs, but for now here is a glimpse of how
Haiku handles clipboards:
As for the clipboard in BeOS and Haiku, it is accessed through a
BClipboard object, the system one being refered to from a global
be_clipboard pointer.
The class is described here:
http://www.haiku-os.org/legacy-docs/bebook/BClipboard_Overview.html
The data within is contained in a BMessage object.
The message usually contains the raw data expressed in several mime
types.
For example the previous paragraph copied from my mail client is stored
in this way:
BMessage('clip') {
text/plain = 'MIME' 51 bytes:
0x000000: 54686520 64617461 20776974 68696e20 'The data within
'
0x000010: 69732063 6f6e7461 696e6564 20696e20 'is contained in
'
0x000020: 6120424d 65737361 6765206f 626a6563 'a BMessage
objec'
0x000030: 742e0a 't..
'
application/x-vnd.Be-text_run_array = 'MIME' 60 bytes:
0x000000: 01000000 00000000 c01669ec 06000000
'..........i.....'
0x000010: 00003041 00000000 00000000 02004000
'..0A.......... at .'
0x000020: 00000000 00fe1641 00605240 00000000
'.......A.`R at ....'
0x000030: 10000000 00000000 000000ff '............
'
}
That is, one data of type 'MIME' (it's a 4CC), with name "text/plain",
that contains the plain text version, and one field for a custom mime
type that holds the flattened color and font information from the text
control.
Here text/plain is always UTF-8.
Other applications might also add text/html and/or text/rtf versions,
image applications usually use raw flattened data from the BBitmap
class, with mimetype image/x-be-bitmap, but can potentially also export
png through translators (in fact, the DnD protocol uses a similar
mechanism with a BMessage object, but there is a first message sent
with a list of the mimetypes the application can send, either directly
or through a file, then when it gets replied to it answers with a
cliboard-like message with the requested mimetypes. For imaging apps
the mimetype list is generated from the Translation kit's supporting
addons for png, gif, ...).
Only exporting raw bitmap data is mostly to avoid performance loss to
convert to another type when it's not certain targets will support it.
I suppose we could agree to also export to image/png (or is it /x-png
?) by default in our apps to simplify interfacing later on, that can be
discussed.
As 2nd example, our Sudoku game can copy the current game to the
clipboard as both image (with several mimetypes and as direct fields in
the message to support some legacy apps) and (plain and html) text, and
even a vector representation (text/x-vnd.Be-picture... oops, just
noticed that shouldn't be text/ !):
BMessage(0x00000000) {
class = string("BBitmap", 8 bytes)
_frame = BRect(0.0, 0.0)-(369.0, 369.0)
_cspace = int32(8 or 0x8)
_bmflags = int32(2 or 0x2)
_rowbytes = int32(1480 or 0x5c8)
_data = 'RAWT' 547600 bytes:
0x000000: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
[...skipped...]
0x085b00: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
image/bitmap = BMessage(0x00000000) {
class = string("BBitmap", 8 bytes)
_frame = BRect(0.0, 0.0)-(369.0, 369.0)
_cspace = int32(8 or 0x8)
_bmflags = int32(2 or 0x2)
_rowbytes = int32(1480 or 0x5c8)
_data = 'RAWT' 547600 bytes:
0x000000: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
[...]
0x085b00: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
}
image/x-be-bitmap = BMessage(0x00000000) {
class = string("BBitmap", 8 bytes)
_frame = BRect(0.0, 0.0)-(369.0, 369.0)
_cspace = int32(8 or 0x8)
_bmflags = int32(2 or 0x2)
_rowbytes = int32(1480 or 0x5c8)
_data = 'RAWT' 547600 bytes:
0x000000: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
[...]
0x085b00: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
}
image/x-vnd.Be-bitmap = BMessage(0x00000000) {
class = string("BBitmap", 8 bytes)
_frame = BRect(0.0, 0.0)-(369.0, 369.0)
_cspace = int32(8 or 0x8)
_bmflags = int32(2 or 0x2)
_rowbytes = int32(1480 or 0x5c8)
_data = 'RAWT' 547600 bytes:
0x000000: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
[...]
0x085b00: f0ffff00 f0ffff00 f0ffff00 f0ffff00
'................'
}
text/html = 'MIME' 6659 bytes:
0x000000: 3c68746d 6c3e0a3c 68656164 3e0a3c21 '<html>.<head>.<
!'
0x000010: 2d2d2057 72697474 656e2062 79205375 '-- Written by
Su'
[...]
0x0019f0: 653e0a0a 3c2f626f 64793e3c 2f68746d 'e>..</body></
htm'
0x001a00: 6c3e0a 'l>.
'
text/plain = 'MIME' 129 bytes:
0x000000: 23205772 69747465 6e206279 20537564 '# Written by
Sud'
0x000010: 6f6b750a 0a323031 20393037 20303634 'oku..201 907
064'
[...]
0x000080: 0a '.
'
text/x-vnd.Be-picture = 'MIME' 4600 bytes:
0x000000: 02000000 00000000 00000000 e8110000
'................'
[...]
0x0011f0: 00000000 00000000 '........
'
}
François.
More information about the xdg
mailing list