Merge branch 'KDE/4.9'

Conflicts:
	ksysguard/gui/ksysguard.desktop
	kwin/effects/translucency/translucency.cpp
icc-effect-5.14.5
Martin Gräßlin 2012-09-07 07:59:10 +02:00
commit 3aee94d798
14 changed files with 475 additions and 421 deletions

View File

@ -28,13 +28,19 @@ namespace KWin
KWIN_EFFECT(translucency, TranslucencyEffect)
TranslucencyEffect::TranslucencyEffect()
: fadeout(NULL)
, current(NULL)
, previous(NULL)
: m_activeDecorations(false)
, m_activeMoveResize(false)
, m_activeDialogs(false)
, m_activeInactive(false)
, m_activeCombobox(false)
, m_activeMenus(false)
, m_active(false)
{
reconfigure(ReconfigureAll);
active = effects->activeWindow();
connect(effects, SIGNAL(windowActivated(KWin::EffectWindow*)), this, SLOT(slotWindowActivated(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(checkIsActive()));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(checkIsActive()));
connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartStopUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartStopUserMovedResized(KWin::EffectWindow*)));
}
@ -58,41 +64,105 @@ void TranslucencyEffect::reconfigure(ReconfigureFlags)
popupmenus = menus;
tornoffmenus = menus;
}
moveresize_timeline.setCurveShape(QTimeLine::EaseInOutCurve);
moveresize_timeline.setDuration(animationTime(conf, "Duration", 800));
activeinactive_timeline.setCurveShape(QTimeLine::EaseInOutCurve);
activeinactive_timeline.setDuration(animationTime(conf, "Duration", 800));
m_activeDecorations = !qFuzzyCompare(decoration, 1.0);
m_activeMoveResize = !qFuzzyCompare(moveresize, 1.0);
m_activeDialogs = !qFuzzyCompare(dialogs, 1.0);
m_activeInactive = !qFuzzyCompare(inactive, 1.0);
m_activeCombobox = !qFuzzyCompare(comboboxpopups, 1.0);
m_activeMenus = !qFuzzyCompare(menus, 1.0);
if (!m_activeMenus && individualmenuconfig) {
m_activeMenus = !qFuzzyCompare(dropdownmenus, 1.0) ||
!qFuzzyCompare(popupmenus, 1.0) ||
!qFuzzyCompare(tornoffmenus, 1.0);
}
checkIsActive();
// Repaint the screen just in case the user changed the inactive opacity
effects->addRepaintFull();
}
void TranslucencyEffect::checkIsActive()
{
m_active = m_activeDecorations ||
m_activeMoveResize ||
m_activeDialogs ||
m_activeInactive ||
m_activeCombobox ||
m_activeMenus;
if (!m_active) {
// all individual options are disabled, no window state can activate it
return;
}
if (m_activeDecorations) {
// we can assume that there is at least one decorated window, so the effect is active
return;
}
if (m_activeInactive) {
// we can assume that there is at least one inactive window, so the effect is active
// TODO: maybe only if inactive window is not obscured?
return;
}
// for all other options we go through the list of window and search for a Window being affected
bool activeDropdown, activePopup, activeTornoff;
activeDropdown = activePopup = activeTornoff = false;
if (individualmenuconfig) {
activeDropdown = !qFuzzyCompare(dropdownmenus, 1.0);
activePopup = !qFuzzyCompare(popupmenus, 1.0);
activeTornoff = !qFuzzyCompare(activeTornoff, 1.0);
}
foreach (EffectWindow *w, effects->stackingOrder()) {
if (w->isDeleted()) {
// ignore deleted windows
continue;
}
if (m_activeMoveResize && (w->isUserMove() || w->isUserResize())) {
return;
}
if (m_activeDialogs && w->isDialog()) {
return;
}
if (m_activeCombobox && w->isComboBox()) {
return;
}
if (m_activeMenus) {
if (individualmenuconfig) {
if (activeDropdown && w->isDropdownMenu()) {
return;
}
if (activePopup && w->isPopupMenu()) {
return;
}
if (activeTornoff && w->isMenu()) {
return;
}
} else {
if (w->isMenu() || w->isDropdownMenu() || w->isPopupMenu()) {
return;
}
}
}
}
// no matching window, disable effect
m_active = false;
}
void TranslucencyEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
{
// We keep track of the windows that was last active so we know
// which one to fade out and which ones to paint as fully inactive
if (w == active && w != current) {
previous = current;
current = w;
}
moveresize_timeline.setCurrentTime(moveresize_timeline.currentTime() + time);
activeinactive_timeline.setCurrentTime(activeinactive_timeline.currentTime() + time);
if (decoration != 1.0 && w->hasDecoration()) {
if (m_activeDecorations && w->hasDecoration()) {
data.mask |= PAINT_WINDOW_TRANSLUCENT;
// don't clear PAINT_WINDOW_OPAQUE, contents are not affected
data.clip &= w->contentsRect().translated(w->pos()); // decoration cannot clip
}
if (inactive != 1.0 && (isInactive(w) || activeinactive_timeline.currentValue() < 1.0))
if (m_activeInactive && isInactive(w))
data.setTranslucent();
else if (moveresize != 1.0 && (w->isUserMove() || w->isUserResize() || w == fadeout)) {
else if (m_activeMoveResize && (w->isUserMove() || w->isUserResize())) {
data.setTranslucent();
}
else if (dialogs != 1.0 && w->isDialog()) {
else if (m_activeDialogs && w->isDialog()) {
data.setTranslucent();
}
else if ((dropdownmenus != 1.0 && w->isDropdownMenu())
else if (m_activeMenus && (dropdownmenus != 1.0 && w->isDropdownMenu())
|| (popupmenus != 1.0 && w->isPopupMenu())
|| (tornoffmenus != 1.0 && w->isMenu())
|| (comboboxpopups != 1.0 && w->isComboBox())) {
@ -109,61 +179,31 @@ void TranslucencyEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
return;
}
// Handling active and inactive windows
if (inactive != 1.0 && isInactive(w)) {
if (m_activeInactive && isInactive(w)) {
data.multiplyOpacity(inactive);
if (w == previous) {
data.multiplyOpacity((inactive + ((1.0 - inactive) * (1.0 - activeinactive_timeline.currentValue()))));
if (activeinactive_timeline.currentValue() < 1.0)
w->addRepaintFull();
else
previous = NULL;
}
} else {
// Fading in
if (!isInactive(w) && !w->isDesktop()) {
data.multiplyOpacity((inactive + ((1.0 - inactive) * activeinactive_timeline.currentValue())));
if (activeinactive_timeline.currentValue() < 1.0)
w->addRepaintFull();
}
// decoration and dialogs
if (decoration != 1.0 && w->hasDecoration())
if (m_activeDecorations && w->hasDecoration())
data.multiplyDecorationOpacity(decoration);
if (dialogs != 1.0 && w->isDialog())
if (m_activeDialogs && w->isDialog())
data.multiplyOpacity(dialogs);
// Handling moving and resizing
if (moveresize != 1.0 && !w->isDesktop() && !w->isDock()) {
double progress = moveresize_timeline.currentValue();
if (w->isUserMove() || w->isUserResize()) {
// Fading to translucent
data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (1.0 - progress))));
if (progress < 1.0 && progress > 0.0) {
w->addRepaintFull();
fadeout = w;
}
} else {
// Fading back to more opaque
if (w == fadeout && !w->isUserMove() && !w->isUserResize()) {
data.multiplyOpacity((moveresize + ((1.0 - moveresize) * (progress))));
if (progress == 1.0 || progress == 0.0)
fadeout = NULL;
else
w->addRepaintFull();
}
}
if (m_activeMoveResize && (w->isUserMove() || w->isUserResize())) {
data.multiplyOpacity(moveresize);
}
// Menus and combos
if (dropdownmenus != 1.0 && w->isDropdownMenu())
data.multiplyOpacity(dropdownmenus);
if (popupmenus != 1.0 && w->isPopupMenu())
data.multiplyOpacity(popupmenus);
if (tornoffmenus != 1.0 && w->isMenu())
data.multiplyOpacity(tornoffmenus);
if (comboboxpopups != 1.0 && w->isComboBox())
data.multiplyOpacity(comboboxpopups);
if (m_activeMenus) {
if (dropdownmenus != 1.0 && w->isDropdownMenu())
data.multiplyOpacity(dropdownmenus);
if (popupmenus != 1.0 && w->isPopupMenu())
data.multiplyOpacity(popupmenus);
if (tornoffmenus != 1.0 && w->isMenu())
data.multiplyOpacity(tornoffmenus);
if (comboboxpopups != 1.0 && w->isComboBox())
data.multiplyOpacity(comboboxpopups);
}
}
effects->paintWindow(w, mask, region, data);
@ -183,16 +223,15 @@ bool TranslucencyEffect::isInactive(const EffectWindow* w) const
void TranslucencyEffect::slotWindowStartStopUserMovedResized(EffectWindow* w)
{
if (moveresize != 1.0) {
moveresize_timeline.setCurrentTime(0);
if (m_activeMoveResize) {
checkIsActive();
w->addRepaintFull();
}
}
void TranslucencyEffect::slotWindowActivated(EffectWindow* w)
{
if (inactive != 1.0) {
activeinactive_timeline.setCurrentTime(0);
if (m_activeInactive) {
if (NULL != active && active != w) {
if ((NULL == w || w->group() != active->group()) &&
NULL != active->group()) {
@ -213,6 +252,12 @@ void TranslucencyEffect::slotWindowActivated(EffectWindow* w)
}
}
active = w;
checkIsActive();
}
bool TranslucencyEffect::isActive() const
{
return m_active;
}
} // namespace

View File

@ -41,13 +41,12 @@ class TranslucencyEffect
Q_PROPERTY(qreal dropDownMenus READ configuredDropDownMenus)
Q_PROPERTY(qreal popupMenus READ configuredPopupMenus)
Q_PROPERTY(qreal tornOffMenus READ configuredTornOffMenus)
Q_PROPERTY(int moveResizeDuration READ configuredMoveResizeDuration)
Q_PROPERTY(int activeInactiveDuration READ configuredActiveInactiveDuration)
public:
TranslucencyEffect();
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual bool isActive() const;
// for properties
qreal configuredDecoration() const {
@ -80,16 +79,13 @@ public:
qreal configuredTornOffMenus() const {
return tornoffmenus;
}
int configuredMoveResizeDuration() const {
return moveresize_timeline.duration();
}
int configuredActiveInactiveDuration() const {
return activeinactive_timeline.duration();
}
public Q_SLOTS:
void slotWindowActivated(KWin::EffectWindow* w);
void slotWindowStartStopUserMovedResized(KWin::EffectWindow *w);
private Q_SLOTS:
void checkIsActive();
private:
bool isInactive(const EffectWindow *w) const;
bool individualmenuconfig;
@ -104,13 +100,15 @@ private:
double popupmenus;
double tornoffmenus;
EffectWindow* fadeout;
EffectWindow* current;
EffectWindow* previous;
EffectWindow* active;
QTimeLine moveresize_timeline;
QTimeLine activeinactive_timeline;
bool m_activeDecorations;
bool m_activeMoveResize;
bool m_activeDialogs;
bool m_activeInactive;
bool m_activeCombobox;
bool m_activeMenus;
bool m_active;
};
} // namespace

View File

@ -56,7 +56,6 @@ TranslucencyEffectConfig::TranslucencyEffectConfig(QWidget* parent, const QVaria
connect(m_ui->dropdownmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->popupmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->tornoffmenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->duration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
load();
}
@ -76,8 +75,6 @@ void TranslucencyEffectConfig::load()
m_ui->dropdownmenus->setValue((int)(conf.readEntry("DropdownMenus", 1.0) * 100));
m_ui->popupmenus->setValue((int)(conf.readEntry("PopupMenus", 1.0) * 100));
m_ui->tornoffmenus->setValue((int)(conf.readEntry("TornOffMenus", 1.0) * 100));
m_ui->duration->setValue(conf.readEntry("Duration", 0));
m_ui->duration->setSuffix(ki18np(" millisecond", " milliseconds"));
emit changed(false);
}
@ -97,7 +94,6 @@ void TranslucencyEffectConfig::save()
conf.writeEntry("DropdownMenus", m_ui->dropdownmenus->value() / 100.0);
conf.writeEntry("PopupMenus", m_ui->popupmenus->value() / 100.0);
conf.writeEntry("TornOffMenus", m_ui->tornoffmenus->value() / 100.0);
conf.writeEntry("Duration", m_ui->duration->value());
conf.sync();
emit changed(false);
@ -116,7 +112,6 @@ void TranslucencyEffectConfig::defaults()
m_ui->dropdownmenus->setValue(100);
m_ui->popupmenus->setValue(100);
m_ui->tornoffmenus->setValue(100);
m_ui->duration->setValue(0);
emit changed(true);
}

View File

@ -1,296 +1,202 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWin::TranslucencyEffectConfigForm</class>
<widget class="QWidget" name="KWin::TranslucencyEffectConfigForm" >
<property name="geometry" >
<widget class="QWidget" name="KWin::TranslucencyEffectConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>616</width>
<height>295</height>
<width>643</width>
<height>269</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Translucency</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" >
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="m_opacityGroupBox" >
<property name="title" >
<widget class="QGroupBox" name="m_opacityGroupBox">
<property name="title">
<string>General Translucency Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="1" column="0" >
<widget class="QLabel" name="decorations_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Decorations:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>decorations</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QSlider" name="decorations" >
<property name="minimumSize" >
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="minimum" >
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1" colspan="2">
<widget class="QSlider" name="dialogs">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="inactive_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<item row="4" column="0">
<widget class="QLabel" name="dialogs_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Inactive windows:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>inactive</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QSlider" name="inactive" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="moveresize_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Moving windows:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>moveresize</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QSlider" name="moveresize" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="dialogs_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Dialogs:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>dialogs</cstring>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QSlider" name="dialogs" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="comboboxpopup_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<item row="1" column="0">
<widget class="QLabel" name="decorations_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Combobox popups:</string>
<property name="text">
<string>Decorations:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>decorations</cstring>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QSlider" name="comboboxpopup">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QSlider" name="menus">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="inactive_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Inactive windows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>inactive</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="moveresize_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Moving windows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>moveresize</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="comboboxpopup_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Combobox popups:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>comboboxpopup</cstring>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2" >
<widget class="QSlider" name="comboboxpopup" >
<property name="minimum" >
<item row="3" column="1" colspan="2">
<widget class="QSlider" name="moveresize">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="menus_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Menus:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>menus</cstring>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QSlider" name="menus" >
<property name="minimum" >
<number>10</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Fading duration:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>duration</cstring>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2" >
<widget class="KIntSpinBox" name="duration" >
<property name="minimumSize" >
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="specialValueText" >
<string comment="Duration of fading">Default</string>
</property>
<property name="maximum" >
<number>5000</number>
</property>
<property name="singleStep" >
<number>100</number>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
@ -298,176 +204,239 @@
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<item row="1" column="1" colspan="2">
<widget class="QSlider" name="decorations">
<property name="minimumSize">
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSlider" name="inactive">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Transparent</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Opaque</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="menus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Menus:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>menus</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="individualmenuconfig" >
<property name="title" >
<widget class="QGroupBox" name="individualmenuconfig">
<property name="title">
<string>Set menu translucency independently</string>
</property>
<property name="checkable" >
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="1" column="0" >
<widget class="QLabel" name="dropdownmenus_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QLabel" name="dropdownmenus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Dropdown menus:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>dropdownmenus</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QSlider" name="dropdownmenus" >
<property name="minimumSize" >
<item row="1" column="1" colspan="2">
<widget class="QSlider" name="dropdownmenus">
<property name="minimumSize">
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="minimum" >
<property name="minimum">
<number>10</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="popupmenus_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<item row="2" column="0">
<widget class="QLabel" name="popupmenus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Popup menus:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>popupmenus</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QSlider" name="popupmenus" >
<property name="minimum" >
<item row="2" column="1" colspan="2">
<widget class="QSlider" name="popupmenus">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="tornoffmenus_label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<item row="3" column="0">
<widget class="QLabel" name="tornoffmenus_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Torn-off menus:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>tornoffmenus</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QSlider" name="tornoffmenus" >
<property name="minimum" >
<item row="3" column="1" colspan="2">
<widget class="QSlider" name="tornoffmenus">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<item row="4" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
@ -475,31 +444,31 @@
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_6" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<item row="0" column="1">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Transparent</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_7" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Opaque</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
@ -516,19 +485,11 @@
<tabstop>dialogs</tabstop>
<tabstop>comboboxpopup</tabstop>
<tabstop>menus</tabstop>
<tabstop>duration</tabstop>
<tabstop>individualmenuconfig</tabstop>
<tabstop>dropdownmenus</tabstop>
<tabstop>popupmenus</tabstop>
<tabstop>tornoffmenus</tabstop>
</tabstops>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
@ -537,11 +498,11 @@
<receiver>menus</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>109</x>
<y>316</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>212</x>
<y>220</y>
</hint>

View File

@ -170,7 +170,7 @@ int WorkspaceWrapper::displayWidth() const
int WorkspaceWrapper::displayHeight() const
{
return KWin::displayWidth();
return KWin::displayHeight();
}
QRect WorkspaceWrapper::clientArea(ClientAreaOption option, const QPoint &p, int desktop) const

View File

@ -162,7 +162,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
switch(tabBox->config().clientSwitchingMode()) {
case TabBoxConfig::FocusChainSwitching: {
TabBoxClient* c = start;
if (!c) {
if (!tabBox->isInFocusChain(c)) {
QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
if (firstClient) {
c = firstClient.data();

View File

@ -112,6 +112,14 @@ QWeakPointer< TabBoxClient > TabBoxHandlerImpl::firstClientFocusChain() const
}
}
bool TabBoxHandlerImpl::isInFocusChain(TabBoxClient *client) const
{
if (TabBoxClientImpl *c = static_cast<TabBoxClientImpl*>(client)) {
return Workspace::self()->globalFocusChain().contains(c->client());
}
return false;
}
int TabBoxHandlerImpl::nextDesktopFocusChain(int desktop) const
{
return m_tabBox->nextDesktopFocusChain(desktop);

View File

@ -52,6 +52,7 @@ public:
virtual QString desktopName(int desktop) const;
virtual QWeakPointer< TabBoxClient > nextClientFocusChain(TabBoxClient* client) const;
virtual QWeakPointer< TabBoxClient > firstClientFocusChain() const;
virtual bool isInFocusChain (TabBoxClient* client) const;
virtual int nextDesktopFocusChain(int desktop) const;
virtual int numberOfDesktops() const;
virtual TabBoxClientList stackingOrder() const;

View File

@ -119,6 +119,20 @@ public:
* @since 4.9.1
**/
virtual QWeakPointer<TabBoxClient> firstClientFocusChain() const = 0;
/**
* Checks whether the given @p client is part of the focus chain at all.
* This is useful to figure out whether the currently active Client can be used
* as a starting point to construct the recently used list.
*
* In case the @p client is not in the focus chain it is recommended to use the
* Client returned by @link firstClientFocusChain.
*
* The method accepts a @c null Client and in that case @c false is returned.
* @param client The Client to check whether it is in the Focus Chain
* @return @c true in case the Client is part of the focus chain, @c false otherwise.
* @since 4.9.2
**/
virtual bool isInFocusChain(TabBoxClient* client) const = 0;
/**
* @param client The client whose desktop name should be retrieved
* @return The desktop name of the given TabBoxClient. If the client is

View File

@ -72,6 +72,9 @@ QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::nextClientFocusChain(Tab
}
}
}
if (!m_windows.isEmpty()) {
return QWeakPointer< TabBox::TabBoxClient >(m_windows.last());
}
return QWeakPointer< TabBox::TabBoxClient >();
}
@ -83,6 +86,20 @@ QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::firstClientFocusChain()
return m_windows.first();
}
bool MockTabBoxHandler::isInFocusChain(TabBox::TabBoxClient *client) const
{
if (!client) {
return false;
}
QList< QSharedPointer< TabBox::TabBoxClient > >::const_iterator it = m_windows.constBegin();
for (; it != m_windows.constEnd(); ++it) {
if ((*it).data() == client) {
return true;
}
}
return false;
}
QWeakPointer< TabBox::TabBoxClient > MockTabBoxHandler::createMockWindow(const QString &caption, WId id)
{
QSharedPointer< TabBox::TabBoxClient > client(new MockTabBoxClient(caption, id));

View File

@ -60,6 +60,7 @@ public:
}
virtual QWeakPointer< TabBox::TabBoxClient > nextClientFocusChain(TabBox::TabBoxClient *client) const;
virtual QWeakPointer<TabBox::TabBoxClient> firstClientFocusChain() const;
virtual bool isInFocusChain (TabBox::TabBoxClient* client) const;
virtual int nextDesktopFocusChain(int desktop) const {
Q_UNUSED(desktop)
return 1;

View File

@ -63,4 +63,24 @@ void TestTabBoxClientModel::testCreateClientListNoActiveClient()
QCOMPARE(clientModel->rowCount(), 2);
}
void TestTabBoxClientModel::testCreateClientListActiveClientNotInFocusChain()
{
MockTabBoxHandler tabboxhandler;
tabboxhandler.setConfig(TabBox::TabBoxConfig());
TabBox::ClientModel *clientModel = new TabBox::ClientModel(&tabboxhandler);
// create two windows, rowCount() should go to two
QWeakPointer<TabBox::TabBoxClient> client = tabboxhandler.createMockWindow(QString("test"), 1);
client = tabboxhandler.createMockWindow(QString("test2"), 2);
clientModel->createClientList();
QCOMPARE(clientModel->rowCount(), 2);
// simulate that the active client is not in the focus chain
// for that we use the closeWindow of the MockTabBoxHandler which
// removes the Client from the Focus Chain but leaves the active window as it is
QSharedPointer<TabBox::TabBoxClient> clientOwner = client.toStrongRef();
tabboxhandler.closeWindow(client.data());
clientModel->createClientList();
QCOMPARE(clientModel->rowCount(), 1);
}
QTEST_MAIN(TestTabBoxClientModel)

View File

@ -40,6 +40,13 @@ private slots:
* See BUG: 305449
**/
void testCreateClientListNoActiveClient();
/**
* Tests the creation of the Client list for the case that
* the active Client is not in the Focus chain.
*
* See BUG: 306260
**/
void testCreateClientListActiveClientNotInFocusChain();
};
#endif

View File

@ -174,19 +174,6 @@ NET::WindowType Toplevel::windowType(bool direct, int supported_types) const
info->setWindowType(wt); // force hint change
}
// hacks here
if (wt == NET::Menu && cl != NULL) {
// ugly hack to support the times when NET::Menu meant NET::TopMenu
// if it's as wide as the screen, not very high and has its upper-left
// corner a bit above the screen's upper-left cornet, it's a topmenu
if (x() == 0 && y() < 0 && y() > -10 && height() < 100
&& abs(width() - workspace()->clientArea(FullArea, cl).width()) < 10)
wt = NET::TopMenu;
}
// TODO change this to rule
const char* const oo_prefix = "openoffice.org"; // QByteArray has no startsWith()
// oo_prefix is lowercase, because resourceClass() is forced to be lowercase
if (qstrncmp(resourceClass(), oo_prefix, strlen(oo_prefix)) == 0 && wt == NET::Dialog)
wt = NET::Normal; // see bug #66065
if (wt == NET::Unknown && cl != NULL) // this is more or less suggested in NETWM spec
wt = cl->isTransient() ? NET::Dialog : NET::Normal;
return wt;