From ae07d17aef8bbe441e6beddd2a65bbd3fea1799f Mon Sep 17 00:00:00 2001 From: Rik Hemsley Date: Sat, 22 Jul 2000 00:16:53 +0000 Subject: [PATCH] Fixed '?' button and added some side borders, so you can resize now :) svn path=/trunk/kdebase/kwin/; revision=58276 --- default/Manager.cpp | 17 +++-------------- default/Manager.h | 1 - default/Static.cpp | 10 ++++++++-- default/TitleBar.cpp | 37 ++++++++++++++++++++++++------------- default/TitleText.cpp | 7 ++++++- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/default/Manager.cpp b/default/Manager.cpp index b0af5785fe..c6cc4e5940 100644 --- a/default/Manager.cpp +++ b/default/Manager.cpp @@ -50,8 +50,6 @@ Manager::Manager( ) : Client(workSpace, id, parent, name) { - setBackgroundMode(NoBackground); - shaded_ = false; connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); @@ -129,20 +127,11 @@ Manager::paintEvent(QPaintEvent * e) if (intersectsLeft) p.drawLine(0, r.top(), 0, r.bottom()); - + if (intersectsRight) p.drawLine(width() - 1, r.top(), width() - 1, r.bottom()); } } - - Client::MousePosition -Manager::mousePosition(const QPoint & p) const -{ - if (titleBar_->rect().contains(p)) - return Client::Center; - else - return Client::Nowhere; -} void Manager::toggleSticky() @@ -180,9 +169,9 @@ Manager::_updateLayout() ); windowWrapper() -> setGeometry( - 1, + 3, Static::instance()->titleHeight(), - width() - 2, + width() - 6, height() - Static::instance()->titleHeight() - RESIZE_BAR_HEIGHT ); diff --git a/default/Manager.h b/default/Manager.h index 1919a9b422..dd1b204884 100644 --- a/default/Manager.h +++ b/default/Manager.h @@ -55,7 +55,6 @@ class Manager : public Client protected: - Client::MousePosition mousePosition(const QPoint &) const; void paletteChange(const QPalette &); void activeChange(bool); void maximizeChange(bool); diff --git a/default/Static.cpp b/default/Static.cpp index f40e001249..239de930ce 100644 --- a/default/Static.cpp +++ b/default/Static.cpp @@ -304,10 +304,16 @@ static unsigned char unmax_bits[] = { 0x30, 0x18, 0xcc, 0xe6, 0xf3, 0xf9, 0xfc, 0xfc}; static unsigned char unsticky_bits[] = { - 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c}; + 0x3c, 0x66, 0xdb, 0xbd, 0xbd, 0xdb, 0x66, 0x3c}; static unsigned char sticky_bits[] = { - 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c}; + 0x3c, 0x66, 0xc3, 0x81, 0x81, 0xc3, 0x66, 0x3c}; + +//static unsigned char unsticky_bits[] = { +// 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c}; + +//static unsigned char sticky_bits[] = { +// 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c}; static unsigned char question_bits[] = { 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x18}; diff --git a/default/TitleBar.cpp b/default/TitleBar.cpp index 7125af5b19..5b80216acf 100644 --- a/default/TitleBar.cpp +++ b/default/TitleBar.cpp @@ -35,14 +35,17 @@ namespace Default { TitleBar::TitleBar(Manager * client) - : QWidget(client) + : QWidget(client), + question_(0L) { close_ = new CloseButton (this); text_ = new TitleText (this, client); iconify_ = new IconifyButton (this); maximise_ = new MaximiseButton (this); sticky_ = new StickyButton (this); - question_ = new QuestionButton (this); + + if (client->providesContextHelp()) + question_ = new QuestionButton(this); // Close | Text | Question | Sticky | Iconify | Maximise @@ -53,7 +56,8 @@ TitleBar::TitleBar(Manager * client) layout->addSpacing(2); layout->addWidget(text_, 1); layout->addSpacing(2); - layout->addWidget(question_); + if (0 != question_) + layout->addWidget(question_); layout->addWidget(sticky_); layout->addWidget(iconify_); layout->addWidget(maximise_); @@ -98,10 +102,11 @@ TitleBar::TitleBar(Manager * client) maximise_, SLOT(setOn(bool)) ); - connect( - question_, SIGNAL(contextHelp()), - client, SLOT(contextHelp()) - ); + if (0 != question_) + connect( + question_, SIGNAL(contextHelp()), + client, SLOT(contextHelp()) + ); } void @@ -109,7 +114,8 @@ TitleBar::updateDisplay() { close_ ->updateDisplay(); sticky_ ->updateDisplay(); - question_ ->updateDisplay(); + if (0 != question_) + question_ ->updateDisplay(); text_ ->updateDisplay(); iconify_ ->updateDisplay(); maximise_ ->updateDisplay(); @@ -140,13 +146,15 @@ TitleBar::resizeEvent(QResizeEvent *) close_ ->show(); sticky_ ->hide(); iconify_ ->show(); - question_ ->hide(); + if (0 != question_) + question_ ->hide(); maximise_ ->hide(); break; case 2: close_ ->show(); - question_ ->hide(); + if (0 != question_) + question_ ->hide(); sticky_ ->hide(); iconify_ ->hide(); maximise_ ->hide(); @@ -154,7 +162,8 @@ TitleBar::resizeEvent(QResizeEvent *) case 3: close_ ->hide(); - question_ ->hide(); + if (0 != question_) + question_ ->hide(); sticky_ ->hide(); iconify_ ->hide(); maximise_ ->hide(); @@ -163,7 +172,8 @@ TitleBar::resizeEvent(QResizeEvent *) case 0: default: close_ ->show(); - question_ ->show(); + if (0 != question_) + question_->show(); sticky_ ->show(); iconify_ ->show(); maximise_ ->show(); @@ -179,7 +189,8 @@ TitleBar::setActive(bool b) text_->setActive(b); iconify_->setActive(b); maximise_->setActive(b); - question_->setActive(b); + if (0 != question_) + question_->setActive(b); } void diff --git a/default/TitleText.cpp b/default/TitleText.cpp index 7de89a525c..291d63d9d2 100644 --- a/default/TitleText.cpp +++ b/default/TitleText.cpp @@ -23,6 +23,7 @@ #include #include "../options.h" +#include "../workspace.h" #include "TitleText.h" #include "Manager.h" @@ -97,7 +98,11 @@ TitleText::mouseMoveEvent(QMouseEvent * e) void TitleText::mouseDoubleClickEvent(QMouseEvent * e) { - client_->fakeMouseEvent(e, this); + client_->workspace()->performWindowOperation( + client_, + options->operationTitlebarDblClick()); + + client_->workspace()->requestFocus(client_); } } // End namespace