Re: [AD] Platform specific functions in A5 [was Re: Windows Addition for Message Parsing]

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wednesday 08 October 2008 06:04:14 pm Evert Glebbeek wrote:
> I think I agree with this - although it would be a bit silly if we
> know it's only ever going to work on one system (the again, did
> scrolling displays really work on anything other than DOS? I don't
> mean the hack job that was in the X11 port).

But can we ever really know if something will never be available on another 
platform? I mean, Allegro4 has win_set_window, but there's no option for 
other platforms despite the capability being there.

Scrolling displays are more of the odd case, because that was existing 
functionality that was removed at the OS level, not something that just 
wasn't yet supported.

> Having more platform specific functions makes it harder to write
> portable code, but having platform specific functions that maskerade
> as platform neutral functions is arguably worse because they suggest
> functionality that isn't there.

As long as the function can fail, and it's not make-or-break functionality 
(ie. the app can still run even if the function doesn't work), I don't really 
see the problem. Even if that functionality isn't there now, it could very 
well be added later. And it would be 100x easier to do it if the Allegro 
methods are already portable, instead of adding another platform-specific 
function, or introducing a cross-platform function that won't help existing 
programs.

> > Does it have to be, though? If it can be exposed in a platform-
> > neutral way,
> > and be useful on multiple platforms, IMO, we should try to make it
> > platform
> > neutral.
>
> Apparently, intercepting messages cannot really be abstracted into a
> platform neutral function, unfortunately. I figured it'd be very hard
> to do, but thought we should discuss it anyway.

I wouldn't say its impossible. In the case of a wndproc, I don't see why 
Allegro couldn't take a callback that, on Windows, is called first in its 
WndProc, and on other OSs, called when it receives an event. Commonly known 
messages could be translated (eg. WM_QUIT -> ALLEGRO_QUIT), and other 
messages could be passed as system-exclusive (eg. WM_TIMER -> 
ALLEGRO_SYS_EXCLUSIVE w/ WM_TIMER as a parameter).




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/