diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 55068c230..9cc176289 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -284,7 +284,14 @@ void CropHandler::update () { // crop->setWindow (cropX, cropY, cropW, cropH, zoom>=1000 ? 1 : zoom); --> we use the "getWindow" hook instead of setting the size before crop->setListener (this); cropPixbuf.clear (); + + // To save threads, try to mark "needUpdate" without a thread first + if (crop->tryUpdate()) { + if (isLowUpdatePriority) Glib::Thread::create(sigc::mem_fun(*crop, &DetailedCrop::fullUpdate), 0, false, true, Glib::THREAD_PRIORITY_LOW); + else + Glib::Thread::create(sigc::mem_fun(*crop, &DetailedCrop::fullUpdate), false ); + } } } diff --git a/rtgui/crophandler.h b/rtgui/crophandler.h index c282e1446..bd97dc14f 100644 --- a/rtgui/crophandler.h +++ b/rtgui/crophandler.h @@ -51,6 +51,7 @@ class CropHandler : public rtengine::DetailedCropListener, public rtengine::Size unsigned char* cropimgtrue; int cropimg_width, cropimg_height, cix, ciy, ciw, cih, cis; bool initial; + bool isLowUpdatePriority; rtengine::StagedImageProcessor* ipc; rtengine::DetailedCrop* crop; diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 3ec02ce85..17f897e25 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -309,14 +309,18 @@ void FileBrowser::close () { Glib::Mutex::Lock lock(entryMutex); #endif + + selected.clear (); + notifySelectionListener (); + + // The listener merges parameters with old values, so delete afterwards for (int i=0; iget_text(); + Glib::ustring BrowsePathValue = BrowsePath->get_text(); + Glib::ustring DecodedPathPrefix=""; + Glib::ustring FirstChar; + + // handle shortcuts in the BrowsePath -- START + // read the 1-st character from the path + FirstChar = BrowsePathValue.substr (0,1); + + if (FirstChar=="~"){ // home directory + DecodedPathPrefix = Glib::get_home_dir(); + } + else if (FirstChar=="!"){ // user's pictures directory + //DecodedPathPrefix = g_get_user_special_dir(G_USER_DIRECTORY_PICTURES); + DecodedPathPrefix = Glib::get_user_special_dir (G_USER_DIRECTORY_PICTURES); + } + + if (DecodedPathPrefix!=""){ + BrowsePathValue = Glib::ustring::compose ("%1%2",DecodedPathPrefix,BrowsePathValue.substr (1,BrowsePath->get_text_length()-1)); + BrowsePath->set_text(BrowsePathValue); + } + // handle shortcuts in the BrowsePath -- END + // validate the path - if (safe_file_test(sel, Glib::FILE_TEST_IS_DIR) && dirlistener){ - dirlistener->selectDir (sel); + if (safe_file_test(BrowsePathValue, Glib::FILE_TEST_IS_DIR) && dirlistener){ + dirlistener->selectDir (BrowsePathValue); } else // error, likely path not found: show red arrow diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index ac2e0f586..86f5d922c 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -140,7 +140,10 @@ bool Thumbnail::isSupported () { } const ProcParams& Thumbnail::getProcParams () { - //Glib::Mutex::Lock lock(mutex); + // TODO: Check for Linux + #ifdef WIN32 + Glib::Mutex::Lock lock(mutex); + #endif if (pparamsValid) return pparams; @@ -161,7 +164,10 @@ const ProcParams& Thumbnail::getProcParams () { } void Thumbnail::loadProcParams () { - //Glib::Mutex::Lock lock(mutex); + // TODO: Check for Linux + #ifdef WIN32 + Glib::Mutex::Lock lock(mutex); + #endif pparamsValid = false; if (options.paramsLoadLocation==PLL_Input) { @@ -183,7 +189,10 @@ void Thumbnail::loadProcParams () { } void Thumbnail::clearProcParams (int whoClearedIt) { - //Glib::Mutex::Lock lock(mutex); + // TODO: Check for Linux + #ifdef WIN32 + Glib::Mutex::Lock lock(mutex); + #endif cfs.recentlySaved = false; pparamsValid = false; @@ -211,7 +220,10 @@ bool Thumbnail::hasProcParams () { } void Thumbnail::setProcParams (const ProcParams& pp, int whoChangedIt, bool updateCacheNow) { - //Glib::Mutex::Lock lock(mutex); + // TODO: Check for Linux + #ifdef WIN32 + Glib::Mutex::Lock lock(mutex); + #endif if (pparams!=pp) cfs.recentlySaved = false; @@ -523,7 +535,10 @@ void Thumbnail::updateCache () { } Thumbnail::~Thumbnail () { - //Glib::Mutex::Lock lock(mutex); + // TODO: Check for Linux + #ifdef WIN32 + Glib::Mutex::Lock lock(mutex); + #endif delete [] lastImg; delete tpp;