From 75df855adff89af3e8442cce4803204ead433d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 7 Mar 2010 13:37:47 +0000 Subject: [PATCH] Better support for maximized windows in Aurorae. The theme can include explicit elements for the maximzed area. Furthermore the SVG is only scaled to the region of the maximzed title rect and not to the complete size of the window. Theme description updated with a complete section on maximized windows. Yeah I know I should move that to techbase. FEATURE: 224226 svn path=/trunk/KDE/kdebase/workspace/; revision=1100406 --- clients/aurorae/src/aurorae.cpp | 35 ++++++++++++++++++++++++++++++- clients/aurorae/theme-description | 21 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 0b845b3e62..24ad997b21 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -761,6 +761,20 @@ void AuroraeClient::paintEvent(QPaintEvent *event) frame->setElementPrefix("decoration-opaque-inactive"); } } + if (maximized) { + if (frame->hasElementPrefix("decoration-maximized")) { + frame->setElementPrefix("decoration-maximized"); + } + if (!isActive() && frame->hasElementPrefix("decoration-maximized-inactive")) { + frame->setElementPrefix("decoration-maximized-inactive"); + } + if (!compositingActive() && frame->hasElementPrefix("decoration-maximized-opaque")) { + frame->setElementPrefix("decoration-maximized-opaque"); + if (!isActive() && frame->hasElementPrefix("decoration-maximized-opaque-inactive")) { + frame->setElementPrefix("decoration-maximized-opaque-inactive"); + } + } + } // restrict painting on the decoration - no need to paint behind the window int left, right, top, bottom; @@ -797,6 +811,11 @@ void AuroraeClient::paintEvent(QPaintEvent *event) rect = QRectF(conf.paddingLeft(), conf.paddingTop(), widget()->width() - conf.paddingRight(), widget()->height() - conf.paddingBottom()); + if (transparentRect().isNull()) { + rect = QRectF(conf.paddingLeft(), conf.paddingTop(), + widget()->width() - conf.paddingRight(), + layoutMetric(LM_TitleEdgeTop) + layoutMetric(LM_TitleHeight) + layoutMetric(LM_TitleEdgeBottom)); + } } QRectF sourceRect = rect; if (!compositingActive()) { @@ -826,10 +845,24 @@ void AuroraeClient::paintEvent(QPaintEvent *event) frame->setElementPrefix("decoration-opaque"); } } + if (maximized && frame->hasElementPrefix("decoration-maximized-inactive")) { + frame->setElementPrefix("decoration-maximized-inactive"); + if (!isActive()) { + frame->setElementPrefix("decoration-maximized"); + } + if (!compositingActive() && frame->hasElementPrefix("decoration-maximized-opaque-inactive")) { + frame->setElementPrefix("decoration-maximized-opaque-inactive"); + if (!isActive()) { + frame->setElementPrefix("decoration-maximized-opaque"); + } + } + } else if (maximized && frame->hasElementPrefix("decoration-maximized")) { + frame->setElementPrefix("decoration-maximized"); + } frame->resizeFrame(rect.size()); QPixmap result = Plasma::PaintUtils::transition(frame->framePixmap(), target, m_animationProgress); - painter.drawPixmap(rect.toRect(), result); + painter.drawPixmap(rect.toRect(), result, sourceRect); } else { frame->paintFrame(&painter, rect, sourceRect); } diff --git a/clients/aurorae/theme-description b/clients/aurorae/theme-description index 8a97819f2d..54962dad3f 100644 --- a/clients/aurorae/theme-description +++ b/clients/aurorae/theme-description @@ -39,6 +39,27 @@ This opaque decoration is used for generating the window mask. The element prefi "decoration-opaque" for active and "decoration-opaque-inactive" for inactive windows. The mask is generated from the active window. +Maximized Windows +----------------- +In order to better support maximized windows there exists a special frame svg called +"decoration-maximized". In the same way as for the general decoration you can specify a version for +inactive, opaque and inactive-opaque. This results in the following names: + * decoration-maximized + * decoration-maximized-inactive + * decoration-maximized-opaque + * decoration-maximized-opaque-inactive + +In all cases only the center element will be used. There is no need to specify borders. Please note +that in case of a window with translucent widgets the center element will be stretched to the size +of the complete window. + +The following fallback strategy is used: if inactive is not present it falls back to the active. +If opaque is not present it falls back to the translucent. If none of the maximized elements are +present the center element of the decoration is used! + +In order to support Fitts' Law all TitleEdge Settings are set to 0. So the buttons will be directly +next to the screen edges. You have the possibility to overwrite these settins (see below). + Buttons ======= You have to provide a svgz file for each button your theme should contain. If you do not provide a