diff options
author | avilla <avilla@FreeBSD.org> | 2010-12-28 19:36:15 +0800 |
---|---|---|
committer | avilla <avilla@FreeBSD.org> | 2010-12-28 19:36:15 +0800 |
commit | 63a97a57f2b46adb45965cd2330a4c0046df9ad4 (patch) | |
tree | adc812d45bd2d45ebda224b09b02b126420c9ef1 /graphics/kdegraphics4 | |
parent | 6c6060314ba47af5c488602293f3028ab886d0a8 (diff) | |
download | freebsd-ports-gnome-63a97a57f2b46adb45965cd2330a4c0046df9ad4.tar.gz freebsd-ports-gnome-63a97a57f2b46adb45965cd2330a4c0046df9ad4.tar.zst freebsd-ports-gnome-63a97a57f2b46adb45965cd2330a4c0046df9ad4.zip |
- Fix calculation of RAM values.
It results in a much faster Okular and in a less annoying Gwenview.
Diffstat (limited to 'graphics/kdegraphics4')
-rw-r--r-- | graphics/kdegraphics4/Makefile | 1 | ||||
-rw-r--r-- | graphics/kdegraphics4/files/patch-1207422 | 53 | ||||
-rw-r--r-- | graphics/kdegraphics4/files/patch-gwenview__lib__memoryutils.cpp | 53 |
3 files changed, 107 insertions, 0 deletions
diff --git a/graphics/kdegraphics4/Makefile b/graphics/kdegraphics4/Makefile index 5da0af295d18..59703b3ab085 100644 --- a/graphics/kdegraphics4/Makefile +++ b/graphics/kdegraphics4/Makefile @@ -6,6 +6,7 @@ PORTNAME= kdegraphics PORTVERSION= ${KDE4_VERSION} +PORTREVISION= 1 CATEGORIES= graphics kde MASTER_SITES= ${MASTER_SITE_KDE} MASTER_SITE_SUBDIR= ${KDE4_BRANCH}/${PORTVERSION}/src diff --git a/graphics/kdegraphics4/files/patch-1207422 b/graphics/kdegraphics4/files/patch-1207422 new file mode 100644 index 000000000000..148d87b15284 --- /dev/null +++ b/graphics/kdegraphics4/files/patch-1207422 @@ -0,0 +1,53 @@ +--- ./okular/core/document.cpp.orig 2010-12-09 10:33:24.149282319 +0100 ++++ ./okular/core/document.cpp 2010-12-09 10:33:32.059265342 +0100 +@@ -14,6 +14,10 @@ + #ifdef Q_OS_WIN + #define _WIN32_WINNT 0x0500 + #include <windows.h> ++#elif defined(Q_OS_FREEBSD) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <vm/vm_param.h> + #endif + + // qt/kde/system includes +@@ -248,6 +251,12 @@ + if ( entry.startsWith( "MemTotal:" ) ) + return (cachedValue = (Q_UINT64_C(1024) * entry.section( ' ', -2, -2 ).toULongLong())); + } ++#elif defined(Q_OS_FREEBSD) ++ qulonglong physmem; ++ int mib[] = {CTL_HW, HW_PHYSMEM}; ++ size_t len = sizeof( physmem ); ++ if ( sysctl( mib, 2, &physmem, &len, NULL, 0 ) == 0 ) ++ return (cachedValue = physmem); + #elif defined(Q_OS_WIN) + MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); +@@ -294,6 +303,26 @@ + lastUpdate = QTime::currentTime(); + + return ( cachedValue = (Q_UINT64_C(1024) * memoryFree) ); ++#elif defined(Q_OS_FREEBSD) ++ qulonglong cache, inact, free, psize; ++ size_t cachelen, inactlen, freelen, psizelen; ++ cachelen = sizeof( cache ); ++ inactlen = sizeof( inact ); ++ freelen = sizeof( free ); ++ psizelen = sizeof( psize ); ++ // sum up inactive, cached and free memory ++ if ( sysctlbyname( "vm.stats.vm.v_cache_count", &cache, &cachelen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_inactive_count", &inact, &inactlen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_free_count", &free, &freelen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_page_size", &psize, &psizelen, NULL, 0 ) == 0 ) ++ { ++ lastUpdate = QTime::currentTime(); ++ return (cachedValue = (cache + inact + free) * psize); ++ } ++ else ++ { ++ return 0; ++ } + #elif defined(Q_OS_WIN) + MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); diff --git a/graphics/kdegraphics4/files/patch-gwenview__lib__memoryutils.cpp b/graphics/kdegraphics4/files/patch-gwenview__lib__memoryutils.cpp new file mode 100644 index 000000000000..88fbfea2b84e --- /dev/null +++ b/graphics/kdegraphics4/files/patch-gwenview__lib__memoryutils.cpp @@ -0,0 +1,53 @@ +--- ./gwenview/lib/memoryutils.cpp.orig 2010-12-13 02:03:56.937466810 +0100 ++++ ./gwenview/lib/memoryutils.cpp 2010-12-13 02:10:42.437502217 +0100 +@@ -32,6 +32,10 @@ + #ifdef Q_OS_WIN + #define _WIN32_WINNT 0x0500 + #include <windows.h> ++#elif defined(Q_OS_FREEBSD) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <vm/vm_param.h> + #endif + + namespace Gwenview { +@@ -61,6 +64,12 @@ + if ( entry.startsWith( "MemTotal:" ) ) + return (cachedValue = (Q_UINT64_C(1024) * entry.section( ' ', -2, -2 ).toULongLong())); + } ++#elif defined(Q_OS_FREEBSD) ++ qulonglong physmem; ++ int mib[] = {CTL_HW, HW_PHYSMEM}; ++ size_t len = sizeof( physmem ); ++ if ( sysctl( mib, 2, &physmem, &len, NULL, 0 ) == 0 ) ++ return (cachedValue = physmem); + #elif defined(Q_OS_WIN) + MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); +@@ -107,6 +116,26 @@ + lastUpdate = QTime::currentTime(); + + return ( cachedValue = (Q_UINT64_C(1024) * memoryFree) ); ++#elif defined(Q_OS_FREEBSD) ++ qulonglong cache, inact, free, psize; ++ size_t cachelen, inactlen, freelen, psizelen; ++ cachelen = sizeof( cache ); ++ inactlen = sizeof( inact ); ++ freelen = sizeof( free ); ++ psizelen = sizeof( psize ); ++ // sum up inactive, cached and free memory ++ if ( sysctlbyname( "vm.stats.vm.v_cache_count", &cache, &cachelen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_inactive_count", &inact, &inactlen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_free_count", &free, &freelen, NULL, 0 ) == 0 && ++ sysctlbyname( "vm.stats.vm.v_page_size", &psize, &psizelen, NULL, 0 ) == 0 ) ++ { ++ lastUpdate = QTime::currentTime(); ++ return (cachedValue = (cache + inact + free) * psize); ++ } ++ else ++ { ++ return 0; ++ } + #elif defined(Q_OS_WIN) + MEMORYSTATUSEX stat; + stat.dwLength = sizeof(stat); |