mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-02 01:20:54 +00:00
Use QFileSystemWatcher instead of polling in KDirWatch.
Submitted by: tijl@
This commit is contained in:
parent
722ac7819e
commit
44eb83e82b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=262452
17
x11/kdelibs4/files/patch-kdecore_CMakeLists.txt
Normal file
17
x11/kdelibs4/files/patch-kdecore_CMakeLists.txt
Normal file
@ -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)
|
@ -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 @@
|
||||
--- ./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);
|
||||
|
||||
#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),
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
11
x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h
Normal file
11
x11/kdelibs4/files/patch-kdecore_io_kdirwatch_p.h
Normal file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user