Version 1.44

Ok, I’ve done an official release of 1.44. The features won’t be a big surprise to those of you who’ve been using the tip, but here’s the change list:

* added a method Desktop::setScreenSaverEnabled(), which lets you prevent the screen-saver from being activated - handy if your app is doing some kind of presentation. (only implemented on windows/mac - anyone know how to do this on linux?)
* new Mac-only class: AppleRemoteDevice, which lets you grab and listen for events from your Apple remote control. (Only works if you build for 10.3 or above).
* tweaks to get it working under Wine.
* change to the keyPressed() and keyStateChanged() callbacks in Component and KeyListener. These used to be void, but they now return a bool to indicate whether the key event was needed or not. Any existing code you've got will break in the compiler, so just change it to return true if the key was used, or false to allow the event to be passed up to the next component in the chain. (This change is a better architecture than before, and was also needed so that plugins can allow unused key events to be passed on to the host application)
* swapped the look and feel classes around, so that the basic LookAndFeel class is now what used to be the "shiny" one. The ShinyLookAndFeel class has been removed, and for that old fashioned look, I've added an OldSchoolLookAndFeel that you can use if you need the original L+F. This means that any custom looks that you were using may need to change their base class.
* changed the MouseEvent structure so that it now contains a pointer to the event component and also the original component.
* added a PopupMenu::dismissAllActiveMenus() method.
* added the JUCE_LOG_ASSERTIONS flag, which can automatically log assertion failures, even in release builds.
* new classes DirectoryContentsDisplayComponent and FileTreeComponent, allow a view of a directory as either a list or treeview. I've added a demo of the FileTreeComponent to the treeviews section of the Juce Demo. There's also now an option in the FileBrowserComponent constructor to use a treeview.
* small change to the strictness of the way TreeViews handle their root items. Be careful now to never delete a tree's root item until either the treeview has been deleted, or until you've removed the root from the tree using setRootItem (0). Not doing this can now cause a crash in the tree's destructor, where it expects the root to still be valid.
* added some virtual methods to TextEditor to allow customisation of its popup menu.
* added a Component::setExplicitFocusOrder() method for specifying the order in which components have their focus traversed, and added Jucer support for setting this value.
* made slider skew factor editable in the jucer
* added a background thread to the MidiOutput class, so it can be given a batch of midi events and will dispatch them itself based on their timestamps.
* added MultiDocumentPanel::createNewDocumentWindow() method to allow creation of custom document windows in a MultiDocumentPanel
* added a Thread::getCurrentThread() method
* added an option to MessageManagerLock that can check for thread termination, to avoid deadlocks.
* new method: PropertySet::setFallbackPropertySet()
* some simplifications to ApplicationProperties, because of problems it was causing when there were read-only common property files.

Ok, for Linux…

void XScreenSaverSuspend(Display *dpy, bool suspend);

XScreenSaverSuspend temporarily suspends the screensaver and DPMS timer if suspend parameter is ‘true’, and restarts the timer if suspend is ‘false’.
This function should be used by applications that don’t want the screensaver or DPMS to become activated while they’re for example in the process of playing a media sequence, or are otherwise continuously presenting visual information to the user while in a non-interactive state. This function is not intended to be called by an external screensaver application.
If XScreenSaverSuspend is called multiple times with suspend set to ‘True’, it must be called an equal number of times with suspend set to ‘False’ in order for the screensaver timer to be restarted. This request has no affect if a client tries to resume the screensaver without first having suspended it. XScreenSaverSuspend can thus not be used by one client to resume the screensaver if it’s been suspended by another client.
If a client that has suspended the screensaver becomes disconnected from the X server, the screensaver timer will automatically be restarted, unless it’s still suspended by another client. Suspending the screensaver timer doesn’t prevent the screensaver from being forceably activated with the ForceScreenSaver request, or a DPMS mode from being set with the DPMSForceLevel request.
XScreenSaverSuspend also doesn’t deactivate the screensaver or DPMS if either is active at the time the request to suspend them is received by the X server. But once they’ve been deactivated, they won’t automatically be activated again, until the client has canceled the suspension.

ah, right! Don’t know how I missed that one… thanks!

Alsa and ASIO is now turned off by default in the config.h… I noticed.

Edit: And as I discovered this I also saw that releaseResources will be called even if prepareToPlay wasn’t, since this is what happened when I ran my app without alsa. (Ergo, one should zero all pointers and test prior to deleting stuff in there.) Is this the expected behavior?

Well, that confused the heck out of me. I updated to head just as you did this. Couldn’t work out what you changed and why!


[quote=“Bruce Wheaton”]Well, that confused the heck out of me. I updated to head just as you did this. Couldn’t work out what you changed and why!


Now I’m confused about what you’re confused about! You mean you were confused about alsa being turned off? That’s just to make it build on a basic installation.

It’s always best to make your releaseResources and prepareToPlay methods robust - they get called from a lot of different places and won’t always be balanced. I’ll maybe add a note about that.

What happened to SystemStats::getNumLogicalCpus()?

I did a bit of refactoring - logical/physical cpus seemed a bit obscure, so getNumCPUs now returns the number of cores.