Commit 5a15e8ed authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[kstyle] Refine shadows

Summary:
Refine shadows in order to match decoration shadows. See D11069

The refined KStyle shadows(from Small to Very Large)
{F5754393, layout=center, size=full}

Desktop experience with the refined shadows
{F5754394, layout=center, size=full}

Depends on D11198

Reviewers: #breeze, #vdg, hpereiradacosta

Reviewed By: hpereiradacosta

Subscribers: abetts, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11175
parent 54b75015
......@@ -82,6 +82,9 @@ include_directories(
debug
)
include_directories(${CMAKE_SOURCE_DIR}/libbreezecommon)
include_directories(${CMAKE_BINARY_DIR}/libbreezecommon)
################# configuration #################
configure_file(config-breeze.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-breeze.h )
......@@ -139,6 +142,7 @@ if(BREEZE_USE_KDE4)
kde4_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc)
kde4_add_plugin(breeze ${breeze_PART_SRCS} kstylekde4compat.cpp)
target_link_libraries(breeze ${KDE4_KDEUI_LIBS})
target_link_libraries(breeze breezecommon4)
if(BREEZE_HAVE_X11)
target_link_libraries(breeze ${X11_XCB_LIBRARIES})
......@@ -153,6 +157,7 @@ else()
add_library(breeze MODULE ${breeze_PART_SRCS})
target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Quick)
target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::WindowSystem)
target_link_libraries(breeze breezecommon)
if( KF5FrameworkIntegration_FOUND )
target_link_libraries(breeze KF5::Style)
......
......@@ -10,7 +10,7 @@
<!-- shadow -->
<entry name="ShadowStrength" type = "Int">
<default>90</default>
<default>255</default>
<min>25</min>
<max>255</max>
</entry>
......
......@@ -47,13 +47,15 @@ namespace Breeze
if( !_widget ) return;
// metrics
const int shadowSize = ShadowHelper::shadowSize( StyleConfigData::shadowSize() );
const int shadowOffset = qMax( shadowSize/2, Metrics::Shadow_Overlap*2 );
const CompositeShadowParams params = ShadowHelper::lookupShadowParams( StyleConfigData::shadowSize() );
if( params.isNone() ) return;
const int shadowSize = qMax( params.shadow1.radius, params.shadow2.radius );
const int size( shadowSize - Metrics::Shadow_Overlap );
const int topSize( size - shadowOffset );
const int bottomSize( size );
const int leftSize( size );
const int rightSize( size );
const int topSize( size - params.offset.y() );
const int bottomSize( size + params.offset.y() );
const int leftSize( size - params.offset.x() );
const int rightSize( size + params.offset.x() );
// get tileSet rect
auto hole = _widget->frameGeometry();
......
This diff is collapsed.
......@@ -50,6 +50,43 @@ namespace Breeze
//* forward declaration
class Helper;
struct ShadowParams
{
ShadowParams()
: offset(QPoint(0, 0))
, radius(0)
, opacity(0) {}
ShadowParams(const QPoint &offset, int radius, qreal opacity)
: offset(offset)
, radius(radius)
, opacity(opacity) {}
QPoint offset;
int radius;
qreal opacity;
};
struct CompositeShadowParams
{
CompositeShadowParams() = default;
CompositeShadowParams(
const QPoint &offset,
const ShadowParams &shadow1,
const ShadowParams &shadow2)
: offset(offset)
, shadow1(shadow1)
, shadow2(shadow2) {}
bool isNone() const
{ return qMax(shadow1.radius, shadow2.radius) == 0; }
QPoint offset;
ShadowParams shadow1;
ShadowParams shadow2;
};
//* handle shadow pixmaps passed to window manager via X property
class ShadowHelper: public QObject
{
......@@ -73,8 +110,8 @@ namespace Breeze
bool isSupported() const
{ return _supported; }
//* shadow size from enum
static int shadowSize( int shadowSizeEnum );
//* shadow params from size enum
static CompositeShadowParams lookupShadowParams( int shadowSizeEnum );
//* reset
void reset();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment