diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 7bf2625ed..cfd82425a 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -223,7 +223,6 @@ void Crop::update (int todo) { // this in output space held in parallel to allow analysis like shadow/highlight Glib::ustring outProfile=params.icm.output; if (params.icm.output=="" || params.icm.output==ColorManagementParams::NoICMString) outProfile="sRGB"; - printf("Using profile %s\n", outProfile.c_str()); Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, outProfile); int finalW = rqcropw; diff --git a/rtgui/windirmonitor.cc b/rtgui/windirmonitor.cc index b1da29732..d91b49156 100644 --- a/rtgui/windirmonitor.cc +++ b/rtgui/windirmonitor.cc @@ -30,36 +30,31 @@ static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nByt } bool notify = false; - // Analysis of the modifications + // Analysis of the modifications. Let only parsed file extensions emit a notify, not PP3 changes do { - Glib::ustring fname = ""; - int strLen = 0; - // Get a pointer to the first change record... pInfo = (FILE_NOTIFY_INFORMATION*) &monData->file_notify_buffer[dwOffset]; char fnameC[(MAX_PATH+1)*2] = {0}; - strLen = WideCharToMultiByte(CP_UTF8,0,pInfo->FileName,pInfo->FileNameLength/sizeof(WCHAR),fnameC,sizeof(fnameC),0,0); + int strLen = WideCharToMultiByte(CP_UTF8,0,pInfo->FileName,pInfo->FileNameLength/sizeof(WCHAR),fnameC,sizeof(fnameC),0,0); fnameC[strLen] = 0; - fname = fnameC; + Glib::ustring fname = fnameC; - // See http://msdn.microsoft.com/en-us/library/aa364391(v=vs.85).aspx for available event type if necessary if (options.has_retained_extention(fname)) notify = true; - // More than one change may happen at the same time. Load the next change and continue... + // More than one change may happen at the same time. Load the next change and continue... dwOffset += pInfo->NextEntryOffset; - } - while (pInfo->NextEntryOffset != 0); + } while (!notify && pInfo->NextEntryOffset != 0); // ReadDirectoryChangesW sometimes emits multiple events per change (one for each change type) // To make sure it's not flooding update, this gets filtered. - time_t curTime= ::time(NULL); - if (notify && monData->listener && ::difftime(curTime, monData->lastTimeUpdateDir)>1.0) { + DWORD curTick = GetTickCount(); + if (notify && monData->listener && (curTick-monData->lastTimeUpdateTick)>500) { + monData->lastTimeUpdateTick = curTick; monData->listener->winDirChanged (); - monData->lastTimeUpdateDir = curTime; } - + ReadDirectoryChangesW (monData->hDirectory, monData->file_notify_buffer, monData->buffer_allocated_bytes, @@ -72,7 +67,7 @@ static void CALLBACK current_directory_monitor_callback (DWORD error, DWORD nByt current_directory_monitor_callback); } -WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* listener) : monData(NULL) { +WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* listener) : monData(NULL) { wchar_t* wdirname = (wchar_t*)g_utf8_to_utf16 (dirName.c_str(), -1, NULL, NULL, NULL); HANDLE hDirectory = CreateFileW (wdirname, FILE_LIST_DIRECTORY,FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL); g_free (wdirname); @@ -84,9 +79,8 @@ WinDirMonitor::WinDirMonitor (Glib::ustring dirName, WinDirChangeListener* liste monData->buffer_allocated_bytes = 32768; monData->file_notify_buffer = new char [monData->buffer_allocated_bytes]; monData->hDirectory = hDirectory; - monData->lastTimeUpdateDir = ::time(NULL); + monData->lastTimeUpdateTick = GetTickCount(); -// printf ("mondata=%d\n", monData); ReadDirectoryChangesW (monData->hDirectory, monData->file_notify_buffer, monData->buffer_allocated_bytes, diff --git a/rtgui/windirmonitor.h b/rtgui/windirmonitor.h index b4f03a4cb..ddef88135 100644 --- a/rtgui/windirmonitor.h +++ b/rtgui/windirmonitor.h @@ -39,7 +39,7 @@ class WinDirMonitor : public Glib::Object { HANDLE hDirectory; WinDirChangeListener* listener; int bigyo; - time_t lastTimeUpdateDir; // for filtering multiple updates events + DWORD lastTimeUpdateTick; // for filtering multiple updates events }; private: