number multiheadScreen

svn path=/trunk/KDE/kdebase/workspace/; revision=1198582
This commit is contained in:
Aaron J. Seigo 2010-11-19 02:27:32 +00:00 committed by Marco Martin
parent 61a7ee7247
commit 0e16dcd2e0
2 changed files with 27 additions and 0 deletions

View File

@ -29,6 +29,11 @@
#include <Plasma/DataEngineManager> #include <Plasma/DataEngineManager>
#include <Plasma/Theme> #include <Plasma/Theme>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <fixx11h.h>
#endif
#include "scriptengine.h" #include "scriptengine.h"
namespace WorkspaceScripting namespace WorkspaceScripting
@ -112,6 +117,25 @@ bool AppInterface::multihead() const
return KGlobalSettings::isMultiHead(); return KGlobalSettings::isMultiHead();
} }
int AppInterface::multiheadScreen() const
{
int id = -1;
#ifdef Q_WS_X11
if (KGlobalSettings::isMultiHead()) {
// with multihead, we "lie" and say that screen 0 is the default screen, in fact, we pretend
// we have only one screen at all
Display *dpy = XOpenDisplay(NULL);
if (dpy) {
id = DefaultScreen(dpy);
XCloseDisplay(dpy);
}
}
#endif
return id;
}
void AppInterface::lockCorona(bool locked) void AppInterface::lockCorona(bool locked)
{ {
m_env->corona()->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable); m_env->corona()->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable);

View File

@ -53,6 +53,7 @@ class PLASMAGENERICSHELL_EXPORT AppInterface : public QObject
Q_PROPERTY(QString platformVersion READ platformVersion) Q_PROPERTY(QString platformVersion READ platformVersion)
Q_PROPERTY(int scriptingVersion READ scriptingVersion) Q_PROPERTY(int scriptingVersion READ scriptingVersion)
Q_PROPERTY(bool multihead READ multihead) Q_PROPERTY(bool multihead READ multihead)
Q_PROPERTY(bool multiheadScreen READ multihead)
public: public:
AppInterface(ScriptEngine *env); AppInterface(ScriptEngine *env);
@ -75,6 +76,8 @@ public:
void setTheme(const QString &name); void setTheme(const QString &name);
bool multihead() const; bool multihead() const;
int multiheadScreen() const;
bool coronaLocked() const; bool coronaLocked() const;
public Q_SLOTS: public Q_SLOTS: