Gui Development in Linux

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.

GUI development In Linux

I suggest gtkmm. It's modern, portable and object oriented. And it doesn't use a weird pre-compiler :)

gui development toolkit for linux and windows

For cross-platform programming you might want to look into JVM based languages (most notably Java, but Scala, Groovy etc. might be fine) which provide the Swing gui framework.

Additionally there are other platform independent languages like Python etc.

As for C++ there GUI toolkits like Qt or GTK+.

Comparison of GUI development tools for linux

Qt is your best bet.

  1. The Qt license states

    Nokia grants Licensee a non-exclusive,
    royalty-free right to reproduce and
    distribute the object code form of
    Redistributables for execution on the
    specified Platforms.

    So you should have no problem about license

  2. It's written in/for C++

  3. It's not so hard to learn
  4. The library (althought modular) contains everything you need to develop a full-blown GUI and also some extra (XML, networking...)
  5. I don't know about this, sorry, but I don't think there are any dependencies (on the client side)
  6. The look and feel is native to the enviroment for which the application is compiled (that is Windows look&feel on Windows, OSX look&feel on OSX)
  7. Qt is supported on a vast range of desktop enviroments

Linux GUI development

Your best bet may be to port it to a cross-platform widget library such as wxWidgets, which would give you portability to any platform wxWidgets supports.

It's also important to make the distinction between Gnome libraries and GTK, and likewise KDE libraries and Qt. If you write the code to use GTK or Qt, it should work fine for users of any desktop environment, including less popular ones like XFCE. If you use other Gnome or KDE-specific libraries to do non-widget-related tasks, your app would be less portable between desktop environments.

Is it possible to develop a GUI on Linux Embedded with just HTML, CSS and JS?

I've just written an article listing the top 5 libraries for creating GUI on Embedded Linux. I've only mentioned one tool that renders HTML UI, the Sciter engine. It's much more compact than Webkit or Chromium. The owner of the project, Andrew Fedoniouk, recently released a new version called Sciter.Lite that will support embedded devices. Check out these two resources.

https://sciter.com/sciter-lite-is-published/

https://sciter.com/windowless-sciter-android-and-iot-devices/

Demos are already available on their GitHub

  • sdk/bin.lnx/x64lite
  • sdk/demos.lite

You don't have to limit yourself to HTML UI, check out the other tools I've recommended. All of them have a free version. For rich UI, I think HTML UI is easier. I mean, Sciter Notes doesn't look to shabby and it's just under 5Mb for Win, Linux and Mac. But the backend is C++. For more minimal hardware, you'll have to look into the C/C++ toolkits I've listed. TotalCross are planning to support Android XML but has not been released yet. So you can check on them also.

Oh. Almost forgot. Two whitepapers comparing QML and HTML5 were published in 2017. Qt requires you to register so I'll just give you the links so that you can download them without registering :)

Paper 1: Qt QML v HTML5 –a practical comparison

Published on May 2017 by Sequality Software Engineering an Austrian firm that is a Qt partner and does Qt consultancy.

Downlink Link 1, Download Link 2

Here is a review of the paper by a software engineer, Amir Shrestha, who provided the first download link. There is more discussion at Hacker News. There was also an interesting discussion thread in a YouTube video about the comparison. You can read the YT comment section but first search "Andrew MacAulay" and read that thread. He was the lead engineer for the autopilot system for the F-18 jets and has worked in other senior embedded roles.

Paper 2: Qt or HTML5? A Million Dollar Question

Published on Oct 2, 2017, by Burkhard Stubert a Qt consultant and developer.

Download Link

Here is the discussion on Hacker News.

An interesting piece of information I found in the second paper is that 90%+ of all home appliances are powered by micro-controllers with no OS or a very minimal RTOS.

Another interesting piece of information I discovered while writing my article, is that Micrium OS and components are now open-source under Apache 2.0. It has its own GUI toolkit written in C but it only targets Micrium OS and not embedded Linux. If developers start adopting Micrium OS (it was already quite popular in the industry and even launched in space) perhaps you can start looking into it too.

How to make Linux C++ GUI apps

I personally prefer QT as I prefer working with the signal/slots mechanism and just find it easy to develop applications quickly with it. Some of your other options would be wxWidgets and GTK+.



Related Topics



Leave a reply



Submit