Remove the 'Test' decoration that was originally created
to test then new kwin_iii decoration API. Not needed anymore and probably doesn't even work. svn path=/trunk/KDE/kdebase/workspace/; revision=1155420
This commit is contained in:
parent
4a6ac702f6
commit
01531e3c8d
4 changed files with 0 additions and 536 deletions
|
@ -1,21 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwin3_test_PART_SRCS test.cpp )
|
||||
|
||||
|
||||
kde4_add_plugin(kwin3_test ${kwin3_test_PART_SRCS})
|
||||
|
||||
|
||||
|
||||
target_link_libraries(kwin3_test ${KDE4_KDEUI_LIBS} kdecorations )
|
||||
|
||||
install(TARGETS kwin3_test DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES test.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin )
|
|
@ -1,361 +0,0 @@
|
|||
/********************************************************************
|
||||
|
||||
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
|
||||
#include <kglobal.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
namespace KWinTest
|
||||
{
|
||||
|
||||
Decoration::Decoration( KDecorationBridge* bridge, KDecorationFactory* factory )
|
||||
: KDecoration( bridge, factory ),
|
||||
button( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
void Decoration::init()
|
||||
{
|
||||
createMainWidget();
|
||||
widget()->setEraseColor( red );
|
||||
widget()->installEventFilter( this );
|
||||
if( isCloseable())
|
||||
{
|
||||
button = new QPushButton( widget());
|
||||
button->show();
|
||||
button->setCursor( arrowCursor );
|
||||
button->move( 0, 0 );
|
||||
connect( button, SIGNAL( clicked()), SLOT( closeWindow()));
|
||||
button->setToolTip( "Zelva Mana" );
|
||||
}
|
||||
}
|
||||
|
||||
Decoration::MousePosition Decoration::mousePosition( const QPoint& p ) const
|
||||
{
|
||||
const int range = 16;
|
||||
const int border = 4;
|
||||
|
||||
MousePosition m = Nowhere;
|
||||
|
||||
int width = widget()->width();
|
||||
int height = widget()->height();
|
||||
if ( ( p.x() > border && p.x() < width - border )
|
||||
&& ( p.y() > border && p.y() < height - border ) )
|
||||
return Center;
|
||||
|
||||
if ( p.y() <= range && p.x() <= range)
|
||||
m = TopLeft2;
|
||||
else if ( p.y() >= height-range && p.x() >= width-range)
|
||||
m = BottomRight2;
|
||||
else if ( p.y() >= height-range && p.x() <= range)
|
||||
m = BottomLeft2;
|
||||
else if ( p.y() <= range && p.x() >= width-range)
|
||||
m = TopRight2;
|
||||
else if ( p.y() <= border )
|
||||
m = Top;
|
||||
else if ( p.y() >= height-border )
|
||||
m = Bottom;
|
||||
else if ( p.x() <= border )
|
||||
m = Left;
|
||||
else if ( p.x() >= width-border )
|
||||
m = Right;
|
||||
else
|
||||
m = Center;
|
||||
return m;
|
||||
}
|
||||
|
||||
void Decoration::borders( int& left, int& right, int& top, int& bottom ) const
|
||||
{
|
||||
if( options()->preferredBorderSize( factory()) == BorderTiny )
|
||||
{
|
||||
left = right = bottom = 1;
|
||||
top = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
left = right = options()->preferredBorderSize( factory()) * 5;
|
||||
top = options()->preferredBorderSize( factory()) * 10;
|
||||
bottom = options()->preferredBorderSize( factory()) * 2;
|
||||
}
|
||||
if( isShade())
|
||||
bottom = 0;
|
||||
if( ( maximizeMode() & MaximizeHorizontal ) && !options()->moveResizeMaximizedWindows())
|
||||
left = right = 0;
|
||||
if( ( maximizeMode() & MaximizeVertical ) && !options()->moveResizeMaximizedWindows())
|
||||
bottom = 0;
|
||||
}
|
||||
|
||||
void Decoration::reset( unsigned long )
|
||||
{
|
||||
}
|
||||
|
||||
void Decoration::resize( const QSize& s )
|
||||
{
|
||||
widget()->resize( s );
|
||||
}
|
||||
|
||||
QSize Decoration::minimumSize() const
|
||||
{
|
||||
return QSize( 100, 50 );
|
||||
}
|
||||
|
||||
bool Decoration::eventFilter( QObject* o, QEvent* e )
|
||||
{
|
||||
if( o == widget())
|
||||
{
|
||||
switch( e->type())
|
||||
{
|
||||
case QEvent::MouseButtonPress:
|
||||
{ // FRAME
|
||||
processMousePressEvent( static_cast< QMouseEvent* >( e ));
|
||||
return true;
|
||||
}
|
||||
case QEvent::Show:
|
||||
break;
|
||||
case QEvent::Hide:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <X11/Xlib.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
namespace KWinTest
|
||||
{
|
||||
|
||||
// taken from riscos
|
||||
bool Decoration::animateMinimize(bool iconify)
|
||||
{
|
||||
int style = 1;
|
||||
switch (style) {
|
||||
|
||||
case 1:
|
||||
{
|
||||
// Double twisting double back, with pike ;)
|
||||
|
||||
if (!iconify) // No animation for restore.
|
||||
return true;
|
||||
|
||||
// Go away quick.
|
||||
helperShowHide( false );
|
||||
qApp->syncX();
|
||||
|
||||
QRect r = iconGeometry();
|
||||
|
||||
if (!r.isValid())
|
||||
return true;
|
||||
|
||||
// Algorithm taken from Window Maker (http://www.windowmaker.org)
|
||||
|
||||
int sx = geometry().x();
|
||||
int sy = geometry().y();
|
||||
int sw = width();
|
||||
int sh = height();
|
||||
int dx = r.x();
|
||||
int dy = r.y();
|
||||
int dw = r.width();
|
||||
int dh = r.height();
|
||||
|
||||
double steps = 12;
|
||||
|
||||
double xstep = double((dx-sx)/steps);
|
||||
double ystep = double((dy-sy)/steps);
|
||||
double wstep = double((dw-sw)/steps);
|
||||
double hstep = double((dh-sh)/steps);
|
||||
|
||||
double cx = sx;
|
||||
double cy = sy;
|
||||
double cw = sw;
|
||||
double ch = sh;
|
||||
|
||||
double finalAngle = 3.14159265358979323846;
|
||||
|
||||
double delta = finalAngle / steps;
|
||||
|
||||
QPainter p( workspaceWidget());
|
||||
p.setRasterOp(Qt::NotROP);
|
||||
|
||||
for (double angle = 0; ; angle += delta) {
|
||||
|
||||
if (angle > finalAngle)
|
||||
angle = finalAngle;
|
||||
|
||||
double dx = (cw / 10) - ((cw / 5) * sin(angle));
|
||||
double dch = (ch / 2) * cos(angle);
|
||||
double midy = cy + (ch / 2);
|
||||
|
||||
QPoint p1(int(cx + dx), int(midy - dch));
|
||||
QPoint p2(int(cx + cw - dx), p1.y());
|
||||
QPoint p3(int(cx + dw + dx), int(midy + dch));
|
||||
QPoint p4(int(cx - dx), p3.y());
|
||||
|
||||
grabXServer();
|
||||
|
||||
p.drawLine(p1, p2);
|
||||
p.drawLine(p2, p3);
|
||||
p.drawLine(p3, p4);
|
||||
p.drawLine(p4, p1);
|
||||
|
||||
p.flush();
|
||||
|
||||
usleep(500);
|
||||
|
||||
p.drawLine(p1, p2);
|
||||
p.drawLine(p2, p3);
|
||||
p.drawLine(p3, p4);
|
||||
p.drawLine(p4, p1);
|
||||
|
||||
ungrabXServer();
|
||||
|
||||
// FRAME qApp->processEvents(); // FRAME ???
|
||||
|
||||
cx += xstep;
|
||||
cy += ystep;
|
||||
cw += wstep;
|
||||
ch += hstep;
|
||||
|
||||
if (angle >= finalAngle)
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
// KVirc style ? Maybe. For qwertz.
|
||||
|
||||
if (!iconify) // No animation for restore.
|
||||
return true;
|
||||
|
||||
// Go away quick.
|
||||
helperShowHide( false );
|
||||
|
||||
qApp->syncX();
|
||||
|
||||
int stepCount = 12;
|
||||
|
||||
QRect r(geometry());
|
||||
|
||||
int dx = r.width() / (stepCount * 2);
|
||||
int dy = r.height() / (stepCount * 2);
|
||||
|
||||
QPainter p( workspaceWidget());
|
||||
p.setRasterOp(Qt::NotROP);
|
||||
|
||||
for (int step = 0; step < stepCount; step++) {
|
||||
|
||||
r.translate(dx, dy);
|
||||
r.setWidth(r.width() - 2 * dx);
|
||||
r.setHeight(r.height() - 2 * dy);
|
||||
|
||||
grabXServer();
|
||||
|
||||
p.drawRect(r);
|
||||
p.flush();
|
||||
usleep(200);
|
||||
p.drawRect(r);
|
||||
|
||||
ungrabXServer();
|
||||
|
||||
// FRAME qApp->processEvents();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
{
|
||||
QRect icongeom = iconGeometry();
|
||||
|
||||
if (!icongeom.isValid())
|
||||
return true;
|
||||
|
||||
QRect wingeom = geometry();
|
||||
|
||||
QPainter p( workspaceWidget());
|
||||
|
||||
p.setRasterOp(Qt::NotROP);
|
||||
|
||||
#if 0
|
||||
if (iconify)
|
||||
p.setClipRegion(
|
||||
QRegion( workspaceWidget()->rect()) - wingeom
|
||||
);
|
||||
#endif
|
||||
|
||||
grabXServer();
|
||||
|
||||
p.drawLine(wingeom.bottomRight(), icongeom.bottomRight());
|
||||
p.drawLine(wingeom.bottomLeft(), icongeom.bottomLeft());
|
||||
p.drawLine(wingeom.topLeft(), icongeom.topLeft());
|
||||
p.drawLine(wingeom.topRight(), icongeom.topRight());
|
||||
|
||||
p.flush();
|
||||
|
||||
qApp->syncX();
|
||||
|
||||
usleep(30000);
|
||||
|
||||
p.drawLine(wingeom.bottomRight(), icongeom.bottomRight());
|
||||
p.drawLine(wingeom.bottomLeft(), icongeom.bottomLeft());
|
||||
p.drawLine(wingeom.topLeft(), icongeom.topLeft());
|
||||
p.drawLine(wingeom.topRight(), icongeom.topRight());
|
||||
|
||||
ungrabXServer();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
KDecoration* Factory::createDecoration( KDecorationBridge* bridge )
|
||||
{
|
||||
NET::WindowType type = windowType( SUPPORTED_WINDOW_TYPES_MASK, bridge );
|
||||
if( type == NET::Dialog )
|
||||
;
|
||||
return new Decoration( bridge, this );
|
||||
}
|
||||
|
||||
bool Factory::reset( unsigned long changed )
|
||||
{
|
||||
resetDecorations( changed );
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
KDE_EXPORT KDecorationFactory *create_factory()
|
||||
{
|
||||
return new KWinTest::Factory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "test.moc"
|
|
@ -1,87 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=KWin test
|
||||
Name[af]=KWin toets
|
||||
Name[ar]=اختبار كوين
|
||||
Name[be]=Тэст KWin
|
||||
Name[be@latin]=Test dla akońnika „KWin”
|
||||
Name[bg]=Тест KWin
|
||||
Name[bn]=Kwin পরীক্ষা
|
||||
Name[bn_IN]=KWin পরীক্ষা
|
||||
Name[ca]=Test de KWin
|
||||
Name[ca@valencia]=Test de KWin
|
||||
Name[cs]=KWin test
|
||||
Name[csb]=Test KWin
|
||||
Name[cy]=arbrawf KWin
|
||||
Name[da]=KWin-test
|
||||
Name[de]=KWin-Test
|
||||
Name[el]=KWin τεστ
|
||||
Name[en_GB]=KWin test
|
||||
Name[eo]=Testo de KDE-fenestroadministrilo
|
||||
Name[es]=Prueba de KWin
|
||||
Name[et]=KWin test
|
||||
Name[eu]=KWin froga
|
||||
Name[fa]=آزمون KWin
|
||||
Name[fi]=KWin-testi
|
||||
Name[fr]=Test de KWin
|
||||
Name[fy]=KWin test
|
||||
Name[ga]=Tástáil KWin
|
||||
Name[gl]=Proba de KWin
|
||||
Name[gu]=KWin ચકાસણી
|
||||
Name[he]=בדיקה של KWin
|
||||
Name[hi]=के-विन जांच
|
||||
Name[hne]=के-विन जांच
|
||||
Name[hr]=KWina proba
|
||||
Name[hsb]=KWin-test
|
||||
Name[hu]=KWin-teszt
|
||||
Name[ia]=prova de KWin
|
||||
Name[id]=Tes KWIN
|
||||
Name[is]=KWin prófun
|
||||
Name[it]=Prova di KWin
|
||||
Name[ja]=KWin テスト
|
||||
Name[ka]=KWin შემოწმება
|
||||
Name[kk]=KWin сынауы
|
||||
Name[km]=សាកល្បង KWin
|
||||
Name[kn]=ಕೆವಿನ್ ಪರೀಕ್ಷೆ
|
||||
Name[ko]=KWin 테스트
|
||||
Name[ku]=KWin test
|
||||
Name[lt]=KWin patikrinimas
|
||||
Name[lv]=KWin tests
|
||||
Name[mai]=के-विन जांच
|
||||
Name[mk]=Тест за KWin
|
||||
Name[ml]=കെവിന് ടെസ്റ്റ്
|
||||
Name[mr]=केविन जांच
|
||||
Name[ms]=Ujian KWin
|
||||
Name[nb]=KWin test
|
||||
Name[nds]=KWin-Test
|
||||
Name[ne]=केडीई विन परीक्षण
|
||||
Name[nl]=KWin test
|
||||
Name[nn]=KWin-test
|
||||
Name[pa]=KWin ਟੈਸਟ
|
||||
Name[pl]=Test KWin
|
||||
Name[pt]=Teste do KWin
|
||||
Name[pt_BR]=Teste do KWin
|
||||
Name[ro]=Test KWin
|
||||
Name[ru]=Проверка KWin
|
||||
Name[se]=KWin-geahččaleapmi
|
||||
Name[si]=KWin පරික්ෂණය
|
||||
Name[sk]=Test KWin
|
||||
Name[sl]=Preizkus KWin
|
||||
Name[sr]=Проба К‑вина
|
||||
Name[sr@ijekavian]=Проба К‑вина
|
||||
Name[sr@ijekavianlatin]=Proba KWina
|
||||
Name[sr@latin]=Proba KWina
|
||||
Name[sv]=Kwin-test
|
||||
Name[ta]=KWin சோதனை
|
||||
Name[te]=KWin పరిశీలన
|
||||
Name[tg]=Санҷиши KWin
|
||||
Name[th]=ทดสอบ KWin
|
||||
Name[tr]=KWin testi
|
||||
Name[uk]=Тест KWin
|
||||
Name[uz]=KWin sinash
|
||||
Name[uz@cyrillic]=KWin синаш
|
||||
Name[vi]=Thử KWin
|
||||
Name[wa]=Saye KWin
|
||||
Name[x-test]=xxKWin testxx
|
||||
Name[zh_CN]=KWin 测试
|
||||
Name[zh_TW]=KWin 測試
|
||||
X-KDE-Library=kwin3_test
|
|
@ -1,67 +0,0 @@
|
|||
/********************************************************************
|
||||
|
||||
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef KWIN_TEST
|
||||
#define KWIN_TEST
|
||||
|
||||
#include <kdecoration.h>
|
||||
#include <kdecorationfactory.h>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace KWinTest
|
||||
{
|
||||
|
||||
const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask
|
||||
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask /*| NET::OverrideMask*/ | NET::TopMenuMask
|
||||
| NET::UtilityMask | NET::SplashMask;
|
||||
|
||||
class Decoration
|
||||
: public KDecoration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Decoration( KDecorationBridge* bridge, KDecorationFactory* factory );
|
||||
virtual void init();
|
||||
virtual MousePosition mousePosition( const QPoint& p ) const;
|
||||
virtual void borders( int& left, int& right, int& top, int& bottom ) const;
|
||||
virtual void resize( const QSize& s );
|
||||
virtual QSize minimumSize() const;
|
||||
virtual void activeChange() {};
|
||||
virtual void captionChange() {};
|
||||
virtual void maximizeChange() {};
|
||||
virtual void desktopChange() {};
|
||||
virtual void shadeChange() {};
|
||||
virtual void iconChange() {};
|
||||
virtual bool eventFilter( QObject* o, QEvent* e );
|
||||
virtual void reset( unsigned long changed );
|
||||
virtual bool animateMinimize( bool minimize );
|
||||
private:
|
||||
QPushButton* button;
|
||||
};
|
||||
|
||||
class Factory
|
||||
: public KDecorationFactory
|
||||
{
|
||||
public:
|
||||
virtual KDecoration* createDecoration( KDecorationBridge* );
|
||||
virtual bool reset( unsigned long changed );
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue