Add option to make login effect fade via black instead of a long transition to your desktop.

Nuno has to decide whether the new option will become default or not, for now it is disabled by default.
You can enable it in effects kcm, now Login effect has a configuration dialog.

It does not (yet) however check for non-fullscreen effects, so they might look weird when this is enabled.

REVIEW: 101812
CCMAIL: nuno@oxygen-icons.org
This commit is contained in:
Kai Uwe Broulik 2011-08-02 15:09:31 +02:00
parent e985201114
commit ca2a019bc8
9 changed files with 229 additions and 89 deletions

View file

@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dashboard/dashboard_config.h"
#include "desktopgrid/desktopgrid_config.h"
#include "diminactive/diminactive_config.h"
#include "login/login_config.h"
#include "magiclamp/magiclamp_config.h"
#include "translucency/translucency_config.h"
#include "presentwindows/presentwindows_config.h"
@ -65,6 +66,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins,
KWIN_EFFECT_CONFIG_SINGLE(dashboard, DashboardEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(desktopgrid, DesktopGridEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(diminactive, DimInactiveEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(login, LoginEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(magiclamp, MagicLampEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(presentwindows, PresentWindowsEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(resize, ResizeEffectConfig)

View file

@ -10,3 +10,17 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
install( FILES
login/login.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
#######################################
# Config
# Source files
set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
login/login_config.cpp
login/login_config.ui
)
# .desktop files
install( FILES
login/login_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View file

@ -22,6 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kdebug.h>
#include <KDE/KConfigGroup>
namespace KWin
{
@ -31,6 +33,7 @@ LoginEffect::LoginEffect()
: progress(1.0)
, login_window(NULL)
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
@ -61,8 +64,19 @@ void LoginEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int
void LoginEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
if (w == login_window && progress != 1.0)
data.opacity *= (1.0 - progress);
if (w == login_window) {
if (m_fadeToBlack) {
if (progress < 0.5)
data.brightness *= (1.0 - progress * 2);
if (progress >= 0.5) {
data.opacity *= (1.0 - (progress - 0.5) * 2);
data.brightness = 0;
}
} else if (progress < 1.0) {
data.opacity *= (1.0 - progress);
}
}
effects->paintWindow(w, mask, region, data);
}
@ -73,6 +87,12 @@ void LoginEffect::postPaintScreen()
effects->postPaintScreen();
}
void LoginEffect::reconfigure(ReconfigureFlags)
{
KConfigGroup conf = effects->effectConfig("Login");
m_fadeToBlack = (conf.readEntry("FadeToBlack", true));
}
void LoginEffect::slotWindowClosed(EffectWindow* w)
{
if (isLoginSplash(w)) {
@ -81,6 +101,7 @@ void LoginEffect::slotWindowClosed(EffectWindow* w)
login_window = w;
login_window->refWindow();
progress = 0.0;
effects->addRepaintFull();
}
}

View file

@ -1,89 +1,5 @@
[Desktop Entry]
Name=Login
Name[af]=Aanteken
Name[ar]=ولوج
Name[ast]=Accesu
Name[be]=Уваход
Name[be@latin]=Uvachod
Name[bg]=Вход
Name[bn]=-
Name[bn_IN]=-
Name[bs]=Prijava
Name[ca]=Entrada
Name[ca@valencia]=Entrada
Name[cs]=Přihlášení
Name[csb]=Logòwanié
Name[da]=Login
Name[de]=Anmelden
Name[el]=Σύνδεση
Name[en_GB]=Login
Name[eo]=Ensaluto
Name[es]=Acceso
Name[et]=Sisselogimine
Name[eu]=Saio hasiera
Name[fi]=Sisäänkirjautuminen
Name[fr]=Connexion
Name[fy]=Ynlogge
Name[ga]=Logáil Isteach
Name[gl]=Acceso
Name[gu]=
Name[he]=כניסה
Name[hi]=
Name[hne]=
Name[hr]=Prijava
Name[hsb]=Přizjewjenje
Name[hu]=Bejelentkezés
Name[ia]=Accesso de identification
Name[id]=Log Masuk
Name[is]=Innskráning
Name[it]=Accesso
Name[ja]=
Name[kk]=Кіру
Name[km]=
Name[kn]=ಿ (ಿ)
Name[ko]=
Name[ku]=Têketin
Name[lt]=Prisijungti
Name[lv]=Pieteikties
Name[mai]=ि
Name[mk]=Најавување
Name[ml]=
Name[mr]=
Name[nb]=Logg inn
Name[nds]=Anmellen
Name[ne]=
Name[nl]=Aanmelden
Name[nn]=Innlogging
Name[oc]=Connexion
Name[or]=
Name[pa]=
Name[pl]=Logowanie
Name[pt]=Arranque
Name[pt_BR]=Início de sessão
Name[ro]=Autentificare
Name[ru]=Вход в систему
Name[se]=Sisačáliheapmi
Name[si]=
Name[sk]=Prihlásenie
Name[sl]=Prijava
Name[sr]=Пријава
Name[sr@ijekavian]=Пријава
Name[sr@ijekavianlatin]=Prijava
Name[sr@latin]=Prijava
Name[sv]=Inloggning
Name[ta]=
Name[te]=ి
Name[tg]=Воридот
Name[th]=
Name[tr]=Giriş
Name[ug]=تىزىمغا كىر
Name[uk]=Вхід
Name[uz]=Kirish
Name[uz@cyrillic]=Кириш
Name[wa]=Elodjaedje
Name[x-test]=xxLoginxx
Name[zh_CN]=
Name[zh_TW]=
Icon=preferences-system-windows-effect-login
Comment=Smoothly fade to the desktop when logging in
Comment[ar]=اظهار سطح المكتب بنعومة عند الولوج
@ -153,10 +69,10 @@ Comment[zh_TW]=登入時平順地淡入桌面
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Lubos Lunak
X-KDE-PluginInfo-Email=l.lunak@kde.org
X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik
X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de
X-KDE-PluginInfo-Name=kwin4_effect_login
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Version=0.1.1
X-KDE-PluginInfo-Category=Appearance
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL

View file

@ -37,6 +37,7 @@ public:
virtual void postPaintScreen();
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void reconfigure(ReconfigureFlags);
public Q_SLOTS:
void slotWindowClosed(EffectWindow *w);
@ -45,6 +46,7 @@ private:
bool isLoginSplash(EffectWindow* w);
double progress; // 0-1
EffectWindow* login_window;
bool m_fadeToBlack;
};
} // namespace

View file

@ -0,0 +1,81 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2010 Martin Gräßlin <kde@martin-graesslin.com>
Copyright (C) 2011 Kai Uwe Broulik <kde@privat.broulik.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "login_config.h"
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <QVBoxLayout>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
LoginEffectConfigForm::LoginEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
LoginEffectConfig::LoginEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new LoginEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
connect(m_ui->fadetoblackBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
load();
}
void LoginEffectConfig::load()
{
KCModule::load();
KConfigGroup conf = EffectsHandler::effectConfig("Login");
m_ui->fadetoblackBox->setChecked(conf.readEntry<bool>("FadeToBlack", true));
emit changed(false);
}
void LoginEffectConfig::save()
{
KConfigGroup conf = EffectsHandler::effectConfig("Login");
conf.writeEntry("FadeToBlack", m_ui->fadetoblackBox->isChecked());
conf.sync();
emit changed(false);
EffectsHandler::sendReloadMessage("login");
}
void LoginEffectConfig::defaults()
{
m_ui->fadetoblackBox->setChecked(true);
emit changed(true);
}
} // namespace
#include "login_config.moc"

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_login
X-KDE-PluginKeyword=login
Name=Login

View file

@ -0,0 +1,57 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2010 Martin Gräßlin <kde@martin-graesslin.com>
Copyright (C) 2011 Kai Uwe Broulik <kde@privat.broulik.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_LOGIN_CONFIG_H
#define KWIN_LOGIN_CONFIG_H
#include <kcmodule.h>
#include "ui_login_config.h"
namespace KWin
{
class LoginEffectConfigForm : public QWidget, public Ui::LoginEffectConfigForm
{
Q_OBJECT
public:
explicit LoginEffectConfigForm(QWidget* parent = 0);
};
class LoginEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit LoginEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private:
LoginEffectConfigForm* m_ui;
};
} // namespace
#endif

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWin::LoginEffectConfigForm</class>
<widget class="QWidget" name="KWin::LoginEffectConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>160</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="fadetoblackBox">
<property name="text">
<string>Fade to black (fullscreen splash screens only)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>