Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Desktop creating a desktop window?

Tags:

desktop

qt

gtk

I'm writing a desktop. I already know the basics of Qt and GTK+ through Python but I don't understand how to display the finished Desktop. How do you make it the root window of a Window Manager, or is there a method for displaying the desktop I'm not familiar with?

like image 686
Christopher Avatar asked Nov 13 '22 12:11

Christopher


1 Answers

You don't make it the root window. X has one root window which you can't change. There are a number of ways to do what you want

  • X Root window

The old way was that the desktop was just the standard X root window. Icons were just individual borderless windows.

  • Desktop Window

Now most systems open a large window, and mark it as being a desktop window. Most window managers then know never to raise it above any other windows. The X root window is still behind it, but it is hidden. This means you can do anything you want on this window, draw to it, include icons or widgets or anything else your toolkit can do.

If you are using Gtk+ then the relevant information is found in the GdkWindowTypeHint enum, specifically the GDK_WINDOW_TYPE_HINT_DESKTOP. The documentation can be found here: GdkWindow

  • Compositor

However, there is a newer way that desktops like Gnome3 or Unity use, which is called the Compositor Overlay Window. When a compositor is running there is an overlay window which covers all the windows on the system. It is then up to the compositor to draw the actual contents of the windows on this overlay. However, the overlay can draw whatever it wishes on this overlay window. For example, in Gnome3 when you enter the window selector and the windows arrange themselves into a grid the windows aren't really moving and shrinking, the compositor has just decided to draw them that way. In reality, the windows are still in the same position they were before, but hidden under this overlay.

This is a very advanced way to do things, and certainly not for the novice developer. You probably want to be focusing on the second method.

like image 199
iain Avatar answered Nov 15 '22 13:11

iain