Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
added option to only use button icons as per RFC #25
Browse files Browse the repository at this point in the history
  • Loading branch information
n4n0GH committed Nov 26, 2019
1 parent 4a443e1 commit 9f16d98
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 203 deletions.
17 changes: 15 additions & 2 deletions kwin-effects/helloshaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,25 @@ HelloShadersEffect::HelloShadersEffect() : KWin::Effect(), m_shader(0)
m_shader->setUniform(sampler, 0);
KWin::ShaderManager::instance()->popShader();
connect(KWin::effects, &KWin::EffectsHandler::windowMaximizedStateChanged, this, &HelloShadersEffect::windowMaximizedStateChanged);
connect(KWin::effects, &KWin::EffectsHandler::windowAdded, this, &HelloShadersEffect::windowMaximizedStart);
}
}
else
deleteLater();
}

void HelloShadersEffect::windowMaximizedStart(KWin::EffectWindow *w)
{
// logic:
// if isMaximized(){
// applyEffect = NULL;
// } else { applyEffect = w; }
// problem:
// how to construct isMaximized()?
// how is it done in the decorations?
// can that be copied to the effects?
}

void HelloShadersEffect::windowMaximizedStateChanged(KWin::EffectWindow *w, bool horizontal, bool vertical)
{
if( ( horizontal == true ) && ( vertical == true ) ) applyEffect = w;
Expand Down Expand Up @@ -188,13 +201,13 @@ HelloShadersEffect::reconfigure(ReconfigureFlags flags)
{
Q_UNUSED(flags)
m_alpha = 63;
setRoundness(5);
setRoundness(5); // TODO: make this dynamic through settings
}

void
HelloShadersEffect::prePaintWindow(KWin::EffectWindow *w, KWin::WindowPrePaintData &data, int time)
{

// TODO: make exclusion list customizable through settings
if (!m_shader->isValid()
|| (w->windowClass().contains("plasma", Qt::CaseInsensitive)
&& !w->isNormalWindow()
Expand Down
1 change: 1 addition & 0 deletions kwin-effects/helloshaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Q_DECL_EXPORT HelloShadersEffect : public KWin::Effect
void reconfigure(ReconfigureFlags flags);
void prePaintWindow(KWin::EffectWindow* w, KWin::WindowPrePaintData& data, int time);
void paintWindow(KWin::EffectWindow* w, int mask, QRegion region, KWin::WindowPaintData& data);
void windowMaximizedStart(KWin::EffectWindow *w);
void windowMaximizedStateChanged(KWin::EffectWindow *w, bool horizontal, bool vertical);
virtual int requestedEffectChainPosition() const { return 100; }

Expand Down
5 changes: 5 additions & 0 deletions window-decoration/kdecoration/config/helloconfigwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ namespace Hello
connect( m_ui.customColorSelect, SIGNAL(changed(QColor)), SLOT(updateChanged()) );
connect( m_ui.drawHighlight, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.drawTitleHighlight, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( m_ui.onlyUseIcons, SIGNAL(clicked()), SLOT(updateChanged()) );

// use custom color for buttons or not
connect( m_ui.buttonCustomColor, SIGNAL(clicked()), SLOT(updateChanged()) );
Expand Down Expand Up @@ -115,6 +116,7 @@ namespace Hello
m_ui.customColorSelect->setColor( m_internalSettings->customColorSelect() );
m_ui.drawHighlight->setChecked( m_internalSettings->drawHighlight() );
m_ui.drawTitleHighlight->setChecked( m_internalSettings->drawTitleHighlight() );
m_ui.onlyUseIcons->setChecked( m_internalSettings->onlyUseIcons() );

m_ui.buttonCustomColor->setChecked( m_internalSettings->buttonCustomColor() );
m_ui.customCloseColor->setColor( m_internalSettings->customCloseColor() );
Expand Down Expand Up @@ -167,6 +169,7 @@ namespace Hello
m_internalSettings->setCustomColorSelect( m_ui.customColorSelect->color() );
m_internalSettings->setDrawHighlight( m_ui.drawHighlight->isChecked() );
m_internalSettings->setDrawTitleHighlight( m_ui.drawTitleHighlight->isChecked() );
m_internalSettings->setOnlyUseIcons( m_ui.onlyUseIcons->isChecked() );

m_internalSettings->setButtonCustomColor( m_ui.buttonCustomColor->isChecked() );
m_internalSettings->setCustomCloseColor( m_ui.customCloseColor->color() );
Expand Down Expand Up @@ -232,6 +235,7 @@ namespace Hello
m_ui.customColorSelect->setColor( m_internalSettings->customColorSelect() );
m_ui.drawHighlight->setChecked( m_internalSettings->drawHighlight() );
m_ui.drawTitleHighlight->setChecked( m_internalSettings->drawTitleHighlight() );
m_ui.onlyUseIcons->setChecked( m_internalSettings->onlyUseIcons() );

m_ui.buttonCustomColor->setChecked( m_internalSettings->buttonCustomColor() );
m_ui.customCloseColor->setColor( m_internalSettings->customCloseColor() );
Expand Down Expand Up @@ -274,6 +278,7 @@ namespace Hello
else if( m_ui.customColorSelect->color() != m_internalSettings->customColorSelect() ) modified = true;
else if( m_ui.drawHighlight->isChecked() != m_internalSettings->drawHighlight() ) modified = true;
else if( m_ui.drawTitleHighlight->isChecked() != m_internalSettings->drawTitleHighlight() ) modified = true;
else if( m_ui.onlyUseIcons->isChecked() != m_internalSettings->onlyUseIcons() ) modified = true;

// custom button colors
else if( m_ui.buttonCustomColor->isChecked() != m_internalSettings->buttonCustomColor() ) modified = true;
Expand Down
Loading

0 comments on commit 9f16d98

Please sign in to comment.