diff --git a/client.cpp b/client.cpp index 91b037dd2b..94c79db3b5 100644 --- a/client.cpp +++ b/client.cpp @@ -1139,6 +1139,14 @@ void Client::resizeEvent( QResizeEvent * e) } +void Client::giveUpShade() +{ + wwrap->show(); + workspace()->requestFocus( this ); + shaded = FALSE; +} + + /*! Reimplemented to provide move/resize */ @@ -1169,11 +1177,8 @@ void Client::mouseMoveEvent( QMouseEvent * e) return; } - if ( mode != Center && shaded ) { - wwrap->show(); - workspace()->requestFocus( this ); - shaded = FALSE; - } + if ( mode != Center && shaded ) + giveUpShade(); QPoint globalPos = e->globalPos(); // pos() + geometry().topLeft(); diff --git a/client.h b/client.h index ecfe96cc2d..9da4aaa6af 100644 --- a/client.h +++ b/client.h @@ -110,6 +110,7 @@ public: bool isShade() const; virtual void setShade( bool ); + void giveUpShade(); bool isMaximized() const; enum MaximizeMode { MaximizeVertical, MaximizeHorizontal, MaximizeFull, MaximizeRestore }; diff --git a/clients/kde1/kde1client.cpp b/clients/kde1/kde1client.cpp index 1168b2193a..f47473ba6a 100644 --- a/clients/kde1/kde1client.cpp +++ b/clients/kde1/kde1client.cpp @@ -433,7 +433,7 @@ StdToolClient::StdToolClient( Workspace *ws, WId w, QWidget *parent, const char g->addColSpacing(0, 1); g->addColSpacing(2, 1); - g->addRowSpacing(2, 2); + g->addRowoSpacing(2, 2); closeBtn = new QToolButton( this ); connect( closeBtn, SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) ); diff --git a/default/DBWidget.cpp b/default/DBWidget.cpp index af4599c727..df0ba48b3a 100644 --- a/default/DBWidget.cpp +++ b/default/DBWidget.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -26,11 +26,9 @@ namespace Default { DBWidget::DBWidget(QWidget * parent, const char * name) - : QWidget(parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped | -WNorthWestGravity) + : QWidget(parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped | WNorthWestGravity) { buf_.resize(20, 20); - setBackgroundMode(NoBackground); } void diff --git a/default/Manager.cpp b/default/Manager.cpp index c6cc4e5940..6afc364854 100644 --- a/default/Manager.cpp +++ b/default/Manager.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -50,14 +50,24 @@ Manager::Manager( ) : Client(workSpace, id, parent, name) { - shaded_ = false; connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); titleBar_ = new TitleBar(this); + titleBar_->setFixedHeight( Static::instance()->titleHeight() ); resizeBar_ = new ResizeBar(this, this); + resizeBar_->setFixedHeight( RESIZE_BAR_HEIGHT ); - activateLayout(); + QVBoxLayout* vbox = new QVBoxLayout( this ); + vbox->addWidget( titleBar_ ); + QHBoxLayout* hbox = new QHBoxLayout; + vbox->addLayout( hbox, 10 ); + hbox->addSpacing( 3 ); + hbox->addWidget( windowWrapper(), 10 ); + hbox->addSpacing( 3 ); + vbox->addWidget( resizeBar_ ); + + _updateDisplay(); } Manager::~Manager() @@ -68,9 +78,10 @@ Manager::~Manager() Manager::slotReset() { Static::instance()->update(); + titleBar_->setFixedHeight( Static::instance()->titleHeight() ); _updateDisplay(); } - + void Manager::captionChange(const QString &) { @@ -86,7 +97,7 @@ Manager::stickyChange(bool b) void Manager::paletteChange(const QPalette &) { - Static::instance()->update(); + Static::instance()->update(); _updateDisplay(); } @@ -133,12 +144,6 @@ Manager::paintEvent(QPaintEvent * e) } } - void -Manager::toggleSticky() -{ - setSticky(!isSticky()); -} - void Manager::raise() { @@ -155,69 +160,18 @@ Manager::vMax() Manager::resizeEvent(QResizeEvent * e) { Client::resizeEvent(e); - _updateLayout(); } - void -Manager::_updateLayout() -{ - titleBar_ -> setGeometry( - 0, - 0, - width(), - Static::instance()->titleHeight() - ); - - windowWrapper() -> setGeometry( - 3, - Static::instance()->titleHeight(), - width() - 6, - height() - Static::instance()->titleHeight() - RESIZE_BAR_HEIGHT - ); - - resizeBar_ -> setGeometry( - 0, - height() - RESIZE_BAR_HEIGHT, - width(), - RESIZE_BAR_HEIGHT - ); - - _updateDisplay(); -} - - void -Manager::activateLayout() -{ - _updateLayout(); -} void Manager::fakeMouseEvent(QMouseEvent * e, QWidget * w) { QPoint adjustedPos = w->pos() + e->pos(); - if (e->type() == QEvent::MouseButtonDblClick) - toggleShaded(); - QMouseEvent fake(e->type(), adjustedPos, e->button(), e->state()); - Client::event(&fake); } - void -Manager::toggleShaded() -{ - if (shaded_) - resize(oldSize_); - else { - oldSize_ = size(); - resize(width(), Static::instance()->titleHeight() + RESIZE_BAR_HEIGHT); - } - - _updateLayout(); - - shaded_ = !shaded_; -} } // End namespace diff --git a/default/Manager.h b/default/Manager.h index dd1b204884..b15b8d2269 100644 --- a/default/Manager.h +++ b/default/Manager.h @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -49,7 +49,6 @@ class Manager : public Client public slots: - void toggleSticky(); void raise(); void vMax(); @@ -60,9 +59,7 @@ class Manager : public Client void maximizeChange(bool); void paintEvent(QPaintEvent *); void resizeEvent(QResizeEvent *); - void activateLayout(); - void toggleShaded(); - + protected slots: void captionChange(const QString &); @@ -72,13 +69,10 @@ class Manager : public Client private: void _updateDisplay(); - void _updateLayout(); - + TitleBar * titleBar_; ResizeBar * resizeBar_; - bool shaded_; - QSize oldSize_; }; class ToolManager : public Manager diff --git a/default/ResizeBar.cpp b/default/ResizeBar.cpp index 22f561d60c..8e70a5dd73 100644 --- a/default/ResizeBar.cpp +++ b/default/ResizeBar.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -30,18 +30,17 @@ namespace Default { ResizeBar::ResizeBar(QWidget * parent, Manager * client) - : QWidget (parent, "ResizeBar"), + : QWidget (parent, "ResizeBar", WResizeNoErase | WRepaintNoErase), client_ (client) { - setBackgroundMode(NoBackground); left_ = new ResizeSide(this, client_, ResizeSide::Left); mid_ = new ResizeMid(this, client_); right_ = new ResizeSide(this, client_, ResizeSide::Right); - + mid_->move(30, 0); } - + void ResizeBar::updateDisplay() { diff --git a/default/ResizeMid.cpp b/default/ResizeMid.cpp index b6ead24fc3..cbea00ed38 100644 --- a/default/ResizeMid.cpp +++ b/default/ResizeMid.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -71,11 +71,12 @@ ResizeMid::mouseMoveEvent(QMouseEvent * e) QRect g = client_->geometry(); g.setBottom(e->globalPos().y()); + if ( client_->isShade() ) + client_->giveUpShade(); QSize adjustedSize = client_->adjustedSize(g.size()); if (adjustedSize != client_->size()) { - g.setBottom(g.top() + adjustedSize.height()); - client_->setGeometry(g); + client_->resize( adjustedSize ); } } diff --git a/default/ResizeSide.cpp b/default/ResizeSide.cpp index b617704fd1..10d8accbb7 100644 --- a/default/ResizeSide.cpp +++ b/default/ResizeSide.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -44,6 +44,8 @@ ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s) void ResizeSide::mouseMoveEvent(QMouseEvent * e) { + if ( client_->isShade() ) + client_->giveUpShade(); QRect g = client_->geometry(); g.setBottom(e->globalPos().y()); if (side_ == Left) @@ -51,16 +53,16 @@ ResizeSide::mouseMoveEvent(QMouseEvent * e) else g.setRight(e->globalPos().x()); - QSize adjustedSize = client_->adjustedSize(g.size()); + QSize adjustedSize = client_->adjustedSize(g.size()); if (adjustedSize != client_->size()) { if (side_ == Left) - g.setLeft(g.right() - adjustedSize.width()); + g.setLeft(g.right() - adjustedSize.width() + 1); else - g.setRight(g.left() + adjustedSize.width()); + g.setRight(g.left() + adjustedSize.width() - 1); - g.setBottom(g.top() + adjustedSize.height()); + g.setBottom(g.top() + adjustedSize.height() - 1); client_->setGeometry(g); } diff --git a/default/TitleBar.cpp b/default/TitleBar.cpp index 5b80216acf..3293fda607 100644 --- a/default/TitleBar.cpp +++ b/default/TitleBar.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -107,8 +107,16 @@ TitleBar::TitleBar(Manager * client) question_, SIGNAL(contextHelp()), client, SLOT(contextHelp()) ); + + if ( client->isTransient() ) { + // lighter decoration for transient windows + sticky_->hide(); + iconify_->hide(); + maximise_->hide(); + } + } - + void TitleBar::updateDisplay() { @@ -139,13 +147,16 @@ TitleBar::resizeEvent(QResizeEvent *) if (width() < 120) sizeProblem = 3; else if (width() < 160) sizeProblem = 2; else if (width() < 200) sizeProblem = 1; + + bool transient = ( (Client*) parentWidget() )->isTransient(); switch (sizeProblem) { case 1: close_ ->show(); sticky_ ->hide(); - iconify_ ->show(); + if ( !transient ) + iconify_ ->show(); if (0 != question_) question_ ->hide(); maximise_ ->hide(); @@ -174,9 +185,11 @@ TitleBar::resizeEvent(QResizeEvent *) close_ ->show(); if (0 != question_) question_->show(); - sticky_ ->show(); - iconify_ ->show(); - maximise_ ->show(); + if ( !transient ) { + sticky_ ->show(); + iconify_ ->show(); + maximise_ ->show(); + } break; } } diff --git a/default/TitleText.cpp b/default/TitleText.cpp index 291d63d9d2..04c8d2ba63 100644 --- a/default/TitleText.cpp +++ b/default/TitleText.cpp @@ -1,6 +1,6 @@ /* Default KWin client - + Copyright 2000 Rik Hemsley @@ -56,7 +56,7 @@ TitleText::updatePixmap() QPainter p(&buf()); Static * s = Static::instance(); - + p.drawPixmap(0, 0, s->titleLeft(active_)); p.drawPixmap(width() - 2, 0, s->titleRight(active_)); p.drawTiledPixmap(2, 0, width() - 2, height(), s->title(active_)); @@ -96,7 +96,7 @@ TitleText::mouseMoveEvent(QMouseEvent * e) } void -TitleText::mouseDoubleClickEvent(QMouseEvent * e) +TitleText::mouseDoubleClickEvent(QMouseEvent * ) { client_->workspace()->performWindowOperation( client_, diff --git a/workspace.cpp b/workspace.cpp index e856a5f612..9f534cf747 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2130,10 +2130,11 @@ void Workspace::clientPopupAboutToShow() if ( !popup_client || !popup ) return; popup->setItemEnabled( Options::ResizeOp, popup_client->isResizable() ); - popup->setItemEnabled( Options::MaximizeOp, popup_client->isResizable() ); + popup->setItemEnabled( Options::MaximizeOp, popup_client->isResizable() && !popup_client->isTransient() ); popup->setItemChecked( Options::MaximizeOp, popup_client->isMaximized() ); popup->setItemChecked( Options::ShadeOp, popup_client->isShade() ); popup->setItemChecked( Options::StaysOnTopOp, popup_client->staysOnTop() ); + popup->setItemEnabled( Options::IconifyOp, !popup_client->isTransient() ); }