From 1457d3ba32f812e5ce437ec3951157887a8433f6 Mon Sep 17 00:00:00 2001 From: Huynh Huu Long Date: Sat, 8 Aug 2009 22:49:31 +0000 Subject: [PATCH] Don't enlarge the clickable area in non-composited environments with no shadows svn path=/trunk/KDE/kdebase/workspace/; revision=1009021 --- clients/oxygen/oxygenclient.cpp | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index fdc439d377..e533393c5c 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -131,7 +131,7 @@ int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const K { bool maximized = isMaximized(); // increase the border of the decoration by including the shadow as clickable area - int extraBorder = maximized ? 0 : EXTENDED_HITAREA; + int extraBorder = (maximized && compositingActive()) ? 0 : EXTENDED_HITAREA; int frameWidth = OxygenFactory::borderSize(); switch (lm) { @@ -139,26 +139,26 @@ int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const K case LM_BorderRight: case LM_BorderBottom: { - if (respectWindowState && maximized) { - return 0; - } else { + int border = 0; + if (!(respectWindowState && maximized)) { // Even for thin borders (2px wide) we want to preserve // the rounded corners having a minimum height of 4px if (lm == LM_BorderBottom) { - return qMax(frameWidth, 4) + extraBorder; + border = qMax(frameWidth, 4); } else { - return frameWidth + extraBorder; + border = frameWidth; } } + return border + extraBorder; } case LM_TitleEdgeTop: { - if (respectWindowState && maximized) { - return 0 + extraBorder; - } else { - return TFRAMESIZE + extraBorder; + int border = 0; + if (!(respectWindowState && maximized)) { + border = TFRAMESIZE; } + return border + extraBorder; } case LM_TitleEdgeBottom: @@ -169,11 +169,11 @@ int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const K case LM_TitleEdgeLeft: case LM_TitleEdgeRight: { - if (respectWindowState && maximized) { - return 0 + extraBorder; - } else { - return 6 + extraBorder; + int border = 0; + if (!(respectWindowState && maximized)) { + border = 6; } + return border + extraBorder; } case LM_TitleBorderLeft: @@ -319,8 +319,9 @@ void OxygenClient::paintEvent(QPaintEvent *e) QColor light = helper_.calcLightColor( color ); QColor dark = helper_.calcDarkColor( color ); + bool compositingIsActive = compositingActive(); bool maximized = isMaximized(); - int extraBorder = maximized ? 0 : EXTENDED_HITAREA; + int extraBorder = (maximized && compositingIsActive) ? 0 : EXTENDED_HITAREA; const int titleHeight = layoutMetric(LM_TitleHeight); const int titleTop = layoutMetric(LM_TitleEdgeTop) + frame.top() - extraBorder; @@ -336,16 +337,15 @@ void OxygenClient::paintEvent(QPaintEvent *e) // draw shadow - if (compositingActive() && !maximized) + if (compositingIsActive && !maximized) shadowTiles(color,KDecoration::options()->color(ColorTitleBar), SHADOW_WIDTH, isActive())->render( frame.adjusted(-SHADOW_WIDTH+4, -SHADOW_WIDTH+4, SHADOW_WIDTH-4, SHADOW_WIDTH-4), &painter, TileSet::Ring); // draw window background - bool isCompositingActive = compositingActive(); - if (isCompositingActive) { + if (compositingIsActive) { frame.getRect(&x, &y, &w, &h); QRegion mask(x+5, y+0, w-10, h-0); @@ -359,7 +359,7 @@ void OxygenClient::paintEvent(QPaintEvent *e) helper_.renderWindowBackground(&painter, frame, this->widget(), palette, SHADOW_WIDTH); - if (isCompositingActive) { + if (compositingIsActive) { painter.setClipping(false); } @@ -372,7 +372,7 @@ void OxygenClient::paintEvent(QPaintEvent *e) painter.setRenderHint(QPainter::Antialiasing); // Draw dividing line - if (compositingActive()) { + if (compositingIsActive) { frame.adjust(-1,-1,1,1); } frame.getRect(&x, &y, &w, &h); @@ -422,7 +422,7 @@ void OxygenClient::paintEvent(QPaintEvent *e) if(maximized) return; - helper_.drawFloatFrame(&painter, frame, color, !compositingActive(), isActive(), + helper_.drawFloatFrame(&painter, frame, color, !compositingIsActive, isActive(), KDecoration::options()->color(ColorTitleBar)); if(!isResizable())