Min/maximize buttons using native titlebar



I am new to juce, and I am evaluating it as an alternative for my crossplatform GUI/Audio needs, particularly as a replacement for FLTK.

I noticed that when using setUsingNativeTitleBar(true), my window doesn’t get a minimize and maximize button (with gnome/metacity, but I suppose this is general). Is this correct?



Did you have a look at DocumentWindow::setTitleBarButtonsRequired() ?


Yes, I did. Here is what i do:

: DocumentWindow (T(“Hello World”),
setContentComponent (new HelloWorldContentComponent());
setVisible (true);
centreWithSize (400, 200);


Hmm - come to think of it, I don’t think I ever got that to work properly on linux. In juce_linux_Windowing.cpp there’s an addWindowButtons method, but I never added all the millions of stupid workarounds needed for all the slightly-different window managers… I’ll make a note to take another look at that when I get chance.


fltk does create the titlebar buttons properly, and the code does not
seem to take in account any window-manager exceptions.

you might want to have a look at:

void Fl_X::sendxjunk()

in file fltk-1.1.7/src/Fl_x.cxx

hope this helps.


i’m actually using cgwd (window_decorator) with compiz (window_manager) and xgl (opengl X server) and the buttons are working as expected with setTitleBarButtonsRequired apart from maximise button… just to notice


ah, great. Thanks for the tips! I’ll take a look at that asap.


With Gnome the native buttons aren’t there (except the close button), with Fluxbox it’s fine. I didn’t test KDE yet.


Just having a play with this now - it seems that the code to turn on the min/max buttons is fine, but they only work if you remove line 1545 (i.e. the one that calls XSetTransientForHint).

I wish I could remember why I added the transient call, I’m sure there’s a reason for it being there, but for now, I guess I’ll remove it…