From kde-commits Tue Aug 26 02:02:24 2008 From: Carlo Segato Date: Tue, 26 Aug 2008 02:02:24 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/shells/screensaver Message-Id: <1219716144.012392.27858.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121971615211774 SVN commit 852578 by segato: fixes for windows M +8 -5 CMakeLists.txt M +42 -2 plasmaapp.cpp M +1 -1 plasmaapp.h M +1 -1 savercorona.h --- trunk/KDE/kdebase/workspace/plasma/shells/screensaver/CMakeLists.txt #852577:852578 @@ -16,11 +16,14 @@ kde4_add_ui_files(plasma-overlay_SRCS saverconfig.ui) kde4_add_executable(plasma-overlay ${plasma-overlay_SRCS}) - -target_link_libraries(plasma-overlay plasma kworkspace ${KDE4_KIO_LIBS}) -if(X11_Xrender_FOUND) - target_link_libraries(plasma-overlay ${X11_Xrender_LIB}) -endif(X11_Xrender_FOUND) +if(NOT WIN32) + target_link_libraries(plasma-overlay plasma kworkspace ${KDE4_KIO_LIBS}) + if(X11_Xrender_FOUND) + target_link_libraries(plasma-overlay ${X11_Xrender_LIB}) + endif(X11_Xrender_FOUND) +else(NOT WIN32) + target_link_libraries(plasma-overlay plasma ${KDE4_KIO_LIBS}) +endif(NOT WIN32) set_target_properties(plasma-overlay PROPERTIES OUTPUT_NAME plasma-overlay) install(TARGETS plasma-overlay ${INSTALL_TARGETS_DEFAULT_ARGS}) --- trunk/KDE/kdebase/workspace/plasma/shells/screensaver/plasmaapp.cpp #852577:852578 @@ -25,6 +25,14 @@ #include "plasmaapp.h" +#ifdef Q_WS_WIN +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif +#define _WIN32_WINNT 0x0500 +#include +#endif + #include #ifndef _SC_PHYS_PAGES @@ -60,19 +68,24 @@ #include "savercorona.h" #include "saverview.h" +#ifdef Q_WS_X11 #include #include +#endif Atom tag; //FIXME should this be a member var or what? const unsigned char DIALOG = 1; //FIXME this is really bad code const unsigned char VIEW = 2; +#ifdef Q_WS_X11 Display* dpy = 0; Colormap colormap = 0; Visual *visual = 0; +#endif void checkComposite() { +#ifdef Q_WS_X11 dpy = XOpenDisplay(0); // open default display if (!dpy) { kError() << "Cannot connect to the X server" << endl; @@ -104,20 +117,29 @@ kDebug() << (colormap ? "Plasma has an argb visual" : "Plasma lacks an argb visual") << visual << colormap; kDebug() << ((KWindowSystem::compositingActive() && colormap) ? "Plasma can use COMPOSITE for effects" : "Plasma is COMPOSITE-less") << "on" << dpy; +#endif } PlasmaApp* PlasmaApp::self() { if (!kapp) { checkComposite(); +#ifdef Q_WS_X11 return new PlasmaApp(dpy, visual ? Qt::HANDLE(visual) : 0, colormap ? Qt::HANDLE(colormap) : 0); +#else + return new PlasmaApp(0, 0, 0); +#endif } return qobject_cast(kapp); } PlasmaApp::PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap) +#ifdef Q_WS_X11 : KUniqueApplication(display, visual, colormap), +#else + : KUniqueApplication(), +#endif m_corona(0), m_view(0) { @@ -172,6 +194,15 @@ sysctl(mib, 2, &memorySize, &len, NULL, 0); memorySize /= 1024; #endif +#ifdef Q_WS_WIN + size_t memorySize; + + MEMORYSTATUSEX statex; + statex.dwLength = sizeof (statex); + GlobalMemoryStatusEx (&statex); + + memorySize = (statex.ullTotalPhys/1024) + (statex.ullTotalPageFile/1024); +#endif // If you have no suitable sysconf() interface and are not FreeBSD, // then you are out of luck and get a compile error. #endif @@ -193,7 +224,9 @@ enableCheats(KCmdLineArgs::parsedArgs()->isSet("cheats")); //we have to keep an eye on created windows +#ifdef Q_WS_X11 tag = XInternAtom(QX11Info::display(), "_KDE_SCREENSAVER_OVERRIDE", False); +#endif qApp->installEventFilter(this); // this line initializes the corona. @@ -291,7 +324,7 @@ } } -uint PlasmaApp::viewWinId() +WId PlasmaApp::viewWinId() { if (m_view) { //kDebug() << m_view->winId(); @@ -344,7 +377,11 @@ bool PlasmaApp::hasComposite() { +#ifdef Q_WS_X11 return colormap && KWindowSystem::compositingActive(); +#else + return false; +#endif } //I think we need this for when the corona loads the default setup @@ -403,7 +440,9 @@ m_view->setWindowOpacity(m_idleOpacity); m_view->showView(); } +#ifndef Q_WS_WIN emit viewCreated(m_view->effectiveWinId()); +#endif } bool PlasmaApp::eventFilter(QObject *obj, QEvent *event) @@ -443,8 +482,9 @@ //FIXME when returning from a subdialog to another dialog, //kbd focus is broken, only esc/enter work } - +#ifdef Q_WS_X11 XChangeProperty(QX11Info::display(), widget->effectiveWinId(), tag, tag, 8, PropModeReplace, &data, 1); +#endif kDebug() << "tagged" << widget << widget->effectiveWinId() << (data != 0); } } --- trunk/KDE/kdebase/workspace/plasma/shells/screensaver/plasmaapp.h #852577:852578 @@ -88,7 +88,7 @@ /** * @return the window id of our view, or 0 if there is none */ - uint viewWinId(); + WId viewWinId(); private Q_SLOTS: void cleanup(); --- trunk/KDE/kdebase/workspace/plasma/shells/screensaver/savercorona.h #852577:852578 @@ -27,7 +27,7 @@ /** * @short A Corona with desktop-y considerations */ -class PLASMA_EXPORT SaverCorona : public Plasma::Corona +class SaverCorona : public Plasma::Corona { Q_OBJECT