Multiple-OS Header Access

Adam D. Ruppe destructionator at gmail.com
Wed Feb 12 13:32:30 PST 2014


On Wednesday, 12 February 2014 at 18:26:45 UTC, Jakob Ovrum wrote:
> I find POSIX much more palatable than the Windows API.

POSIX is ok for what it does, but it doesn't actually do very 
much. The topics here, for example, are not standardized (I'm 
pretty sure anyway). Even de-facto standards like X11 is pretty 
minimal; you end having to do things yourself or get random third 
party libraries (which are often poorly documented and the user 
may not have installed!). Biggest examples are GTK and Qt for 
doing gui widgets since X doesn't do that, but even for basic 
drawing, X is pretty minimal... yet pretty complex in the stuff 
you have to get right to do that minimal amount of work.

An example that irks me is the lack of "draw this image sized for 
this rectangle"; there's nothing like StretchBlt from Windows. 
Instead, you need to create an image (being sure to get the right 
format) and resize it yourself before sending those bits down to 
the display. (which btw cannot be compressed in the X protocol 
itself!)


But generally, I find when I have a task I need to get done, 
Win32 offers some kind of function to do it and it doesn't take 
too long to find it on MSDN. It might be an ugly function with a 
dozen arguments wrapped up in a struct, but it gets the job done 
and just works for the user.

On Linux, gotta go hunting for third party libraries... which 
might not work on the user's environment... or cannot complete 
the task at all (terminal emulators SUCK! want a key up 
notification? too bad) or can only very inefficiently 
(anti-aliased text on X for example... you get a screenshot, draw 
the text, then draw the modified image. The network won't be very 
transparent through that process, I tell you what.)

> Though I guess GUI programming can be a little more involved, 
> having to figure out which libraries to code against.

Yeah, that's a big problem too.


More information about the Digitalmars-d-learn mailing list