What Is Linux's Native Gui API

What is Linux’s native GUI API?

In Linux the graphical user interface is not a part of the operating system. The graphical user interface found on most Linux desktops is provided by software called the X Window System, which defines a device independent way of dealing with screens, keyboards and pointer devices.

X Window defines a network protocol for communication, and any program that knows how to "speak" this protocol can use it. There is a C library called Xlib that makes it easier to use this protocol, so Xlib is kind of the native GUI API. Xlib is not the only way to access an X Window server; there is also XCB.

Toolkit libraries such as GTK+ (used by GNOME) and Qt (used by KDE), built on top of Xlib, are used because they are easier to program with. For example they give you a consistent look and feel across applications, make it easier to use drag-and-drop, provide components standard to a modern desktop environment, and so on.

How X draws on the screen internally depends on the implementation. X.org has a device independent part and a device dependent part. The former manages screen resources such as windows, while the latter communicates with the graphics card driver, usually a kernel module. The communication may happen over direct memory access or through system calls to the kernel. The driver translates the commands into a form that the hardware on the card understands.

As of 2013, a new window system called Wayland is starting to become usable, and many distributions have said they will at some point migrate to it, though there is still no clear schedule. This system is based on OpenGL/ES API, which means that in the future OpenGL will be the "native GUI API" in Linux. Work is being done to port GTK+ and QT to Wayland, so that current popular applications and desktop systems would need minimal changes. The applications that cannot be ported will be supported through an X11 server, much like OS X supports X11 apps through Xquartz. The GTK+ port is expected to be finished within a year, while Qt 5 already has complete Wayland support.

To further complicate matters, Ubuntu has announced they are developing a new system called Mir because of problems they perceive with Wayland. This window system is also based on the OpenGL/ES API.

How do you make linux GUI's?

X is a hideous layer to program for and, despite your intent to avoid Java, QT or any of the excellent UI abstraction layers, you'll be doing yourself a disservice by coding to that level. I've done it (a long time ago when Motif was in its infancy on the platform we were using) and I would not do it again if there was an easier way.

Your use of the phrase "native programming" confuses me a little. If you want to learn native programming, it's to the APIs that you choose to call. Using similar reasoning, you shouldn't be coding in C either, instead opting for assembler (or direct machine code) since C provides an abstraction to the hardware.

If you want to learn X programming, that's fine. You'll end up with a lot more control over your interface but almost everyone else will be out-performing you in terms of delivery of software. Myself, I'd prefer to code to a higher-level API that I can use on many platforms - it gives me both faster delivery times and more market potential.

You don't build a house out of atoms, you build it out of bricks. My suggestion is to use the tools, that's what they're there for.

How to use GUI in C?

For pure C, you could use GTK+, but if you're familiar with C++ too, i 'd recommend Qt Framework from Nokia. There are over 100 of youtube videos for mastering Qt. Follow this link: Qt training

How are GUI's for OS created

This is a very broad question and as far as I know that's not the ideal format for a StackOverflow question. If you have searched Google then elaborate why the Google search results weren't sufficient, and ideally elaborate which specific things about the search results you are confused with, if anything. Also it would have been a good idea to search StackOverflow itself for similar questions before creating a new question. See the "Asking" page here: https://stackoverflow.com/help/how-to-ask

That said the GUI you're asking about isn't necessarily part of the operating system. Strictly speaking the operating system refers to the kernel, which is the software that manages hardware devices and scheduling of processes, and a user interface which may or may not involve graphics (rather than just a command line interface). Though in common parlance the "operating system" can refer to both the kernel and a GUI consisting of a windowing system and a desktop environment.

Variations of this question appear to have already been asked around StackOverflow and StackExchange. See these pages:

What is Linux’s native GUI API?

How does the *NIX GUI work?

https://unix.stackexchange.com/questions/250375/how-does-gui-in-unix-linux-actually-work

https://superuser.com/questions/1173074/how-do-the-componets-of-a-gui-work-in-linux

Writing generic/native look GUI linux application

I don't think so, because I am not sure that any native look is well defined. However, toolkits like GTK (used by Gnome & XFCE) and Qt (used by KDE) are somehow standardizing some "common" (or at least usual) look... (and indeed, both Gnome and KDE define some visual and behavior guides, which are incompatible).

Did you consider making a web application -perhaps using FastCGI, or even some HTTP server library like libonion or Wt? It would use the usual browser "look and feel" ...

Notice that thanks to X11 and conventions like EWMH, applications written in GTK can inter-operate with applications written in Qt (and vice-versa), even if they are looking slightly different... And as commented by andlabs, you might make appropriate themes for them to make them look even more similar.

Also, several Unix and Linux applications (even recent ones like git) are mostly command line applications (which does the bulk of the work), with some smaller GUI wrappers, perhaps communicating with the CLI application (e.g. thru pipes). Perhaps you could organize your application likewise: have most of the work done by some command line executable and add some small
GUI wrappers above (you could then code one wrapper in GTK for Gnome and another wrapper in Qt for KDE). You could even go even further by designing and developing a free software library implementing your features, leaving the bulk of the GUI work to other developers (and accepting improvements to your free software library)?

Native gui toolkit for Ubuntu, past, present, and future

Linux distros don't have a "native toolkit". Qt and GTK call the XLib, but the switch to Wayland is in progress, and Mir looks like a terrible idea for me. Anyway, the real low-level thing is: XLib, Wayland, or Mir. And the GUI toolkits, GTK, Qt are above these, and transparently use the right backend. Other toolkits like wxWidgets are on top of the "native toolkit" of the platform. For Linux, they chose GTK.

Ubuntu is moving to Qt, but was previously GTK, so you can't predict what it will be in the future. But the integration of your app depends on what your user runs as a desktop environment, so Qt or GTK are the best options. Qt is better for Windows portability, though.

What api should I use for Gui development, c++

No, you need a platform independent GUI framework like Qt.

This Qt GUI code works on Windows, Linux and MacOS.

#include<QApplication>
#include<QLabel>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QLabel label;

label.setText("Hello World");

label.show();

a.exec();
}

http://en.wikipedia.org/wiki/Qt_(framework)



Related Topics



Leave a reply



Submit