Category Archives: Development

Since we’re using Openbox as our default window manager, we need a GUI way to configure it. Previously, we have a GUI config tool for OpenBox named obconf, which is based on gtk+ 2 and libglade. However, since we plan to use Qt, and gtk+ 2 is no longer officially supported by its upstream, a Qt port is wanted.
Hence, as part of LXDE-Qt project, I started a Qt port of obconf and that’s obconf-qt.
It’s a pure Qt program so it works as well outside LXDE-Qt. It’s also useful for the upcoming razor-qt 0.6.

After posting a preview screenshot for LXDE-Qt, I got quite a lot of feedback from various sources. Generally the responses from the users are positive, but there are also some people saying that LXDE is no longer lightweight.

Please, in the free world we’re all friends and let’s not spread FUDs to hurt each other. I’m not going to respond to groundless accuse or get involved in toolkit wars. Just see the screenshot.

This screenshot is done for a cleanly installed Debian testing system running LXDE-Qt after a cold boot. The Qt theme engine used is “CleanLook”.

The command “free -h” shows that 252 MB is in use. However, most of the space is used for buffers and caches. After excluding caches and buffers, the memory usage is 91 MB. On the same machine, LXDE gtk+ version uses 86 MB. Will you call this “bloated”? Please note that I open “lxterminal”, a GTK+ 2 terminal emulator, to execute the “free” command. That means doing this also loads GTK+ so the actual memory usage should be lower than this. Besides, I’m using zh_TW locale since I’m from Taiwan and we use traditional Chinese here. That means, I also have Chinese fonts and input methods loaded in the memory. If you’re a western user, you probably don’t need them and can save a little bit here.

By default, similar setting under Ubuntu will use around 200 MB of RAM. That’s caused by differences between distros, not the bloat of LXDE. So, please stop spreading unfounded FUDs. Qt is designed for use with embedded systems and cell phones. How fat and resource hungry can it be? It’s the way you use it that really matters.

Delivering a good lightweight desktop is always our goal no matter what approach we’re using. So stay tunned and be confident.

Many users have read about our recent Qt-related work in prior blog posts.
The GTK+ version of LXDE is still under development, but we did some experiments with Qt, too. Now I have some things to show you.
Here is a preview screenshot for LXDE-Qt.

At the bottom of the screen is lxpanel-qt, the Qt port of lxpanel. Now it basically works, but it’s still rough and needs much polishing. Besides, there are no GUI configuration tools for it yet. Editing the xml config file manually is needed. Later there will be preferences dialogs as the old gtk+ version of lxpanel. Most of the major applets already work. However, don’t expect too much!
It’s still a work in progress and it can be better in the future.

In the middle of the screen is PCManFM-Qt, the Qt port of the PCManFM file manager. It looks very similar to the original gtk+ version. The desktop wallpaper and icons are also managed by PCManFM-Qt, just like what the gtk+ version does.
The memory usage of PCManFM-Qt is slightly higher than that of the gtk+ 2 version, but the difference is not very significant. The overall performance is similar to the original gtk+ 2 version. Now it has most of the features of the original one and is almost ready for daily use. \o/

On the right side of the screen is the new Qt-based image view, LxImage-Qt.
It’s not really a port of the original gtk+ GPicView. I regard it the successor of GPicView in the Qt world. It works better than GPicView and is as fast.

Most of the work demonstrated in the screenshot is still in our git repository and is not ready for a new stable release, but there is really much progress and LXDE-Qt is no more a plan or a concept. It’s a real project that gradually shapes.

OK, back to what most user will concern, the resource usage.
To be honest, migrating to Qt will cause mild elevation of memory usage compared to the old Gtk+ 2 version. Don’t jump to the conclusion too soon. Migrating to gtk+ 3 also causes similar increase of resource usage.
Since gtk+ 2 is no longer supported by its developer and is now being deprecated, porting to Qt is not a bad idea at the moment.
Besides, the slightly higher memory usage is still acceptable for most of the existing old machines. The real resource usage may differ a lot among different Linux distros. For example, Ubuntu-based distros running LXDE tends to use more memory than ArchLinux-based ones. So more testing and real benchmarks are needed before making a conclusion on this.

Anyway, glad to share with you what we already done. Hope that you like it.
Long live LXDE!

Edited on 2013-07-04
Answer the questions in the comments of this blog entry:

Cooperation with razor-qt is going on. We subscribed razor-qt google groups and discussed about possible cooperation earlier. Currently, the ported LXDE components are designed with Razor-Qt in mind. For example, PCManFM-Qt and LxImage-Qt will reads razor-qt config file when running in razor-qt session. We’ll try to keep the interchangeability between the two DEs. Further integration is also possible. Actually, I personally am running a mixed desktop with LXDE-Qt + Razor-Qt components on my laptop. Components from the both DE blends well.

The version of Qt supported now is Qt 4. I’m going to skip Qt 5 and wait for Qt 5.1. Qt4 and Qt5 are compatible in many areas and porting to Qt5 should be easy in most of the cases. Unfortunately, this is not the case when you use X11-related stuff. Qt 5 removed many X11-related APIs and there are no direct equivalent methods. So the porting is not painless for desktop environments. In addition, some freedesktop.org specs are designed to work with X11 only, such as the EWMH/NETWM spec and Xsettings spec. To port to Wayland, these problems need to be solved first. Gnome and KDE guys will fix them so we can just wait. Then why Qt 5.1? Because Qt 5.1 added back the once-removed X11-related APIs. So porting from Qt 4 to Qt 5.1 should be the most smooth path. It takes time for distros to adopt Qt 5.1, though.

As many people know, a Qt port of PCManFM is under heavy development. Although we released PCManFM-Qt 0.1 previously, it contains some bugs and memory leaks. Most of the issues are already solved in the latest source code in our online git repository and will be available in the next release. However, the new code depends on the latest libfm 1.2, which is not released yet. Due to the small delay of libfm release, the new release for PCManFM-Qt cannot be made at the moment. Brave users who cannot wait for the final release are encouraged to try the latest git version of libfm and PCManFM-Qt to get the latest features and fixes.

Here is a short list of what’s in the latest git version (and will be in the next release):

Fix several important memory leaks in version 0.1

Some optimizations for memory usage and speed are done

Full thumbnail support (can show thumbnails for image files and other formats with external thumbnailer installed)

Extract thumbnails from EXIF data of jpeg files (via libfm 1.2)

Optimize column widths of detailed list view automatically

Correctly handle desktop icons when a work area is set

Detects icon theme automatically according to current desktop environment. No need to set an icon theme manually in LXDE, XFCE, Gnome, and Razor-Qt.

Some other small bug fixse

The current code of PCManFM-Qt in the git repo is nearly ready for daily use. The memory usage and overall performance are acceptable, too. When Andriy finishes libfm 1.2 and makes a new release, I’ll make one for PCManFM-Qt at the same time. Before that, users are encouraged to try the git version.

Since I started learning Qt recently, I noted some issues when trying to port Gtk+ programs to Qt. There are tons of tutorials for Gtk+ and Qt, but a guide for porting is lacking. Most of the articles comparing Gtk+ and Qt did not go into detailed issues people will encounter during coding.

To help people porting their Gtk+ programs to Qt, I just started a wiki page documenting what I’ve learned so far.

commonly used GtkWidget classes. Since I cannot find a similar list with Google, I built one. This is useless for experts, but it’s very handy and helpful for Qt beginners who already know Gtk+. The mapping between Gtk+ and Qt classes is not yet finished, but I’ll try to make it complete soon.

I also documented things you need to know to safely mix glib/gio/GObject code with Qt. Later I’ll add docs describing how the translation systems differ.

I hope that developers interested in this topic can help edit the wiki

page to make it more complete and free from errors. It’s still a work in progress but I hope it helps someone as more and more people are using Qt and some more LXDE components *might* get Qt ports later. BTW, since Ubuntu guys is moving toward Qt, this also helps them.

P.S. When running the program for the first time, please choose an icon theme from the [Edit] / [Preferences] menu. Otherwise you’ll get no file icons.

If you install the program into /usr/local, don’t forget to run “ldconfig” after installation, or libfm-qt won’t be correctly loaded by the loader.

This release contains no thumbnail support yet.

However a fully working thumbnail support is already in the git.

Because this requires some changes to the upstream libfm library,

it’s scheduled for the next release and not make public at the moment.

To turn on the desktop icon management feature, run with the command:

> pcmanfm-qt –desktop>

Generally it’s a good idea to add this command to your session startup script.

To turn the desktop icon manager off again, do this:

> pcmanfm-qt –desktop-off

>

If you don’t want to use the desktop icons, you can still add the

command to your session startup script:

> pcmanfm-qt –daemon

>

In this way, it will becomes a background daemon. Every time you need

to open a folder with pcmanfm-qt, it can be shown “immediately”.

BTW, please don’t mail me and ask if PCManFM will shift to Qt.

The Gtk+ and Qt versions will coexist.

There will still be new releases for the Gtk+ version in the future.

The Qt port is only an alternative, not a replacement.

Thank you!

—

I, however, need to admit that working with Qt/C++ is much more pleasant and productive than messing with C/GObject/GTK+.

Since GTK+ 3 breaks backward compatibility a lot and it becomes more memory hungry and slower, I don’t see much advantage of GTK+ now. GTK+ 2 is lighter, but it’s no longer true for GTK+ 3. Ironically, fixing all of the broken compatibility is even harder than porting to Qt in some cases (PCManFM IMO is one of them).

So If someone is starting a whole new project and is thinking about what GUI toolkit to use, personally I might recommend Qt if you’re not targeting Gnome 3.

Update 2013-03-27:

I got some feedback about the toolkit choice above. Don’t get me wrong. I’m not saying that gtk+ is bad and did not intend to start a toolkit flame war. If you’re going to use python, C#, or other scripting language, gtk+ is still a good choice due to its mature language bindings.
Vala is attractive initially, but after trying it in real development, you’ll see the shortcomings of this approach. Because it sometimes generates incorrect C code that still compiles, we got some really hard-to-find bugs. So we need to examine the generated C code to make sure it does things right. This takes much more time than just writing plain C code myself. Besides, the generated C code is not quite human-readable and debugging becomes a problem. Another issue that’ll hit you is the problems in the library bindings. Though there exists many vala bindings for various C library, their quality is uncertain. Finally, debugging, examing, and fixing the bindings all the time takes even more time and offsets the time saved by using Vala.

To sum up, for compiled binary programs, Qt IMHO is a good choice to consider if you don’t hate C++.

A picture is worth a thousands words so again let’s see the screenshot first.

This is the Qt port of PCManFM with desktop management feature turned on. The desktop icons and the wallpaper were painted by PCManFM-Qt, just like the gtk+ version of the original PCManFM. The new Qt port is in a pretty good shape now.
Although it’s not yet ready for production use, it’s almost there. About 85% of the planned features are finished.

Double release!?
We made a poop here. First we pushed 1.0.2 of PCManFM and libfm, that was busted and needed an adjustment. At the same time we debated the version numbering things and as we had to do a new release we decided to bump the version number to hilight the fact that there are hundreds and hundreds of changes in these two releases. 1.1.0 is more like a bug fix to the 1.0.2 but also bumps the version. Happy file managing everyone =)

Added option ‘Treat backup files as hidden’ into ‘Display’ tab of the preferences dialog and ‘Use Application Startup Notify by default’ into ‘Advanced’ tab. Both have effect with libfm 1.0.2 or newer.

Added rintime option ‘–new-win’ to open new window instead of new tab when started with some directory name.

Added runtime option ‘–role’ to set WM_WINDOW_ROLE property which can be used by window manager to do arrangement of window. Works only if option ‘–new-win’ is also used.

The items which cannot act (such as “Copy” when no items selected) now are disabled in menu and toolbar.

libfm

Main changes in libfm 1.1.0 (since 1.0.1)

Added ‘no_usb_trash’ option into config file, defaulted to 0, which defines whether skip trashing files on removable media or not. If defined to skip then files will go into “trash-unsupported” and user will be asked by fm_file_ops_job_run_with_progress() to remove them instead.

Added ‘no_child_non_expandable’ option into config file, defaulted to 0, which adds feature to hide expanders on non-expandable rows so no extra ‘No Sub Folder’ rows are shown. No automation on that is done still since it may be expensive sometimes.

Corrected underscores (mnemonics) on every menu and dialog.

Fixed GTK+ 3.0 compatibility problems. Libfm can be compiled with Gtk 2.18 … 3.x and Glib 2.22+ currently (if glib < 2.26 or vala < 0.13 still requires run configure –disable-actions). Added new switch to configure script –with-gtk=N where N is GTK+ generation to be used, may be either 2 or 3. Default is 2.

Enabled option to Unmount removable media without ejecting it.

Migrated menu:// support into built-in VFS. There will be support for menu editing functions later.

Full name in Icon View mode now shown in tooltip while long names are placed under icons in truncated form.

Added ability to change columns of view. Works only for Detailed List View in FmStandardView widget for now. Implementation for other modes and widgets will come later on demand.

Added a FmSortMode enumerator (similar to GtkSortType) with few modes specific fo file manager (ascending/descending is one of new modes).

Sorting set/get functions moved from FmFolderView into FmFolderModel. Sorting isn’t remembered by implementations of FmFolderView anymore so application should set sorting explicitly after creation of new FmFolderModel instance. Previously FmFolderView remembered it and no explicit setting was required.

I will turn off the services later tonight The services are offline and I did salvage the data and hopefully have stuff running tonight or something. It really depends on what obstacles I might hit during the ride. Yes I should have done this months ago but other stuff came across…

The URL for the Pootle instance will change, no doubt. Hopefully I can get a landing page at the old URL pointing out the change but I am not sure about that yet.”

FmFolderView is converted into generic interface. Former FmFolderView is renamed into FmStandardView so APIs specific to it have changed their names and arguments. Old APIs left for compatibility reasons. New FmFolderView interface now contains methods to handle popups, keyboard and mouse gestures, including Cut/Copy/Paste operations.

Fixed compatibility with systems that are a bit old so have neither decent Vala compiler nor GLib 2.26.