[Gtk-sharp-list] Custom Title Bar

Cody Russell cody at jhu.edu
Thu Aug 4 01:49:31 UTC 2016


If you're using gtk3 there may be some newer features you can use
related to this, but I haven't looked at them in a long time and don't
really know any of the details.

We're still using gtk2 right now, and it's what is shipped by Mono still
so I'll base the rest of what I write on that. The short answer is that
no, the titlebar is generally provided by the operating system, or on
Linux by the window manager, and you can't draw on it.

If you *really* want to manage this yourself then you can go through a
great deal of effort and disable the decorations as you've done and then
deal with window edge/title bar drawing in your application code, and
deal with window movement and resizing in your application code. I
wouldn't recommend it, but you can do it.

If you choose to ignore my recommendation, then you'll probably want to
subclass Gtk.Window and implement proper size request/allocation, handle
button press/release/motion, etc.

Here's a very ancient branch of gtk that I made back in 2009 that
implements most of this stuff directly in gtk2. This kind of served as a
basis for what eventually went into gtk3.
    https://github.com/GNOME/gtk/commits/client-side-decorations

Take a look directly in gtk/gtkwindow.c and look for functions like
gtk_window_button_press_event() and gtk_window_motion_notify_event().
Basically search for anything related to "client_side_decorated".

I can't really provide any support for it, this was stuff I wrote in
2009 just as an experiment. But if you're really determined to do this
then you might find this to be a helpful jumping off point.

/ Cody

On Wed, Aug 3, 2016, at 03:12 PM, Jan Kleinebudde wrote:
> Hi.
> Is there a way to customize the title bar? I want to use my own images
> for the background and the minimize, maximize, close icons.
> I can set the decoration of the window to false and then create my own
> title bar with the gui elements, but it is no longer movable or
> resizable without the decoration.
> Any suggestions what todo?
> _________________________________________________
> Gtk-sharp-list maillist  - Gtk-sharp-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/gtk-sharp-list/attachments/20160803/8bf7a6e1/attachment.html>


More information about the Gtk-sharp-list mailing list