From 2b434c3667cabc7f6ae2965dc94834e1ca22962f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 31 Dec 2011 14:24:32 +0100 Subject: [PATCH] Drop WindowInfo JavaScript bindings Everything they provided are also available directly as properties on Toplevel or Client. --- scripting/windowinfo.cpp | 50 --------------------- scripting/windowinfo.h | 97 ---------------------------------------- 2 files changed, 147 deletions(-) delete mode 100644 scripting/windowinfo.cpp delete mode 100644 scripting/windowinfo.h diff --git a/scripting/windowinfo.cpp b/scripting/windowinfo.cpp deleted file mode 100644 index 6ca3e8ec9f..0000000000 --- a/scripting/windowinfo.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 Rohan Prabhu - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#include "windowinfo.h" - -SWrapper::WindowInfo::WindowInfo(const KWindowInfo info, QScriptEngine* eng, QObject* parent) : - QObject(parent) -{ - this->infoClass = info; - centralEngine = eng; -} - -MAP_GET(valid, bool) -MAP_GET(state, int) -MAP_GET(isMinimized, bool) -MAP_GET(visibleName, QString) -MAP_GET2(windowClassClass, QString) -MAP_GET2(windowClassName, QString) -MAP_GET2(windowRole, QString) - -QScriptValue SWrapper::WindowInfo::generate(const KWindowInfo info, QScriptEngine* eng, KWin::Client* client) -{ - SWrapper::WindowInfo* winInfo = new SWrapper::WindowInfo(info, eng, static_cast(client)); - - QScriptValue temp = eng->newQObject(winInfo, - QScriptEngine::ScriptOwnership, - QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater - ); - - KWin::MetaScripting::RefWrapping::embed(temp, winInfo); - - return temp; -} diff --git a/scripting/windowinfo.h b/scripting/windowinfo.h deleted file mode 100644 index 7464989235..0000000000 --- a/scripting/windowinfo.h +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2010 Rohan Prabhu - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_SCRIPTING_WINDOWINFO_H -#define KWIN_SCRIPTING_WINDOWINFO_H - -#include "./../client.h" - -#include "meta.h" - -#include -#include - -#include - -// The following two extremely helpful functions are taken -// from the KWin Scripting proof-of-concept submitted by -// Lubos Lunak . Copyrights belong with -// original author (Lubos Lunak). - -#undef MAP_GET -#undef MAP_SET - -#define MAP_GET2(name, type2) \ - type2 SWrapper::WindowInfo::name() const { \ - return type2(infoClass.name()); \ - } - -#define MAP_GET(name, type) \ - type SWrapper::WindowInfo::name() const { \ - return infoClass.name(); \ - } - -#define MAP_SET(name, type) \ - void SWrapper::Toplevel::name(type value) { \ - subObject->name(value); \ - } - - -namespace SWrapper -{ - -// No signals/slots here, but the usage of properties -// would make things a breeze, so a QObject it is. -class WindowInfo : public QObject -{ - Q_OBJECT -private: - KWindowInfo infoClass; - QScriptEngine* centralEngine; - - /** - * The info about a lot of window properties enumerated from the - * client this windowinfo was generated from. - */ - Q_PROPERTY(bool valid READ valid) - Q_PROPERTY(int state READ state) - Q_PROPERTY(bool isMinimized READ isMinimized) - Q_PROPERTY(QString visibleName READ visibleName) - Q_PROPERTY(QString windowClassClass READ windowClassClass) - Q_PROPERTY(QString windowClassName READ windowClassName) - Q_PROPERTY(QString windowRole READ windowRole) - - bool valid() const; - int state() const; - bool isMinimized() const; - QString visibleName() const; - - QString windowClassClass() const; - QString windowClassName() const; - QString windowRole() const; - -public: - WindowInfo(const KWindowInfo, QScriptEngine*, QObject* parent = 0); - static QScriptValue generate(const KWindowInfo, QScriptEngine*, KWin::Client* client = 0); -}; - -} - -#endif