diff options
author | makc <makc@FreeBSD.org> | 2010-10-06 01:33:33 +0800 |
---|---|---|
committer | makc <makc@FreeBSD.org> | 2010-10-06 01:33:33 +0800 |
commit | 95cf071b46f0eba2d4bf3be9a20c7531d699cdeb (patch) | |
tree | 4e683dab92acd2f80524e93be55a2fc310fd16aa /x11/kdelibs4 | |
parent | c7fb2084a61e224931daf4069c580e587a7ce227 (diff) | |
download | freebsd-ports-gnome-95cf071b46f0eba2d4bf3be9a20c7531d699cdeb.tar.gz freebsd-ports-gnome-95cf071b46f0eba2d4bf3be9a20c7531d699cdeb.tar.zst freebsd-ports-gnome-95cf071b46f0eba2d4bf3be9a20c7531d699cdeb.zip |
Use QFileSystemWatcher instead of polling in KDirWatch.
Submitted by: tijl@
Diffstat (limited to 'x11/kdelibs4')
-rw-r--r-- | x11/kdelibs4/files/patch-kdecore_CMakeLists.txt | 17 | ||||
-rw-r--r-- | x11/kdelibs4/files/patch-kdecore_io_kdirwatch.cpp | 100 | ||||
-rw-r--r-- | x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h | 11 |
3 files changed, 117 insertions, 11 deletions
diff --git a/x11/kdelibs4/files/patch-kdecore_CMakeLists.txt b/x11/kdelibs4/files/patch-kdecore_CMakeLists.txt new file mode 100644 index 000000000000..70eb9296cc0a --- /dev/null +++ b/x11/kdelibs4/files/patch-kdecore_CMakeLists.txt @@ -0,0 +1,17 @@ +--- ./kdecore/CMakeLists.txt.orig 2010-08-11 20:17:01.854343811 +0400 ++++ ./kdecore/CMakeLists.txt 2010-08-11 20:16:10.000000000 +0400 +@@ -15,11 +15,9 @@ + + check_include_files(sys/inotify.h SYS_INOTIFY_H_FOUND) + macro_bool_to_01(SYS_INOTIFY_H_FOUND HAVE_SYS_INOTIFY_H) +-if(WIN32) +- # currently for win32 only, since it doesn't support watching files that don't exist yet +- option(USE_QFILESYSTEMWATCHER "Use QFileSystemWatcher instead polling for KDirWatch" ON) +- macro_bool_to_01(USE_QFILESYSTEMWATCHER HAVE_QFILESYSTEMWATCHER) +-endif(WIN32) ++ ++option(USE_QFILESYSTEMWATCHER "Use QFileSystemWatcher instead polling for KDirWatch" ON) ++macro_bool_to_01(USE_QFILESYSTEMWATCHER HAVE_QFILESYSTEMWATCHER) + + # Generate io/config-kdirwatch.h + include(io/ConfigureChecks.cmake) diff --git a/x11/kdelibs4/files/patch-kdecore_io_kdirwatch.cpp b/x11/kdelibs4/files/patch-kdecore_io_kdirwatch.cpp index 84391941bd6e..ebd585151bd4 100644 --- a/x11/kdelibs4/files/patch-kdecore_io_kdirwatch.cpp +++ b/x11/kdelibs4/files/patch-kdecore_io_kdirwatch.cpp @@ -1,11 +1,89 @@ ---- kdecore/io/kdirwatch.cpp.orig 2010-06-02 03:38:59.000000000 -0400 -+++ kdecore/io/kdirwatch.cpp 2010-06-02 03:42:23.000000000 -0400 -@@ -164,7 +164,7 @@ - - #ifdef HAVE_FAM - // It's possible that FAM server can't be started -- if (FAMOpen(&fc) ==0) { -+ if (m_preferredMethod == Fam && FAMOpen(&fc) ==0) { - availableMethods << "FAM"; - use_fam=true; - sn = new QSocketNotifier( FAMCONNECTION_GETFD(&fc), +--- ./kdecore/io/kdirwatch.cpp.orig 2010-05-17 00:03:59.000000000 +0400 ++++ ./kdecore/io/kdirwatch.cpp 2010-08-11 20:13:53.553022509 +0400 +@@ -95,7 +95,7 @@ + #ifdef Q_OS_WIN + return KDirWatchPrivate::QFSWatch; + #elif defined(Q_OS_FREEBSD) +- return KDirWatchPrivate::Stat; ++ return KDirWatchPrivate::QFSWatch; + #else + return KDirWatchPrivate::INotify; + #endif +@@ -151,7 +151,11 @@ + m_preferredMethod = methodFromString(method); + + // The nfs method defaults to the normal (local) method ++#if defined(Q_OS_FREEBSD) ++ m_nfsPreferredMethod = methodFromString(config.readEntry("nfsPreferredMethod", "Stat")); ++#else + m_nfsPreferredMethod = methodFromString(config.readEntry("nfsPreferredMethod", method)); ++#endif + + QStringList availableMethods; + +@@ -988,7 +992,16 @@ + + #ifdef HAVE_QFILESYSTEMWATCHER + if (e->m_mode == QFSWatchMode) { +- fsWatcher->removePath(e->path); ++ if ( e->m_status == Normal ) { ++ fsWatcher->removePath(e->path); ++ kDebug(7001).nospace() << "Cancelled QFSWatch for " << e->path; ++ } ++ else { ++ if (e->isDir) ++ removeEntry(0, QDir::cleanPath(e->path+"/.."), e); ++ else ++ removeEntry(0, QFileInfo(e->path).absolutePath(), e); ++ } + } + #endif + if (e->m_mode == StatMode) { +@@ -1664,8 +1677,7 @@ + EntryMap::Iterator it; + it = m_mapEntries.find(path); + if(it != m_mapEntries.end()) { +- Entry entry = *it; // deep copy to not point to uninialized data (can happen inside emitEvent() ) +- Entry *e = &entry; ++ Entry *e = &(*it); + e->dirty = true; + int ev = scanEntry(e); + if (ev != NoChange) +@@ -1676,28 +1688,20 @@ + else + addEntry(0, QFileInfo(e->path).absolutePath(), e, true); + } else ++ if(ev == Created) { ++ if(!useQFSWatch(e)) ++#ifdef HAVE_SYS_INOTIFY_H ++ if(!useINotify(e)) ++#endif ++ useStat(e); ++ } else + if (ev == Changed && e->isDir && e->m_entries.count()) { + Entry* sub_entry = 0; + Q_FOREACH(sub_entry, e->m_entries) { +- if(e->isDir) { // ####### !?!? Already checked above +- if (QFileInfo(sub_entry->path).isDir()) // ##### !? no comparison between sub_entry->path and path? +- break; +- } else { +- if (QFileInfo(sub_entry->path).isFile()) +- break; +- } ++ if (QFileInfo(sub_entry->path).exists()) ++ break; + } + if (sub_entry) { +- removeEntry(0, e, sub_entry); +- //KDE_struct_stat stat_buf; +- //QByteArray tpath = QFile::encodeName(path); +- //KDE_stat(tpath, &stat_buf); +- +- if(!useQFSWatch(sub_entry)) +-#ifdef HAVE_SYS_INOTIFY_H +- if(!useINotify(sub_entry)) +-#endif +- useStat(sub_entry); + fswEventReceived(sub_entry->path); + } + } diff --git a/x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h b/x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h new file mode 100644 index 000000000000..89968af0a7b6 --- /dev/null +++ b/x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h @@ -0,0 +1,11 @@ +--- ./kdecore/io/kdirwatch_p.h.orig 2010-05-17 00:03:59.000000000 +0400 ++++ ./kdecore/io/kdirwatch_p.h 2010-08-11 20:13:53.492105378 +0400 +@@ -102,7 +102,7 @@ + QHash<QString,QFileSystemWatcher*> m_paths; + }; + #else +-typedef KFileSystemWatcher QFileSystemWatcher; ++typedef QFileSystemWatcher KFileSystemWatcher; + #endif + #endif + |