Min/maximize buttons using native titlebar


#1

Hi,

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?

maarten


#2

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


#3

Yes, I did. Here is what i do:

HelloWorldWindow()
: DocumentWindow (T(“Hello World”),
Colours::lightgrey,
DocumentWindow::allButtons,
true)
{
setContentComponent (new HelloWorldContentComponent());
setUsingNativeTitleBar(true);
setTitleBarButtonsRequired(DocumentWindow::allButtons,true);
setVisible (true);
centreWithSize (400, 200);
}


#4

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.


#5

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.


#6

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


#7

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


#8

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


#9

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…


#10