diff --git a/effects.cpp b/effects.cpp
index 29802dba23..adbe0e2800 100644
--- a/effects.cpp
+++ b/effects.cpp
@@ -26,6 +26,7 @@ along with this program. If not, see .
#include "group.h"
#include "scene_xrender.h"
#include "scene_opengl.h"
+#include "screenedge.h"
#include "unmanaged.h"
#include "tabbox.h"
#include "workspace.h"
@@ -869,7 +870,7 @@ Window EffectsHandlerImpl::createInputWindow(Effect* e, int x, int y, int w, int
// Raise electric border windows above the input windows
// so they can still be triggered.
- Workspace::self()->raiseElectricBorderWindows();
+ Workspace::self()->screenEdge()->raiseElectricBorderWindows();
return win;
}
@@ -940,7 +941,7 @@ void EffectsHandlerImpl::checkInputWindowStacking()
delete[] wins;
// Raise electric border windows above the input windows
// so they can still be triggered. TODO: Do both at once.
- Workspace::self()->raiseElectricBorderWindows();
+ Workspace::self()->screenEdge()->raiseElectricBorderWindows();
}
QPoint EffectsHandlerImpl::cursorPos() const
@@ -950,22 +951,22 @@ QPoint EffectsHandlerImpl::cursorPos() const
void EffectsHandlerImpl::checkElectricBorder(const QPoint &pos, Time time)
{
- Workspace::self()->checkElectricBorder(pos, time);
+ Workspace::self()->screenEdge()->checkElectricBorder(pos, time);
}
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border)
{
- Workspace::self()->reserveElectricBorder(border);
+ Workspace::self()->screenEdge()->reserveElectricBorder(border);
}
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
{
- Workspace::self()->unreserveElectricBorder(border);
+ Workspace::self()->screenEdge()->unreserveElectricBorder(border);
}
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
{
- Workspace::self()->reserveElectricBorderSwitching(reserve);
+ Workspace::self()->screenEdge()->reserveElectricBorderSwitching(reserve);
}
unsigned long EffectsHandlerImpl::xrenderBufferPicture()
diff --git a/events.cpp b/events.cpp
index 5218deb6b7..4e0559cbdb 100644
--- a/events.cpp
+++ b/events.cpp
@@ -35,6 +35,7 @@ along with this program. If not, see .
#include "rules.h"
#include "unmanaged.h"
#include "scene.h"
+#include "screenedge.h"
#include "effects.h"
#include
@@ -376,7 +377,7 @@ bool Workspace::workspaceEvent(XEvent * e)
if (w)
QWhatsThis::leaveWhatsThisMode();
}
- if (electricBorderEvent(e))
+ if (m_screenEdge.electricBorderEvent(e))
return true;
break;
}
@@ -428,7 +429,7 @@ bool Workspace::workspaceEvent(XEvent * e)
case FocusOut:
return true; // always eat these, they would tell Qt that KWin is the active app
case ClientMessage:
- if (electricBorderEvent(e))
+ if (m_screenEdge.electricBorderEvent(e))
return true;
break;
case Expose:
diff --git a/geometry.cpp b/geometry.cpp
index 178184daf7..bd971fe473 100644
--- a/geometry.cpp
+++ b/geometry.cpp
@@ -40,6 +40,7 @@ along with this program. If not, see .
#include "notifications.h"
#include "geometrytip.h"
#include "rules.h"
+#include "screenedge.h"
#include "effects.h"
#include
#include
@@ -71,8 +72,8 @@ void Workspace::desktopResized()
rootInfo->setDesktopGeometry(-1, desktop_geometry);
updateClientArea();
- destroyElectricBorders();
- updateElectricBorders();
+ m_screenEdge.destroyElectricBorders();
+ m_screenEdge.updateElectricBorders();
if (compositing())
compositeResetTimer.start(0);
}
@@ -2526,7 +2527,7 @@ bool Client::startMoveResize()
if (options->electricBorders() == Options::ElectricMoveOnly ||
options->electricBorderMaximize() ||
options->electricBorderTiling())
- workspace()->reserveElectricBorderSwitching(true);
+ workspace()->screenEdge()->reserveElectricBorderSwitching(true);
return true;
}
@@ -2591,7 +2592,7 @@ void Client::finishMoveResize(bool cancel)
kDebug(1212) << "invalid electric mode" << electricMode << "leading to invalid array acces,\
this should not have happened!";
else
- workspace()->restoreElectricBorderSize(border);
+ workspace()->screenEdge()->restoreElectricBorderSize(border);
electricMaximizing = false;
workspace()->outline()->hide();
}
@@ -2621,7 +2622,7 @@ void Client::leaveMoveResize()
if (options->electricBorders() == Options::ElectricMoveOnly ||
options->electricBorderMaximize() ||
options->electricBorderTiling())
- workspace()->reserveElectricBorderSwitching(false);
+ workspace()->screenEdge()->reserveElectricBorderSwitching(false);
}
// This function checks if it actually makes sense to perform a restricted move/resize.
@@ -2944,7 +2945,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
if (isMove()) {
workspace()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom);
- workspace()->checkElectricBorder(globalPos, xTime());
+ workspace()->screenEdge()->checkElectricBorder(globalPos, xTime());
}
}
diff --git a/layers.cpp b/layers.cpp
index 9ce87ca251..c7508d22f1 100644
--- a/layers.cpp
+++ b/layers.cpp
@@ -79,6 +79,7 @@ along with this program. If not, see .
#include "utils.h"
#include "client.h"
#include "workspace.h"
+#include "screenedge.h"
#include "tabbox.h"
#include "group.h"
#include "rules.h"
@@ -158,8 +159,8 @@ void Workspace::propagateClients(bool propagate_new_clients)
for (int i = 0;
i < ELECTRIC_COUNT;
++i)
- if (electric_windows[ i ] != None)
- new_stack[ pos++ ] = electric_windows[ i ];
+ if (m_screenEdge.electricWindows()[ i ] != None)
+ new_stack[ pos++ ] = m_screenEdge.electricWindows()[ i ];
for (int i = stacking_order.size() - 1; i >= 0; i--) {
if (stacking_order.at(i)->hiddenPreview()) {
continue;
diff --git a/screenedge.cpp b/screenedge.cpp
index 5c81b1ea37..c97e22405f 100644
--- a/screenedge.cpp
+++ b/screenedge.cpp
@@ -49,6 +49,10 @@ namespace KWin {
ScreenEdge::ScreenEdge()
: QObject(NULL)
{
+ for (int i = 0; i < ELECTRIC_COUNT; ++i) {
+ electric_reserved[i] = 0;
+ electric_windows[i] = None;
+ }
}
ScreenEdge::~ScreenEdge()
diff --git a/screenedge.h b/screenedge.h
index c461c341c4..bc98b3e653 100644
--- a/screenedge.h
+++ b/screenedge.h
@@ -28,9 +28,10 @@ along with this program. If not, see .
#ifndef KWIN_SCREENEDGE_H
#define KWIN_SCREENEDGE_H
-#include
+#include
#include "kwinglobals.h"
+
namespace KWin {
//-----------------------------------------------------------------------------
@@ -52,11 +53,11 @@ public:
void reserveElectricBorderActions(bool reserve);
void reserveElectricBorderSwitching(bool reserve);
void raiseElectricBorderWindows();
-private Q_SLOTS:
- void updateElectricBorders();
-private:
void destroyElectricBorders();
bool electricBorderEvent(XEvent * e);
+public Q_SLOTS:
+ void updateElectricBorders();
+private:
void electricBorderSwitchDesktop(ElectricBorder border, const QPoint& pos);
ElectricBorder electric_current_border;
diff --git a/workspace.cpp b/workspace.cpp
index bee4c68c2f..63d2ce131d 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -252,10 +252,11 @@ Workspace::Workspace(bool restore)
void Workspace::init()
{
- reserveElectricBorderActions(true);
+ m_screenEdge.reserveElectricBorderActions(true);
if (options->electricBorders() == Options::ElectricAlways)
- reserveElectricBorderSwitching(true);
- updateElectricBorders();
+ m_screenEdge.reserveElectricBorderSwitching(true);
+ m_screenEdge.updateElectricBorders();
+ m_screenEdge.init();
// Not used yet
//topDock = 0L;
@@ -911,9 +912,9 @@ void Workspace::slotReconfigure()
kDebug(1212) << "Workspace::slotReconfigure()";
reconfigureTimer.stop();
- reserveElectricBorderActions(false);
+ m_screenEdge.reserveElectricBorderActions(false);
if (options->electricBorders() == Options::ElectricAlways)
- reserveElectricBorderSwitching(false);
+ m_screenEdge.reserveElectricBorderSwitching(false);
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
@@ -953,10 +954,10 @@ void Workspace::slotReconfigure()
c->triggerDecorationRepaint();
}
- reserveElectricBorderActions(true);
+ m_screenEdge.reserveElectricBorderActions(true);
if (options->electricBorders() == Options::ElectricAlways)
- reserveElectricBorderSwitching(true);
- updateElectricBorders();
+ m_screenEdge.reserveElectricBorderSwitching(true);
+ m_screenEdge.updateElectricBorders();
if (!compositingSuspended) {
setupCompositing();
@@ -1007,7 +1008,7 @@ void Workspace::slotReinitCompositing()
KGlobal::config()->reparseConfiguration();
// Update any settings that can be set in the compositing kcm.
- updateElectricBorders();
+ m_screenEdge.updateElectricBorders();
// Restart compositing
finishCompositing();