From d1ef7e823697cc75c1933972ea2a9158a169a5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Sun, 1 Sep 2002 22:50:34 +0000 Subject: [PATCH] - Made the bottom grab bar optional by popular demand. - Implemented a (hopefully) temporary solution to tooltip setting changes not being applied to the titlebar buttons while the style is in use. svn path=/trunk/kdebase/kwin/; revision=175167 --- clients/keramik/Makefile.am | 3 +- clients/keramik/config/config.cpp | 4 + clients/keramik/config/keramikconfig.ui | 13 +++- clients/keramik/embedtool.cpp | 2 +- clients/keramik/keramik.cpp | 95 ++++++++++++++++-------- clients/keramik/keramik.h | 10 ++- clients/keramik/pics/bottom-center.png | Bin 0 -> 149 bytes clients/keramik/pics/bottom-left.png | Bin 0 -> 156 bytes clients/keramik/pics/bottom-right.png | Bin 0 -> 163 bytes 9 files changed, 89 insertions(+), 38 deletions(-) create mode 100644 clients/keramik/pics/bottom-center.png create mode 100644 clients/keramik/pics/bottom-left.png create mode 100644 clients/keramik/pics/bottom-right.png diff --git a/clients/keramik/Makefile.am b/clients/keramik/Makefile.am index 4b9eff8f25..727425f525 100644 --- a/clients/keramik/Makefile.am +++ b/clients/keramik/Makefile.am @@ -30,7 +30,8 @@ tiles.h: pics/caption-large-left.png pics/caption-small-right.png pics/titlebar- pics/grabbar-center.png pics/titlebar-left.png pics/border-right.png \ pics/caption-small-center.png pics/grabbar-left.png pics/titlebar-right.png \ pics/caption-large-center.png pics/caption-small-left.png pics/grabbar-right.png \ - pics/titlebutton-round.png + pics/titlebutton-round.png pics/bottom-left.png pics/bottom-right.png \ + pics/bottom-center.png tiles.h: embedtool pics=`ls $(srcdir)/pics/*.png 2>/dev/null` ;\ diff --git a/clients/keramik/config/config.cpp b/clients/keramik/config/config.cpp index 4202cd8ade..4210fa0d79 100644 --- a/clients/keramik/config/config.cpp +++ b/clients/keramik/config/config.cpp @@ -58,6 +58,7 @@ KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent ) ui = new KeramikConfigUI( parent ); connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) ); + connect( ui->largeGrabBars, SIGNAL(clicked()), SIGNAL(changed()) ); connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) ); load( conf ); @@ -79,6 +80,7 @@ void KeramikConfig::load( KConfig* ) c->setGroup("General"); ui->showAppIcons->setChecked( c->readBoolEntry("ShowAppIcons", true) ); ui->smallCaptions->setChecked( c->readBoolEntry("SmallCaptionBubbles", false) ); + ui->largeGrabBars->setChecked( c->readBoolEntry("LargeGrabBars", true) ); ui->useShadowedText->setChecked( c->readBoolEntry("UseShadowedText", true) ); } @@ -89,6 +91,7 @@ void KeramikConfig::save( KConfig* ) c->setGroup( "General" ); c->writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() ); c->writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() ); + c->writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() ); c->writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() ); c->sync(); } @@ -99,6 +102,7 @@ void KeramikConfig::defaults() { ui->showAppIcons->setChecked( true ); ui->smallCaptions->setChecked( false ); + ui->largeGrabBars->setChecked( true ); ui->useShadowedText->setChecked( true ); emit changed(); diff --git a/clients/keramik/config/keramikconfig.ui b/clients/keramik/config/keramikconfig.ui index af5372ee35..ed43228a46 100644 --- a/clients/keramik/config/keramikconfig.ui +++ b/clients/keramik/config/keramikconfig.ui @@ -78,6 +78,17 @@ Check this option if you want the caption bubble to have the same size on active windows that it has on inactive ones. This option is useful for laptops or low resolution displays where you want maximize the amount of space available to the window contents. + + + largeGrabBars + + + Draw g&rab bars below windows + + + Check this option if you want a grab bar to be drawn below windows. When this option is not selected only a thin border will be drawn in its place. + + useShadowedText @@ -89,7 +100,7 @@ Check this option if you want the titlebar text to have a 3D look with a shadow behind it. - + diff --git a/clients/keramik/embedtool.cpp b/clients/keramik/embedtool.cpp index f221bee2ab..022ddb1f7c 100644 --- a/clients/keramik/embedtool.cpp +++ b/clients/keramik/embedtool.cpp @@ -170,7 +170,7 @@ void KeramikEmbedder::writeIndex() uint prime = 0; for ( i = 0; i < 50; i++ ) - if ( (prime = primes[i]) > index->count() ) + if ( (prime = primes[i]) >= index->count() ) break; stream << "\tclass KeramikImageDb {\n"; diff --git a/clients/keramik/keramik.cpp b/clients/keramik/keramik.cpp index 6af6ea3730..11ff280ea5 100644 --- a/clients/keramik/keramik.cpp +++ b/clients/keramik/keramik.cpp @@ -249,10 +249,15 @@ void KeramikHandler::createPixmaps() activeTiles[ BorderRight ] = loadPixmap( "border-right", titleColor ); // Load the bottom grabbar pixmaps - activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); - activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); - activeTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); - + if ( largeGrabBars ) { + activeTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); + activeTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); + activeTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); + } else { + activeTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); + activeTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); + activeTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor ); + } // Inactive tiles // ------------------------------------------------------------------------- @@ -283,10 +288,15 @@ void KeramikHandler::createPixmaps() inactiveTiles[ BorderLeft ] = loadPixmap( "border-left", titleColor ); inactiveTiles[ BorderRight ] = loadPixmap( "border-right", titleColor ); - inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); - inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); - inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); - + if ( largeGrabBars ) { + inactiveTiles[ GrabBarLeft ] = loadPixmap( "grabbar-left", titleColor ); + inactiveTiles[ GrabBarRight ] = loadPixmap( "grabbar-right", titleColor ); + inactiveTiles[ GrabBarCenter ] = loadPixmap( "grabbar-center", titleColor ); + } else { + inactiveTiles[ GrabBarLeft ] = loadPixmap( "bottom-left", titleColor ); + inactiveTiles[ GrabBarRight ] = loadPixmap( "bottom-right", titleColor ); + inactiveTiles[ GrabBarCenter ] = loadPixmap( "bottom-center", titleColor ); + } // Buttons // ------------------------------------------------------------------------- @@ -404,10 +414,11 @@ void KeramikHandler::readConfig() showIcons = c->readBoolEntry( "ShowAppIcons", true ); shadowedText = c->readBoolEntry( "UseShadowedText", true ); smallCaptionBubbles = c->readBoolEntry( "SmallCaptionBubbles", false ); + largeGrabBars = c->readBoolEntry( "LargeGrabBars", true ); if ( ! settings_cache ) { settings_cache = new SettingsCache; - + if ( options->customButtonPositions() ) { settings_cache->buttonsLeft = options->titleButtonsLeft(); settings_cache->buttonsRight = options->titleButtonsRight(); @@ -415,12 +426,14 @@ void KeramikHandler::readConfig() settings_cache->buttonsLeft = QString( default_left ); settings_cache->buttonsRight = QString( default_right ); } - - settings_cache->aTitleColor = options->color( Options::TitleBar, true ); - settings_cache->aTitleBlend = options->color( Options::TitleBlend, true ); - settings_cache->iTitleColor = options->color( Options::TitleBar, false ); - settings_cache->iTitleBlend = options->color( Options::TitleBlend, false ); - settings_cache->buttonColor = options->color( Options::ButtonBg, true ); + + settings_cache->aTitleColor = options->color( Options::TitleBar, true ); + settings_cache->aTitleBlend = options->color( Options::TitleBlend, true ); + settings_cache->iTitleColor = options->color( Options::TitleBar, false ); + settings_cache->iTitleBlend = options->color( Options::TitleBlend, false ); + settings_cache->buttonColor = options->color( Options::ButtonBg, true ); + settings_cache->showTooltips = options->showTooltips(); + settings_cache->largeGrabBars = largeGrabBars; } delete c; @@ -500,9 +513,9 @@ QPixmap *KeramikHandler::loadPixmap( const QString &name, const QColor &col ) void KeramikHandler::reset() { QString buttonsLeft, buttonsRight; - + keramik_initialized = false; - + bool needHardReset = false; bool pixmapsInvalid = false; @@ -518,7 +531,7 @@ void KeramikHandler::reset() { pixmapsInvalid = true; } - + // Check if button positions have changed if ( options->customButtonPositions() ) { buttonsLeft = options->titleButtonsLeft(); @@ -527,22 +540,33 @@ void KeramikHandler::reset() buttonsLeft = QString( default_left ); buttonsRight = QString( default_right ); } - + if ( (settings_cache->buttonsLeft != buttonsLeft) || (settings_cache->buttonsRight != buttonsRight) ) { needHardReset = true; } - + + // Check if tooltips options have changed + if ( (settings_cache->showTooltips != options->showTooltips()) ) { + needHardReset = true; + } + + if ( (settings_cache->largeGrabBars != largeGrabBars) ) { + pixmapsInvalid = true; + needHardReset = true; + } + // Update our config cache settings_cache->aTitleColor = options->color( Options::TitleBar, true ); settings_cache->aTitleBlend = options->color( Options::TitleBlend, true ); settings_cache->iTitleColor = options->color( Options::TitleBar, false ); settings_cache->iTitleBlend = options->color( Options::TitleBlend, false ); settings_cache->buttonColor = options->color( Options::ButtonBg, true ); + settings_cache->showTooltips = options->showTooltips(); settings_cache->buttonsLeft = buttonsLeft; settings_cache->buttonsRight = buttonsRight; - - + settings_cache->largeGrabBars = largeGrabBars; + // Do we need to recreate the pixmaps? if ( pixmapsInvalid ) { destroyPixmaps(); @@ -710,15 +734,16 @@ KeramikClient::KeramikClient( Workspace *ws, WId w, QWidget *parent, const char largeTitlebar = ( !maximizedVertical() && clientHandler->largeCaptionBubbles() ); largeCaption = ( isActive() && largeTitlebar ); + int grabBarHeight = clientHandler->grabBarHeight(); int topSpacing = ( largeTitlebar ? 4 : 1 ); topSpacer = new QSpacerItem( 10, topSpacing, QSizePolicy::Expanding, QSizePolicy::Minimum ); mainLayout->addItem( topSpacer ); - mainLayout->addLayout( titleLayout ); // Titlebar - mainLayout->addLayout( windowLayout, 1 ); // Left border + window + right border - mainLayout->addSpacing( 8 ); // Bottom grab bar + shadow + mainLayout->addLayout( titleLayout ); // Titlebar + mainLayout->addLayout( windowLayout, 1 ); // Left border + window + right border + mainLayout->addSpacing( grabBarHeight ); // Bottom grab bar titleLayout->setSpacing( buttonSpacing ); @@ -1206,6 +1231,7 @@ void KeramikClient::paintEvent( QPaintEvent *e ) int titleBaseY = ( largeTitlebar ? 3 : 0 ); int titleBarHeight = clientHandler->titleBarHeight( largeTitlebar ); + int grabBarHeight = clientHandler->grabBarHeight(); if ( maskDirty ) updateMask(); @@ -1259,10 +1285,11 @@ void KeramikClient::paintEvent( QPaintEvent *e ) // Borders // ----------------------------------------------------------------------- - if ( updateRect.bottom() >= titleBarHeight && updateRect.top() < height() - 8 ) + if ( updateRect.bottom() >= titleBarHeight && + updateRect.top() < height() - grabBarHeight ) { int top = QMAX( titleBarHeight, updateRect.top() ); - int bottom = QMIN( updateRect.bottom(), height() - 8 ); + int bottom = QMIN( updateRect.bottom(), height() - grabBarHeight ); // Left border if ( updateRect.x() <= 4 ) { @@ -1280,10 +1307,10 @@ void KeramikClient::paintEvent( QPaintEvent *e ) // Bottom grab bar // ----------------------------------------------------------------------- - if ( updateRect.bottom() >= height() - 8 ) { + if ( updateRect.bottom() >= height() - grabBarHeight ) { // Bottom left corner if ( updateRect.x() < 9 ) - p.drawPixmap( 0, height() - 8, + p.drawPixmap( 0, height() - grabBarHeight, *clientHandler->tile( GrabBarLeft, active ) ); // Space between the left corner and the right corner @@ -1291,13 +1318,13 @@ void KeramikClient::paintEvent( QPaintEvent *e ) int x1 = QMAX( 9, updateRect.x() ); int x2 = QMIN( width() - 9, updateRect.right() ); - p.drawTiledPixmap( x1, height() - 8, x2 - x1 + 1, 8, - *clientHandler->tile( GrabBarCenter, active ) ); + p.drawTiledPixmap( x1, height() - grabBarHeight, x2 - x1 + 1, + grabBarHeight, *clientHandler->tile( GrabBarCenter, active ) ); } // Bottom right corner if ( updateRect.right() > width() - 9 ) - p.drawPixmap( width()-9, height()-8, + p.drawPixmap( width() - 9, height() - grabBarHeight, *clientHandler->tile( GrabBarRight, active ) ); } } @@ -1405,7 +1432,7 @@ Client::MousePosition KeramikClient::mousePosition( const QPoint &p ) const && p.y() < titleBaseY+3 ) return Top; - if ( p.y() >= height() - 8 ) + if ( p.y() >= height() - clientHandler->grabBarHeight() ) return Bottom; return Center; @@ -1413,6 +1440,8 @@ Client::MousePosition KeramikClient::mousePosition( const QPoint &p ) const }; // namespace Keramik + + // ------------------------------------------------------------------------------------------- diff --git a/clients/keramik/keramik.h b/clients/keramik/keramik.h index 5870c4dc27..d95139e53b 100644 --- a/clients/keramik/keramik.h +++ b/clients/keramik/keramik.h @@ -56,6 +56,8 @@ namespace Keramik { QColor buttonColor; QString buttonsLeft; QString buttonsRight; + bool showTooltips:1; + bool largeGrabBars:1; }; class KeramikHandler : public QObject { @@ -76,7 +78,10 @@ namespace Keramik { return ( large ? activeTiles[CaptionLargeCenter]->height() : activeTiles[CaptionSmallCenter]->height() ); } - + + int grabBarHeight() const + { return activeTiles[GrabBarCenter]->height(); } + const QPixmap *roundButton() const { return titleButtonRound; } const QPixmap *squareButton() const { return titleButtonSquare; } const QBitmap *buttonDeco( ButtonDeco deco ) const @@ -100,7 +105,8 @@ namespace Keramik { QPixmap *loadPixmap( const QString &, const QColor & ); private: - bool showIcons:1, shadowedText:1, smallCaptionBubbles:1; + bool showIcons:1, shadowedText:1, + smallCaptionBubbles:1, largeGrabBars:1; SettingsCache *settings_cache; KeramikImageDb *imageDb; diff --git a/clients/keramik/pics/bottom-center.png b/clients/keramik/pics/bottom-center.png new file mode 100644 index 0000000000000000000000000000000000000000..a4eb0b9df5ca26876ea40050889087d5f5cc6fce GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~d!2~2Zu4(KBQfx`y?k)`fL2$v|<&%LToCO|{ z#S9GGK&9LQjBAzmmI4LYOFVsD*)MU(iz^x3RoQtHD5T`+;uumfCwY!}z8te=!^i*s p|EpvsD0!MPGczY=WN3IwF?jW}-f@0(W)4s_gQu&X%Q~loCIANrC+h$J literal 0 HcmV?d00001 diff --git a/clients/keramik/pics/bottom-left.png b/clients/keramik/pics/bottom-left.png new file mode 100644 index 0000000000000000000000000000000000000000..54f88d5861b92a7908be20b9a87e92bbc7e759f5 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRN!2~2P=Qhm*Qfx`y?k)`fL2$v|<&!~53Opi< z85p<)K$vl@^4?OQAbW|YuPgf{4ta4U&2Yy8Q=pKhr;B4q#hm0n|Nq-FGdpKzubwhR sgjp-05h3yT|NsAz8yYukFi=|~Byd1NN~+77kKt1=5A&7jdVN5>44$rjF6*2UngE!2 BEm{Bo literal 0 HcmV?d00001