Gtk+ and Window Managers

Many novice developers for Gtk+ get confused about the relationship between the Gtk+ toolkit and the window manager. After all, window managers are part of the graphical interface, and they have elements that control how windows behave. However, there is a great difference between toolkits and the window manager when it comes to X Window programming.

A Window Manager is the part of the system that handles top level windows. For example, when you create a new window by starting an application, the top level window will typically have controls to maximize, minimize, moving, and resizing the application. These are functions performed by the window manager.

While the window manager is responsible for maintaining the top level windows, it is not part of any application. It is a separate process itself, running as part of the X server for the machine you are using.

The reason for the separation may look odd for users accustomed to graphical interfaces such as Microsoft Windows or Apple OS. However it makes sense if you consider the following characteristics of the X Window System:

We see then that having separate window managers is a logical decision on the X Window System. This means that even if we develop our application with Gtk+, there is no guarantee that the window manager for the system we are running is also written in Gtk+.

The good news is that, because X requires the separation between window manager and main application, we don't have to worry about the window manager at all. Every major UNIX system has a predefined window manager that is capable of handling any X application, be it written in Gtk+ or not.

In the Gnome desktop environment, there are several window managers that can be configured by the user. KDE also has a preferred window manager, which integrates with the features provided by the KDE environment. Looking at the preferences settings of your environment you can customize, or change entirely the window manager used in your desktop.

Tags: Windows, X, Unix, Linux, manager, Window, programming, Gtk
Article created on 2010-08-19 10:39:12

Post a comment