-   Programming (
-   -   API for X that works with KDE XFCE etc. (

binarybob0001 11-12-2006 04:00 AM

API for X that works with KDE XFCE etc.
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?

Simon Bridge 11-13-2006 01:31 AM


It dosn't exist. Instead, you have access to the entire source code for the entire thing.

Of course, you could always use java.

binarybob0001 11-16-2006 02:23 AM

You mean the KDE, Gnome and XFCE do not develop off the X interface? Or do you mean that KDE, Gnome and XFCE all provide their own API and I should not use X?

Simon Bridge 11-16-2006 06:17 AM

Neither - I mean there is no equivalent for the Windows API in Linux. You get API functionality through the libraries.

95se 11-16-2006 09:04 AM

^ there is Wine.

paulsm4 11-16-2006 03:45 PM

binarybob0001 -

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.

'Hope that helps .. PSM

Simon Bridge 11-17-2006 03:35 AM

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...)

binarybob0001 11-17-2006 04:12 AM

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.

Thanks for the help.

Simon Bridge 11-17-2006 04:36 AM

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

binarybob0001 11-18-2006 05:52 AM

Thanks Simon, you have helped my tremendously. I am definitely going to look at that book too.
