Merged "active screen edges" and "active desktop borders" into a single

GUI panel. This panel is currently located in System Settings -> Desktop
-> Screen Edges.
BUG: 174709

svn path=/trunk/KDE/kdebase/workspace/; revision=932929
icc-effect-5.14.5
Lucas Murray 2009-02-27 15:40:53 +00:00
parent 50f9db8dd9
commit ac9c37c64d
15 changed files with 1076 additions and 564 deletions

View File

@ -1,6 +1,7 @@
add_subdirectory( kwinoptions )
add_subdirectory( kwindecoration )
add_subdirectory( kwinrules )
add_subdirectory( kwinoptions )
add_subdirectory( kwindecoration )
add_subdirectory( kwinrules )
add_subdirectory( kwincompositing )
add_subdirectory( kwindesktop )
add_subdirectory( kwindesktop )
add_subdirectory( kwinscreenedges )

View File

@ -5,7 +5,6 @@ include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin )
set(kcm_kwincompositing_PART_SRCS
main.cpp
ktimerdialog.cpp
monitor.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/compositingprefs.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/lib/kwinglobals.cpp
)

View File

@ -79,7 +79,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
layout()->setMargin(0);
ui.tabWidget->setCurrentIndex(0);
ui.statusTitleWidget->hide();
setupElectricBorders();
#define OPENGL_INDEX 0
#define XRENDER_INDEX 1
@ -111,9 +110,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
connect(ui.desktopSwitchingCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.animationSpeedCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.edges_monitor, SIGNAL(changed()), this, SLOT(changed()));
connect(ui.edges_monitor, SIGNAL(edgeSelectionChanged(int,int)), this, SLOT(electricBorderSelectionChanged(int,int)));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(compositingModeChanged()));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed()));
@ -215,7 +211,6 @@ void KWinCompositingConfig::compositingEnabled( bool enabled )
ui.compositingOptionsContainer->setEnabled(enabled);
ui.tabWidget->setTabEnabled(1, enabled);
ui.tabWidget->setTabEnabled(2, enabled);
ui.tabWidget->setTabEnabled(3, enabled);
}
void KWinCompositingConfig::showConfirmDialog( bool reinitCompositing )
@ -288,7 +283,7 @@ void KWinCompositingConfig::currentTabChanged(int tab)
saveEffectsTab();
loadGeneralTab();
}
else if ( tab == 2 )
else if ( tab == 1 )
{
// Effects tab was activated
saveGeneralTab();
@ -397,7 +392,6 @@ void KWinCompositingConfig::load()
tmpconfig.writeEntry(it.key(), it.value());
loadGeneralTab();
loadElectricBorders();
loadEffectsTab();
loadAdvancedTab();
@ -563,7 +557,6 @@ void KWinCompositingConfig::save()
loadGeneralTab();
saveGeneralTab();
}
saveElectricBorders();
bool advancedChanged = saveAdvancedTab();
// Copy Plugins group from temp config to real config
@ -649,14 +642,6 @@ void KWinCompositingConfig::defaults()
ui.glDirect->setChecked( mDefaultPrefs.enableDirectRendering() );
ui.glVSync->setChecked( mDefaultPrefs.enableVSync() );
ui.xrenderSmoothScale->setChecked( false );
for( int i=0; i<8; i++ )
{
// set all edges to no effect
ui.edges_monitor->selectEdgeItem( i, 0 );
}
// set top left to present windows
ui.edges_monitor->selectEdgeItem( (int)Monitor::TopLeft, (int)PresentWindowsAll );
}
QString KWinCompositingConfig::quickHelp() const
@ -664,143 +649,6 @@ QString KWinCompositingConfig::quickHelp() const
return i18n("<h1>Desktop Effects</h1>");
}
void KWinCompositingConfig::setupElectricBorders()
{
addItemToEdgesMonitor( i18n("No Effect"));
// search the effect names
KServiceTypeTrader* trader = KServiceTypeTrader::self();
KService::List services;
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_presentwindows'");
if( !services.isEmpty() )
{
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "All Desktops" ));
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Current Desktop" ));
}
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_desktopgrid'");
if( !services.isEmpty() )
addItemToEdgesMonitor( services.first()->name());
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'");
if( !services.isEmpty() )
{
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cube") );
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cylinder") );
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Sphere") );
}
}
void KWinCompositingConfig::addItemToEdgesMonitor(const QString& item)
{
for( int i=0; i<8; i++ )
ui.edges_monitor->addEdgeItem( i, item );
}
void KWinCompositingConfig::electricBorderSelectionChanged(int edge, int index)
{
if( index == (int)NoEffect )
return;
for( int i=0; i<8; i++)
{
if( i == edge )
continue;
if( ui.edges_monitor->selectedEdgeItem( i ) == index )
ui.edges_monitor->selectEdgeItem( i, (int)NoEffect );
}
}
void KWinCompositingConfig::loadElectricBorders()
{
// Present Windows
KConfigGroup presentwindowsconfig(mKWinConfig, "Effect-PresentWindows");
changeElectricBorder( (ElectricBorder)presentwindowsconfig.readEntry( "BorderActivateAll",
int( ElectricTopLeft )), (int)PresentWindowsAll );
changeElectricBorder( (ElectricBorder)presentwindowsconfig.readEntry( "BorderActivate",
int( ElectricNone )), (int)PresentWindowsCurrent );
// Desktop Grid
KConfigGroup gridconfig(mKWinConfig, "Effect-DesktopGrid");
changeElectricBorder( (ElectricBorder)gridconfig.readEntry( "BorderActivate",
int( ElectricNone )), (int)DesktopGrid );
// Desktop Cube
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivate",
int( ElectricNone )), (int)Cube );
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateCylinder",
int( ElectricNone )), (int)Cylinder );
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateSphere",
int( ElectricNone )), (int)Sphere );
}
void KWinCompositingConfig::changeElectricBorder( ElectricBorder border, int index )
{
switch (border)
{
case ElectricTop:
ui.edges_monitor->selectEdgeItem( (int)Monitor::Top, index );
break;
case ElectricTopRight:
ui.edges_monitor->selectEdgeItem( (int)Monitor::TopRight, index );
break;
case ElectricRight:
ui.edges_monitor->selectEdgeItem( (int)Monitor::Right, index );
break;
case ElectricBottomRight:
ui.edges_monitor->selectEdgeItem( (int)Monitor::BottomRight, index );
break;
case ElectricBottom:
ui.edges_monitor->selectEdgeItem( (int)Monitor::Bottom, index );
break;
case ElectricBottomLeft:
ui.edges_monitor->selectEdgeItem( (int)Monitor::BottomLeft, index );
break;
case ElectricLeft:
ui.edges_monitor->selectEdgeItem( (int)Monitor::Left, index );
break;
case ElectricTopLeft:
ui.edges_monitor->selectEdgeItem( (int)Monitor::TopLeft, index );
break;
default:
// nothing
break;
}
}
ElectricBorder KWinCompositingConfig::checkEffectHasElectricBorder( int index )
{
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::Top ) == index )
return ElectricTop;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::TopRight ) == index )
return ElectricTopRight;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::Right ) == index )
return ElectricRight;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::BottomRight ) == index )
return ElectricBottomRight;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::Bottom ) == index )
return ElectricBottom;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::BottomLeft ) == index )
return ElectricBottomLeft;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::Left ) == index )
return ElectricLeft;
if( ui.edges_monitor->selectedEdgeItem( (int)Monitor::TopLeft ) == index )
return ElectricTopLeft;
return ElectricNone;
}
void KWinCompositingConfig::saveElectricBorders()
{
KConfigGroup presentwindowsconfig(mKWinConfig, "Effect-PresentWindows");
presentwindowsconfig.writeEntry( "BorderActivateAll", (int)checkEffectHasElectricBorder( (int)PresentWindowsAll ));
presentwindowsconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)PresentWindowsCurrent ));
KConfigGroup gridconfig(mKWinConfig, "Effect-DesktopGrid");
gridconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)DesktopGrid ));
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
cubeconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Cube ));
cubeconfig.writeEntry( "BorderActivateCylinder", (int)checkEffectHasElectricBorder( (int)Cylinder ));
cubeconfig.writeEntry( "BorderActivateSphere", (int)checkEffectHasElectricBorder( (int)Sphere ));
}
} // namespace
#include "main.moc"

View File

@ -65,22 +65,15 @@ class KWinCompositingConfig : public KCModule
void loadGeneralTab();
void loadEffectsTab();
void loadAdvancedTab();
void loadElectricBorders();
void saveGeneralTab();
void saveEffectsTab();
bool saveAdvancedTab();
void electricBorderSelectionChanged(int edge, int index);
void configChanged(bool reinitCompositing);
void initEffectSelector();
private:
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;
void setupElectricBorders();
void addItemToEdgesMonitor(const QString& item);
void changeElectricBorder( ElectricBorder border, int index );
ElectricBorder checkEffectHasElectricBorder( int index );
void saveElectricBorders();
KSharedConfigPtr mKWinConfig;
Ui::KWinCompositingConfig ui;
@ -90,17 +83,6 @@ class KWinCompositingConfig : public KCModule
KTemporaryFile mTmpConfigFile;
KSharedConfigPtr mTmpConfig;
bool m_showConfirmDialog;
enum ElectricBorderEffects
{
NoEffect,
PresentWindowsAll,
PresentWindowsCurrent,
DesktopGrid,
Cube,
Cylinder,
Sphere
};
};
} // namespace

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWinCompositingConfig</class>
<widget class="QWidget" name="KWinCompositingConfig" >
<property name="geometry" >
<widget class="QWidget" name="KWinCompositingConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,78 +10,78 @@
<height>554</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<widget class="QWidget" name="tab">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KTitleWidget" name="statusTitleWidget" />
<widget class="KTitleWidget" name="statusTitleWidget"/>
</item>
<item>
<widget class="QCheckBox" name="useCompositing" >
<property name="text" >
<string comment="@option:check" >Enable desktop effects</string>
<widget class="QCheckBox" name="useCompositing">
<property name="text">
<string comment="@option:check">Enable desktop effects</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="compositingOptionsContainer" >
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QWidget" name="compositingOptionsContainer" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Common Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="effectWinManagement" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="effectWinManagement">
<property name="text">
<string>Improved window management</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="effectShadows" >
<property name="text" >
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="effectShadows">
<property name="text">
<string>Shadows</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="effectAnimations" >
<property name="text" >
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="effectAnimations">
<property name="text">
<string>Various animations</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -88,71 +89,71 @@
</property>
</spacer>
</item>
<item row="8" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>You can find more effects, as well as effect-specific settings, in the "All Effects" tab above.</string>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>You can find more effects, as well as effect-specific settings, in the &quot;All Effects&quot; tab above.</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Effect for window switching:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>windowSwitchingCombo</cstring>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QComboBox" name="windowSwitchingCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<item row="4" column="1">
<widget class="QComboBox" name="windowSwitchingCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Effect for desktop switching:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>desktopSwitchingCombo</cstring>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QComboBox" name="desktopSwitchingCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<item row="5" column="1">
<widget class="QComboBox" name="desktopSwitchingCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<item row="3" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
@ -160,63 +161,63 @@
</property>
</spacer>
</item>
<item row="6" column="1" >
<widget class="QComboBox" name="animationSpeedCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<item row="6" column="1">
<widget class="QComboBox" name="animationSpeedCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex" >
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text" >
<property name="text">
<string>Instant</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Very Fast</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Fast</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Normal</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Slow</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Very Slow</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Extremely Slow</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Animation speed:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>animationSpeedCombo</cstring>
</property>
</widget>
@ -225,17 +226,14 @@
</widget>
</item>
</layout>
<zorder>groupBox</zorder>
<zorder></zorder>
<zorder>advancedOptions</zorder>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<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>
@ -245,120 +243,25 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<attribute name="title" >
<string>Screen Edges</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="7" column="0" >
<spacer name="verticalSpacer_3" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" >
<widget class="KWin::Monitor" native="1" name="edges_monitor" >
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Active screen edges allow you to activate effects by pushing your mouse cursor against the edge of the screen. Here you can configure which effect will get activated on each edge and corner of the screen.</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<spacer name="verticalSpacer_4" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" >
<spacer name="verticalSpacer_5" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>If you are looking for the setting to enable switching of desktops by pushing your mouse cursor against the edge of the screen you can find it in the "Window Behavior" advanced tab under the name of "Active Desktop Borders".</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" >
<spacer name="verticalSpacer_7" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>All Effects</string>
</attribute>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<widget class="QLabel" name="label_2">
<property name="text">
<string>Hint: To find out or configure how to activate an effect, look at the effect's settings.</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="KPluginSelector" native="1" name="effectSelector" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<widget class="KPluginSelector" name="effectSelector" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -367,215 +270,215 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
<attribute name="title" >
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Advanced</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" >
<widget class="QLabel" name="label_7" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Compositing type:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>compositingType</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="compositingType" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="0" column="1">
<widget class="QComboBox" name="compositingType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text" >
<property name="text">
<string>OpenGL</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>XRender</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_8" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Keep window thumbnails:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>windowThumbnails</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="windowThumbnails" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="1" column="1">
<widget class="QComboBox" name="windowThumbnails">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text" >
<property name="text">
<string>Always</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Only for Shown Windows</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Never</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="disableChecks" >
<property name="whatsThis" >
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="disableChecks">
<property name="whatsThis">
<string>Enabling this option allows compositing to be activated even if some of the internal checks fail. Doing so may make the whole desktop unusable and its use is not recommened. Use only if KWin refuses to activate compositing on a system that should be capable of compositing.
</string>
</property>
<property name="text" >
<property name="text">
<string>Disable functionality checks</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QGroupBox" name="glGroup" >
<property name="title" >
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="glGroup">
<property name="title">
<string>OpenGL Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_5" >
<item row="0" column="0" >
<widget class="QLabel" name="label_9" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>OpenGL mode:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>glMode</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="glMode" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="0" column="1">
<widget class="QComboBox" name="glMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text" >
<property name="text">
<string>Texture From Pixmap</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Shared Memory</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Fallback</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_10" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Texture filter:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>glTextureFilter</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="glTextureFilter" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<item row="1" column="1">
<widget class="QComboBox" name="glTextureFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text" >
<property name="text">
<string>Nearest (fastest)</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Bilinear</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Trilinear (best quality)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="glDirect" >
<property name="text" >
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="glDirect">
<property name="text">
<string>Enable direct rendering</string>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="glVSync" >
<property name="text" >
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="glVSync">
<property name="text">
<string>Use VSync</string>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
</widget>
@ -583,15 +486,15 @@
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<widget class="QGroupBox" name="xrenderGroup" >
<property name="title" >
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="xrenderGroup">
<property name="title">
<string>XRender Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_6" >
<item row="0" column="0" >
<widget class="QCheckBox" name="xrenderSmoothScale" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QCheckBox" name="xrenderSmoothScale">
<property name="text">
<string>Smooth scaling (slower)</string>
</property>
</widget>
@ -599,12 +502,12 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<spacer name="verticalSpacer_6" >
<property name="orientation" >
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer_6">
<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>
@ -630,12 +533,6 @@
<header>kpluginselector.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KWin::Monitor</class>
<extends>QWidget</extends>
<header>monitor.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
@ -646,7 +543,6 @@
<tabstop>windowSwitchingCombo</tabstop>
<tabstop>desktopSwitchingCombo</tabstop>
<tabstop>animationSpeedCombo</tabstop>
<tabstop>edges_monitor</tabstop>
</tabstops>
<resources/>
<connections>
@ -656,11 +552,11 @@
<receiver>groupBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>86</x>
<y>66</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>102</x>
<y>156</y>
</hint>

View File

@ -68,10 +68,6 @@
#define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus"
#define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen"
// kwm config keywords
#define KWM_ELECTRIC_BORDER "ElectricBorders"
#define KWM_ELECTRIC_BORDER_DELAY "ElectricBorderDelay"
//CT 15mar 98 - magics
#define KWM_BRDR_SNAP_ZONE "BorderSnapZone"
#define KWM_BRDR_SNAP_ZONE_DEFAULT 10
@ -605,7 +601,7 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KCom
{
QString wtstr;
QLabel *label;
QGridLayout *lay = new QGridLayout (this);
QVBoxLayout *lay = new QVBoxLayout (this);
//iTLabel = new QLabel(i18n(" Allowed overlap:\n"
// "(% of desktop space)"),
@ -647,51 +643,14 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KCom
kLay->addWidget(shadeHoverLabel, 1, 0);
kLay->addWidget(shadeHover, 1, 1);
kLay->setRowStretch(2, 1);
lay->addWidget(shBox, 0, 0);
lay->addWidget(shBox);
// Any changes goes to slotChanged()
connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed()));
connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed()));
electricBox = new KButtonGroup(this);
electricBox->setTitle(i18n("Active Desktop Borders"));
QGridLayout *bLay = new QGridLayout(electricBox);
electricBox->setWhatsThis( i18n("If this option is enabled, moving the mouse to a screen border"
" will change your desktop. This is e.g. useful if you want to drag windows from one desktop"
" to the other.") );
active_disable = new QRadioButton(i18n("D&isabled"), electricBox);
bLay->addWidget(active_disable, 0, 0, 1, 2);
active_move = new QRadioButton(i18n("Only &when moving windows"), electricBox);
bLay->addWidget(active_move, 1, 0, 1, 2);
active_always = new QRadioButton(i18n("A&lways enabled"), electricBox);
bLay->addWidget(active_always, 2, 0, 1, 2);
delays = new KIntNumInput(10, electricBox);
delays->setRange(0, MAX_EDGE_RES, 50);
delays->setSuffix(i18n(" ms"));
delays->setWhatsThis( i18n("Here you can set a delay for switching desktops using the active"
" borders feature. Desktops will be switched after the mouse has been pushed against a screen border"
" for the specified number of milliseconds.") );
delays->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
delaysLabel = new QLabel(i18n("Desktop &switch delay:"), this);
delaysLabel->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
delaysLabel->setBuddy(delays);
bLay->addWidget(delaysLabel, 3, 0);
bLay->addWidget(delays, 3, 1);
connect( electricBox, SIGNAL(clicked(int)), this, SLOT(setEBorders()));
// Any changes goes to slotChanged()
connect(electricBox, SIGNAL(clicked(int)), SLOT(changed()));
connect(delays, SIGNAL(valueChanged(int)), SLOT(changed()));
lay->addWidget(electricBox, 0, 1);
QGridLayout *vLay = new QGridLayout();
lay->addLayout( vLay, 1, 0, 1, 2 );
lay->addLayout( vLay );
placementCombo = new QComboBox(this);
placementCombo->setEditable( false );
@ -740,7 +699,7 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KCom
vLay->addWidget( hideUtilityWindowsForInactive, 1, 0, 1, 2 );
lay->setRowStretch(2, 1);
lay->addStretch();
load();
}
@ -773,9 +732,6 @@ void KAdvancedConfig::load( void )
setShadeHover(cg.readEntry(KWIN_SHADEHOVER, false));
setShadeHoverInterval(cg.readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
setElectricBorders(cg.readEntry(KWM_ELECTRIC_BORDER, 0));
setElectricBorderDelay(cg.readEntry(KWM_ELECTRIC_BORDER_DELAY, 150));
QString key;
// placement policy --- CT 19jan98 ---
key = cg.readEntry(KWIN_PLACEMENT);
@ -828,9 +784,6 @@ void KAdvancedConfig::save( void )
if (v<0) v = 0;
cg.writeEntry(KWIN_SHADEHOVER_INTERVAL, v);
cg.writeEntry(KWM_ELECTRIC_BORDER, getElectricBorders());
cg.writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay());
// placement policy --- CT 31jan98 ---
v =getPlacement();
if (v == RANDOM_PLACEMENT)
@ -871,8 +824,6 @@ void KAdvancedConfig::defaults()
{
setShadeHover(false);
setShadeHoverInterval(250);
setElectricBorders(0);
setElectricBorderDelay(150);
setPlacement(SMART_PLACEMENT);
setHideUtilityWindowsForInactive( true );
emit KCModule::changed(true);
@ -890,41 +841,6 @@ void KAdvancedConfig::setPlacement(int plac)
}
void KAdvancedConfig::setEBorders()
{
delaysLabel->setEnabled(!active_disable->isChecked());
delays->setEnabled(!active_disable->isChecked());
}
int KAdvancedConfig::getElectricBorders()
{
if (active_move->isChecked())
return 1;
if (active_always->isChecked())
return 2;
return 0;
}
int KAdvancedConfig::getElectricBorderDelay()
{
return delays->value();
}
void KAdvancedConfig::setElectricBorders(int i){
switch(i)
{
case 1: active_move->setChecked(true); break;
case 2: active_always->setChecked(true); break;
default: active_disable->setChecked(true); break;
}
setEBorders();
}
void KAdvancedConfig::setElectricBorderDelay(int delay)
{
delays->setValue(delay);
}
void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) {
hideUtilityWindowsForInactive->setChecked( s );
}

View File

@ -198,9 +198,6 @@ public:
private slots:
void shadeHoverChanged(bool);
//copied from kcontrol/konq/kwindesktop, aleXXX
void setEBorders();
void changed() { emit KCModule::changed(true); }
private:
@ -217,18 +214,6 @@ private:
KConfig *config;
bool standAlone;
int getElectricBorders( void );
int getElectricBorderDelay();
void setElectricBorders( int );
void setElectricBorderDelay( int );
KButtonGroup *electricBox;
QRadioButton *active_disable;
QRadioButton *active_move;
QRadioButton *active_always;
QLabel *delaysLabel;
KIntNumInput *delays;
void setHideUtilityWindowsForInactive( bool );
QCheckBox* hideUtilityWindowsForInactive;

View File

@ -0,0 +1,40 @@
include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin )
set(
kcm_kwinscreenedges_PART_SRCS
main.cpp
monitor.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/compositingprefs.cpp
${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/lib/kwinglobals.cpp
)
kde4_add_ui_files( kcm_kwinscreenedges_PART_SRCS main.ui )
kde4_add_plugin( kcm_kwinscreenedges ${kcm_kwinscreenedges_PART_SRCS} )
target_link_libraries( kcm_kwinscreenedges ${KDE4_KDE3SUPPORT_LIBS} ${X11_LIBRARIES} )
install( TARGETS kcm_kwinscreenedges DESTINATION ${PLUGIN_INSTALL_DIR} )
# CompositingPrefs uses OpenGL
if( OPENGL_FOUND )
target_link_libraries( kcm_kwinscreenedges ${OPENGL_gl_LIBRARY} )
# -ldl used by OpenGL code
find_library( DL_LIBRARY dl )
if( DL_LIBRARY )
target_link_libraries( kcm_kwinscreenedges ${DL_LIBRARY} )
endif( DL_LIBRARY )
endif( OPENGL_FOUND )
if( X11_Xrender_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xrender_LIB} )
endif( X11_Xrender_FOUND )
if( X11_Xrandr_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xrandr_LIB} )
endif( X11_Xrandr_FOUND )
if( X11_Xcomposite_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xcomposite_LIB} )
endif( X11_Xcomposite_FOUND )
if( X11_Xdamage_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xdamage_LIB} )
endif( X11_Xdamage_FOUND )
if( X11_Xfixes_FOUND )
target_link_libraries( kcm_kwinscreenedges ${X11_Xfixes_LIB} )
endif( X11_Xfixes_FOUND )
install( FILES kwinscreenedges.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View File

@ -0,0 +1,4 @@
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp || exit 11
$XGETTEXT *.cpp -o $podir/kcmkwinscreenedges.pot
rm -f rc.cpp

View File

@ -0,0 +1,18 @@
[Desktop Entry]
Exec=kcmshell4 kwinscreenedges
Icon=preferences-screen-edges
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/kwinscreenedges/index.html
X-KDE-Library=kcm_kwinscreenedges
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=desktop
X-KDE-Weight=65
Name=Screen Edges
Comment=Configure active screen edges
X-KDE-Keywords=kwin,window,manager,effect,edge,border,action,switch,desktop

View File

@ -0,0 +1,418 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <kde@martin-graesslin.com>
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
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 "kdebug.h"
#include "main.h"
#include <kservicetypetrader.h>
#include <KPluginFactory>
#include <KPluginLoader>
#include <QtDBus/QtDBus>
K_PLUGIN_FACTORY( KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>(); )
K_EXPORT_PLUGIN( KWinScreenEdgesConfigFactory( "kcmkwinscreenedges" ))
namespace KWin
{
KWinScreenEdgesConfigForm::KWinScreenEdgesConfigForm( QWidget* parent )
: QWidget( parent )
{
setupUi( this );
}
KWinScreenEdgesConfig::KWinScreenEdgesConfig( QWidget* parent, const QVariantList& args )
: KCModule( KWinScreenEdgesConfigFactory::componentData(), parent, args )
, m_config( KSharedConfig::openConfig( "kwinrc" ))
{
m_ui = new KWinScreenEdgesConfigForm( this );
QVBoxLayout* layout = new QVBoxLayout( this );
layout->addWidget( m_ui );
monitorInit();
connect( m_ui->monitor, SIGNAL( changed() ), this, SLOT( changed() ));
connect( m_ui->monitor, SIGNAL( edgeSelectionChanged(int,int) ),
this, SLOT( monitorEdgeChanged(int,int) ));
connect( m_ui->desktopSwitchCombo, SIGNAL( currentIndexChanged(int) ), this, SLOT( changed() ));
connect( m_ui->quickTileBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
connect( m_ui->quickMaximizeBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
connect( m_ui->activationDelaySpin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
connect( m_ui->triggerCooldownSpin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
// Visual feedback of action group conflicts
connect( m_ui->desktopSwitchCombo, SIGNAL( currentIndexChanged(int) ), this, SLOT( groupChanged() ));
connect( m_ui->quickTileBox, SIGNAL( stateChanged(int) ), this, SLOT( groupChanged() ));
connect( m_ui->quickMaximizeBox, SIGNAL( stateChanged(int) ), this, SLOT( groupChanged() ));
if( CompositingPrefs::compositingPossible() )
m_defaultPrefs.detect(); // Driver-specific config detection
load();
}
KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
{
}
void KWinScreenEdgesConfig::groupChanged()
{
// Monitor conflicts
bool hide = false;
if( m_ui->desktopSwitchCombo->currentIndex() == 2 )
hide = true;
monitorHideEdge( ElectricTop, hide || m_ui->quickMaximizeBox->isChecked() );
monitorHideEdge( ElectricRight, hide || m_ui->quickTileBox->isChecked() );
monitorHideEdge( ElectricBottom, hide );
monitorHideEdge( ElectricLeft, hide || m_ui->quickTileBox->isChecked() );
// Desktop switch conflicts
if( m_ui->quickTileBox->isChecked() || m_ui->quickMaximizeBox->isChecked() )
{
m_ui->desktopSwitchLabel->setEnabled( false );
m_ui->desktopSwitchCombo->setEnabled( false );
m_ui->desktopSwitchCombo->setCurrentIndex( 0 );
}
else
{
m_ui->desktopSwitchLabel->setEnabled( true );
m_ui->desktopSwitchCombo->setEnabled( true );
}
}
void KWinScreenEdgesConfig::load()
{
KCModule::load();
monitorLoad();
KConfigGroup config( m_config, "Windows" );
m_ui->desktopSwitchCombo->setCurrentIndex( config.readEntry( "ElectricBorders", 0 ));
m_ui->quickTileBox->setChecked( config.readEntry( "QuickTile", false ));
m_ui->quickMaximizeBox->setChecked( config.readEntry( "QuickMaximize", false ));
m_ui->activationDelaySpin->setValue( config.readEntry( "ElectricBorderDelay", 150 ));
m_ui->triggerCooldownSpin->setValue( config.readEntry( "ElectricBorderCooldown", 350 ));
emit changed( false );
}
void KWinScreenEdgesConfig::save()
{
KCModule::save();
monitorSave();
KConfigGroup config( m_config, "Windows" );
config.writeEntry( "ElectricBorders", m_ui->desktopSwitchCombo->currentIndex() );
config.writeEntry( "QuickTile", m_ui->quickTileBox->isChecked() );
config.writeEntry( "QuickMaximize", m_ui->quickMaximizeBox->isChecked() );
config.writeEntry( "ElectricBorderDelay", m_ui->activationDelaySpin->value() );
config.writeEntry( "ElectricBorderCooldown", m_ui->triggerCooldownSpin->value() );
config.sync();
// Reload KWin.
QDBusMessage message = QDBusMessage::createSignal( "/KWin", "org.kde.KWin", "reloadConfig" );
QDBusConnection::sessionBus().send( message );
emit changed( false );
}
void KWinScreenEdgesConfig::defaults()
{
monitorDefaults();
m_ui->desktopSwitchCombo->setCurrentIndex( 0 );
m_ui->quickTileBox->setChecked( false );
m_ui->quickMaximizeBox->setChecked( false );
m_ui->activationDelaySpin->setValue( 150 );
m_ui->triggerCooldownSpin->setValue( 350 );
emit changed( true );
}
void KWinScreenEdgesConfig::showEvent( QShowEvent* e )
{
KCModule::showEvent( e );
monitorShowEvent();
}
// Copied from kcmkwin/kwincompositing/main.cpp
bool KWinScreenEdgesConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
{
KService::List services = KServiceTypeTrader::self()->query(
"KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_" + effect + "'");
if( services.isEmpty())
return false;
QVariant v = services.first()->property("X-KDE-PluginInfo-EnabledByDefault");
return cfg.readEntry("kwin4_effect_" + effect + "Enabled", v.toBool());
}
//-----------------------------------------------------------------------------
// Monitor
void KWinScreenEdgesConfig::monitorAddItem( const QString& item )
{
for( int i = 0; i < 8; i++ )
m_ui->monitor->addEdgeItem( i, item );
}
void KWinScreenEdgesConfig::monitorItemSetEnabled( int index, bool enabled )
{
for( int i = 0; i < 8; i++ )
m_ui->monitor->setEdgeItemEnabled( i, index, enabled );
}
void KWinScreenEdgesConfig::monitorInit()
{
monitorAddItem( i18n( "No Action" ));
// Search the effect names
KServiceTypeTrader* trader = KServiceTypeTrader::self();
KService::List services;
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_presentwindows'" );
if( !services.isEmpty() ) // WARNING: If this is false then all later items will have the wrong IDs
{
monitorAddItem( services.first()->name() + " - " + i18n( "All Desktops" ));
monitorAddItem( services.first()->name() + " - " + i18n( "Current Desktop" ));
}
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_desktopgrid'" );
if( !services.isEmpty() ) // WARNING: If this is false then all later items will have the wrong IDs
monitorAddItem( services.first()->name());
services = trader->query( "KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'" );
if( !services.isEmpty() ) // WARNING: If this is false then all later items will have the wrong IDs
{
monitorAddItem( services.first()->name() + " - " + i18n( "Cube" ));
monitorAddItem( services.first()->name() + " - " + i18n( "Cylinder" ));
monitorAddItem( services.first()->name() + " - " + i18n( "Sphere" ));
}
monitorShowEvent();
}
void KWinScreenEdgesConfig::monitorLoad()
{
// Present Windows
KConfigGroup presentWindowsConfig( m_config, "Effect-PresentWindows" );
monitorChangeEdge(
ElectricBorder( presentWindowsConfig.readEntry( "BorderActivateAll", int( ElectricTopLeft ))),
int( PresentWindowsAll ));
monitorChangeEdge(
ElectricBorder( presentWindowsConfig.readEntry( "BorderActivate", int( ElectricNone ))),
int( PresentWindowsCurrent ));
// Desktop Grid
KConfigGroup gridConfig( m_config, "Effect-DesktopGrid" );
monitorChangeEdge(
ElectricBorder( gridConfig.readEntry( "BorderActivate", int( ElectricNone ))),
int( DesktopGrid ));
// Desktop Cube
KConfigGroup cubeConfig( m_config, "Effect-Cube" );
monitorChangeEdge(
ElectricBorder( cubeConfig.readEntry( "BorderActivate", int( ElectricNone ))),
int( Cube ));
monitorChangeEdge(
ElectricBorder( cubeConfig.readEntry( "BorderActivateCylinder", int( ElectricNone ))),
int( Cylinder ));
monitorChangeEdge(
ElectricBorder( cubeConfig.readEntry( "BorderActivateSphere", int( ElectricNone ))),
int( Sphere ));
}
void KWinScreenEdgesConfig::monitorSave()
{
// Present Windows
KConfigGroup presentWindowsConfig( m_config, "Effect-PresentWindows" );
presentWindowsConfig.writeEntry( "BorderActivateAll",
int( monitorCheckEffectHasEdge( int( PresentWindowsAll ))));
presentWindowsConfig.writeEntry( "BorderActivate",
int( monitorCheckEffectHasEdge( int( PresentWindowsCurrent ))));
// Desktop Grid
KConfigGroup gridConfig( m_config, "Effect-DesktopGrid" );
gridConfig.writeEntry( "BorderActivate",
int( monitorCheckEffectHasEdge( int( DesktopGrid ))));
// Desktop Cube
KConfigGroup cubeConfig( m_config, "Effect-Cube" );
cubeConfig.writeEntry( "BorderActivate",
int( monitorCheckEffectHasEdge( int( Cube ))));
cubeConfig.writeEntry( "BorderActivateCylinder",
int( monitorCheckEffectHasEdge( int( Cylinder ))));
cubeConfig.writeEntry( "BorderActivateSphere",
int( monitorCheckEffectHasEdge( int( Sphere ))));
}
void KWinScreenEdgesConfig::monitorDefaults()
{
// Clear all edges
for( int i = 0; i < 8; i++ )
m_ui->monitor->selectEdgeItem( i, 0 );
// Present windows = Top-left
m_ui->monitor->selectEdgeItem( int( Monitor::TopLeft ), int( PresentWindowsAll ));
}
void KWinScreenEdgesConfig::monitorEdgeChanged( int edge, int index )
{
if( index == int( NoEffect ))
return;
for( int i = 0; i < 8; i++ )
{
if( i == edge )
continue;
if( m_ui->monitor->selectedEdgeItem( i ) == index )
m_ui->monitor->selectEdgeItem( i, int( NoEffect ));
}
}
void KWinScreenEdgesConfig::monitorShowEvent()
{
// Check if they are enabled
KConfigGroup config( m_config, "Compositing" );
if( config.readEntry( "Enabled", m_defaultPrefs.enableCompositing() ))
{ // Compositing enabled
config = KConfigGroup( m_config, "Plugins" );
// Present Windows
bool enabled = effectEnabled( "presentwindows", config );
monitorItemSetEnabled( 1, enabled );
monitorItemSetEnabled( 2, enabled );
// Desktop Grid
enabled = effectEnabled( "desktopgrid", config );
monitorItemSetEnabled( 3, enabled );
// Desktop Cube
enabled = effectEnabled( "cube", config );
monitorItemSetEnabled( 4, enabled );
monitorItemSetEnabled( 5, enabled );
monitorItemSetEnabled( 6, enabled );
}
else // Compositing disabled
{
monitorItemSetEnabled( 1, false );
monitorItemSetEnabled( 2, false );
monitorItemSetEnabled( 3, false );
monitorItemSetEnabled( 4, false );
monitorItemSetEnabled( 5, false );
monitorItemSetEnabled( 6, false );
}
}
void KWinScreenEdgesConfig::monitorChangeEdge( ElectricBorder border, int index )
{
switch( border )
{
case ElectricTop:
m_ui->monitor->selectEdgeItem( int( Monitor::Top ), index );
break;
case ElectricTopRight:
m_ui->monitor->selectEdgeItem( int( Monitor::TopRight ), index );
break;
case ElectricRight:
m_ui->monitor->selectEdgeItem( int( Monitor::Right ), index );
break;
case ElectricBottomRight:
m_ui->monitor->selectEdgeItem( int( Monitor::BottomRight ), index );
break;
case ElectricBottom:
m_ui->monitor->selectEdgeItem( int( Monitor::Bottom ), index );
break;
case ElectricBottomLeft:
m_ui->monitor->selectEdgeItem( int( Monitor::BottomLeft ), index );
break;
case ElectricLeft:
m_ui->monitor->selectEdgeItem( int( Monitor::Left ), index );
break;
case ElectricTopLeft:
m_ui->monitor->selectEdgeItem( int( Monitor::TopLeft ), index );
break;
default: // Nothing
break;
}
}
void KWinScreenEdgesConfig::monitorHideEdge( ElectricBorder border, bool hidden )
{
switch( border )
{
case ElectricTop:
m_ui->monitor->setEdgeHidden( int( Monitor::Top ), hidden );
break;
case ElectricTopRight:
m_ui->monitor->setEdgeHidden( int( Monitor::TopRight ), hidden );
break;
case ElectricRight:
m_ui->monitor->setEdgeHidden( int( Monitor::Right ), hidden );
break;
case ElectricBottomRight:
m_ui->monitor->setEdgeHidden( int( Monitor::BottomRight ), hidden );
break;
case ElectricBottom:
m_ui->monitor->setEdgeHidden( int( Monitor::Bottom ), hidden );
break;
case ElectricBottomLeft:
m_ui->monitor->setEdgeHidden( int( Monitor::BottomLeft ), hidden );
break;
case ElectricLeft:
m_ui->monitor->setEdgeHidden( int( Monitor::Left ), hidden );
break;
case ElectricTopLeft:
m_ui->monitor->setEdgeHidden( int( Monitor::TopLeft ), hidden );
break;
default: // Nothing
break;
}
}
ElectricBorder KWinScreenEdgesConfig::monitorCheckEffectHasEdge( int index )
{
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Top )) == index )
return ElectricTop;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::TopRight )) == index )
return ElectricTopRight;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Right )) == index )
return ElectricRight;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::BottomRight )) == index )
return ElectricBottomRight;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Bottom )) == index )
return ElectricBottom;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::BottomLeft )) == index )
return ElectricBottomLeft;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::Left )) == index )
return ElectricLeft;
if( m_ui->monitor->selectedEdgeItem( int( Monitor::TopLeft )) == index )
return ElectricTopLeft;
return ElectricNone;
}
} // namespace
#include "main.moc"

View File

@ -0,0 +1,95 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
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 __MAIN_H__
#define __MAIN_H__
#include <kcmodule.h>
#include <ksharedconfig.h>
#include "kwinglobals.h"
#include "compositingprefs.h"
#include "ui_main.h"
class QShowEvent;
namespace KWin
{
class KWinScreenEdgesConfigForm : public QWidget, public Ui::KWinScreenEdgesConfigForm
{
Q_OBJECT
public:
explicit KWinScreenEdgesConfigForm( QWidget* parent );
};
class KWinScreenEdgesConfig : public KCModule
{
Q_OBJECT
public:
explicit KWinScreenEdgesConfig( QWidget* parent, const QVariantList& args );
~KWinScreenEdgesConfig();
public slots:
virtual void groupChanged();
virtual void save();
virtual void load();
virtual void defaults();
protected:
virtual void showEvent( QShowEvent* e );
private:
KWinScreenEdgesConfigForm* m_ui;
KSharedConfigPtr m_config;
CompositingPrefs m_defaultPrefs;
enum EffectActions
{
NoEffect,
PresentWindowsAll,
PresentWindowsCurrent,
DesktopGrid,
Cube,
Cylinder,
Sphere
};
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;
void monitorAddItem( const QString& item );
void monitorItemSetEnabled( int index, bool enabled );
void monitorInit();
void monitorLoad();
void monitorSave();
void monitorDefaults();
void monitorShowEvent();
void monitorEdgeChanged( int edge, int index );
void monitorChangeEdge( ElectricBorder border, int index );
void monitorHideEdge( ElectricBorder border, bool hidden );
ElectricBorder monitorCheckEffectHasEdge( int index );
};
} // namespace
#endif

View File

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWinScreenEdgesConfigForm</class>
<widget class="QWidget" name="KWinScreenEdgesConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>619</width>
<height>321</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Active Screen Edge Actions</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="KWin::Monitor" name="monitor" native="true">
<property name="minimumSize">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>To trigger an action push your mouse cursor against the edge of the screen in the action's direction.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Other Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Activation &amp;delay:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>activationDelaySpin</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="activationDelaySpin">
<property name="suffix">
<string> ms</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Trigger &amp;cooldown:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>triggerCooldownSpin</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="triggerCooldownSpin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> ms</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Action Groups</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="quickTileBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Tile windows by dragging them to the side of the screen</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="quickMaximizeBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Ma&amp;ximize windows by dragging them to the top of the screen</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="desktopSwitchLabel">
<property name="text">
<string>&amp;Switch desktop on edge:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>desktopSwitchCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="desktopSwitchCombo">
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Only when moving windows</string>
</property>
</item>
<item>
<property name="text">
<string>Always enabled</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KWin::Monitor</class>
<extends>QWidget</extends>
<header>monitor.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>monitor</tabstop>
<tabstop>desktopSwitchCombo</tabstop>
<tabstop>quickTileBox</tabstop>
<tabstop>quickMaximizeBox</tabstop>
<tabstop>activationDelaySpin</tabstop>
<tabstop>triggerCooldownSpin</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
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
@ -54,6 +55,7 @@ Monitor::Monitor( QWidget* parent )
items[ i ] = new Corner( this );
scene->addItem( items[ i ] );
items[ i ]->setBrush( Qt::red ); // TODO color-scheme dependent?
hidden[ i ] = false;
grp[ i ] = new QActionGroup( this );
}
checkSize();
@ -67,6 +69,7 @@ void Monitor::clear()
{
popups[ i ]->clear();
setEdge( i, false );
setEdgeHidden( i, false );
delete grp[ i ];
grp[ i ] = new QActionGroup( this );
}
@ -108,6 +111,20 @@ bool Monitor::edge( int edge ) const
return items[ edge ]->brush() == Qt::green;
}
void Monitor::setEdgeHidden( int edge, bool set )
{
hidden[ edge ] = set;
if( set )
items[ edge ]->hide();
else
items[ edge ]->show();
}
bool Monitor::edgeHidden( int edge ) const
{
return hidden[ edge ];
}
void Monitor::addEdgeItem( int edge, const QString& item )
{
QAction* act = popups[ edge ]->addAction( item );
@ -119,6 +136,16 @@ void Monitor::addEdgeItem( int edge, const QString& item )
setEdge( edge, !popup_actions[ edge ][ 0 ]->isChecked());
}
void Monitor::setEdgeItemEnabled( int edge, int index, bool enabled )
{
popup_actions[ edge ][ index ]->setEnabled( enabled );
}
bool Monitor::edgeItemEnabled( int edge, int index ) const
{
return popup_actions[ edge ][ index ]->isEnabled();
}
void Monitor::selectEdgeItem( int edge, int index )
{
popup_actions[ edge ][ index ]->setChecked( true );

View File

@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
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
@ -42,8 +43,12 @@ class Monitor
Monitor( QWidget* parent );
void setEdge( int edge, bool set );
bool edge( int edge ) const;
void setEdgeHidden( int edge, bool set );
bool edgeHidden( int edge ) const;
void clear();
void addEdgeItem( int edge, const QString& item );
void setEdgeItemEnabled( int edge, int index, bool enabled );
bool edgeItemEnabled( int edge, int index ) const;
void selectEdgeItem( int edge, int index );
int selectedEdgeItem( int edge ) const;
@ -71,6 +76,7 @@ class Monitor
QGraphicsView* view;
QGraphicsScene* scene;
QGraphicsRectItem* items[ 8 ];
bool hidden[ 8 ];
QMenu* popups[ 8 ];
QVector< QAction* > popup_actions[ 8 ];
QActionGroup* grp[ 8 ];