Make resource management in clients easier with these three functions:
init() called after client got loaded deinit() called when client is about to get unloaded reset() called once before Options::resetClients() is emitted svn path=/trunk/kdebase/kwin/; revision=93372
This commit is contained in:
parent
93f4cf1dce
commit
57f4808d0f
16 changed files with 312 additions and 132 deletions
|
@ -15,16 +15,9 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new B2Client(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: stick all these in an array
|
// TODO: stick all these in an array
|
||||||
static KPixmap *aClosePix=0, *aClosePixDown;
|
static KPixmap *aClosePix, *aClosePixDown;
|
||||||
static KPixmap *iClosePix, *iClosePixDown;
|
static KPixmap *iClosePix, *iClosePixDown;
|
||||||
static KPixmap *aMaxPix, *aMaxPixDown;
|
static KPixmap *aMaxPix, *aMaxPixDown;
|
||||||
static KPixmap *iMaxPix, *iMaxPixDown;
|
static KPixmap *iMaxPix, *iMaxPixDown;
|
||||||
|
@ -76,7 +69,6 @@ static void redraw_pixmaps();
|
||||||
|
|
||||||
QPixmap* kwin_get_menu_pix_hack()
|
QPixmap* kwin_get_menu_pix_hack()
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
//return menu_pix; FIXME
|
//return menu_pix; FIXME
|
||||||
return aMenuPix;
|
return aMenuPix;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +167,40 @@ static void create_pixmaps()
|
||||||
redraw_pixmaps();
|
redraw_pixmaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void delete_pixmaps()
|
||||||
|
{
|
||||||
|
delete aClosePix;
|
||||||
|
delete aClosePixDown;
|
||||||
|
delete iClosePix;
|
||||||
|
delete iClosePixDown;
|
||||||
|
delete aMaxPix;
|
||||||
|
delete aMaxPixDown;
|
||||||
|
delete iMaxPix;
|
||||||
|
delete iMaxPixDown;
|
||||||
|
delete aNormalizePix;
|
||||||
|
delete aNormalizePixDown;
|
||||||
|
delete iNormalizePix;
|
||||||
|
delete iNormalizePixDown;
|
||||||
|
delete aIconifyPix;
|
||||||
|
delete aIconifyPixDown;
|
||||||
|
delete iIconifyPix;
|
||||||
|
delete iIconifyPixDown;
|
||||||
|
delete aPinupPix;
|
||||||
|
delete aPinupPixDown;
|
||||||
|
delete iPinupPix;
|
||||||
|
delete iPinupPixDown;
|
||||||
|
delete aMenuPix;
|
||||||
|
delete aMenuPixDown;
|
||||||
|
delete iMenuPix;
|
||||||
|
delete iMenuPixDown;
|
||||||
|
delete aHelpPix;
|
||||||
|
delete aHelpPixDown;
|
||||||
|
delete iHelpPix;
|
||||||
|
delete iHelpPixDown;
|
||||||
|
|
||||||
|
pixmaps_created = false;
|
||||||
|
}
|
||||||
|
|
||||||
B2Button::B2Button(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix,
|
B2Button::B2Button(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix,
|
||||||
KPixmap *iPixDown, Client *_client, QWidget *parent,
|
KPixmap *iPixDown, Client *_client, QWidget *parent,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
@ -436,7 +462,6 @@ B2Client::B2Client( Workspace *ws, WId w, QWidget *parent,
|
||||||
bar_x_ofs = 0;
|
bar_x_ofs = 0;
|
||||||
in_unobs = 0;
|
in_unobs = 0;
|
||||||
|
|
||||||
create_pixmaps();
|
|
||||||
g = new QGridLayout( this, 0, 0);
|
g = new QGridLayout( this, 0, 0);
|
||||||
g->addMultiCellWidget(windowWrapper(), 1, 1, 1, 2);
|
g->addMultiCellWidget(windowWrapper(), 1, 1, 1, 2);
|
||||||
|
|
||||||
|
@ -1017,4 +1042,24 @@ void B2Client::positionButtons()
|
||||||
titlebar->move(bar_x_ofs, 0);
|
titlebar->move(bar_x_ofs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new B2Client(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
redraw_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "b2client.moc"
|
#include "b2client.moc"
|
||||||
|
|
|
@ -22,15 +22,6 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client * allocate(Workspace * workSpace, WId winId, int tool )
|
|
||||||
{
|
|
||||||
if ( tool )
|
|
||||||
return new StdToolClient( workSpace, winId );
|
|
||||||
return new StdClient(workSpace, winId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static QPixmap* close_pix = 0;
|
static QPixmap* close_pix = 0;
|
||||||
|
@ -147,7 +138,7 @@ static void create_pixmaps()
|
||||||
question_mark_pix->setMask(QBitmap(16, 16, help_mask_bits, true));
|
question_mark_pix->setMask(QBitmap(16, 16, help_mask_bits, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StdClient::slotReset()
|
static void delete_pixmaps()
|
||||||
{
|
{
|
||||||
delete close_pix;
|
delete close_pix;
|
||||||
delete maximize_pix;
|
delete maximize_pix;
|
||||||
|
@ -165,8 +156,10 @@ void StdClient::slotReset()
|
||||||
delete dis_menu_pix;
|
delete dis_menu_pix;
|
||||||
delete question_mark_pix;
|
delete question_mark_pix;
|
||||||
pixmaps_created = false;
|
pixmaps_created = false;
|
||||||
create_pixmaps();
|
}
|
||||||
|
|
||||||
|
void StdClient::slotReset()
|
||||||
|
{
|
||||||
if(miniIcon().isNull())
|
if(miniIcon().isNull())
|
||||||
button[0]->setIconSet(isActive() ? *menu_pix : *dis_menu_pix);
|
button[0]->setIconSet(isActive() ? *menu_pix : *dis_menu_pix);
|
||||||
button[1]->setIconSet(isSticky() ? isActive() ? *pindown_pix : *dis_pindown_pix :
|
button[1]->setIconSet(isSticky() ? isActive() ? *pindown_pix : *dis_pindown_pix :
|
||||||
|
@ -184,7 +177,6 @@ void StdClient::slotReset()
|
||||||
StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
|
StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase )
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
setFont(options->font(isActive() ));
|
setFont(options->font(isActive() ));
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
|
|
||||||
|
@ -507,7 +499,6 @@ void StdToolClient::activeChange( bool on )
|
||||||
|
|
||||||
void StdToolClient::slotReset()
|
void StdToolClient::slotReset()
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
QImage img = close_pix->convertToImage();
|
QImage img = close_pix->convertToImage();
|
||||||
img = img.smoothScale( 12, 12 );
|
img = img.smoothScale( 12, 12 );
|
||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
|
@ -516,6 +507,28 @@ void StdToolClient::slotReset()
|
||||||
setFont(options->font(isActive(), true ));
|
setFont(options->font(isActive(), true ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client * allocate(Workspace * workSpace, WId winId, int tool )
|
||||||
|
{
|
||||||
|
if ( tool )
|
||||||
|
return new StdToolClient( workSpace, winId );
|
||||||
|
return new StdClient(workSpace, winId);
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "kde1client.moc"
|
#include "kde1client.moc"
|
||||||
|
|
|
@ -13,13 +13,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int )
|
|
||||||
{
|
|
||||||
return(new NextClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char close_bits[] = {
|
static unsigned char close_bits[] = {
|
||||||
|
@ -160,7 +153,7 @@ static void create_pixmaps()
|
||||||
btnForeground = new QColor(Qt::white);
|
btnForeground = new QColor(Qt::white);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_pixmaps()
|
static void delete_pixmaps()
|
||||||
{
|
{
|
||||||
delete aTitlePix;
|
delete aTitlePix;
|
||||||
delete iTitlePix;
|
delete iTitlePix;
|
||||||
|
@ -179,8 +172,6 @@ void delete_pixmaps()
|
||||||
|
|
||||||
void NextClient::slotReset()
|
void NextClient::slotReset()
|
||||||
{
|
{
|
||||||
delete_pixmaps();
|
|
||||||
create_pixmaps();
|
|
||||||
button[0]->reset();
|
button[0]->reset();
|
||||||
button[1]->reset();
|
button[1]->reset();
|
||||||
button[2]->reset();
|
button[2]->reset();
|
||||||
|
@ -226,7 +217,6 @@ NextClient::NextClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase )
|
||||||
{
|
{
|
||||||
setBackgroundMode( NoBackground );
|
setBackgroundMode( NoBackground );
|
||||||
create_pixmaps();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||||
|
@ -377,5 +367,25 @@ NextClient::mousePosition( const QPoint& p ) const
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int )
|
||||||
|
{
|
||||||
|
return(new NextClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "nextclient.moc"
|
#include "nextclient.moc"
|
||||||
|
|
|
@ -20,13 +20,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w)
|
|
||||||
{
|
|
||||||
return(new KWMThemeClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QPixmap stretchPixmap(QPixmap& src, bool stretchVert){
|
static QPixmap stretchPixmap(QPixmap& src, bool stretchVert){
|
||||||
QPixmap dest;
|
QPixmap dest;
|
||||||
|
@ -85,7 +78,7 @@ static bool pixmaps_created = false;
|
||||||
static bool titleSunken = false;
|
static bool titleSunken = false;
|
||||||
static bool titleTransparent;
|
static bool titleTransparent;
|
||||||
|
|
||||||
static void init_theme()
|
static void create_pixmaps()
|
||||||
{
|
{
|
||||||
const char *keys[] = {"wm_top", "wm_bottom", "wm_left", "wm_right",
|
const char *keys[] = {"wm_top", "wm_bottom", "wm_left", "wm_right",
|
||||||
"wm_topleft", "wm_topright", "wm_bottomleft", "wm_bottomright"};
|
"wm_topleft", "wm_topright", "wm_bottomleft", "wm_bottomright"};
|
||||||
|
@ -209,13 +202,9 @@ static void init_theme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void delete_pixmaps()
|
||||||
KWMThemeClient::slotReset()
|
|
||||||
{
|
{
|
||||||
if (!pixmaps_created) return;
|
for(int i=0; i < 8; ++i)
|
||||||
pixmaps_created = false;
|
|
||||||
|
|
||||||
for(int i=0; i < 8; ++i)
|
|
||||||
delete framePixmaps[i];
|
delete framePixmaps[i];
|
||||||
|
|
||||||
delete menuPix;
|
delete menuPix;
|
||||||
|
@ -233,8 +222,11 @@ KWMThemeClient::slotReset()
|
||||||
titleGradient = true;
|
titleGradient = true;
|
||||||
pixmaps_created = false;
|
pixmaps_created = false;
|
||||||
titleSunken = false;
|
titleSunken = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KWMThemeClient::slotReset()
|
||||||
|
{
|
||||||
|
|
||||||
init_theme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyButton::drawButtonLabel(QPainter *p)
|
void MyButton::drawButtonLabel(QPainter *p)
|
||||||
|
@ -250,7 +242,6 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity)
|
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity)
|
||||||
{
|
{
|
||||||
stickyBtn = maxBtn = mnuBtn = 0;
|
stickyBtn = maxBtn = mnuBtn = 0;
|
||||||
init_theme();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
QGridLayout *layout = new QGridLayout(this);
|
QGridLayout *layout = new QGridLayout(this);
|
||||||
layout->addColSpacing(0, maxExtent);
|
layout->addColSpacing(0, maxExtent);
|
||||||
|
@ -797,6 +788,25 @@ void KWMThemeClient::init()
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w)
|
||||||
|
{
|
||||||
|
return(new KWMThemeClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "kwmthemeclient.moc"
|
#include "kwmthemeclient.moc"
|
||||||
|
|
|
@ -18,13 +18,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new LaptopClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char iconify_bits[] = {
|
static unsigned char iconify_bits[] = {
|
||||||
|
@ -210,6 +203,24 @@ static void create_pixmaps()
|
||||||
btnForeground = Qt::white;
|
btnForeground = Qt::white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void delete_pixmaps()
|
||||||
|
{
|
||||||
|
delete titlePix;
|
||||||
|
if(aUpperGradient){
|
||||||
|
delete aUpperGradient;
|
||||||
|
delete iUpperGradient;
|
||||||
|
delete btnPix1;
|
||||||
|
delete btnDownPix1;
|
||||||
|
delete iBtnPix1;
|
||||||
|
delete iBtnDownPix1;
|
||||||
|
delete btnPix2;
|
||||||
|
delete btnDownPix2;
|
||||||
|
delete iBtnPix2;
|
||||||
|
delete iBtnDownPix2;
|
||||||
|
}
|
||||||
|
pixmaps_created = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LaptopClientButton::LaptopClientButton(int w, int h, Client *parent, const char *name,
|
LaptopClientButton::LaptopClientButton(int w, int h, Client *parent, const char *name,
|
||||||
const unsigned char *bitmap)
|
const unsigned char *bitmap)
|
||||||
|
@ -280,21 +291,6 @@ void LaptopClientButton::drawButton(QPainter *p)
|
||||||
|
|
||||||
void LaptopClient::slotReset()
|
void LaptopClient::slotReset()
|
||||||
{
|
{
|
||||||
delete titlePix;
|
|
||||||
if(aUpperGradient){
|
|
||||||
delete aUpperGradient;
|
|
||||||
delete iUpperGradient;
|
|
||||||
delete btnPix1;
|
|
||||||
delete btnDownPix1;
|
|
||||||
delete iBtnPix1;
|
|
||||||
delete iBtnDownPix1;
|
|
||||||
delete btnPix2;
|
|
||||||
delete btnDownPix2;
|
|
||||||
delete iBtnPix2;
|
|
||||||
delete iBtnDownPix2;
|
|
||||||
}
|
|
||||||
pixmaps_created = false;
|
|
||||||
create_pixmaps();
|
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < 5; ++i){
|
for(i=0; i < 5; ++i){
|
||||||
if(button[i])
|
if(button[i])
|
||||||
|
@ -310,7 +306,6 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
lastButtonWidth = 0;
|
lastButtonWidth = 0;
|
||||||
lastBufferWidth = 0;
|
lastBufferWidth = 0;
|
||||||
|
|
||||||
create_pixmaps();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
bool help = providesContextHelp();
|
bool help = providesContextHelp();
|
||||||
|
|
||||||
|
@ -685,4 +680,25 @@ LaptopClient::mousePosition( const QPoint& p ) const
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new LaptopClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "laptopclient.moc"
|
#include "laptopclient.moc"
|
||||||
|
|
|
@ -18,13 +18,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new ModernSys(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char iconify_bits[] = {
|
static unsigned char iconify_bits[] = {
|
||||||
|
@ -249,8 +242,6 @@ void ModernButton::mouseReleaseEvent( QMouseEvent* e )
|
||||||
|
|
||||||
void ModernSys::slotReset()
|
void ModernSys::slotReset()
|
||||||
{
|
{
|
||||||
delete_pixmaps();
|
|
||||||
create_pixmaps();
|
|
||||||
titleBuffer.resize(0, 0);
|
titleBuffer.resize(0, 0);
|
||||||
recalcTitleBuffer();
|
recalcTitleBuffer();
|
||||||
button[0]->reset();
|
button[0]->reset();
|
||||||
|
@ -266,7 +257,6 @@ ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase )
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
bool help = providesContextHelp();
|
bool help = providesContextHelp();
|
||||||
|
|
||||||
|
@ -568,4 +558,26 @@ Client::MousePosition ModernSys::mousePosition( const QPoint& p) const
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new ModernSys(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "modernsys.moc"
|
#include "modernsys.moc"
|
||||||
|
|
|
@ -13,13 +13,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w)
|
|
||||||
{
|
|
||||||
return(new MwmClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char close_bits[] = {
|
static unsigned char close_bits[] = {
|
||||||
|
@ -93,7 +86,7 @@ static void create_pixmaps()
|
||||||
KPixmapEffect::VerticalGradient);
|
KPixmapEffect::VerticalGradient);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwmClient::slotReset()
|
static void delete_pixmaps()
|
||||||
{
|
{
|
||||||
delete aTitlePix;
|
delete aTitlePix;
|
||||||
delete iTitlePix;
|
delete iTitlePix;
|
||||||
|
@ -102,7 +95,10 @@ void MwmClient::slotReset()
|
||||||
delete aHandlePix;
|
delete aHandlePix;
|
||||||
delete iHandlePix;
|
delete iHandlePix;
|
||||||
pixmaps_created = false;
|
pixmaps_created = false;
|
||||||
create_pixmaps();
|
}
|
||||||
|
|
||||||
|
void MwmClient::slotReset()
|
||||||
|
{
|
||||||
button[0]->reset();
|
button[0]->reset();
|
||||||
button[1]->reset();
|
button[1]->reset();
|
||||||
button[2]->reset();
|
button[2]->reset();
|
||||||
|
@ -194,7 +190,6 @@ MwmClient::MwmClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase )
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||||
|
@ -320,5 +315,25 @@ void MwmClient::init()
|
||||||
Client::init();
|
Client::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w)
|
||||||
|
{
|
||||||
|
return(new MwmClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "mwmclient.moc"
|
#include "mwmclient.moc"
|
||||||
|
|
|
@ -24,13 +24,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new QuartzClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *kdelogo[] = {
|
static const char *kdelogo[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
|
@ -186,7 +179,7 @@ static void create_pixmaps()
|
||||||
drawBlocks( ititleBlocks, *ititleBlocks, c, c2 );
|
drawBlocks( ititleBlocks, *ititleBlocks, c, c2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_pixmaps()
|
static void delete_pixmaps()
|
||||||
{
|
{
|
||||||
btnPix1 = new KPixmap;
|
btnPix1 = new KPixmap;
|
||||||
iBtnPix1 = new KPixmap;
|
iBtnPix1 = new KPixmap;
|
||||||
|
@ -328,9 +321,6 @@ QuartzClient::QuartzClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
|
|
||||||
lastButtonWidth = 0;
|
lastButtonWidth = 0;
|
||||||
|
|
||||||
// Create the button and titlebar pixmaps
|
|
||||||
create_pixmaps();
|
|
||||||
|
|
||||||
// Pack the windowWrapper() window within a grid
|
// Pack the windowWrapper() window within a grid
|
||||||
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
||||||
g->setResizeMode(QLayout::FreeResize);
|
g->setResizeMode(QLayout::FreeResize);
|
||||||
|
@ -395,9 +385,6 @@ QuartzClient::QuartzClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
|
|
||||||
void QuartzClient::slotReset()
|
void QuartzClient::slotReset()
|
||||||
{
|
{
|
||||||
delete_pixmaps();
|
|
||||||
create_pixmaps();
|
|
||||||
|
|
||||||
// ( 4 buttons - Help, Max, Iconify, Close )
|
// ( 4 buttons - Help, Max, Iconify, Close )
|
||||||
for(int i = QuartzClient::BtnHelp; i <= QuartzClient::BtnClose; i++)
|
for(int i = QuartzClient::BtnHelp; i <= QuartzClient::BtnClose; i++)
|
||||||
if(button[i])
|
if(button[i])
|
||||||
|
@ -668,4 +655,25 @@ void QuartzClient::menuButtonPressed()
|
||||||
tc = this;
|
tc = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new QuartzClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "quartz.moc"
|
#include "quartz.moc"
|
||||||
|
|
|
@ -52,6 +52,19 @@ extern "C"
|
||||||
else
|
else
|
||||||
return new RiscOS::Manager(workSpace, winId);
|
return new RiscOS::Manager(workSpace, winId);
|
||||||
}
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
(void) RiscOS::Static::instance();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
RiscOS::Static::instance()->update();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete RiscOS::Static::instance();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
@ -343,7 +356,6 @@ Manager::slotReset()
|
||||||
{
|
{
|
||||||
for (QDictIterator<Button> it(buttonDict_); it.current(); ++it)
|
for (QDictIterator<Button> it(buttonDict_); it.current(); ++it)
|
||||||
it.current()->update();
|
it.current()->update();
|
||||||
Static::instance()->update();
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new SystemClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char iconify_bits[] = {
|
static unsigned char iconify_bits[] = {
|
||||||
0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00};
|
0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00};
|
||||||
|
@ -174,7 +167,7 @@ static void create_pixmaps()
|
||||||
btnForeground = new QColor(Qt::white);
|
btnForeground = new QColor(Qt::white);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_pixmaps()
|
static void delete_pixmaps()
|
||||||
{
|
{
|
||||||
if(aUpperGradient){
|
if(aUpperGradient){
|
||||||
delete aUpperGradient;
|
delete aUpperGradient;
|
||||||
|
@ -281,8 +274,6 @@ void SystemButton::handleClicked()
|
||||||
|
|
||||||
void SystemClient::slotReset()
|
void SystemClient::slotReset()
|
||||||
{
|
{
|
||||||
delete_pixmaps();
|
|
||||||
create_pixmaps();
|
|
||||||
titleBuffer.resize(0, 0);
|
titleBuffer.resize(0, 0);
|
||||||
recalcTitleBuffer();
|
recalcTitleBuffer();
|
||||||
repaint();
|
repaint();
|
||||||
|
@ -313,7 +304,6 @@ SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase )
|
||||||
{
|
{
|
||||||
create_pixmaps();
|
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
bool help = providesContextHelp();
|
bool help = providesContextHelp();
|
||||||
|
|
||||||
|
@ -541,5 +531,25 @@ void SystemClient::activeChange(bool)
|
||||||
button[4]->reset();
|
button[4]->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new SystemClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "systemclient.moc"
|
#include "systemclient.moc"
|
||||||
|
|
|
@ -22,13 +22,6 @@
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
Client *allocate(Workspace *ws, WId w, int)
|
|
||||||
{
|
|
||||||
return(new GalliumClient(ws, w));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *kdelogo[] = {
|
static const char *kdelogo[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
|
@ -369,8 +362,6 @@ GalliumClient::GalliumClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
|
|
||||||
lastButtonWidth = 0;
|
lastButtonWidth = 0;
|
||||||
|
|
||||||
create_pixmaps();
|
|
||||||
|
|
||||||
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
||||||
g->setResizeMode(QLayout::FreeResize);
|
g->setResizeMode(QLayout::FreeResize);
|
||||||
g->addRowSpacing(0, 4); // Top grab bar
|
g->addRowSpacing(0, 4); // Top grab bar
|
||||||
|
@ -434,9 +425,6 @@ GalliumClient::GalliumClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
|
|
||||||
void GalliumClient::slotReset()
|
void GalliumClient::slotReset()
|
||||||
{
|
{
|
||||||
delete_pixmaps();
|
|
||||||
create_pixmaps();
|
|
||||||
|
|
||||||
// 0 to 3 ( 4 buttons - Help, Max, Iconify, Close )
|
// 0 to 3 ( 4 buttons - Help, Max, Iconify, Close )
|
||||||
for(int i = GalliumClient::BtnHelp; i <= GalliumClient::BtnClose; i++)
|
for(int i = GalliumClient::BtnHelp; i <= GalliumClient::BtnClose; i++)
|
||||||
if(button[i])
|
if(button[i])
|
||||||
|
@ -743,4 +731,26 @@ void GalliumClient::menuButtonPressed()
|
||||||
tc = this;
|
tc = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
Client *allocate(Workspace *ws, WId w, int)
|
||||||
|
{
|
||||||
|
return(new GalliumClient(ws, w));
|
||||||
|
}
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
create_pixmaps();
|
||||||
|
}
|
||||||
|
void deinit()
|
||||||
|
{
|
||||||
|
delete_pixmaps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "win2k.moc"
|
#include "win2k.moc"
|
||||||
|
|
|
@ -231,6 +231,7 @@ void Options::reload()
|
||||||
CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower"));
|
CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower"));
|
||||||
CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize"));
|
CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize"));
|
||||||
|
|
||||||
|
emit resetPlugin();
|
||||||
emit resetClients();
|
emit resetClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,7 @@ public slots:
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void resetPlugin();
|
||||||
void resetClients();
|
void resetClients();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
15
plugins.cpp
15
plugins.cpp
|
@ -164,6 +164,9 @@ void PluginMgr::loadPlugin(QString nameStr)
|
||||||
|
|
||||||
if( !path.isEmpty() ) {
|
if( !path.isEmpty() ) {
|
||||||
if ( (handle = lt_dlopen(path.latin1() ) ) ) {
|
if ( (handle = lt_dlopen(path.latin1() ) ) ) {
|
||||||
|
lt_ptr init_func = lt_dlsym(handle, "init");
|
||||||
|
if (init_func)
|
||||||
|
((void (*)())init_func)();
|
||||||
lt_ptr alloc_func = lt_dlsym(handle, "allocate");
|
lt_ptr alloc_func = lt_dlsym(handle, "allocate");
|
||||||
if(alloc_func) {
|
if(alloc_func) {
|
||||||
alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func;
|
alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func;
|
||||||
|
@ -182,7 +185,19 @@ void PluginMgr::loadPlugin(QString nameStr)
|
||||||
|
|
||||||
emit resetAllClients();
|
emit resetAllClients();
|
||||||
if(oldHandle)
|
if(oldHandle)
|
||||||
|
{
|
||||||
|
lt_ptr deinit_func = lt_dlsym(oldHandle, "deinit");
|
||||||
|
if (deinit_func)
|
||||||
|
((void (*)())deinit_func)();
|
||||||
lt_dlclose(oldHandle);
|
lt_dlclose(oldHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginMgr::resetPlugin()
|
||||||
|
{
|
||||||
|
lt_ptr reset_func = lt_dlsym(handle, "reset");
|
||||||
|
if (reset_func)
|
||||||
|
((void (*)())reset_func)();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "plugins.moc"
|
#include "plugins.moc"
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
QString currentPlugin() { return pluginStr; }
|
QString currentPlugin() { return pluginStr; }
|
||||||
public slots:
|
public slots:
|
||||||
bool updatePlugin();
|
bool updatePlugin();
|
||||||
|
void resetPlugin();
|
||||||
signals:
|
signals:
|
||||||
void resetAllClients();
|
void resetAllClients();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -242,6 +242,7 @@ Workspace::Workspace( bool restore )
|
||||||
{
|
{
|
||||||
d = new WorkspacePrivate;
|
d = new WorkspacePrivate;
|
||||||
mgr = new PluginMgr;
|
mgr = new PluginMgr;
|
||||||
|
connect(options, SIGNAL(resetPlugin()), mgr, SLOT(resetPlugin()));
|
||||||
root = qt_xrootwin();
|
root = qt_xrootwin();
|
||||||
default_colormap = DefaultColormap(qt_xdisplay(), qt_xscreen() );
|
default_colormap = DefaultColormap(qt_xdisplay(), qt_xscreen() );
|
||||||
installed_colormap = default_colormap;
|
installed_colormap = default_colormap;
|
||||||
|
|
Loading…
Reference in a new issue