ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
About a year ago, I was working on a library for Windows which would make my life much easier. I simply used the Windows API. I can't seem to find an equivalent in Linux. Everyone wants to use Qt, GTK+, wxWidgets or some other library to design their apps. Then I hear people saying not use Qt because it uses KDE libraries which must be loaded by XFCE or another windows manager and therefore increases memory consumption bla, bla. I want to take things back a step and design the library (I know I'm reinventing the wheel, but I have learned a tremendous amount about Windows this way and hope to do the same with Linux and maybe, just maybe there is a one in a million chance I can make a better library). Where do I start?
The biggest difference between "the Windows Platform API" (aka "Win32") and Linux is that Win32 is basically one, big, "everything and the kitchen sink" API that includes both OS-level as well as GUI stuff.
But yes, you can safely say that "Xlib" is the Linux equivalent of Win32 for "GUI stuff", just as you can safely say that the GCC runtime is the Linux equivalent of Win32's "OS stuff".
And yes, KDE, Gnome, XFCE (and many others) all sit on top of Xlib.
OT - slightly: I understand that ATI complained about the lack of a windows-like api for the linux kernel in a conference earlier this year. The advantage would be that they wouldn't have to revise their drivers for each individual kernel ... the responce, of course, is that if they open-sourced their drivers, the hackers would do it for them.
(ATI then went on to state that 3D graphics is too complicated for the open-source community to make any contribution... that was an interesting conference.)
Anyway, it can be tricky for programmers used to windows to understand why there isn't a similar all-in-one for linux. It's soo hany, after all. (OTOH: 3rd party software is notoriously shakey under windows...)
See, I'm learning a lot already If all the GUI stuff sits on Xlib, then if I make an Xlib program it should run in KDE, Gnome and XFCE? I imagine a problem would be that KDE probably has a library built on top of Xlib to provide say a standard form of dialog box. Which means if I made my own library on top of Xlib, I may not be able to get the appearance to match the current running windows managers appearance. Is this a valid problem, or are there ways of taking care of these differences?
Just one other thing. Do any of you know of books or websites where I can find the kind of information I'm looking for. I really hate to bug others with (probably stupid) questions if it can be avoided.
There are ways of tying in with the current running windows manager as well.
gnome uses gtk and kde uses qt and so forth. I understand that if you issue an instruction to draw a window (say) of a given size and so on, this will get passed to the appropriate windows manager and thus get drawn by it. So anything basic should come out right.
Xlib Programming Manual
By Adrian Nye, Tim O'Reilly