Refactoring Screen Edge handling
This commit change the screen edge function calls to be called in the new class ScreenEdge. The old methods are still in Workspace and will be removed in a further commit.
This commit is contained in:
parent
7533bfac75
commit
2f11337d98
7 changed files with 39 additions and 29 deletions
13
effects.cpp
13
effects.cpp
|
@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "scene_xrender.h"
|
#include "scene_xrender.h"
|
||||||
#include "scene_opengl.h"
|
#include "scene_opengl.h"
|
||||||
|
#include "screenedge.h"
|
||||||
#include "unmanaged.h"
|
#include "unmanaged.h"
|
||||||
#include "tabbox.h"
|
#include "tabbox.h"
|
||||||
#include "workspace.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
|
// Raise electric border windows above the input windows
|
||||||
// so they can still be triggered.
|
// so they can still be triggered.
|
||||||
Workspace::self()->raiseElectricBorderWindows();
|
Workspace::self()->screenEdge()->raiseElectricBorderWindows();
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
@ -940,7 +941,7 @@ void EffectsHandlerImpl::checkInputWindowStacking()
|
||||||
delete[] wins;
|
delete[] wins;
|
||||||
// Raise electric border windows above the input windows
|
// Raise electric border windows above the input windows
|
||||||
// so they can still be triggered. TODO: Do both at once.
|
// so they can still be triggered. TODO: Do both at once.
|
||||||
Workspace::self()->raiseElectricBorderWindows();
|
Workspace::self()->screenEdge()->raiseElectricBorderWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint EffectsHandlerImpl::cursorPos() const
|
QPoint EffectsHandlerImpl::cursorPos() const
|
||||||
|
@ -950,22 +951,22 @@ QPoint EffectsHandlerImpl::cursorPos() const
|
||||||
|
|
||||||
void EffectsHandlerImpl::checkElectricBorder(const QPoint &pos, Time time)
|
void EffectsHandlerImpl::checkElectricBorder(const QPoint &pos, Time time)
|
||||||
{
|
{
|
||||||
Workspace::self()->checkElectricBorder(pos, time);
|
Workspace::self()->screenEdge()->checkElectricBorder(pos, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border)
|
void EffectsHandlerImpl::reserveElectricBorder(ElectricBorder border)
|
||||||
{
|
{
|
||||||
Workspace::self()->reserveElectricBorder(border);
|
Workspace::self()->screenEdge()->reserveElectricBorder(border);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
|
void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border)
|
||||||
{
|
{
|
||||||
Workspace::self()->unreserveElectricBorder(border);
|
Workspace::self()->screenEdge()->unreserveElectricBorder(border);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
|
void EffectsHandlerImpl::reserveElectricBorderSwitching(bool reserve)
|
||||||
{
|
{
|
||||||
Workspace::self()->reserveElectricBorderSwitching(reserve);
|
Workspace::self()->screenEdge()->reserveElectricBorderSwitching(reserve);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long EffectsHandlerImpl::xrenderBufferPicture()
|
unsigned long EffectsHandlerImpl::xrenderBufferPicture()
|
||||||
|
|
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "unmanaged.h"
|
#include "unmanaged.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
#include "screenedge.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
#include <QWhatsThis>
|
#include <QWhatsThis>
|
||||||
|
@ -376,7 +377,7 @@ bool Workspace::workspaceEvent(XEvent * e)
|
||||||
if (w)
|
if (w)
|
||||||
QWhatsThis::leaveWhatsThisMode();
|
QWhatsThis::leaveWhatsThisMode();
|
||||||
}
|
}
|
||||||
if (electricBorderEvent(e))
|
if (m_screenEdge.electricBorderEvent(e))
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +429,7 @@ bool Workspace::workspaceEvent(XEvent * e)
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
return true; // always eat these, they would tell Qt that KWin is the active app
|
return true; // always eat these, they would tell Qt that KWin is the active app
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
if (electricBorderEvent(e))
|
if (m_screenEdge.electricBorderEvent(e))
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case Expose:
|
case Expose:
|
||||||
|
|
13
geometry.cpp
13
geometry.cpp
|
@ -40,6 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "notifications.h"
|
#include "notifications.h"
|
||||||
#include "geometrytip.h"
|
#include "geometrytip.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
|
#include "screenedge.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QVarLengthArray>
|
#include <QVarLengthArray>
|
||||||
|
@ -71,8 +72,8 @@ void Workspace::desktopResized()
|
||||||
rootInfo->setDesktopGeometry(-1, desktop_geometry);
|
rootInfo->setDesktopGeometry(-1, desktop_geometry);
|
||||||
|
|
||||||
updateClientArea();
|
updateClientArea();
|
||||||
destroyElectricBorders();
|
m_screenEdge.destroyElectricBorders();
|
||||||
updateElectricBorders();
|
m_screenEdge.updateElectricBorders();
|
||||||
if (compositing())
|
if (compositing())
|
||||||
compositeResetTimer.start(0);
|
compositeResetTimer.start(0);
|
||||||
}
|
}
|
||||||
|
@ -2526,7 +2527,7 @@ bool Client::startMoveResize()
|
||||||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||||
options->electricBorderMaximize() ||
|
options->electricBorderMaximize() ||
|
||||||
options->electricBorderTiling())
|
options->electricBorderTiling())
|
||||||
workspace()->reserveElectricBorderSwitching(true);
|
workspace()->screenEdge()->reserveElectricBorderSwitching(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2591,7 +2592,7 @@ void Client::finishMoveResize(bool cancel)
|
||||||
kDebug(1212) << "invalid electric mode" << electricMode << "leading to invalid array acces,\
|
kDebug(1212) << "invalid electric mode" << electricMode << "leading to invalid array acces,\
|
||||||
this should not have happened!";
|
this should not have happened!";
|
||||||
else
|
else
|
||||||
workspace()->restoreElectricBorderSize(border);
|
workspace()->screenEdge()->restoreElectricBorderSize(border);
|
||||||
electricMaximizing = false;
|
electricMaximizing = false;
|
||||||
workspace()->outline()->hide();
|
workspace()->outline()->hide();
|
||||||
}
|
}
|
||||||
|
@ -2621,7 +2622,7 @@ void Client::leaveMoveResize()
|
||||||
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
if (options->electricBorders() == Options::ElectricMoveOnly ||
|
||||||
options->electricBorderMaximize() ||
|
options->electricBorderMaximize() ||
|
||||||
options->electricBorderTiling())
|
options->electricBorderTiling())
|
||||||
workspace()->reserveElectricBorderSwitching(false);
|
workspace()->screenEdge()->reserveElectricBorderSwitching(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function checks if it actually makes sense to perform a restricted move/resize.
|
// 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()) {
|
if (isMove()) {
|
||||||
workspace()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom);
|
workspace()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom);
|
||||||
workspace()->checkElectricBorder(globalPos, xTime());
|
workspace()->screenEdge()->checkElectricBorder(globalPos, xTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
#include "screenedge.h"
|
||||||
#include "tabbox.h"
|
#include "tabbox.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
|
@ -158,8 +159,8 @@ void Workspace::propagateClients(bool propagate_new_clients)
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < ELECTRIC_COUNT;
|
i < ELECTRIC_COUNT;
|
||||||
++i)
|
++i)
|
||||||
if (electric_windows[ i ] != None)
|
if (m_screenEdge.electricWindows()[ i ] != None)
|
||||||
new_stack[ pos++ ] = electric_windows[ i ];
|
new_stack[ pos++ ] = m_screenEdge.electricWindows()[ i ];
|
||||||
for (int i = stacking_order.size() - 1; i >= 0; i--) {
|
for (int i = stacking_order.size() - 1; i >= 0; i--) {
|
||||||
if (stacking_order.at(i)->hiddenPreview()) {
|
if (stacking_order.at(i)->hiddenPreview()) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -49,6 +49,10 @@ namespace KWin {
|
||||||
ScreenEdge::ScreenEdge()
|
ScreenEdge::ScreenEdge()
|
||||||
: QObject(NULL)
|
: QObject(NULL)
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < ELECTRIC_COUNT; ++i) {
|
||||||
|
electric_reserved[i] = 0;
|
||||||
|
electric_windows[i] = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenEdge::~ScreenEdge()
|
ScreenEdge::~ScreenEdge()
|
||||||
|
|
|
@ -28,9 +28,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef KWIN_SCREENEDGE_H
|
#ifndef KWIN_SCREENEDGE_H
|
||||||
#define KWIN_SCREENEDGE_H
|
#define KWIN_SCREENEDGE_H
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
#include "kwinglobals.h"
|
#include "kwinglobals.h"
|
||||||
|
|
||||||
|
|
||||||
namespace KWin {
|
namespace KWin {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -52,11 +53,11 @@ public:
|
||||||
void reserveElectricBorderActions(bool reserve);
|
void reserveElectricBorderActions(bool reserve);
|
||||||
void reserveElectricBorderSwitching(bool reserve);
|
void reserveElectricBorderSwitching(bool reserve);
|
||||||
void raiseElectricBorderWindows();
|
void raiseElectricBorderWindows();
|
||||||
private Q_SLOTS:
|
|
||||||
void updateElectricBorders();
|
|
||||||
private:
|
|
||||||
void destroyElectricBorders();
|
void destroyElectricBorders();
|
||||||
bool electricBorderEvent(XEvent * e);
|
bool electricBorderEvent(XEvent * e);
|
||||||
|
public Q_SLOTS:
|
||||||
|
void updateElectricBorders();
|
||||||
|
private:
|
||||||
void electricBorderSwitchDesktop(ElectricBorder border, const QPoint& pos);
|
void electricBorderSwitchDesktop(ElectricBorder border, const QPoint& pos);
|
||||||
|
|
||||||
ElectricBorder electric_current_border;
|
ElectricBorder electric_current_border;
|
||||||
|
|
|
@ -252,10 +252,11 @@ Workspace::Workspace(bool restore)
|
||||||
|
|
||||||
void Workspace::init()
|
void Workspace::init()
|
||||||
{
|
{
|
||||||
reserveElectricBorderActions(true);
|
m_screenEdge.reserveElectricBorderActions(true);
|
||||||
if (options->electricBorders() == Options::ElectricAlways)
|
if (options->electricBorders() == Options::ElectricAlways)
|
||||||
reserveElectricBorderSwitching(true);
|
m_screenEdge.reserveElectricBorderSwitching(true);
|
||||||
updateElectricBorders();
|
m_screenEdge.updateElectricBorders();
|
||||||
|
m_screenEdge.init();
|
||||||
|
|
||||||
// Not used yet
|
// Not used yet
|
||||||
//topDock = 0L;
|
//topDock = 0L;
|
||||||
|
@ -911,9 +912,9 @@ void Workspace::slotReconfigure()
|
||||||
kDebug(1212) << "Workspace::slotReconfigure()";
|
kDebug(1212) << "Workspace::slotReconfigure()";
|
||||||
reconfigureTimer.stop();
|
reconfigureTimer.stop();
|
||||||
|
|
||||||
reserveElectricBorderActions(false);
|
m_screenEdge.reserveElectricBorderActions(false);
|
||||||
if (options->electricBorders() == Options::ElectricAlways)
|
if (options->electricBorders() == Options::ElectricAlways)
|
||||||
reserveElectricBorderSwitching(false);
|
m_screenEdge.reserveElectricBorderSwitching(false);
|
||||||
|
|
||||||
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
||||||
|
|
||||||
|
@ -953,10 +954,10 @@ void Workspace::slotReconfigure()
|
||||||
c->triggerDecorationRepaint();
|
c->triggerDecorationRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
reserveElectricBorderActions(true);
|
m_screenEdge.reserveElectricBorderActions(true);
|
||||||
if (options->electricBorders() == Options::ElectricAlways)
|
if (options->electricBorders() == Options::ElectricAlways)
|
||||||
reserveElectricBorderSwitching(true);
|
m_screenEdge.reserveElectricBorderSwitching(true);
|
||||||
updateElectricBorders();
|
m_screenEdge.updateElectricBorders();
|
||||||
|
|
||||||
if (!compositingSuspended) {
|
if (!compositingSuspended) {
|
||||||
setupCompositing();
|
setupCompositing();
|
||||||
|
@ -1007,7 +1008,7 @@ void Workspace::slotReinitCompositing()
|
||||||
KGlobal::config()->reparseConfiguration();
|
KGlobal::config()->reparseConfiguration();
|
||||||
|
|
||||||
// Update any settings that can be set in the compositing kcm.
|
// Update any settings that can be set in the compositing kcm.
|
||||||
updateElectricBorders();
|
m_screenEdge.updateElectricBorders();
|
||||||
|
|
||||||
// Restart compositing
|
// Restart compositing
|
||||||
finishCompositing();
|
finishCompositing();
|
||||||
|
|
Loading…
Reference in a new issue