>From 77a9568bd888f25b4ba222e811aa39c8b0d316cb Mon Sep 17 00:00:00 2001 From: Andreas Stricker Date: Thu, 28 May 2009 09:14:58 +0200 Subject: [PATCH 13/14] Ported desktop shell to OSX * Implemented physical memory size query using Carbon Gestalt API * Excluded X11 specific parts --- workspace/plasma/shells/desktop/desktopview.cpp | 8 ++++---- workspace/plasma/shells/desktop/plasmaapp.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/workspace/plasma/shells/desktop/desktopview.cpp b/workspace/plasma/shells/desktop/desktopview.cpp index 16b852d..2ad2496 100644 --- a/workspace/plasma/shells/desktop/desktopview.cpp +++ b/workspace/plasma/shells/desktop/desktopview.cpp @@ -319,7 +319,7 @@ void DesktopView::toolBoxOpened() return; } -#ifndef Q_WS_WIN +#ifdef Q_WS_X11 NETRootInfo info(QX11Info::display(), NET::Supported); if (!info.isSupported(NET::WM2ShowingDesktop)) { return; @@ -331,7 +331,7 @@ void DesktopView::toolBoxOpened() connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(showDesktopUntoggled())); -#ifndef Q_WS_WIN +#ifdef Q_WS_X11 info.setShowingDesktop(true); #endif } @@ -342,7 +342,7 @@ void DesktopView::toolBoxClosed() return; } -#ifndef Q_WS_WIN +#ifdef Q_WS_X11 NETRootInfo info(QX11Info::display(), NET::Supported); if (!info.isSupported(NET::WM2ShowingDesktop)) { return; @@ -355,7 +355,7 @@ void DesktopView::toolBoxClosed() this, SLOT(showDesktopUntoggled())); connect(c, SIGNAL(toolBoxToggled()), this, SLOT(toolBoxOpened())); -#ifndef Q_WS_WIN +#ifdef Q_WS_X11 info.setShowingDesktop(false); #endif } diff --git a/workspace/plasma/shells/desktop/plasmaapp.cpp b/workspace/plasma/shells/desktop/plasmaapp.cpp index d65655d..66b7305 100644 --- a/workspace/plasma/shells/desktop/plasmaapp.cpp +++ b/workspace/plasma/shells/desktop/plasmaapp.cpp @@ -76,6 +76,10 @@ #include #endif +#ifdef Q_OS_MAC +#include +#endif + PlasmaApp* PlasmaApp::self() { if (!kapp) { @@ -158,6 +162,13 @@ PlasmaApp::PlasmaApp() memorySize = (statex.ullTotalPhys/1024) + (statex.ullTotalPageFile/1024); #endif +#ifdef Q_OS_MAC + size_t memorySize = 0; + long bytes; + if (Gestalt(gestaltPhysicalRAMSize, &bytes) == noErr) { + memorySize = bytes; + } +#endif // If you have no suitable sysconf() interface and are not FreeBSD, // then you are out of luck and get a compile error. #endif -- 1.6.3.1