tool window handling for the default style

visible dialogs for stays-on-top fullscreen windows (helps with Konqueror's dialogs)
Fixed lock with Alt-Tab box plus accelerator

svn path=/trunk/kdebase/kwin/; revision=65241
This commit is contained in:
Matthias Ettrich 2000-09-25 15:30:51 +00:00
parent e0e632dfdf
commit 6dacbd0112
15 changed files with 176 additions and 84 deletions

View file

@ -423,6 +423,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
is_sticky = FALSE; is_sticky = FALSE;
stays_on_top = FALSE; stays_on_top = FALSE;
may_move = TRUE; may_move = TRUE;
is_fullscreen = TRUE;
skip_taskbar = FALSE; skip_taskbar = FALSE;
max_mode = MaximizeRestore; max_mode = MaximizeRestore;
@ -497,15 +498,17 @@ bool Client::manage( bool isMapped, bool doNotShow, bool isInitial )
QRect area = workspace()->clientArea(); QRect area = workspace()->clientArea();
if ( geom == workspace()->geometry() ) if ( geom == workspace()->geometry() ) {
is_fullscreen = TRUE;
may_move = FALSE; // don't let fullscreen windows be moved around may_move = FALSE; // don't let fullscreen windows be moved around
}
if ( isMapped || session || isTransient() ) { if ( isMapped || session || isTransient() ) {
placementDone = TRUE; placementDone = TRUE;
} else { } else {
if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) { if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) {
placementDone = TRUE; placementDone = TRUE;
if ( windowType() == NET::Normal && !area.contains( geom.topLeft() ) && may_move ) { if ( windowType() == NET::Normal && !area.contains( geom.topLeft() ) && may_move ) {
int tx = geom.x(); int tx = geom.x();
int ty = geom.y(); int ty = geom.y();
if ( tx >= 0 && tx < area.x() ) if ( tx >= 0 && tx < area.x() )
@ -1144,9 +1147,19 @@ bool Client::isMaximizable() const
{ {
if ( isMaximized() ) if ( isMaximized() )
return TRUE; return TRUE;
return isResizable() && !isTransient(); return isResizable() && !isTransient() && !isTool();
} }
/*
Returns whether the window is minimizable or not
*/
bool Client::isMinimizable() const
{
return wantsTabFocus();
}
/*! /*!
Reimplemented to provide move/resize Reimplemented to provide move/resize
@ -1516,9 +1529,9 @@ void Client::invalidateWindow()
*/ */
void Client::iconify() void Client::iconify()
{ {
if ( windowType() != NET::Normal && windowType() != NET::Toolbar ) // desktop and dock cannot be minimized if ( !isMinimizable() )
return; return;
if ( isShade() ) if ( isShade() )
setShade( FALSE ); setShade( FALSE );
if ( workspace()->iconifyMeansWithdraw( this ) ) { if ( workspace()->iconifyMeansWithdraw( this ) ) {
@ -1867,7 +1880,7 @@ void Client::setShade( bool s )
shaded = s; shaded = s;
int as = options->animateShade? options->animSteps : 1; int as = options->animateShade? 10 : 1;
if (shaded ) { if (shaded ) {
int h = height(); int h = height();
@ -2406,6 +2419,12 @@ bool Client::wantsTabFocus() const
return (windowType() == NET::Normal || windowType() == NET::Override ) && ( input || Ptakefocus ) && !skip_taskbar; return (windowType() == NET::Normal || windowType() == NET::Override ) && ( input || Ptakefocus ) && !skip_taskbar;
} }
bool Client::wantsInput() const
{
return input;
}
/*! /*!
Returns whether the window is moveable or has a fixed Returns whether the window is moveable or has a fixed
position. !isMovable implies !isResizable. position. !isMovable implies !isResizable.
@ -2433,6 +2452,12 @@ bool Client::isMenu() const
} }
bool Client::isTool() const
{
return windowType() == NET::Tool;
}
/*! /*!
Returns \a area with the client's strut taken into account. Returns \a area with the client's strut taken into account.
@ -2465,9 +2490,13 @@ void Client::animateIconifyOrDeiconify( bool iconify)
float lf,rf,tf,bf,step; float lf,rf,tf,bf,step;
int options_dot_ResizeAnimation = 1; int speed = options->animateMinimizeSpeed;
if ( speed > 10 )
speed = 10;
if ( speed < 0 )
speed = 0;
step = 40. * (11 - options_dot_ResizeAnimation); step = 40. * (11 - speed );
NETRect r = info->iconGeometry(); NETRect r = info->iconGeometry();
QRect icongeom( r.pos.x, r.pos.y, r.size.width, r.size.height ); QRect icongeom( r.pos.x, r.pos.y, r.size.width, r.size.height );

View file

@ -117,6 +117,7 @@ public:
bool isMaximizable() const; bool isMaximizable() const;
QRect geometryRestore() const; QRect geometryRestore() const;
MaximizeMode maximizeMode() const; MaximizeMode maximizeMode() const;
bool isMinimizable() const;
bool isSticky() const; bool isSticky() const;
void setSticky( bool ); void setSticky( bool );
@ -126,9 +127,11 @@ public:
// auxiliary functions, depend on the windowType // auxiliary functions, depend on the windowType
bool wantsTabFocus() const; bool wantsTabFocus() const;
bool wantsInput() const;
bool isMovable() const; bool isMovable() const;
bool isDesktop() const; bool isDesktop() const;
bool isDock() const; bool isDock() const;
bool isTool() const;
bool isMenu() const; bool isMenu() const;
bool isResizable() const; bool isResizable() const;
@ -142,6 +145,8 @@ public:
virtual void drawbound( const QRect& geom ); virtual void drawbound( const QRect& geom );
virtual void clearbound(); virtual void clearbound();
// fullscreen hint, for stacking
bool isFullScreen() const;
// shape extensions // shape extensions
bool shape() const; bool shape() const;
@ -264,6 +269,7 @@ private:
uint stays_on_top : 1; uint stays_on_top : 1;
uint is_shape :1; uint is_shape :1;
uint may_move :1; uint may_move :1;
uint is_fullscreen :1;
uint skip_taskbar :1; uint skip_taskbar :1;
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol? uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
uint Ptakefocus :1;// does the window understand the TakeFocus protocol? uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
@ -386,6 +392,12 @@ inline bool Client::shape() const
return is_shape; return is_shape;
} }
inline bool Client::isFullScreen() const
{
return is_fullscreen;
}
inline const QRegion& Client::getMask() const inline const QRegion& Client::getMask() const
{ {
return mask; return mask;

View file

@ -15,7 +15,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int)
{ {
return(new B2Client(ws, w)); return(new B2Client(ws, w));
} }

View file

@ -22,9 +22,11 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
extern "C" extern "C"
{ {
Client * allocate(Workspace * workSpace, WId winId) Client * allocate(Workspace * workSpace, WId winId, int tool )
{ {
return new StdClient(workSpace, winId); if ( tool )
return new StdToolClient( workSpace, winId );
return new StdClient(workSpace, winId);
} }
} }

View file

@ -13,7 +13,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int )
{ {
return(new NextClient(ws, w)); return(new NextClient(ws, w));
} }
@ -105,7 +105,7 @@ static void create_pixmaps()
aBtnDown->resize(18, 18); aBtnDown->resize(18, 18);
KPixmap internal; KPixmap internal;
internal.resize(12, 12); internal.resize(12, 12);
// inactive buttons // inactive buttons
QColor c(options->color(Options::ButtonBg, false)); QColor c(options->color(Options::ButtonBg, false));
KPixmapEffect::gradient(*iBtn, c.light(120), c.dark(120), KPixmapEffect::gradient(*iBtn, c.light(120), c.dark(120),
@ -170,7 +170,7 @@ void NextClient::slotReset()
delete iBtn; delete iBtn;
delete aBtnDown; delete aBtnDown;
delete iBtnDown; delete iBtnDown;
pixmaps_created = false; pixmaps_created = false;
create_pixmaps(); create_pixmaps();
button[0]->reset(); button[0]->reset();
@ -218,7 +218,7 @@ NextClient::NextClient( Workspace *ws, WId w, QWidget *parent,
{ {
create_pixmaps(); 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);
QHBoxLayout *titleLayout = new QHBoxLayout(); QHBoxLayout *titleLayout = new QHBoxLayout();
QHBoxLayout *windowLayout = new QHBoxLayout(); QHBoxLayout *windowLayout = new QHBoxLayout();

View file

@ -17,7 +17,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int)
{ {
return(new LaptopClient(ws, w)); return(new LaptopClient(ws, w));
} }
@ -359,7 +359,7 @@ void LaptopClient::resizeEvent( QResizeEvent* e)
dx = 16 + QABS( e->oldSize().width() - width() ); dx = 16 + QABS( e->oldSize().width() - width() );
if ( e->oldSize().height() != height() ) if ( e->oldSize().height() != height() )
dy = 16 + QABS( e->oldSize().height() - height() ); dy = 16 + QABS( e->oldSize().height() - height() );
if ( dy ) if ( dy )
update( 0, height() - dy + 1, width(), dy ); update( 0, height() - dy + 1, width(), dy );
if ( dx ) { if ( dx ) {
update( width() - dx + 1, 0, dx, height() ); update( width() - dx + 1, 0, dx, height() );

View file

@ -18,7 +18,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int)
{ {
return(new ModernSys(ws, w)); return(new ModernSys(ws, w));
} }
@ -51,7 +51,7 @@ static unsigned char btnhighcolor_mask_bits[] = {
0xe0,0x41,0xf8,0x07,0xfc,0x0f,0xfe,0xdf,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff, 0xe0,0x41,0xf8,0x07,0xfc,0x0f,0xfe,0xdf,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff,
0x3f,0xff,0x3f,0xff,0xff,0xff,0xff,0xfe,0x9f,0xfe,0x1f,0xfc,0x0f,0xf0,0x03, 0x3f,0xff,0x3f,0xff,0xff,0xff,0xff,0xfe,0x9f,0xfe,0x1f,0xfc,0x0f,0xf0,0x03,
0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x20,0x99,0x0f,0x08,0xc4, 0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x20,0x99,0x0f,0x08,0xc4,
0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 }; 0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 };
static KPixmap *aUpperGradient=0; static KPixmap *aUpperGradient=0;
static KPixmap *iUpperGradient=0; static KPixmap *iUpperGradient=0;
@ -508,7 +508,7 @@ void ModernSys::activeChange(bool)
Client::MousePosition ModernSys::mousePosition( const QPoint& p) const Client::MousePosition ModernSys::mousePosition( const QPoint& p) const
{ {
MousePosition m = Client::mousePosition( p ); MousePosition m = Client::mousePosition( p );
if ( m == Center ) { if ( m == Center ) {
int border = 10; int border = 10;
if ( p.y() >= height()-border ) if ( p.y() >= height()-border )

View file

@ -1,6 +1,6 @@
/* /*
RISC OS KWin client RISC OS KWin client
Copyright 2000 Copyright 2000
Rik Hemsley <rik@kde.org> Rik Hemsley <rik@kde.org>
@ -33,7 +33,7 @@
extern "C" extern "C"
{ {
Client * allocate(Workspace * workSpace, WId winId) Client * allocate(Workspace * workSpace, WId winId, int)
{ {
return new RiscOS::Manager(workSpace, winId); return new RiscOS::Manager(workSpace, winId);
} }
@ -70,7 +70,7 @@ Manager::slotReset()
Static::instance()->update(); Static::instance()->update();
_updateDisplay(); _updateDisplay();
} }
void void
Manager::captionChange(const QString &) Manager::captionChange(const QString &)
{ {
@ -80,7 +80,7 @@ Manager::captionChange(const QString &)
void void
Manager::paletteChange(const QPalette &) Manager::paletteChange(const QPalette &)
{ {
Static::instance()->update(); Static::instance()->update();
_updateDisplay(); _updateDisplay();
} }
@ -127,12 +127,12 @@ Manager::paintEvent(QPaintEvent * e)
if (intersectsLeft) if (intersectsLeft)
p.drawLine(0, r.top(), 0, r.bottom()); p.drawLine(0, r.top(), 0, r.bottom());
if (intersectsRight) if (intersectsRight)
p.drawLine(width() - 1, r.top(), width() - 1, r.bottom()); p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
} }
} }
Client::MousePosition Client::MousePosition
Manager::mousePosition(const QPoint & p) const Manager::mousePosition(const QPoint & p) const
{ {
@ -173,7 +173,7 @@ Manager::_updateLayout()
titleBar_ -> setGeometry(0, 0, width(), 20); titleBar_ -> setGeometry(0, 0, width(), 20);
windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30); windowWrapper() -> setGeometry(1, 20, width() - 2, height() - 30);
resizeBar_ -> setGeometry(0, height() - 10, width(), 10); resizeBar_ -> setGeometry(0, height() - 10, width(), 10);
_updateDisplay(); _updateDisplay();
} }
@ -193,7 +193,7 @@ Manager::fakeMouseEvent(QMouseEvent * e, QWidget * w)
Client::event(&fake); Client::event(&fake);
} }
void void
Manager::mouseDoubleClickEvent( QMouseEvent * ) Manager::mouseDoubleClickEvent( QMouseEvent * )
{ {
workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); workspace()->performWindowOperation( this, options->operationTitlebarDblClick() );

View file

@ -15,7 +15,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int)
{ {
return(new SystemClient(ws, w)); return(new SystemClient(ws, w));
} }
@ -23,13 +23,13 @@ extern "C"
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};
static unsigned char maximize_bits[] = { static unsigned char maximize_bits[] = {
0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00}; 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00};
static unsigned char minmax_bits[] = { static unsigned char minmax_bits[] = {
0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f}; 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
static unsigned char unsticky_bits[] = { static unsigned char unsticky_bits[] = {
0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00}; 0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00};
@ -38,7 +38,7 @@ static unsigned char sticky_bits[] = {
static unsigned char question_bits[] = { static unsigned char question_bits[] = {
0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}; 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
static KPixmap *aUpperGradient=0; static KPixmap *aUpperGradient=0;
static KPixmap *iUpperGradient=0; static KPixmap *iUpperGradient=0;
@ -131,7 +131,7 @@ static void create_pixmaps()
bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true);
drawButtonFrame(iBtnPix, options->colorGroup(Options::Frame, false)); drawButtonFrame(iBtnPix, options->colorGroup(Options::Frame, false));
// pressed buttons // pressed buttons
hColor = options->color(Options::ButtonBg, false); hColor = options->color(Options::ButtonBg, false);
KPixmapEffect::gradient(iInternal, KPixmapEffect::gradient(iInternal,
@ -171,7 +171,7 @@ static void create_pixmaps()
btnForeground = Qt::black; btnForeground = Qt::black;
else else
btnForeground = Qt::white; btnForeground = Qt::white;
} }
SystemButton::SystemButton(Client *parent, const char *name, SystemButton::SystemButton(Client *parent, const char *name,
@ -233,9 +233,9 @@ void SystemButton::drawButton(QPainter *p)
p->setPen(isDown() ? g.light() : g.mid()); p->setPen(isDown() ? g.light() : g.mid());
p->drawLine(x2-2, 2, x2-2, y2-2); p->drawLine(x2-2, 2, x2-2, y2-2);
p->drawLine(2, x2-2, y2-2, x2-2); p->drawLine(2, x2-2, y2-2, x2-2);
} }
if(!deco.isNull()){ if(!deco.isNull()){
p->setPen(btnForeground); p->setPen(btnForeground);
p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco); p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco);
@ -359,7 +359,7 @@ void SystemClient::recalcTitleBuffer()
p.fillRect(0, 0, width(), 18, p.fillRect(0, 0, width(), 18,
options->colorGroup(Options::Frame, true). options->colorGroup(Options::Frame, true).
brush(QColorGroup::Button)); brush(QColorGroup::Button));
QRect t = titlebar->geometry(); QRect t = titlebar->geometry();
t.setTop( 2 ); t.setTop( 2 );
t.setLeft( t.left() + 4 ); t.setLeft( t.left() + 4 );
@ -386,7 +386,7 @@ void SystemClient::recalcTitleBuffer()
p.end(); p.end();
oldTitle = caption(); oldTitle = caption();
} }
void SystemClient::captionChange( const QString &) void SystemClient::captionChange( const QString &)
{ {
recalcTitleBuffer(); recalcTitleBuffer();
@ -415,7 +415,7 @@ void SystemClient::paintEvent( QPaintEvent* )
t.setTop( 2 ); t.setTop( 2 );
t.setLeft( t.left() + 4 ); t.setLeft( t.left() + 4 );
t.setRight( t.right() - 2 ); t.setRight( t.right() - 2 );
if(isActive()) if(isActive())
p.drawPixmap(0, 0, titleBuffer); p.drawPixmap(0, 0, titleBuffer);
else{ else{
@ -427,7 +427,7 @@ void SystemClient::paintEvent( QPaintEvent* )
p.setFont(options->font(isActive())); p.setFont(options->font(isActive()));
p.drawText(t, AlignCenter, caption() ); p.drawText(t, AlignCenter, caption() );
} }
p.setPen(options->colorGroup(Options::Frame, isActive()).light()); p.setPen(options->colorGroup(Options::Frame, isActive()).light());
@ -446,7 +446,7 @@ void SystemClient::doShape()
{ {
// using a bunch of QRect lines seems much more efficent than bitmaps or // using a bunch of QRect lines seems much more efficent than bitmaps or
// point arrays // point arrays
QRegion mask; QRegion mask;
kRoundMaskRegion(mask, 0, 0, width(), height()); kRoundMaskRegion(mask, 0, 0, width(), height());
setMask(mask); setMask(mask);
@ -462,7 +462,7 @@ void SystemClient::showEvent(QShowEvent *ev)
void SystemClient::windowWrapperShowEvent( QShowEvent* ) void SystemClient::windowWrapperShowEvent( QShowEvent* )
{ {
doShape(); doShape();
} }
void SystemClient::mouseDoubleClickEvent( QMouseEvent * e ) void SystemClient::mouseDoubleClickEvent( QMouseEvent * e )
{ {

View file

@ -18,7 +18,7 @@
extern "C" extern "C"
{ {
Client *allocate(Workspace *ws, WId w) Client *allocate(Workspace *ws, WId w, int)
{ {
return(new KDEClient(ws, w)); return(new KDEClient(ws, w));
} }
@ -307,7 +307,7 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
{ {
lastButtonWidth = 0; lastButtonWidth = 0;
lastBufferWidth = 0; lastBufferWidth = 0;
create_pixmaps(); create_pixmaps();
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
bool help = providesContextHelp(); bool help = providesContextHelp();
@ -323,18 +323,22 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
g->addColSpacing(0, 4); g->addColSpacing(0, 4);
g->addColSpacing(2, 4); g->addColSpacing(2, 4);
button[BtnClose] = new KDEDefaultClientButton(27, titleHeight, this, "close", close_bits); int th = titleHeight;
button[BtnSticky] = new KDEDefaultClientButton(17, titleHeight, this, "sticky"); if ( isTool() )
th -= 2;
button[BtnClose] = new KDEDefaultClientButton(27, th, this, "close", close_bits);
button[BtnSticky] = new KDEDefaultClientButton(17, th, this, "sticky");
if(isSticky()) if(isSticky())
button[BtnSticky]->setBitmap(unsticky_bits); button[BtnSticky]->setBitmap(unsticky_bits);
else else
button[BtnSticky]->setBitmap(sticky_bits); button[BtnSticky]->setBitmap(sticky_bits);
button[BtnIconify] = new KDEDefaultClientButton(27, titleHeight, this, "iconify", button[BtnIconify] = new KDEDefaultClientButton(27, th, this, "iconify",
iconify_bits); iconify_bits);
button[BtnMax] = new KDEDefaultClientButton(27, titleHeight, this, "maximize", button[BtnMax] = new KDEDefaultClientButton(27, th, this, "maximize",
maximize_bits); maximize_bits);
if(help){ if(help){
button[BtnHelp] = new KDEDefaultClientButton(17, titleHeight, this, "help", button[BtnHelp] = new KDEDefaultClientButton(17, th, this, "help",
question_bits); question_bits);
connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) ); connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
} }
@ -351,7 +355,7 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
g->addLayout( hb, 1, 1 ); g->addLayout( hb, 1, 1 );
hb->addWidget( button[BtnClose]); hb->addWidget( button[BtnClose]);
hb->addSpacing(1); hb->addSpacing(1);
titlebar = new QSpacerItem(10, titleHeight, QSizePolicy::Expanding, titlebar = new QSpacerItem(10, th, QSizePolicy::Expanding,
QSizePolicy::Minimum); QSizePolicy::Minimum);
hb->addItem(titlebar); hb->addItem(titlebar);
hb->addSpacing(1); hb->addSpacing(1);
@ -362,11 +366,12 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
hb->addWidget( button[BtnIconify]); hb->addWidget( button[BtnIconify]);
hb->addWidget( button[BtnMax]); hb->addWidget( button[BtnMax]);
if ( isTransient() ) { if ( isTransient() || isTool() )
button[BtnSticky]->hide(); button[BtnSticky]->hide();
if ( !isMinimizable() )
button[BtnIconify]->hide(); button[BtnIconify]->hide();
if ( !isMaximizable() )
button[BtnMax]->hide(); button[BtnMax]->hide();
}
hiddenItems = false; hiddenItems = false;
bufferDirty = true; bufferDirty = true;
@ -429,9 +434,13 @@ void KDEClient::paintEvent( QPaintEvent* )
p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1); p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1);
p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1); p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
int th = titleHeight;
if ( isTool() )
th -= 2;
// inner rect // inner rect
p.drawRect(r.x()+3, r.y()+titleHeight+3, r.width()-6, p.drawRect(r.x()+3, r.y()+th+3, r.width()-6,
r.height()-titleHeight-10); r.height()-th-10);
// handles // handles
if(r.width() > 44){ if(r.width() > 44){
qDrawShadePanel(&p, r.x()+1, r.bottom()-6, 20, qDrawShadePanel(&p, r.x()+1, r.bottom()-6, 20,
@ -464,7 +473,7 @@ void KDEClient::paintEvent( QPaintEvent* )
p.fillRect(r.x(), r.y(), r.width(), r.height()-1, p.fillRect(r.x(), r.y(), r.width(), r.height()-1,
options->color(Options::TitleBar, false)); options->color(Options::TitleBar, false));
p.setFont(options->font(false)); p.setFont(options->font(false, isTool() ));
QFontMetrics fm(options->font(false)); QFontMetrics fm(options->font(false));
g = options->colorGroup(Options::TitleBar, false); g = options->colorGroup(Options::TitleBar, false);
if(iUpperGradient) if(iUpperGradient)
@ -582,7 +591,12 @@ void KDEClient::calcHiddenButtons()
if(button[i]){ if(button[i]){
if(button[i]->sizeHint().width() + totalSize <= width()){ if(button[i]->sizeHint().width() + totalSize <= width()){
totalSize+=button[i]->sizeHint().width(); totalSize+=button[i]->sizeHint().width();
if(button[i]->isHidden() && ( !isTransient() || ( i != BtnIconify && i != BtnSticky && i != BtnMax ) ) ){ if(button[i]->isHidden() &&
( !isTransient() || !isTransient() || i != BtnSticky ) &&
( isMinimizable() || i != BtnIconify ) &&
( isMaximizable() || ( i != BtnIconify && i != BtnSticky && i != BtnMax ) )
) {
button[i]->resize(button[i]->sizeHint()); button[i]->resize(button[i]->sizeHint());
button[i]->show(); button[i]->show();
} }
@ -621,7 +635,7 @@ void KDEClient::updateActiveBuffer( )
if(titlePix) if(titlePix)
p.drawTiledPixmap(r, *titlePix); p.drawTiledPixmap(r, *titlePix);
p.setFont(options->font(true)); p.setFont(options->font(true, isTool() ));
QFontMetrics fm(options->font(true)); QFontMetrics fm(options->font(true));
QColorGroup g = options->colorGroup(Options::TitleBar, true); QColorGroup g = options->colorGroup(Options::TitleBar, true);
if(aUpperGradient) if(aUpperGradient)

View file

@ -169,9 +169,9 @@ void Options::reload()
animateShade = config->readBoolEntry("AnimateShade", TRUE ); animateShade = config->readBoolEntry("AnimateShade", TRUE );
animSteps = config->readNumEntry("AnimSteps", 10); animateMinimize = config->readBoolEntry("AnimateMinimize", TRUE );
animateMinimizeSpeed = config->readNumEntry("AnimateMinimizeSpeed", 1 );
autoRaise = config->readBoolEntry("AutoRaise", FALSE ); autoRaise = config->readBoolEntry("AutoRaise", FALSE );
autoRaiseInterval = config->readNumEntry("AutoRaiseInterval", 0 ); autoRaiseInterval = config->readNumEntry("AutoRaiseInterval", 0 );

View file

@ -145,11 +145,6 @@ public:
*/ */
bool animateShade; bool animateShade;
/**
* the number of animation steps (would this be general?)
*/
int animSteps;
/** /**
* the size of the zone that triggers snapping on desktop borders * the size of the zone that triggers snapping on desktop borders
*/ */
@ -159,7 +154,17 @@ public:
* the number of animation steps (would this be general?) * the number of animation steps (would this be general?)
*/ */
int windowSnapZone; int windowSnapZone;
/**
* whether we animate the minimization of windows or not
*/
bool animateMinimize;
/**
* Animation speed (0 .. 10 )
*/
int animateMinimizeSpeed;
// mouse bindings // mouse bindings

View file

@ -120,10 +120,10 @@ PluginMgr::~PluginMgr()
lt_dlclose(handle); lt_dlclose(handle);
} }
Client* PluginMgr::allocateClient(Workspace *ws, WId w) Client* PluginMgr::allocateClient(Workspace *ws, WId w, bool tool)
{ {
if(alloc_ptr) if(alloc_ptr)
return(alloc_ptr(ws, w)); return(alloc_ptr(ws, w, tool));
else else
return(new KDEClient(ws, w)); return(new KDEClient(ws, w));
} }
@ -134,7 +134,7 @@ void PluginMgr::loadPlugin(QString nameStr)
static lt_dlhandle oldHandle = 0; static lt_dlhandle oldHandle = 0;
pluginStr = nameStr; pluginStr = nameStr;
oldHandle = handle; oldHandle = handle;
// Rikkus: temporary change in semantics. // Rikkus: temporary change in semantics.
@ -166,7 +166,7 @@ void PluginMgr::loadPlugin(QString nameStr)
else{ else{
lt_ptr_t alloc_func = lt_dlsym(handle, "allocate"); lt_ptr_t alloc_func = lt_dlsym(handle, "allocate");
if(alloc_func) if(alloc_func)
alloc_ptr = (Client* (*)(Workspace *ws, WId w))alloc_func; alloc_ptr = (Client* (*)(Workspace *ws, WId w, int tool))alloc_func;
else{ else{
qWarning("KWin: %s is not a KWin plugin.", nameStr.latin1()); qWarning("KWin: %s is not a KWin plugin.", nameStr.latin1());
lt_dlclose(handle); lt_dlclose(handle);

View file

@ -1,6 +1,6 @@
/***************************************************************** /*****************************************************************
kwin - the KDE window manager kwin - the KDE window manager
Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org> Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
******************************************************************/ ******************************************************************/
#ifndef __PLUGINS_H #ifndef __PLUGINS_H
@ -22,13 +22,13 @@ class PluginMgr : public QObject
public: public:
PluginMgr(); PluginMgr();
~PluginMgr(); ~PluginMgr();
Client *allocateClient(Workspace *ws, WId w); Client *allocateClient(Workspace *ws, WId w, bool tool);
void loadPlugin(QString name); void loadPlugin(QString name);
QString currentPlugin() { return pluginStr; } QString currentPlugin() { return pluginStr; }
signals: signals:
void resetAllClients(); void resetAllClients();
protected: protected:
Client* (*alloc_ptr)(Workspace *ws, WId w); Client* (*alloc_ptr)(Workspace *ws, WId w, int tool);
lt_dlhandle handle; lt_dlhandle handle;
QString pluginStr; QString pluginStr;
}; };

View file

@ -162,13 +162,13 @@ Client* Workspace::clientFactory( WId w )
return c; return c;
} }
case NET::Toolbar: case NET::Tool:
return (mgr.allocateClient(this,w) ); // TODO use mgr.allocateClient in toolbar mode return ( mgr.allocateClient( this, w, true ) );
case NET::Menu: case NET::Menu:
case NET::Dock: case NET::Dock:
{ {
Client * c = new NoBorderClient( this, w); Client * c = new NoBorderClient( this, w );
c->setSticky( TRUE ); c->setSticky( TRUE );
return c; return c;
} }
@ -183,7 +183,7 @@ Client* Workspace::clientFactory( WId w )
if ( Shape::hasShape( w ) ){ if ( Shape::hasShape( w ) ){
return new NoBorderClient( this, w ); return new NoBorderClient( this, w );
} }
return(mgr.allocateClient(this, w)); return ( mgr.allocateClient( this, w, false ) );
} }
// Rikkus: This class is too complex. It needs splitting further. // Rikkus: This class is too complex. It needs splitting further.
@ -703,6 +703,7 @@ bool Workspace::keyPress(XKeyEvent key)
tab_box->reset(); tab_box->reset();
} }
tab_box->nextPrev( (km & ShiftMask) == 0 ); tab_box->nextPrev( (km & ShiftMask) == 0 );
keys->setEnabled( FALSE );
tab_box->delayedShow(); tab_box->delayedShow();
} }
} }
@ -730,6 +731,7 @@ bool Workspace::keyPress(XKeyEvent key)
tab_box->reset(); tab_box->reset();
} }
tab_box->nextPrev( (km & ShiftMask) == 0 ); tab_box->nextPrev( (km & ShiftMask) == 0 );
keys->setEnabled( FALSE );
tab_box->delayedShow(); tab_box->delayedShow();
} }
} }
@ -737,8 +739,9 @@ bool Workspace::keyPress(XKeyEvent key)
if (control_grab || tab_grab){ if (control_grab || tab_grab){
if (kc == XK_Escape){ if (kc == XK_Escape){
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
XUngrabPointer( qt_xdisplay(), kwin_time); XUngrabPointer( qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
keys->setEnabled( TRUE );
tab_grab = FALSE; tab_grab = FALSE;
control_grab = FALSE; control_grab = FALSE;
return TRUE; return TRUE;
@ -764,8 +767,9 @@ bool Workspace::keyRelease(XKeyEvent key)
if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i] if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i]
== key.keycode){ == key.keycode){
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
XUngrabPointer( qt_xdisplay(), kwin_time); XUngrabPointer( qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
keys->setEnabled( TRUE );
tab_grab = false; tab_grab = false;
if ( tab_box->currentClient() ){ if ( tab_box->currentClient() ){
@ -779,9 +783,10 @@ bool Workspace::keyRelease(XKeyEvent key)
for (i=0; i<xmk->max_keypermod; i++) for (i=0; i<xmk->max_keypermod; i++)
if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i] if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i]
== key.keycode){ == key.keycode){
XUngrabPointer( qt_xdisplay(), kwin_time); XUngrabPointer( qt_xdisplay(), kwin_time);
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
keys->setEnabled( TRUE );
control_grab = False; control_grab = False;
if ( tab_box->currentDesktop() != -1 ) if ( tab_box->currentDesktop() != -1 )
setCurrentDesktop( tab_box->currentDesktop() ); setCurrentDesktop( tab_box->currentDesktop() );
@ -1071,7 +1076,8 @@ void Workspace::requestFocus( Client* c, bool force )
} else if ( c->isShade() ) { } else if ( c->isShade() ) {
// client cannot accept focus, but at least the window should be active (window menu, et. al. ) // client cannot accept focus, but at least the window should be active (window menu, et. al. )
focusToNull(); focusToNull();
c->setActive( TRUE ); if ( c->wantsInput() )
c->setActive( TRUE );
} }
} }
@ -1653,6 +1659,26 @@ void Workspace::raiseClient( Client* c )
raiseTransientsOf(saveset, c ); raiseTransientsOf(saveset, c );
ClientList list = constrainedStackingOrder( stacking_order ); ClientList list = constrainedStackingOrder( stacking_order );
/* workaround to help broken full-screen applications to keep (modal) dialogs visible
*/
if ( c->isTransient() && c->mainClient() == c ) {
bool has_full_screen = false;
for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) {
if ( (*it) == c )
break;
if ( (*it)->isVisible() && (*it)->isFullScreen() ) {
has_full_screen = true;
break;
}
}
if ( has_full_screen ) {
list.remove( c );
list.append( c );
}
}
/* end workaround */
Window* new_stack = new Window[ list.count() + 1 ]; Window* new_stack = new Window[ list.count() + 1 ];
int i = 0; int i = 0;
for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) { for ( ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it) {
@ -2309,6 +2335,10 @@ void Workspace::slotWindowOperations()
*/ */
void Workspace::slotWindowClose() void Workspace::slotWindowClose()
{ {
if ( tab_box->isVisible() ) {
qDebug("ARGGGLLLLLLLLL");
return;
}
performWindowOperation( popup_client, Options::CloseOp ); performWindowOperation( popup_client, Options::CloseOp );
} }
@ -2652,7 +2682,7 @@ void Workspace::slotResetAllClients()
(*jt) = newClient; (*jt) = newClient;
jt = focus_chain.find (oldClient); jt = focus_chain.find (oldClient);
(*jt) = newClient; (*jt) = newClient;
newClient->cloneMode(oldClient); newClient->cloneMode(oldClient);
delete oldClient; delete oldClient;
bool showIt = newClient->manage( TRUE, TRUE, FALSE ); bool showIt = newClient->manage( TRUE, TRUE, FALSE );
if ( prev ) { if ( prev ) {