Possible bug in juce_mac_Windowing.cpp


#1

Our little application doesn’t repaint when it is shown after hidden in the dock.
Simply start the app, press CMD+H to hide the app and press tab to select the app again which will show the window again.

Following code does fix this:

static pascal OSStatus handleShowHideEvent (EventHandlerCallRef, EventRef theEvent, void* userData)
{
    MessageManagerLock messLock;

    NativeDesktopWindow* const nw = (NativeDesktopWindow*) userData;
	Component* cp = nw->getComponent();
	if(nw && cp)
		nw->repaint(0, 0, cp->getWidth(), cp->getHeight());

    return noErr;
}

and

void NativeDesktopWindow::initialiseNativeWindow (const String& title, int windowStyleFlags)
{
...
    const EventTypeSpec types7[] = { { kEventClassWindow, kEventWindowShown } };
    InstallWindowEventHandler (window, NewEventHandlerUPP (handleShowHideEvent), 1, types7, (void*) this, 0);

#2

The next version’s got a whole load of fixes for this, and changes the way minimisation/hiding works, so should all be ok…


#3

Perfect. Can’t wait for it :smiley:


#4