summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/noatunmadness
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/noatunmadness
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/noatunmadness')
-rw-r--r--noatun-plugins/noatunmadness/Makefile.am10
-rw-r--r--noatun-plugins/noatunmadness/madness.cpp123
-rw-r--r--noatun-plugins/noatunmadness/madness.h32
-rw-r--r--noatun-plugins/noatunmadness/madness.plugin105
4 files changed, 270 insertions, 0 deletions
diff --git a/noatun-plugins/noatunmadness/Makefile.am b/noatun-plugins/noatunmadness/Makefile.am
new file mode 100644
index 0000000..973ae51
--- /dev/null
+++ b/noatun-plugins/noatunmadness/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES= $(all_includes)
+
+kde_module_LTLIBRARIES = noatunmadness.la
+noatunmadness_la_SOURCES = madness.cpp
+noatunmadness_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+noatunmadness_la_LIBADD = $(LIB_KFILE) -lnoatun -lm
+noatunmadness_la_METASOURCES = AUTO
+
+noatun_DATA = madness.plugin
+noatundir = $(kde_datadir)/noatun
diff --git a/noatun-plugins/noatunmadness/madness.cpp b/noatun-plugins/noatunmadness/madness.cpp
new file mode 100644
index 0000000..0b0d086
--- /dev/null
+++ b/noatun-plugins/noatunmadness/madness.cpp
@@ -0,0 +1,123 @@
+/*****************************************************************
+
+Copyright (c) 2001 Charles Samuels <charles@kde.org>
+ 2000 Rik Hemsley <rik@kde.org>
+
+This code is released under the GNU General Public License 2.0, or any
+later version, at your option. I mean, you know the drill, just read
+RMS's novel that I'm supposed to put at the top of every story. He's insane.
+******************************************************************/
+
+#include "madness.h"
+
+#include <kwin.h>
+#include <kwinmodule.h>
+#include <kiconloader.h>
+#include <math.h>
+#include <iostream>
+
+#include <X11/Xlib.h>
+
+
+extern "C"
+{
+Plugin *create_plugin()
+{
+ return new Madness();
+}
+}
+
+Madness::Madness()
+ : MonoFFTScope(100), Plugin(), mWm(this)
+{
+ connect(&mWm, SIGNAL(currentDesktopChanged(int)), SLOT(update()));
+ connect(&mWm, SIGNAL(windowAdded(WId)), SLOT(update()));
+ connect(&mWm, SIGNAL(windowRemoved(WId)), SLOT(update()));
+ connect(&mWm, SIGNAL(strutChanged()), SLOT(update()));
+
+}
+
+Madness::~Madness()
+{
+ QMap<WId, QPoint>::ConstIterator it(mOriginalPositions.begin());
+
+ for (; it != mOriginalPositions.end(); ++it)
+ XMoveWindow(qt_xdisplay(), it.key(), (*it).x(), (*it).y());
+}
+
+void Madness::update()
+{
+ mWindowList = mWm.windows();
+ mWorkArea = mWm.workArea();
+
+ QValueList<WId>::ConstIterator it(mWindowList.begin());
+
+ for (; it != mWindowList.end(); ++it)
+ {
+ QRect area=KWin::info(*it).frameGeometry;
+ if (!mOriginalPositions.contains(*it))
+ mOriginalPositions.insert(*it, area.topLeft());
+ }
+}
+
+void Madness::init()
+{
+ update();
+ MonoFFTScope::start();
+}
+
+void Madness::scopeEvent(float *d, int size)
+{
+ int delta=0; // in pixels
+ for (int count=0; count<size; count++)
+ {
+ delta+=(int)((log10(d[count]+1)/log(2))*(size-count))/2;
+ }
+
+// cout << "delta: " << delta << endl;
+
+ QValueList<WId>::ConstIterator it(mWindowList.begin());
+
+ for (; it != mWindowList.end(); ++it)
+ {
+ KWin::Info i(KWin::info(*it));
+
+ if ((NET::Visible != i.mappingState) ||
+ ((NET::Unknown != i.windowType) &&
+ (NET::Normal != i.windowType) &&
+ (NET::Tool != i.windowType) &&
+ (NET::Menu != i.windowType) &&
+ (NET::Dialog != i.windowType)) || (NET::Max & i.state)
+ || (NET::Shaded & i.state)
+ || (mWm.currentDesktop() != i.desktop))
+ continue;
+
+ QRect area=i.frameGeometry;
+ float lightness=100000.0/(area.width()*area.height());
+
+ int x=area.x();
+ int y=area.y();
+
+
+ int dx=(int)((delta*lightness*(area.height()/10)/100))*(KApplication::random()%2 ? -1 : 1);
+ int dy=(int)((delta*lightness*(area.width()/10)/100))*(KApplication::random()%2 ? -1 : 1);
+
+ if (dx < 0 && (x - dx < mWorkArea.left()))
+ dx = -dx;
+
+ else if (dx > 0 && (x + dx + area.width() > mWorkArea.right()))
+ dx = -dx;
+
+ if (dy < 0 && (y - dy < mWorkArea.top()))
+ dy = -dy;
+
+ else if (dy > 0 && (y + dy + area.height() > mWorkArea.bottom()))
+ dy = -dy;
+
+
+ XMoveWindow(qt_xdisplay(), i.win, x + dx, y + dy);
+ }
+
+}
+
+#include "madness.moc"
diff --git a/noatun-plugins/noatunmadness/madness.h b/noatun-plugins/noatunmadness/madness.h
new file mode 100644
index 0000000..b36c468
--- /dev/null
+++ b/noatun-plugins/noatunmadness/madness.h
@@ -0,0 +1,32 @@
+#ifndef MADNESS_H
+#define MADNESS_H
+
+#include <noatun/plugin.h>
+#include <string.h>
+#include <qmap.h>
+#include <qvaluelist.h>
+#include <kwinmodule.h>
+
+class Madness : public QObject, public MonoFFTScope, public Plugin
+{
+Q_OBJECT
+public:
+ Madness();
+ virtual ~Madness();
+
+ void init();
+
+private slots:
+ void update();
+
+protected:
+ virtual void scopeEvent(float *data, int bands);
+
+private:
+ KWinModule mWm;
+ QValueList<WId> mWindowList;
+ QRect mWorkArea;
+ QMap<WId, QPoint> mOriginalPositions;
+};
+
+#endif
diff --git a/noatun-plugins/noatunmadness/madness.plugin b/noatun-plugins/noatunmadness/madness.plugin
new file mode 100644
index 0000000..ddfd136
--- /dev/null
+++ b/noatun-plugins/noatunmadness/madness.plugin
@@ -0,0 +1,105 @@
+Filename=noatunmadness.la
+Author=Charles Samuels
+Site=http://noatun.kde.org/
+Email=charles@kde.org
+Type=visualization
+License=GPL
+Name=Madness
+Name[ar]=جنون
+Name[az]=Dəlilik
+Name[br]=Fallentez
+Name[bs]=Ludilo
+Name[cs]=Šílenost
+Name[cy]=Gwallgofrwydd
+Name[da]=Galskab
+Name[de]=Verrücktheit
+Name[el]=Τρέλα
+Name[eo]=Delireco
+Name[es]=Locura
+Name[et]=Hullumeelsus
+Name[fa]=دیوانگی
+Name[fi]=Hulluus
+Name[fy]=Gekheid
+Name[gl]=Loucura
+Name[hi]=मेडनेस
+Name[hr]=Ludilo
+Name[ka]=სიგიჟე
+Name[km]=ភាពឆ្កួត
+Name[lt]=Beprotybė
+Name[mk]=Беснило
+Name[nds]=Mallheit
+Name[ne]=पागलपन
+Name[nl]=Gekheid
+Name[nn]=Galskap
+Name[nso]=Bogafa
+Name[pl]=Szaleństwo
+Name[pt]=Loucura
+Name[pt_BR]=Maldade
+Name[ro]=Nebunie
+Name[ru]=Безумие
+Name[sl]=Norost
+Name[sv]=Galenskap
+Name[ta]= முட்டாள்தனம்
+Name[tg]=Беандешагӣ
+Name[tr]=Çılgınlık
+Name[uk]=Божевілля
+Name[vi]=Chứng điên
+Name[xh]=Impambano
+Name[zh_CN]=疯狂
+Comment=A weird and annoying scope that moves your windows
+Comment[af]='n weird en irriterend skoop wat skuiwe jou vensters
+Comment[ar]=ملحق غريب و مزعج يقوم بتحريك نوافذك
+Comment[az]=Pəncərələrinizi daşıyan dəlicə və narahat edən dairə
+Comment[bg]=Досадна приставка за преместване на прозореца
+Comment[bs]=Čudan i neugodan scope koji pomjera rvaše prozore
+Comment[ca]=Un estrany i molest calidoscopi que mou les finestres
+Comment[cs]=Otravná vizualizace, který hýbe s vašimi okny
+Comment[cy]=Sgop annifyr a diflas sy'n symud eich ffenestri
+Comment[da]=Et underligt og irriterende virkefelt der flytter dine vinduer
+Comment[de]=Ein verrücktes und nervendes Oszilloskop, das Fenster verschiebt
+Comment[el]=Ένα περίεργο και ενοχλητικό καλειδοσκόπιο που μετακινεί τα παράθυρά σας
+Comment[eo]=Bizara kaj incita vidilo kiu movas viajn fenestrojn
+Comment[es]=Algo extraño y fastidioso se mueve por su pantalla
+Comment[et]=Veider ja ärritav ostsilloskoop, mis paneb aknad lendlema
+Comment[eu]=Zure leihoak mugitzen dituen esparru bitxi eta harrigarria
+Comment[fa]=دامنۀ رنجش‌آور و مرموزی که پنجره‌های شما را حرکت می‌دهد
+Comment[fi]=Outo ja rasittava oskiloskooppi, joka liikuttelee ikkunoitasi
+Comment[fr]=Un aperçu magique et ennuyeux qui déplace votre fenêtre
+Comment[fy]=In maffe en nerveuze Ossilloskoop dy't jo finsters ferpleatst
+Comment[ga]=Scóp corr ciapach a bhogann do chuid fuinneog
+Comment[gl]=Un osciloscópio estraño e irritante que move as suas fiestras
+Comment[he]=תחום מוזר ומעצבן שמזיז את החלונות שלך
+Comment[hi]=एक सनकी और चिढ़ाकू स्कोप जो आपके विंडो को खिसकाता है
+Comment[hr]=Neobičan i živcirajući osciloskop koji pomiče vaše prozore
+Comment[hu]=Egy különleges ablakmozgató vizualizációs modul
+Comment[is]=Undarlegur og pirrandi mælir sem færir gluggana þína
+Comment[it]=Uno strano e scocciante "scope" che muove le tue finestre
+Comment[ja]=奇妙で鬱しくあなたのウィンドウを動かすスコープ
+Comment[ka]=უცნაური გამოსახულებები, რომლებიც თქვენს ფანჯრებს გადააადგილებს
+Comment[kk]=Терезлеріңізді жылжытатын біртүрлі көрініс
+Comment[km]= វិសាល​ដែល​រំខាន ​និង​ចំឡែក​ដែល​ផ្លាស់ទី​បង្អួច​របស់​អ្នក​
+Comment[lt]=Keista ir erzinantis vaizdas, judinantis Jūsų langus
+Comment[mk]=Чуден и досаден осцилоскоп што Ви ги движи прозорците
+Comment[ms]=Skop yang pelik untuk memerhati pergerakan pada tetingkap anda
+Comment[nb]=En rar og irriterende ting som flytter vinduene dine
+Comment[nds]=En snaaksch un piesacken Frequenzkieker, de Finster verschufft
+Comment[ne]=तपाईँको सञ्झ्याल चलाउने एउटा भाग्य र कष्टप्रद क्षेत्र
+Comment[nl]=Een maffe en nerveuze Oscilloscoop die uw vensters verplaatst
+Comment[nn]=Ein rar og irriterande ting som flyttar vindauga dine
+Comment[pl]=Przesuwa twoje okna w rytm muzyki
+Comment[pt]=Um osciloscópio estranho e irritante que move as suas janelas
+Comment[pt_BR]= Um escopo estranho que move suas janelas
+Comment[ro]=Un modul de vizualizare care mişcă ferestrele
+Comment[ru]=Странный зрительный образ, перемещающий ваши окна
+Comment[sk]=Šialený a protivný rámec ktorý hýbe vašími oknami.
+Comment[sl]=Čudno in nadležno območje, ki premika vaša okna
+Comment[sr]=Чудан и иритирајући нишан који помера ваше прозоре
+Comment[sr@Latn]=Čudan i iritirajući nišan koji pomera vaše prozore
+Comment[sv]=Konstigt och påfrestande oscilloskop som flyttar fönster
+Comment[ta]=ஒரு புதிரான வரையெல்லை உங்கள் சாளரத்தை நகர்த்துகிறது
+Comment[tg]=Намуди тамошобини аҷиб, ки тирезаҳои шуморо бетартиб мекунад
+Comment[tr]=Pencerelerinizi taşıyan garip ve sinir bozucu bir alan
+Comment[uk]=Дивний та набридливий моноскоп, що пересуває ваші вікна
+Comment[vi]=Ô xem lạ di chuyển các cửa sổ
+Comment[xh]=Isibuko esingaqhelekanga nesidikayo sesibuko esi hambisa iiwindow zakho
+Comment[zh_CN]=一个会移动您的窗口的奇怪而有讨厌的观测器