Search code examples
gtkgtk3cairo

Gtk+: How to Draw Custom Window Borders Like Chrome or Steam


I was wondering if it would be possible to draw (ie design) window frames with Cairo in Gtk, so that the Cairo API could be used to decorate the surface such as adding gradients.

How would I tone down GTK decorations and redesign them with something like Cairo?


Solution

  • Normally on Linux window decorations (borders, title bar, close and minimize buttons etc) are drawn by Window Manager, which helps to maintain similar look and behavior amongst different windows.

    However, application may signal to window manager that it wants to disable decorations provided by window manager and draw their own. In Gtk+, that can be achieved by calling gtk_window_set_decorated on GtkWindow, and then using Cairo to draw own borders.